Application Development 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: 

SUBMIT - Export to Memory

kasithunuguntla
Participant
0 Kudos

Hi,

I have a requirement to capture results from a SAP standard ALV report and use the output to fill custom tables.

I have created a ZPORGRAM to use SUBMIT statement with EXPORT TO MEMORY option

and used LIST_FROM_MEMORY and converted to ASCII using LIST_TO_ASCI.

I actually need only the internal table data that the ALV grid is displaying but I got everything that is displayed on the screen including pipe symbols, rows, boxes, headings etc.. I could not really bring the output back to the exact internal table structure in SAP standard program.

Is there any easy way to do this. I heard something about dirty ASSIGN but not sure how to use this. I have the syntax though but it is not returning anything.

ASSIGN ('(SAPLFWTD)acwt_item') TO <ls_acwt_item>.

Your response is highly appreciated.

Regards

Kasi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Kasi,

Since you wan't only the internal table to be exported to the next program, instead of using LIST_FROM_MEMORY, where you export the whole list as it is, use the simple EXPORT statement like this.

EXPORT <itab> to MEMORY ID <ABC>.

SUBMIT <report 2> AND RETURN.

-


In your second program,

IMPORT <itab> FROM MEMORY ID <ABC>.

In your statement, ASSIGN ('(SAPLFWTD)acwt_item') TO <ls_acwt_item>. where you are dynamically assigning the field-symbol, check the sy-subrc value and please refer to the example provided in 'dynamic ASSIGN' part of the link provided below...

[Dynamic ASSIGN|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb38d5358411d1829f0000e829fbfe/content.htm]

Hope it helps you

Regards

Indu.

6 REPLIES 6

naimesh_patel
Active Contributor
0 Kudos

You can read the test from the Memory and convert to Text like this:


    SUBMIT report WITH so_vbeln IN so_vbeln
      EXPORTING LIST TO MEMORY
      AND RETURN.

    IMPORT listobject TO lt_list FROM MEMORY ID '%_LIST'.

    CALL FUNCTION 'LIST_TO_TXT'
      TABLES
        listtxt            = lt_line
        listobject         = lt_list
      EXCEPTIONS
        empty_list         = 1
        list_index_invalid = 2
        OTHERS             = 3.

Regards,

Naimesh Patel

0 Kudos

I actually dont want the whole list due to different formats and it becomes complicated to identify needed fields using offsets.

Is there a way I can read the list (which is internal table in the called program) into calling program.

Regards

former_member188685
Active Contributor
0 Kudos

There is a open option,

if you are submitting a custom Program ...

using EXPORT in SUBMIT PROGRAM and IMPORT in CALLING PROGRAM.

Even some standard programs uses EXPORT option. if you are submitting a standard program then you can check the any EXPORT memory operations inside the program.

Former Member
0 Kudos

Hello Kasi,

Since you wan't only the internal table to be exported to the next program, instead of using LIST_FROM_MEMORY, where you export the whole list as it is, use the simple EXPORT statement like this.

EXPORT <itab> to MEMORY ID <ABC>.

SUBMIT <report 2> AND RETURN.

-


In your second program,

IMPORT <itab> FROM MEMORY ID <ABC>.

In your statement, ASSIGN ('(SAPLFWTD)acwt_item') TO <ls_acwt_item>. where you are dynamically assigning the field-symbol, check the sy-subrc value and please refer to the example provided in 'dynamic ASSIGN' part of the link provided below...

[Dynamic ASSIGN|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb38d5358411d1829f0000e829fbfe/content.htm]

Hope it helps you

Regards

Indu.

0 Kudos

It is a SAP standard report and I dont want to edit that report. just wondering if anybody used dirty ASSIGN statement that I mentioned earlier. I could not make following logic work in my program but it is working in one of our custom programs. the only difference is that I am trying for the whole internal table and below logic is for reading into a structure.

FIELD-SYMBOLS: <ls_acwt_item> TYPE acwt_item.

  • try to make a dirty assign to the AUAK structure in program SAPLKO72

ASSIGN ('(SAPLFWTD)acwt_item') TO <ls_acwt_item>.

CHECK <ls_acwt_item> IS ASSIGNED.

0 Kudos

This kind of ASSIGN will not work if you are trying to access the table which is not there in the memory.

This kind of ASSIGN will work in the USER Exits, and BADI to access the main programs global data which are not avaliable in User exit interface or BADI signature.

In your scenario, you are trying to access memory after the SUBMIT has been complete, means the memory of the SUBMITed program is vanished. Means by the time you try to access the internal table using the ASSIGN, that table is not there in the internal memory of the program.

Best way is,

copy the standard program,

put EXPORT to MEMORY before the output,

Put IMPORT from MEMORY after SUBMIT in your program

Regards,

Naimesh Patel