Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Data getting deleted while performing Quotation Change via BAPI

Hi,

I am Trying to utilize at standard bapi (followed by transaction commit) for changing the address data of quotation.

I want to change only

Sold -To Party's: Email ID and Telephone number and

Ship- To Party's: Street,City.

Data is getting changed but unfortunately other (All) data is get erased (likewise Name,postal code,etc)

Can you help me out?

It very urgent issue and I have tried to change all.

Bapi Used: BAPI_CUSTOMERQUOTATION_CHANGE

please check below code that I have used:

REPORT zg_bapi_change_qotation_sold.

TABLES:bapisdh1,bapisdh1x,bapisditm,bapisditmx,bapischdl,bapischdlx,bapiret2.

DATA:text(4096) TYPE c OCCURS 0.

DATA:it_item       TYPE TABLE OF bapisditm,

     wa_item       TYPE bapisditm,

     it_return     TYPE TABLE OF bapiret2,

     wa_return     TYPE bapiret2,

     it_bapischdl  TYPE TABLE OF bapischdl,

     wa_bapischdl  TYPE bapischdl,

     it_bapischdlx TYPE TABLE OF bapischdlx,

     wa_bapischdlx TYPE bapischdlx,

     it_head       TYPE TABLE OF bapisdh1,

     wa_head       TYPE bapisdh1,

     it_headx      TYPE TABLE OF bapisdh1x,

     wa_headx      TYPE bapisdh1x,

     it_itemx      TYPE TABLE OF  bapisditmx,

     wa_itemx      TYPE bapisditmx,

     it_partner    TYPE TABLE OF bapiparnr,

     wa_partner    TYPE bapiparnr,

     it_partnercng TYPE TABLE OF bapiparnrc,

     wa_partnercng TYPE bapiparnrc,

     it_partneradd TYPE TABLE OF bapiaddr1,

     wa_partneradd TYPE bapiaddr1.

wa_head-sales_org  = 'PRIM'.

wa_head-distr_chan = 'PR'.

wa_head-division   = '01'.

APPEND wa_head TO it_head.

wa_headx-updateflag = 'U'.

wa_headx-sales_org  = 'X'.

wa_headx-distr_chan = 'X'.

wa_headx-division   = 'X'.

APPEND wa_headx TO it_headx.

wa_item-itm_number = '000010'.

wa_item-material   = '000000000000000015'.

wa_item-target_qty = '21'.

*WA_ITEM-STORE_LOC= '1'.

wa_item-plant = 'PRIM'.

APPEND wa_item TO it_item.

wa_itemx-updateflag = 'U'.

wa_itemx-itm_number = '000010'.

wa_itemx-material   = 'X'.

wa_itemx-target_qty   = 'X'.

*WA_ITEMX-STORE_LOC= 'X'.

wa_itemx-plant = 'X'.

APPEND wa_itemx TO it_itemx.

wa_bapischdl-itm_number = '000010'.

wa_bapischdl-sched_line = '1'.

wa_bapischdl-req_qty = '6'.

APPEND wa_bapischdl TO it_bapischdl.

wa_bapischdlx-updateflag = 'U'.

*wa_bapischdlx-itm_number = '000010'.

wa_bapischdlx-req_qty = 'X'.

wa_bapischdlx-sched_line = '1'.

APPEND wa_bapischdlx TO it_bapischdlx.

wa_partner-partn_role = 'AG'.

wa_partner-partn_numb = '0000100005'.

wa_partner-itm_number = '10'.

APPEND wa_partner TO it_partner.

CLEAR wa_partner.

*FOR SOLD-TO-PARTY

wa_partnercng-document  = '0050000104'.

wa_partnercng-updateflag  = 'U'.

wa_partnercng-partn_role  = 'AG'.

wa_partnercng-p_numb_old  = '0000100005'.

wa_partnercng-p_numb_new  = '0000100005'.

wa_partnercng-addr_link   = '0000000003'.

APPEND wa_partnercng TO it_partnercng.

CLEAR wa_partnercng.

wa_partneradd-addr_no = '0000000003'.

wa_partneradd-country = 'IN'.

wa_partneradd-tel1_numbr = '2487271472'.

wa_partneradd-e_mail = 'sap@gmail.com'.

APPEND wa_partneradd TO it_partneradd.

CLEAR wa_partneradd.

**FOR SHIP-TO-PARTY

CLEAR wa_partner.

wa_partnercng-document  = '0050000104'.

wa_partnercng-updateflag  = 'U'.

wa_partnercng-partn_role  = 'WE'.

wa_partnercng-p_numb_old  = '0000100005'.

wa_partnercng-p_numb_new  = '0000100005'.

wa_partnercng-addr_link   = '0000000004'.

APPEND wa_partnercng TO it_partnercng.

CLEAR wa_partnercng.

wa_partneradd-addr_no = '0000000004'.

wa_partneradd-city   'SATARA1'.

wa_partneradd-street  = 'SHIVAJI ROAD1'.

wa_partneradd-postl_cod1  = '123456'.

wa_partneradd-country = 'IN'.

APPEND wa_partneradd TO it_partneradd.

CLEAR wa_partneradd.

CALL FUNCTION 'BAPI_CUSTOMERQUOTATION_CHANGE'

  EXPORTING

    salesdocument        = '0050000104'

    quotation_header_in  = wa_head

    quotation_header_inx = wa_headx

  TABLES

    return               = it_return[]

    quotation_item_in    = it_item[]

    quotation_item_inx   = it_itemx[]

    partners             = it_partner[]

    partnerchanges       = it_partnercng[]

    partneraddresses     = it_partneradd[]

    schedule_lines       = it_bapischdl[]

    schedule_linesx      = it_bapischdlx[]  .


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Tags:
replied

Yes, had tried for pushing all data (by first calling display bapi and then Populating all and updating the required changes).

I thought that its not the correct way to change quotation through BAPI but

I get its the only way to change partner and address data by calling display bapi first and populating it to (change bapi's ) tables and then calling the Change bapi.

Thanks anyways,

--Pavan G

Message was edited by: Pavan Golesar

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question