Solving ebs form failure to export Master-slave relationship (Master Detail) data to EXCEL

Source: Internet
Author: User

The ebs form cannot export Master-slave relationship (Master Detail) data to EXCEL.

The following describes how to solve the problem that the EBS standard export function cannot export master-slave relationship data.

Solution:

1. Add an export button on form or register a menu item on the toolbar.

2. Create a report or imitate the standard export function of the system. Then, use the preceding buttons or menu items to directly call the interface.

This section describes the function of imitating system standard export.

Steps:

1. directly modify form-Level trigger EXPORT and comment out the default app_standard.event ('expiport. Copy the following code.

 

  1. /* Export the COST of the master-slave structureGROUPData. */
  2. DECLARE
  3. -- Copy the preceding five variables.
  4. URL VARCHAR2 (2000 );
  5. DB_FILE NUMBER;
  6. WEB_SERVER_PREFIX VARCHAR2 (255 );
  7. Res boolean;
  8. MIME_TYPE VARCHAR2 (255 );
  9. Rochelle ziation_id NUMBER;
  10. -- Define a CURSOR that contains master-slave relationship data
  11. CURSORCSR (V_ORGANIZATION_IDINNUMBER)IS
  12. SELECTCST. COST_GROUP_CODE,
  13. CST. COST_GROUP_DESCRIPTION,
  14. CST. COST_GROUP_DISABLE_DATE,
  15. CAP. CAPABILITY,
  16. EQP. EQP_CAP_DESC DESCRIPTION,
  17. CAP. ACTIVE
  18. FROMCUX2_CST_COST_GROUP_ALL CST,
  19. CUX2_CST_COST_GROUP_EQPS_ALL CAP,
  20. CUX2_BOM_EQP_CAP_TYPE EQP
  21. WHERECAP. COST_GROUP_ID (+) = CST. COST_GROUP_ID
  22. ANDEQP. EQP_CAP_CODE (+) = CAP. CAPABILITY
  23. ANDEQP. ORGANIZATION_ID (+) = CAP. ORGANIZATION_ID
  24. ANDCAP. ORGANIZATION_ID (+) = CST. ORGANIZATION_ID
  25. ANDCST. ORGANIZATION_ID = V_ORGANIZATION_ID
  26. ORDER BYCST. ORGANIZATION_ID, CST. COST_GROUP_CODE, CAP. CAPABILITY;
  27. BEGIN
  28. -- Get Organzition_id
  29. L_ORGANZIATION_ID: = FND_PROFILE.VALUE ('Mfg _ ORGANIZATION_ID');
  30. -- Change the mouse style: funnel mouse (busy)
  31. SET_APPLICATION_PROPERTY (CURSOR_STYLE,'Busy');
  32. -- Display the progress bar window and set the progress to 0
  33. App_progress progress SS (0 );
  34. -- Create a data packet and set the file header type.
  35. DB_FILE: = FND_GFM.FILE_CREATE (CONTENT_TYPE =>'Text/html',
  36. PROGRAM_NAME =>'Port');
  37. /* The system standard export function exports item data only in the currently focused BLOCK.
  38. When a custom FORM contains two blocks with a master-slave relationship, the system standard export cannot export master-slave data.
  39. The text format after the study system standard export is as follows:
  40. CostGroupCode CostGroupDescription CostGroupDisableDate
  41. Test-1 a test costGroupCode 2011-09-09
  42. Test-2 another codstGroupCode 2011-10-10
  43. .......
  44. ...
  45. ..
  46. The title header of the first action. The long-distance blank area in the middle is the tab character, that is, chr (9 ),
  47. In the next data row, the delimiter between data columns is tab.
  48. It is easy to find out the rules and imitate the exported data.
  49. */
  50. -- Output question header line Note: chr (9) is the tab key
  51. FND_GFM.FILE_WRITE_LINE (DB_FILE,
  52. 'Cost Group Code'| CHR (9) |
  53. 'Cost Group description'| CHR (9) |
  54. 'Cost Group Disable date'| CHR (9) |
  55. 'Capable'| CHR (9) |'Description'| CHR (9) |
  56. 'Active');
  57. -- Loop data rows
  58. FORRINCSR (L_ORGANZIATION_ID) LOOP
  59. FND_GFM.FILE_WRITE_LINE (DB_FILE,
  60. R. COST_GROUP_CODE | CHR (9) |
  61. R. COST_GROUP_DESCRIPTION | CHR (9) |
  62. TO_CHAR (R. COST_GROUP_DISABLE_DATE,
  63. 'Yyyy-MM-DD HH24: MI: ss') | CHR (9) |
  64. R. CAPABILITY | CHR (9) | R. DESCRIPTION |
  65. CHR (9) | R. ACTIVE );
  66. ENDLOOP;
  67. -- Disable data packets
  68. DB_FILE: = FND_GFM.FILE_CLOSE (DB_FILE );
  69. -- Submit the data packet to the client
  70. URL: = FND_GFM.CONSTRUCT_DOWNLOAD_URL (WEB_SERVER_PREFIX, DB_FILE,TRUE);
  71. -- DBMS_OUTPUT.PUT_LINE (URL );
  72. -- Enable URL download
  73. FND_UTILITIES.OPEN_URL (URL );
  74. -- Change the mouse style: Default pointer (regular state)
  75. SET_APPLICATION_PROPERTY (CURSOR_STYLE,'Default');
  76. App_progress progress SS (1 );-- Display the progress bar window and set the progress to 1 (100%)
  77. END;

Effect:

 




This method is compared with the method used to run requests. I personally feel that this method is faster. Just my opinion .....

OK.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.