6/13/2017 10:22:13 AM

Send SAP external lot to APO system-This blog will gives you how to send SAP external lot to APO system. In general as per SAP standard behavior like Lot origin 17 which is external lot which will not sent to APO system as this is external lot. 

Issue : When ECC, APO and EWM are integrated then the external lot(ie. 17) wont sent to APO system.

In standard implementation non-stock relevant inspection origins are not considered, means even after activating you won't see external created inspection lots in APO (as these are per non-stock relevant).

Analysis : During GR for both purchase order and process order the lot will be created and the BTE function module OUTBOUND_CALL_01000108_E will be called which in turn call the table TBE31 and read appropriate Function module NDPLG_APO_11A_01000108_APO_PUT with the event 01000108

Solution : 

Step 1) Call the transaction BF31 or use SM30 with the table TBE31(Publish&Subscribe BTE: SAP Enhancement)

Create copy of the Function module NDPLG_APO_11A_01000108_APO_PUT into Z_NDPLG_APO_11A_01000108_APO

Create an entry with the event 01000108 with Application indicator as ND-APO and Function module as Z_NDPLG_APO_11A_01000108_APO

Step 2) Create copy of the Function Module QAPO_INSPLOT_PUT into Z_QAPO_INSPLOT_PUT

Step 3) Goto Function module Z_NDPLG_APO_11A_01000108_APO and add the logic which is given below

CONSTANTS lc_qherk_17 TYPE qherk VALUE '17'. 

DATA:  lwa_qals_old TYPE qals.


  IF is_qals-herkunft EQ lc_qherk_17. 

  select single from qals into lwa_qals_old where PRUEFLOS is_qals-PRUEFLOS. 

    CALL FUNCTION 'Z_QAPO_INSPLOT_PUT'
      EXPORTING
        is_qals     is_qals
        is_qals_old is_qals_old
      EXCEPTIONS
        OTHERS      1. 

  ENDIF. 

Step 4) Enhance the table QALS with append structure and add below the custom fields with data type as CHAR

ZZ_INSMK

ZZ_BLOCK_STOCK

ZZ_CHG

We need to enhance since the ECC is integrated with EWM system 

Step 5) Goto Function module Z_QAPO_INSPLOT_PUT and  comment the below code.

*  IF is_qals-insmk NE c_x
*     AND ( is_qals_old-prueflos IS INITIAL
*             OR ( NOT is_qals_old-prueflos IS INITIAL
*                  AND is_qals_old-insmk NE c_x ) ) .
*    EXIT.

*  ENDIF. 

add below the code 

  IF is_qals-ZZ_INSMK NE c_x
     AND is_qals_old-prueflos IS INITIAL
             OR NOT is_qals_old-prueflos IS INITIAL
                  AND is_qals_old-ZZ_INSMK NE c_x .
    EXIT.
  ENDIF. 

  IF is_qals-stat35 EQ c_x
     AND is_qals_old-prueflos IS INITIAL
             OR NOT is_qals_old-prueflos IS INITIAL
                  AND is_qals_old-stat35 EQ c_x .
    EXIT.
  ENDIF. 

Comment below the code

*  CALL FUNCTION 'STATUS_CHECK'
*       EXPORTING
*            bypass_buffer     = ' '
**           CLIENT            = SY-MANDT
*            objnr             = is_qals-objnr
*            status            = c_sprq "I0203 = BERF
*       EXCEPTIONS
*            object_not_found  = 1
*            status_not_active = 2
*            OTHERS            = 3.
*
*  IF sy-subrc IS INITIAL.
**   status "stock posting required" is set
*    MOVE c_x TO l_stat_sprq.
*  ENDIF. 

*  CALL FUNCTION 'STATUS_CHECK'
*       EXPORTING
*            bypass_buffer     = ' '
**           CLIENT            = SY-MANDT
*            objnr             = is_qals-objnr
*            status            = c_hum                       "I0443  HUM
*       EXCEPTIONS
*            object_not_found  = 1
*            status_not_active = 2
*            OTHERS            = 3.
*
*  IF sy-subrc IS INITIAL.
**   status "handling unit managed" is set
*    MOVE c_x TO l_stat_hum.
*  ENDIF. 

*    CALL FUNCTION 'STATUS_CHECK'
*         EXPORTING
*              bypass_buffer     = c_x  " always from DB!!!
**             CLIENT            = SY-MANDT
*              objnr             = is_qals_old-objnr
*              status            = c_sprq            "I0203 = BERF
*         EXCEPTIONS
*              object_not_found  = 1
*              status_not_active = 2
*              OTHERS            = 3.
*
*    IF sy-subrc IS INITIAL.
**     status "stock posting required" is set
*      MOVE c_x TO l_stat_sprq_old.
*    ENDIF.

*    CALL FUNCTION 'STATUS_CHECK'
*         EXPORTING
*              bypass_buffer     = c_x  " always from DB!!!
**             CLIENT            = SY-MANDT
*              objnr             = is_qals_old-objnr
*              status            = c_hum                     "I0443  HUM
*         EXCEPTIONS
*              object_not_found  = 1
*              status_not_active = 2
*              OTHERS            = 3.
*
*    IF sy-subrc IS INITIAL.
**     status "handling unit managed" is set
*      MOVE c_x TO l_stat_hum_old.
*    ENDIF. 

*  IF l_stat_sprq IS INITIAL
*     AND ( is_qals_old-prueflos IS INITIAL
*           OR ( NOT is_qals_old-prueflos IS INITIAL
*                AND l_stat_sprq_old IS INITIAL ) ).
*    EXIT.
*  ENDIF.
** Any HUM ? Not relevant for APO!
*  IF l_stat_hum EQ c_x
*     AND ( is_qals_old-prueflos IS INITIAL
*           OR ( NOT is_qals_old-prueflos IS INITIAL
*                AND l_stat_hum_old EQ c_x ) ).
*    EXIT.
*  ENDIF. 

*          l_stat_sprq_old      TO l_stat_wa-sprq,
*          l_stat_hum_old       TO l_stat_wa-hum, 

Testing:
Create Purchase order or Process order for EWM system and do GR in EWM system. Now you will get two inbound queue in ECC, one will be Inbound delivery update and another will be Lot creation. Now you keep break point in Function module OUTBOUND_CALL_01000108_E and you can see the event 01000108 will be called twice with the function modules NDPLG_APO_11A_01000108_APO_PUT and Z_NDPLG_APO_11A_01000108_APO. For external lot then the FM Z_NDPLG_APO_11A_01000108_APO will be called and will send lot details to APO.

Note : For early lot(Process order) and Lot cancellation the BTE not at all called so you have to enhance(implicit) below the function modules and call the BTE function module OUTBOUND_CALL_01000108_E

QPLEXT_MATDOC_GET

QPLEXT_INSPECTION_LOT_CANCEL

Just call like below code

CALL FUNCTION 'OUTBOUND_CALL_01000108_E'
 EXPORTING
   IS_QALS           lwa_qals
   IS_QALS_OLD       lwa_qals_old. 


Please feel free to contact me if you have any queries @ karthik.ramanan@techwaukee.com also send your suggestion to the same email id.


If you like this blog, please share (Facebook/LinkedIn/Google+) to click below links so it will reach to others.


COMMENTS