Can anyone just rectify this code ?

0 votes

Q.1. Read data from z-table with given status 003 . For all sales orders against this status check if delivery is created (Read from LIKP) , If delivery is created change status 004 in this table .  And Read data from this table for status 004 and check if delivery exist or not, if delivery not found revert back status to 003 .

 

MY CODE IS:

REPORT ZSDREPPROG_DELIVERYSTATUS.
 
 
TABLES : ZSD_EXCHG_STS, LIKP.
 
* STRUCTURE DECLARATION FOR DELIVERY HEADER .
TYPES : BEGIN OF TY_LIKP,
 
          VBELN TYPE LIKP-VBELN, "DELIVERY FIELD
        END OF TY_LIKP.
 
 
 
 
 
DATA: IT_ZSD_EXCHG_STS TYPE  TABLE OF ZSD_EXCHG_STS, "internal table for z-table ZSD_EXCHG_STS
      WA_ZSD_EXCHG_STS TYPE ZSD_EXCHG_STS, " work area for z-table ZSD_EXCHG_STS
 
      IT_LIKP          TYPE  TABLE OF TY_LIKP, "internal table for LIKP
      WA_LIKP          TYPE TY_LIKP. " work area for LIKP
 
 
START-OF-SELECTION.
  SELECT    EQUNR
           VBELN_VA
           STATUSID
           LFDAT
           FROM ZSD_EXCHG_STS
           INTO TABLE IT_ZSD_EXCHG_STS
           WHERE STATUSID = '003'.
 
  IF IT_ZSD_EXCHG_STS IS NOT INITIAL."check whether internal table is not empty
 
    SELECT
           VBELN
           FROM LIKP
           INTO TABLE IT_LIKP
           FOR ALL ENTRIES IN IT_ZSD_EXCHG_STS
           WHERE VBELN = IT_ZSD_EXCHG_STS-VBELN_VA.
  ENDIF.
 
 
 
  LOOP AT IT_ZSD_EXCHG_STS INTO WA_ZSD_EXCHG_STS.
    READ TABLE IT_LIKP INTO WA_LIKP WITH KEY VBELN = WA_ZSD_EXCHG_STS-VBELN_VA."Read data from this table(LIKP) for status '004' and check if DELIVERY exist or not(SY-SUBRC check)
    "if delivery not found REVERT back status to '003' .
 
 
    IF SY-SUBRC = 0."to check whether delivery found or not
      WA_ZSD_EXCHG_STS-STATUSID = '004'."status id '004' if delivery exists
    ELSE.
      WA_ZSD_EXCHG_STS-STATUSID = '003'."revert back to status '003'
      MODIFY ZSD_EXCHG_STS FROM WA_ZSD_EXCHG_STS.
    ENDIF.
  ENDLOOP.
    "WRITE :/  WA_ZSD_EXCHG_STS-STATUSID."checking the current STATUSID
 
asked Nov 4, 2017 in SD by Aamir

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.