Skip to Content
0
Former Member
Jun 29, 2010 at 09:27 AM

Performance mod. of BW exit

27 Views

Hi guys

I am currently working on an exit used to extract data to BW. For each project I have to select the corresponding sold-to and ship-to customers from VBAK and VBPA. Since VBAK only contains the WBS element I have to select all WBS elements for the project from PRPS first and "try" these in the selection from VBAK and afterwards VBPA.

DATA: L_KUNNR LIKE VBAK-KUNNR,
            L_VBELN LIKE VBAK-VBELN,
            L_PSPNR LIKE PRPS-PSPNR,
            L_PSPID LIKE L_S_PROJ-PSPID,
            L_KUNWE LIKE VBPA-KUNNR,
            L_S_PROJ LIKE BIW_PROJ.

CASE I_DATASOURCE.

 WHEN '0PROJECT_ATTR'.

LOOP AT I_T_DATA INTO L_S_PROJ.
      L_TABIX = SY-TABIX.
* INSERT % for LIKE selection
      CONCATENATE L_S_PROJ-PSPID(6) '%' INTO L_PSPID.
* SELECT WBS elements
      SELECT PSPNR INTO L_PSPNR FROM PRPS WHERE POSID LIKE L_PSPID AND FAKKZ = 'X'.

      CLEAR L_KUNNR.
* SELECT the sold to customer and the sales doc from VBAK
      SELECT SINGLE KUNNR VBELN INTO (L_KUNNR, L_VBELN) FROM VBAK WHERE PS_PSP_PNR = L_PSPNR.
* IF a sales doc is found select the ship to customer from VBPA and EXIT
      IF L_VBELN IS NOT INITIAL.
        SELECT SINGLE KUNNR INTO L_KUNWE FROM VBPA WHERE VBELN = L_VBELN AND PARVW = 'WE' AND POSNR = '000000'.
        EXIT.
      ENDIF.

      ENDSELECT.

ENDLOOP.

ENDCASE.

I work as a BW developer so my ABAP skills are low. Is it possible to "tune" the above coding?

BR

Stefan