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

Exporting data to structure in export parameter

0 Likes
2,889

Hi experts,

I am new to ABAP programming and want to understand about export parameter.

I am querying a table and trying to output it to export parameter.

The export parameter is a structure which has one component of table type.

Read some articles which mentions use of append for output but they were basically for output tables.

I am trying to select data from any table

      SELECT (FIELDS)
INTO CORRESPONDING FIELDS OF TABLE <RECORDS>
FROM (TABLES)
UP TO <ROWS> ROWS
WHERE (WHERECOND)
ORDER BY PRIMARY KEY.

I want to output this result in export which is a structure

Tried to search but did not find anything helpful online. Any help is appreciated.

6 REPLIES 6
Read only

FredericGirod
Active Contributor
2,585

Could you explain the context ? What did you try to do ? What is your export method ? Class / Odata / RFC / .....

Could you post your SELECT statement?

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,585

I don't understand why you say it's an issue with "export parameter", it seems to me that it's an issue about how to fill a table type component.

structure-table_type_component = VALUE #( ( comp1 = 'line1 comp1' ) ( comp1 = 'line2 comp1' ) ). 

Please clarify your question.

Read only

venkateswaran_k
Active Contributor
0 Likes
2,585

Hi gianni.aiello

I assume you are trying to export the result data records to a memory variable. If that is so, here is the way.

DATA export_data type standard table of mast,
     import_data  type standard table of mast.

      SELECT matnr , werks, stlnr
        INTO CORRESPONDING FIELDS OF TABLE export_data
        FROM mast
        UP TO 5 ROWS.

To Export to memory

EXPORT export_data TO MEMORY ID 'CTAB'.

To Import back in another program

IMPORT export_data TO import_data FROM MEMORY ID 'CTAB'.

Regards,

Venkat

Read only

0 Likes
2,585

Hi gianni.aiello

Is this works for you?

Read only

0 Likes
2,585

Thank you venkateswaran.k

I have not tried this code yet.

I am not trying to pass data from one FM to another but trying to export data such that it can be used by any calling program and not necessarily another FM.

Read only

0 Likes
2,585

Yes, the code I have written is of same scenario.

I was export that into a memory variable in one called program, and retrieve the same back in a another program that called the previous program.