Friday, August 28, 2020

Batch Validation COR1 in PP Module In SAP

Enhancement COR1 for Batch Validation In SAP  PP Module.



Include Name: ZXCO1U06 COR1 for Batch Validation.


IF sy-tcode =  'COR1' OR sy-tcode =  'COR2' ).
  IF header_imp-auart 'ZA02' OR header_imp-auart 'ZU02'
  OR header_imp-auart 'ZA01' OR header_imp-auart 'ZA03'
  OR header_imp-auart 'ZU01' OR header_imp-auart 'ZU10'.
*************************
    FIELD-SYMBOLS <fs_afpo1> TYPE any.
*************************
    DATA ls_afpo1 TYPE afpod.
    TYPESBEGIN OF ty_mch11,
              matnr TYPE matnr,     "Material
              charg TYPE charg_d,   "Batch No
              lvorm TYPE lvoc1,
              ersda TYPE ersda,     "Date
              END OF ty_mch11.
    TYPESBEGIN OF ty_batch11,
            charg TYPE charg_d,
            atwtb TYPE ersda,
            END OF ty_batch11.
    DATA wa_mch11 TYPE ty_mch11,
           wa_mch21 TYPE ty_mch11,
           i_mch11 TYPE STANDARD TABLE OF ty_mch11.
    DATAv_mcha1 TYPE mcha,
          class1 TYPE klah-class,
          w_batch2 TYPE clbatch,
          i_batch2 TYPE STANDARD TABLE OF clbatch,
          w_batch11 TYPE ty_batch11,
          i_batch11 TYPE STANDARD TABLE OF ty_batch11.
    DATAv_date1 TYPE sy-datum.
    DATArec1 TYPE i.
    DATAv_count1 TYPE i.   " counter for loop
    ASSIGN ('(SAPLCOKO)AFPOD'TO <fs_afpo1>.
    ls_afpo1 <fs_afpo1>.
    SELECT matnr
           charg
           lvorm
           ersda
           
           charg
           lvorm
           ersda
           FROM mch1 INTO TABLE i_mch11
           
           WHERE matnr header_imp-plnbez.
    DATA:lv_lvorm1 TYPE lvoc1.
    CLEAR:lv_lvorm1.
    SELECT SINGLE matnr
                  charg
                  lvorm
                  ersda
                  
                  charg
                  lvorm
                  ersda
                  FROM mch1 INTO wa_mch21
                  
                  WHERE matnr header_imp-plnbez
                    
                    AND charg ls_afpo1-charg.
    IF wa_mch21-lvorm 'X'.
      MESSAGE  e005(zbtch_msgWITH ls_afpo1-charg header_imp-plnbez.
    ENDIF.
  ENDIF.
ENDIF.

1 comment:

  1. Thank you for the post. It was handy at a time I could not find the value of Batch.

    ReplyDelete