cancel
Showing results for 
Search instead for 
Did you mean: 

Incoterms not changing in Purchase order

0 Kudos

Hi,

In our S4 HANA project ,we've a country specific requirement to update the incoterms and inco location field in Purchase order at both header and item level with corresponding values in Sales Order ( from which PO is created ) at the time of PO creation.

We've used a custom implementation of BADI ME_PROCESS_PO_CUST and add the code changes in methods

IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM

and IF_EX_ME_PROCESS_PO__CUST~PROCESS_HEADER.

The value is getting updated at header level and it is working fine. But at item level ,the field incoterm is not getting updated with the value in SO, only the incolocation value is getting updated .

Please provide your valuable insights on this issue .

Thanks and Regards,

Athira S

Accepted Solutions (0)

Answers (1)

Answers (1)

DominikTylczyn
Active Contributor
0 Kudos

Hello athira_s

Why don't you implement item processing with PROCESS_ITEM method of the BadI instead of FIELDSELECTION_ITEM? FIELDSELECTION_ITEM is used to manipulate fields' statuses, not fields' values.

Best regards

Dominik Tylczynski

Hi Dominik ,

Thanks for your reply .That was a mistake from my side when I copied the method name .

Actually we've used IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM only .

Edited my question to correct it .Thanks for pointing out .

We've used FIELDSELECTION_ITEM to see whether altering the field statuses will solve the issue .But the custom implementation of this method is restricted using value of metafield .So this doesn't seems to be useful.

Thanks and Regards

Athira S

DominikTylczyn
Active Contributor
0 Kudos

Hello athira_s

Would share you code?

BR, Dominik Tylczynski

0 Kudos

Hi Domink ,

*---get item data
gs_mepoitem = im_item->get_data( ).

"---Fetch the value of SO number and item using Purchase Requisition Number
"---and Item number of purchase requisition
SELECT SINGLE vbeln,posnr
FROM vbep
INTO @DATA(ls_vbep)
WHERE banfn EQ @gs_mepoitem-banfn
AND bnfpo EQ @gs_mepoitem-bnfpo.

IF sy-subrc IS INITIAL.

"---Using SO number and item number fetch the value of incoterms
"---and inco locations
"---If a coreesponding incoterms value not exist for item,
"---fetch the value from header data
SELECT vbeln,posnr,inco1,inco2,inco2_l,inco3_l
FROM vbkd
INTO TABLE @DATA(lt_vbkd)
WHERE vbeln EQ @ls_vbep-vbeln
AND ( posnr EQ @ls_vbep-posnr
OR posnr EQ @space ).

IF sy-subrc IS INITIAL.


"---read the values corresponding to given item
READ TABLE lt_vbkd INTO DATA(ls_vbkd) WITH KEY posnr = ls_vbep-posnr.
IF sy-subrc IS INITIAL.

"Pass the values to corresponding item
gs_mepoitem-inco1 = ls_vbkd-inco1.
gs_mepoitem-inco2 = ls_vbkd-inco2.
gs_mepoitem-inco2_l = ls_vbkd-inco2_l.

ELSE.
"---if incoterms values are not present for item ,read value from header level
READ TABLE lt_vbkd INTO DATA(ls_vbkd2) WITH KEY posnr = space.
IF sy-subrc IS INITIAL.

"Pass the values to corresponding item
gs_mepoitem-inco1 = ls_vbkd2-inco1.
gs_mepoitem-inco2 = ls_vbkd2-inco2.
gs_mepoitem-inco2_l = ls_vbkd2-inco2_l. ENDIF.
ENDIF.


* "---change the data
im_item->set_data( im_data = gs_mepoitem ).
ENDIF.
ENDIF.
ENDIF.

Thanks and Regards

Athira S