Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

To change the Purchase order header and line item text

kanishakgupta1
Contributor
0 Kudos

Hi everybody,

I need to upload the PO Header and item text for the combinaion of PO and a material.

Please help???

2 REPLIES 2

Former Member
0 Kudos

sort the internal table based on PO Number and Material number.

Then pass the data to BAPI BAPI_PO_CREATE1

Former Member
0 Kudos

Hi,

Try this beloe code

  • Length of the PO item text
  • If the length > 132 Chars
  • BAPI Function module for changing PO item Text
  • commiting the bapi change
SORT t_bapi BY ebeln ebelp. LOOP AT t_ebeln INTO wa_ebeln. LOOP AT t_bapi INTO wa_bapi WHERE ebeln = wa_ebeln-ebeln. REFRESH t_return. READ TABLE t_input INTO wa_input WITH KEY ref_num = wa_bapi-ref_num item = wa_bapi-ebelp. IF sy-subrc EQ 0. APPEND wa_input TO t_output. w_len = STRLEN( wa_input-text ). wa_potextitem-po_number = wa_bapi-ebeln. wa_potextitem-po_item = wa_bapi-ebelp. wa_potextitem-text_id = 'F01'. wa_potextitem-text_form = '*'. wa_potextitem-text_line = wa_input-text+0(132). APPEND wa_potextitem TO t_potextitem. IF w_len > 132. wa_potextitem-po_number = wa_bapi-ebeln. wa_potextitem-po_item = wa_bapi-ebelp. wa_potextitem-text_id = 'F01'. wa_potextitem-text_form = '='. wa_potextitem-text_line = wa_input-text+132(123). APPEND wa_potextitem TO t_potextitem. ENDIF. ENDIF. ENDLOOP. CALL FUNCTION 'BAPI_PO_CHANGE' EXPORTING purchaseorder = wa_bapi-ebeln TABLES return = t_return potextitem = t_potextitem. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = ' ' IMPORTING return = wa_bapiret2.

Regards

Krishna