‎2016 Sep 01 2:51 AM
Hi Expert,
Is it possible to export an internal table which is having a dynamic structure in A program and import in B program?
The requirement is to copy a standard program to a Z program. Current standard program will having a dynamic output which depends on the selection screen input. So I would need to export the final output table and submit to a custom program. So from the custom program, I can massage the data that I needs.
How can I declare the structure( lt_datatable[]) in program B for the imported data so that I can start to manipulate the imported data.
Program A: EXPORT lt_datatable[] to memory id 'ABC'.
Program B: IMPORT lt_datatable[] from memory id 'ABC'.
Thanks.
Regards,
-Ben-
‎2016 Sep 01 3:13 AM
Hi Yen Shen,
Try this class and method, cl_salv_bs_runtime_info=>GET_DATA,
Many examples in SCN for this.
BRs,
Archer
‎2016 Sep 01 6:54 AM
Yen Shen, Ben Lim wrote:
The requirement is to copy a standard program to a Z program.
No, it isn't. That's a proposed solution to meet a business requirement. The requirement is what the business need.
I've said this many times, and it is born out of years of experience.
Copying a standard program to a Z program is a very very bad thing to do.
Much better is to change the original. You benefit from the modification assistant and have full visibility and control during upgrades and note implementation.
With regards to your question: what is the standard program? How does the dynamic output vary? What determines the dynamic output?
‎2016 Sep 01 8:30 AM
The standard program may have dynamic output as the output is displayed based on the input from selection screen. I understand that the disadvantages of copying out a standard program. My business requirement is to maintain all the current logic in H99CWTR0 report. After getting the final output, I'll need to filter out unique wage type and these wage type will be used as header line for new internal table. The other information from the standard report is used and populate to this new internal table for output.
Is there a better way to achieve this requirements?
Regards,
-Ben-
‎2016 Sep 01 9:06 AM
Well, as I said - change the existing standard program to have your new functionality. You can make is switchable if you need the exact original functionality as well.
You need to somehow present the structure of the dynamic table. For example, convert it to xml
CALL TRANSFORMATION id SOURCE <internal_table> RESULT XML xml.
Then EXPORT xml (a string) to memory. The problem you now have is in the IMPORT; where you have to define the structure of the internal table to run the transformation in other other direction.
To do this, in the source report, use the RTTS classes to get the structure of the <internal_table>, and EXPORT that information to memory as well.
(Edit: I note Raymond has made pretty much the same suggestion)
‎2016 Sep 01 7:50 AM
Dear Yen Shen,
Is it possible to define the export of internal table using Field Symbols?
FIELD-SYMBOLS : <ft_table> TYPE STANDARD TABLE OF any.
Regards,
Yance
‎2016 Sep 01 8:32 AM
Hi Yance Ciputra,
Yes it is possible to define field symbol type any table. But it does not carry any data after import. I've put break point after import and get message the variable is unassigned.
Regards,
-Ben-
‎2016 Sep 01 7:57 AM
You could export the description of the table with the actual data. Look for adequate RTTI or ALV class (*)
But what do you do in your custom report that you couldn't managed in the original program with some Enhancements?
Regards,
Raymond
(*) IMHO ALV proper use only if you extract some ALV data with class cl_salv_bs_runtime_info
‎2016 Sep 01 8:34 AM
Hi Raymond Giuseppi,
I need to manipulate the row data of the output and convert it to header line for new internal table.
Thanks for your suggestion and I'll look for the information that you suggested.
Regards,
-Ben-