Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Import/Export dynamic table

benlim
Contributor
0 Likes
2,939

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-

8 REPLIES 8
Read only

ArcherZhang
Product and Topic Expert
Product and Topic Expert
0 Likes
1,735

Hi Yen Shen,

Try this class and method, cl_salv_bs_runtime_info=>GET_DATA,

Many examples in SCN for this.

BRs,

Archer

Read only

matt
Active Contributor
0 Likes
1,735

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.


  1. It is the same as writing a program to directly update SAP tables. (If the standard does updating)
  2. You won't benefit from an OSS notes
  3. The standard may change during an upgrade, and you won't know to recopy the original
  4. If you keep some of the includes from the original, if they change due to an upgrade or note, they may break your program.

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?

Read only

0 Likes
1,735

Hi Matthew Billingham,

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-

Read only

matt
Active Contributor
0 Likes
1,735

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)

Read only

Former Member
0 Likes
1,735

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

Read only

0 Likes
1,735

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-

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,735

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

Read only

0 Likes
1,735

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-