‎2011 Mar 21 11:06 AM
Hi experts,
I need to update some specific fields (BAPIADDR1-HOME_CITY, BAPIADDR1-HOUSE_NO2) in sales order.
For this I use BAPI above.
Obviously in BAPIADDR1 structure there is also ADDR_NO field filled.
The problem is, that the rest of the fields was deleted (updated). I mean these one, which was not specified ...
How to avoid update those field. ?
Really thanks.
Daniel.
‎2011 Mar 21 11:41 AM
data PARTNERADDRESSES like BAPIADDR1 occurs 0 with header line.
PARTNERADDRESSES-ADDR_NO = '0000000004'.
PARTNERADDRESSES-NAME = 'krupa'.
PARTNERADDRESSES-STREET = 'test'.
PARTNERADDRESSES-NAME_2 = 'Bldg 56'.
PARTNERADDRESSES-CITY = 'ahmedabad'.
*APPEND PARTNERADDRESSES. CLEAR PARTNERADDRESSES*
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = salesd
ORDER_HEADER_IN = it_BAPISDH1
order_header_inx = it_BAPISDH1X
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
tables
ORDER_ITEM_IN = it_BAPISDITM
ORDER_ITEM_INX = it_BAPISDITMX
PARTNERS = it_BAPIPARNR
return = it_BAPIRET2
PARTNERCHANGES = it_BAPIPARNRC
PARTNERADDRESSES = PARTNERADDRESSES
.
‎2011 Mar 21 11:45 AM
Thanks for your reply.
Thing is that I don't want to fill those fields like STREET, NAME, CITY .etc. because they are exist allready.
I do not want to update all of this fields.
Edited by: Daniel Duras on Mar 21, 2011 1:36 PM
‎2011 Mar 21 12:59 PM
first u use BAPISDORDER_GETDETAILEDLIST and get list all then after wht u want to modify u can do for example:
if want to change val.type the the see the following example
order_header_in-sd_doc_cat = 'C'.
order_header_inx-updateflag = 'U'.
i_bapi_view-header = 'X'.
i_bapi_view-item = 'X'.
i_bapi_view-partner = 'X'.
i_bapi_view-contract = 'X'.
i_bapi_view-sdcond = 'X'.
i_bapi_view-sdcond_add = 'X'.
i_bapi_view-billplan = 'X'.
i_bapi_view-configure = 'X'.
sales_documents-vbeln = v_order.
.
APPEND sales_documents.
***GET LIST OF SALESORDER
CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST'
EXPORTING
i_bapi_view = i_bapi_view
TABLES
sales_documents = sales_documents
order_headers_out = order_headers_out
order_items_out = order_items_out
order_contracts_out = order_contracts_out
order_billingplans_out = order_billingplans_out
order_billingdates_out = order_billingdates_out
order_partners_out = order_partners_out
order_conditions_out = order_conditions_out.
LOOP AT order_items_out .
MOVE-CORRESPONDING order_items_out TO order_item_in.
order_item_in-val_type = pval.
APPEND order_item_in.
ENDLOOP
Then pass order_item_in into bapi
Edited by: Krupaji on Mar 21, 2011 2:01 PM
‎2011 Mar 21 1:46 PM
I doubt that you updated those fields; most likely, you created a new address with only those fields specified. To change existing address detail, you should use the org. address change BAPI or one of the other functions provided for address changes.
@Krupaji: if you're going to give example code, don't use deprecated syntax.
data PARTNERADDRESSES like BAPIADDR1 occurs 0 with header line.
‎2011 Mar 22 6:43 AM
Thanks for replies again.
I have decided to use ADDR_UPDATE FM. Seems to work fine.
Daniel.