Skip to Content
Technical Articles

Integrate It! – LUW debug. Step-by-step guide

Prerequisites.

You have ERP and SCM systems integrated via CIF-interface*. To find out the cause of the errors you want to know about “debug LUW” tool in SMQ2
*CIF (Core Interface) is technically part of the integration for master and transaction data between S/4HANA and SCM-system
** In our case SCM system – SAP EWM

Quote.

“The increased scale and complexity of SAP and non-SAP systems challenges require that we look for
ways to simplify the system-integration requirements”
This quote about a series of blog-posts (“Integrate it…”) about integration between different SAP and non-SAP systems
Another posts from this series (The list is being updated.)
Integrate it! – SAP and MES integration. Step-by-step guide
Integrate it! – Qlick View/Sense and SAP integration. Step-by-step guide
Integrate it! – SAP BW. Extract data from remote MS SQL Server. Step by step guide

Resolution for LUW without error

At the transaction (SMQ2 – qRFC Monitor – Inbound Queue) you not found hang-up queues in SYSFAIL state at SCM-system side but you want a step-by-step investigation LUW.
Case with a real example:
In our example, we have Z- Enhancement for Material data flow at SCM-side.
It overwrites empty values for “checked” indicator in /SCWM/MAT1 if some key parameters for material (for example WHTSC – Warehouse Storage Condition or Material name) was changed in the ERP side.
In our real example “checked” indicator was overwritten in cases when key parameters have not to be changed in the ERP side and we want to reproduce this situation in debug mode.
At the SCM-side:
  1. Transaction – SMQR – qRFC Monitor – (QIN Scheduler) in SCM-system. Deregistration of CF* Inbound queues
    2. Transaction – SE80 – Object Navigator.  Set external and internal breakpoints* at

at Z- Enhancement for Material data flow at SCM-side.
Some facts for breakpoints:
Fact #1. You can’t save breakpoints in the RFC session.
Fact #2. There are two types of breakpoints:
– Internal – for ABAP sessions
– External – for BSP/WebDynpro (browser) sessions i.e for cases when you not logon via SAP Logon GUI and (very important!) for session running from another user for example from the service user. Friendly advice setup both internal and external breakpoints together.
At the ERP side:
  1. Reproduce material changes in MASS or MM2 transactions
  2. Generate integration model for materials in CFM1 transaction
  3. Activate the integration model for materials in CFM2 transaction. Two times ignore the message “Inbound Queue Blocked”

 

 

At the SCM – side:
  1. Found CF* queue in a READY state in SMQ2 transaction (opened in a separate session)

 

 

  1. In the ABAP Debugger navigate to our breakpoint (F8 – Continue)
  2. Investigate variable/structure/tables values in our Z- code
“checked” indicator will be overwritten if …
IF ls_prdhead-meins <> ls_prd_det-uom-uom.
          CONTINUE.
        ENDIF.
        IF ls_prdhead-batch_req <> ls_prd_det-batch_required.
          CONTINUE.
        ENDIF.
       IF ls_prdhead-whmatgr <> ls_mat_global-whmatgr.
       CONTINUE.
       ENDIF.
        IF ls_prdhead-whstc <> ls_mat_global-whstc.
          CONTINUE.
        ENDIF.
        IF ls_prdhead-hndlcode <> ls_mat_global-hndlcode.
          CONTINUE.
        ENDIF.
        IF ls_prdhead-qgrp <> ls_mat_global-qgrp.
          CONTINUE.
        ENDIF.
and
 IF <ls_prdtext>-maktx <> ls_mat_global-maktx.
          CONTINUE.
        ENDIF.
Investigate values in structures <ls_prdtext> and  ls_mat_global  and error was found at this fragment

 

 

This code selects the first string where MAKTX is empty

We can add additional table KEY and fix this error:
For example:
READ TABLE it_ext_mattxt ASSIGNING FIELD-SYMBOL(<ls_prdtext>)
WITH KEY ext_matnr = ls_prdhead-ext_matnr
  method = ‘M’.

Resolution for LUW in error state

In our real example at the transaction (SMQ2 – qRFC Monitor – Inbound Queue), we found a hang-up queue in SYSFAIL state at the SCM-system side. Data flow with Suppliers was broken and we want to investigate this situation in debug mode.

Step 1. Error code

1.Retrieve Message No and message text from SYSFAIL queue
At this point, we can try to explore sap blogs and sap notes with this Message txt/No
But in some cases, you can’t find the correct answer and must start debugging for root cause analysis
2.Debug LUW
  1. In the ABAP Debugger
Menu – Breakpoints – Breakpoint at – Breakpoint at Message
For Message No “/SAPAPO/LOM077”
ID: /SAPAPO/LOM0
Number: 077
Result: Breakpoint Set. This is will be our entry point to the ABAP code investigation.

Step 2. Code investigation

  1. F8 (Continue) and we inside a handling error function.
This is only handled error function and prerequisites for this error occurred earlier
On right pane (ABAP and Screen Stack) goto on several steps down (for example from Stack level 16 to Stack level 14)
  1. Investigate structures and variables from this stack level. The problem can be looked as Inconsistency in structure LT_CIF_LOCMAP

 

Inconsistency where EXT_LOCNO – customer code without prefix (SU means Supplier). LOCNO – customer code with the prefix
We can find try to find the root cause in Function /sapapo/cif_loc_inbound.
but before this, a few words about breakpoints* again
Fact #1. You can’t save breakpoints in the RFC session.
Fact #2. There are two types of breakpoints:
– Internal – for ABAP sessions
– External – for BSP/WebDynpro (browser) sessions i.e for cases when you not logon via SAP Logon GUI and (very important!) for session running from another user for example from the service user. Friendly advice setup both internal and external breakpoints together.

Step 3.  Investigate FUNCTION /sapapo/cif_loc_inbound.

  1. In the ABAP Debugger
Menu – Breakpoints – Breakpoint at – Breakpoint at Function
Function: /sapapo/cif_loc_inbound.
Found that desired LT_CIF_LOCMAP filed in BADI SMOD_APOCF001

Step 4. Investigate BADI SMOD_APOCF001

Transactions SE18 (Bussiness Add-ins: Difinitions) or SE80 (Object Navigator)->Development Object
Method ->EXIT_/SAPAPO/SAPLCIF_LOC_001
Investigate BADI description in code:
Investigate BADI description in the Integration of SAP ERP with SAP EWM guide – https://wiki.scn.sap.com/wiki/download/attachments/473958110/003_ERP_EWM_Integration.pdf
So the problem was understanding: Suppliers was CIFed to SCM system before BADI SMOD_APOCF001 was implemented.
Resolution:
Something like this z-code (Use this code at you own the risk)
REPORT ZUPDATE_LOCMAP.
TABLES: /SAPAPO/LOCMAP.
DATA: LT_LOCMAP TYPE STANDARD TABLE OF /SAPAPO/LOCMAP WITH HEADER LINE,
      LT_LOC    TYPE STANDARD TABLE OF /SAPAPO/LOC WITH HEADER LINE,
      PREFIX    TYPE                   /SAPAPO/C_LOCTYPE.
SELECT-OPTIONS: S_LOCNO FOR /SAPAPO/LOCMAP-LOCNO.
SELECT * FROM /SAPAPO/LOCMAP  INTO TABLE LT_LOCMAP WHERE LOCNO IN S_LOCNO.
CHECK SY-SUBRC EQ 0.
LOOP AT LT_LOCMAP.
    PERFORM DETERMINE_PREFIX USING LT_LOCMAP-LOCTYPE CHANGING PREFIX.
  IF LT_LOCMAP-LOCNO(2) <> PREFIX.
    CONCATENATE PREFIX LT_LOCMAP-EXT_LOCNO INTO LT_LOCMAP-LOCNO.
    MODIFY LT_LOCMAP.
    MODIFY /SAPAPO/LOCMAP FROM LT_LOCMAP.
    UPDATE /SAPAPO/LOC SET LOCNO = LT_LOCMAP-LOCNO WHERE LOCID = LT_LOCMAP-LOCID.
    NEW-LINE.
    write: / SY-TABIX, ‘ Location changed to ‘, LT_LOCMAP-LOCNO, ‘GUID’, LT_LOCMAP-LOCID.
  ELSE.
    DELETE LT_LOCMAP.
  ENDIF.
ENDLOOP.
GET TIME.
FORM DETERMINE_PREFIX USING LV_LOCTYPE TYPE /SAPAPO/C_LOCTYPE CHANGING PREFIX TYPE /SAPAPO/C_LOCTYPE.
  CLEAR PREFIX.
  CASE LV_LOCTYPE.
    WHEN ‘1011’.
      PREFIX = ‘SU’.
  ENDCASE.
ENDFORM.

Conclusion

SAP EWM routine task with examples from real life was provided.
2 Comments
You must be Logged on to comment or reply to a post.