08-01-2008 10:18 PM
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
08-02-2008 4:32 AM
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.
08-01-2008 10:34 PM
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
08-01-2008 11:01 PM
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
08-02-2008 4:19 AM
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.
08-02-2008 4:32 AM
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.
08-04-2008 4:13 PM
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.
08-04-2008 4:18 PM
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