Skip to Content
0
Former Member
Feb 14, 2006 at 11:28 PM

Delete partners with BAPI_SALESORDER_CHANGE

431 Views

I'm able to change and create new partners in a Sales Document...

But I'm not ablr to delete partners.Can any 1 give me clue where I'm doing wrong.

&----


*& Report YCHANGEORDER

*&

&----


*&

*&

&----


report ychangeorder.

tables: bapivbeln, bapicond, bapicondx,

bapisdh1x, bapisditmx.

data: ls_head_x type bapisdh1x,

lt_order_item_x like bapisditmx occurs 1 with header line,

lt_conditions like bapicond occurs 2 with header line,

lt_conditions_x like bapicondx occurs 2 with header line,

lt_bapiparnr like bapiparnr occurs 2 with header line,

lt_bapiparnrc like bapiparnrc occurs 2 with header line,

lt_messages like bapiret2 occurs 5 with header line,

lt_messages1 like bapiret2 occurs 5 with header line.

data: ls_vbup type vbup,

ls_gmbr type gmbr,

ls_messages type bapiret2 .

data: lv_vbeln type bapivbeln-vbeln,

lv_posnr type bapisditmx-itm_number.

lv_vbeln = '0001000340'.

ls_head_x-updateflag = 'U'.

lt_bapiparnr-partn_role = 'ZA'.

lt_bapiparnr-partn_numb = '1018'.

append lt_bapiparnr.

  • ITM_NUMBER

lt_bapiparnrc-document = lv_vbeln.

  • lt_BAPIPARNRC-ITM_NUMBER =

lt_bapiparnrc-updateflag = 'D'.

lt_bapiparnrc-partn_role = 'ZA'.

  • P_NUMB_OLD

  • lt_BAPIPARNRC-P_NUMB_NEW = '1018'.

  • lt_bapiparnrc-p_numb_old = '0000001018'.

    append lt_bapiparnrc.

    call function 'BAPI_SALESORDER_CHANGE'

    exporting

    salesdocument = lv_vbeln

    • ORDER_HEADER_IN =

    order_header_inx = ls_head_x

    • SIMULATION =

    • BEHAVE_WHEN_ERROR = ' '

    • INT_NUMBER_ASSIGNMENT = ' '

    • LOGIC_SWITCH =

    • NO_STATUS_BUF_INIT = ' '

    tables

    return = lt_messages1

    • ORDER_ITEM_IN =

    • ORDER_ITEM_INX =

    partners = lt_bapiparnr

    partnerchanges = lt_bapiparnrc

    • PARTNERADDRESSES =

    • ORDER_CFGS_REF =

    • ORDER_CFGS_INST =

    • ORDER_CFGS_PART_OF =

    • ORDER_CFGS_VALUE =

    • ORDER_CFGS_BLOB =

    • ORDER_CFGS_VK =

    • ORDER_CFGS_REFINST =

    • SCHEDULE_LINES =

    • SCHEDULE_LINESX =

    • ORDER_TEXT =

    • ORDER_KEYS =

    • CONDITIONS_IN =

    • CONDITIONS_INX =

    • EXTENSIONIN =

    .

    call function 'BAPI_TRANSACTION_COMMIT'

    exporting

    wait = 'X'

    importing

    return = ls_messages.

    if sy-subrc ne 0.

    append ls_messages to lt_messages .

    endif.

    http://www.sapfans.com/forums/viewtopic.php?t=229289