There are lots of solutions in the SDN site for this issue, but I tried not to calculate anything at SUS and should be used ECC value, also no changes done in integration.

These kinds of POs are used most commonly by all the manufacturing companies. Ex. Each vs Box

Here some of the code changes done at ECC and SUS system, and then the PO and follow-on documents are flowing without any issue.

PO creation process at ECC.

Enhance the BADI ME_PROCESS_PO_CUST

BADI ME_PROCESS_PO_CUST.png

ZIMP_SC_ME_PRCESS_PO.png

PO Quantity Weights tab.png

PO line item ekpo-menge.png

Find the actual quantity by calculating like this.

Total Qty = (Order price unit (ekpo-bpumz)/order unit (ekpo-bpumn))* Purchase Order Quantity (ekpo-menge)

Add this calculated quantity information at item text node F01

Make sure you call function module ‘ROUND’ to round the value. Also if you going the display the unit at item text, then make sure get the right ISO format for the units.

Following Item Text screen shows total quantity by doing the above code changes at ECC.

PO-Item Text with total qty information.png

No the PO logic has to be changed at SUS system also, so the XML will process successfully at SUS.

Function module UNIT_CONVERSION_SIMPLE_OLD is to cross verify the entire order unit and order price unit. Here need to override the verification logic.

For Ex.

  DATA override_logic TYPE char1 VALUE ‘X’.
  IF override_logic = ‘X’.

  ELSE.

               Rest of the actual code is here….

  ENDIF.

There is an include program LBBP_PDIGPF1J in SUS system has direct logic to calculate price. Implement an enhancement at end and add the following. This is basically getting the PO value from ECC and updating to SUS system for PO & GR.

DATA : lvar_po_no           TYPE BBPS_BAPIEKKO-PO_NUMBER,

       lvar_po_item         TYPE ebelp,

       ls_po_header         TYPE BBPS_BAPIEKKOL,

       ls_po_address        TYPE BBPS_BAPIADDRESS,

       ls_po_items          TYPE BAPIEKPO_ECI,

       lvar_qty             TYPE string,

       lvar_logsys          TYPE logsys,

       lvar_itm_id          TYPE string,

       ls_itmigp            TYPE BBP_PDS_IGP_IC,

       lvar_src_id          TYPE NUM10,

       lt_po_items        TYPE STANDARD TABLE OF BAPIEKPO_ECI,

       ls_po_item_history TYPE BAPIEKBE_ECI,

       lt_po_item_history TYPE STANDARD TABLE OF BAPIEKBE_ECI.

*You may call using function module to get the actual ECC logical system

lvar_logsys = “ECCCLNT300.

lvar_itm_id = GW_ITMIGP-SRC_ITM_ID+9(1).

CONCATENATE lvar_itm_id ‘0’ INTO lvar_itm_id.

lvar_src_id = lvar_itm_id.

IF GW_ITMIGP-SRC_OBJECT_TYPE+0(7) = ‘BUS2012’.

lvar_po_no = GW_ITMIGP-SRC_OBJECT_ID.

lvar_po_item = GW_ITMIGP-SRC_ITM_ID+6(5).

CALL FUNCTION ‘META_PO_GETDETAIL’

  EXPORTING

    purchaseorder                    = lvar_po_no

    ITEMS                            = ‘X’

   LOGICAL_SYSTEM                    = lvar_logsys

IMPORTING

   PO_HEADER                         = ls_po_header

   PO_ADDRESS                        = ls_po_address

TABLES

   PO_ITEMS                          = lt_po_items.

READ TABLE lt_po_items INTO ls_po_items

WITH KEY PO_NUMBER = lvar_po_no

PO_ITEM = lvar_po_item.

IF SY-SUBRC = 0.

p_value = ls_po_items-net_value.

  ENDIF.

ENDIF.

IF GW_ITMBEI-BE_OBJECT_TYPE+0(7) = ‘BUS2017’.

  lvar_po_no = GW_ITMBEI-BE_REFOBJ.

  lvar_po_item = GW_ITMBEI-BE_REFOBJ_ITEM+5(5).

  CALL FUNCTION ‘META_PO_GETDETAIL’

    EXPORTING

     PURCHASEORDER                    = lvar_po_no

     ITEMS                            = ‘X’

     HISTORY                           = ‘X’

     LOGICAL_SYSTEM                    = lvar_logsys

   IMPORTING

     PO_HEADER                         = ls_po_header

     PO_ADDRESS                        = ls_po_address

   TABLES

     PO_ITEMS                          = lt_po_items

     PO_ITEM_HISTORY                   = lt_po_item_history.

  READ TABLE lt_po_items INTO ls_po_items

WITH KEY PO_NUMBER = lvar_po_no PO_ITEM = lvar_po_item.

  IF ls_po_items-NOND_ITAX IS NOT INITIAL.

    READ TABLE lt_po_item_history INTO ls_po_item_history

WITH KEY PO_ITEM = GW_ITMBEI-BE_REFOBJ_ITEM+5(5) 

DOC_YEAR = GW_ITMBEI-BE_OBJECT_ID+10(4) 

MAT_DOC = GW_ITMBEI-BE_OBJECT_ID+0(10).

    IF SY-SUBRC = 0.

      lvar_qty = ls_po_item_history-QUANTITY / ls_po_items-QUANTITY.

      p_value = ls_po_items-NET_VALUE * lvar_qty.

    ENDIF.

  ELSE.

    READ TABLE lt_po_item_history INTO ls_po_item_history

WITH KEY PO_ITEM = GW_ITMBEI-BE_REFOBJ_ITEM+5(5)

DOC_YEAR = GW_ITMBEI-BE_OBJECT_ID+10(4)  

MAT_DOC = GW_ITMBEI-BE_OBJECT_ID+0(10).

    IF SY-SUBRC = 0.

      p_value = ls_po_item_history-VAL_FORCUR.

    ENDIF.

  ENDIF.

ENDIF.

READ TABLE GX_ITMIGP INTO ls_itmigp WITH KEY src_itm_id = lvar_src_id.

IF SY-SUBRC = 0 AND GX_ITMIGP-SRC_OBJECT_TYPE+0(7) = ‘BUS2230’.

  p_value = ls_itmigp-value.

ENDIF.

PO Status tab.png

The following shows SUS supplier view with ECC total amount.

PO list from SUS.png

Item detail view has item text description with the total quantity detail.

SUS PO item detail.png

No need any changes to PO acknowledgment and ASN at SUS side, but there is a validation happening at ECC side for PO acknowledgement.

Function module IDOC_INPUT_SUS_ORDRSP has validation, these needs to be fixed. The unit is not comes with ISO format, so this should be converted and passed to the validation code.

Add these codes at the beginning enhancement.

FIELD-SYMBOLS <ls_idocdata> TYPE EDIDD.

READ TABLE iDoc_Data into ls_iDocData with key segnam = ‘E1EDK01’.
IF SY-SUBRC = 0.
  lvar_po_no = ls_iDocDatasdata+83(10).
  IF lvar_po_no is not initial.
      SELECT ebeln ebelp meins bprme peinh
        FROM ekpo
        INTO TABLE lt_ekpo
        WHERE ebeln = lvar_po_no.
      IF SY-SUBRC = 0.
            SELECT msehi dimid
                  FROM t006 INTO TABLE lt_t006
                  FOR ALL ENTRIES IN lt_ekpo
                  WHERE msehi = lt_ekpomeins.

            SELECT msehi dimid
                  FROM t006 APPENDING TABLE lt_t006
                  FOR ALL ENTRIES IN lt_ekpo
                  WHERE msehi = lt_ekpobprme.
      ENDIF.
  ENDIF.

ENDIF.

READ TABLE lt_t006 WITH KEY dimid = ‘AAAADL’ TRANSPORTING NO FIELDS.
IF SY-SUBRC = 0.
    LOOP AT lt_ekpo INTO ls_ekpo.
      IF ls_ekpomeins <> ls_ekpobprme.
        READ TABLE iDocData assigning <ls_iDocData>

WITH KEY segnam = ‘E1EDP01’

sdata+0(5) = ls_ekpoebelp.

IF SY-SUBRC = 0.

CALL FUNCTION ‘UNIT_OF_MEASURE_SAP_TO_ISO’
  EXPORTING
    sap_code         = ls_ekpobprme
IMPORTING
   ISO_CODE          = <ls_iDocData>sdata+44(3)
EXCEPTIONS
   NOT_FOUND         = 1
   NO_ISO_CODE       = 2
   OTHERS            = 3.


IF SY-SUBRC <> 0.
MESSAGE ID SYMSGID TYPE SYMSGTY NUMBER SYMSGNO
         WITH SYMSGV1 SYMSGV2 SYMSGV3 SYMSGV4.
ENDIF.


<ls_iDocData>sdata+69(9) = ls_ekpopeinh.

  ENDIF.

            ENDIF.
      ENDLOOP.

ENDIF.

PO acknowledgement and ASN transferred successfully to ECC.

ECC PO Confirmation tab.png

Create GR at ECC and send to SUS. Till now whatever the code change done, should work without any issue. And the price also matching between ECC and SUS for Goods Receipt.

ECC PO history tab.png

SUS PO follow on documents.png

Invoice:

Already some of the codes done in include LBBP_PDIGPF1J that takes care of invoicing also, but there is a tolerance check needs to be ignored.

Comment the following at include LBBP_PDIGPF84

*-Price check
* Check conf-price
*  PERFORM check_iv_price USING  p_method
*                                ls_cf_itmpln_x
*                                ls_po_itmpln_x
*                                is_old_itmigp
*                                is_new_itmigp
*                                is_icom.

As per the standard, you cannot directly comment the PERFORM statement. So copy entire performs and put into beginning of enhancement spot, then remove this perform and then at end include RETURN command to ignore the standard code.

Now you can create Invoice and credit memo and it matches at ECC.

SUS PO follow on documents with invoice.png

ECC PO history tab with invoice.png

I hoep this solution will be helpful to you.

Thanks

Senthil Thavamani

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply