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.
Wednesday, May 15, 2013
Lets assume that we want to check all the pending leave work items.
Steps
  • Get all pending work items from table SWWWIHEAD(Header Table for All Work Item Types).
  •  "Get all pending work items
      SELECT WI_ID WI_TYPE WI_STAT TOP_WI_ID
        FROM SWWWIHEAD
        INTO TABLE IT_PLVE_WITEMS
       WHERE WI_TYPE     = 'W'
         AND WI_STAT     = 'READY'
         AND WI_RH_TASK  = C_WORFLOW_TASK.
  • Get the work items assigned to user using table SWWUSERWI.
  • IF IT_PLVE_WITEMS IS NOT INITIAL.
        "Current Work Items Assigned to a User
        SELECT USER_ID WI_ID TASK_OBJ
          FROM  SWWUSERWI
          INTO TABLE IT_WI_AGENT
          FOR ALL ENTRIES IN IT_PLVE_WITEMS
         WHERE WI_ID     = IT_PLVE_WITEMS-WI_ID
           AND TASK_OBJ  = C_WORFLOW_TASK
           AND NO_SEL    = SPACE.
      ENDIF.
  • Based on two tables, we can filter work item for user.

Repetitive structures in HR denotes the table which has the same type of field structures(which stores same kind of values). For example, Table for Basic Pay Infotype 0008 is PA0008. This table stores all the wage types assigned to an employee in its fields LGAXX,  BETXX,  ANZXX,  EINXX and OPKXX. Here XX denotes the number 01-40. These fields are repeated for 40 times, as it is defined in SAP system(We can maintain 40 different wage types for an employee in Standards).

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.