Wednesday, May 29, 2013

Steps to read called program output into internal table defined in the calling program. 
  • Use syntax addition "EXPORTING LIST TO MEMORY AND RETURN" to SUBMIT statement. This addition stores the basic list for the program accessed in the ABAP Memory. It can only be used together with the addition AND RETURN.The list is stored in the ABAP Memory as an internal table of the row type ABAPLIST. ABAPLIST is a structured data type in ABAP Dictionary.
  • Use the function module LIST_FROM_MEMORY to load the list from the ABAP Memory to an internal table of the row type ABAPLIST.
  • Use the function module LIST_TO_ASCI to convert the content of an internal table of the row type ABAPLIST to ASCII representation.
  • Please check the below screen shots to see data in table before and after LIST_TO_ASCI function module is used. 

  • Data is in pipe delimited. So loop the internal table and split the row type into corresponding fields. 
  • Sample code to convert ASCI data to internal table
  • LOOP AT IT_WGTY_REP INTO WA_WGTY_REP.
            CHECK SY-TABIX GT 3 AND SY-TABIX LT LV_TOT_RECS.
            IF SY-TABIX = 4.
              SPLIT WA_WGTY_REP AT '|' INTO LV_DUMMY01
                                            LV_DUMMY02.
              IF LV_DUMMY02 CS 'List Contains no data'.
                EXIT.
              ENDIF.
            ENDIF.
            " Split pipe delimited data
            SPLIT WA_WGTY_REP AT '|' INTO LV_DUMMY01
                                          WA_ALV_OUTPUT_C-PERNR
                                          LV_DUMMY02
                                          WA_ALV_OUTPUT_C-FPPER
                                          WA_ALV_OUTPUT_C-PAYDT
                                          WA_ALV_OUTPUT_C-LGART
                                          WA_ALV_OUTPUT_C-LGTXT
                                          WA_ALV_OUTPUT_C-BETRG
                                          LV_DUMMY03.
    
            APPEND WA_ALV_OUTPUT_C TO IT_ALV_OUTPUT_C.
            CLEAR  WA_ALV_OUTPUT_C.
          ENDLOOP.

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.