Skip to Content
author's profile photo Former Member
Former Member

Regarding Sales order change

hi

i want to change the sales order fields values the fields are ETENR,LIFSP,ETTYP,and EDATU.

i used bapi BAPI_SALESORDER_CHANGE.

the following is the code i written by me,but is now working fine.

can any body make me know what changes has to me made .

data:begin of itab occurs 0,

VBELN(10),

SCHED_LINE(4),

REQ_DATE(8),

SCHED_TYPE(2),

REQ_DLV_BL(2),

end of itab.

DATA:I_MSG TYPE STRING.

DATA: IT_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.

DATA: ISCH_TAB LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE.

DATA: ISCH_TABX LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE.

DATA:ORDERNO TYPE BAPIVBELN-VBELN.

LOOP AT ITAB.

BAPIVBELN-VBELN = VBELN.

MOVE-CORRESPONDING ITAB TO ISCH_TAB.

MOVE-CORRESPONDING ITAB TO ISCH_TABX.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = BAPIVBELN-VBELN

  • ORDER_HEADER_IN =

order_header_inx =

  • SIMULATION =

  • BEHAVE_WHEN_ERROR = ' '

  • INT_NUMBER_ASSIGNMENT = ' '

  • LOGIC_SWITCH =

  • NO_STATUS_BUF_INIT = ' '

tables

return = IT_RETURN

  • ORDER_ITEM_IN =

  • ORDER_ITEM_INX =

  • PARTNERS =

  • PARTNERCHANGES =

  • 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 = ISCH_TAB

SCHEDULE_LINESX = ISCH_TABX

  • ORDER_TEXT =

  • ORDER_KEYS =

  • CONDITIONS_IN =

  • CONDITIONS_INX =

  • EXTENSIONIN = .

APPEND IT_RETURN.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN = .

ENDLOOP.

LOOP AT IT_RETURN.

call function 'FORMAT_MESSAGE'

exporting

id = ireturn-id

lang = '-D'

no = ireturn-number

v1 = ireturn-message_v1

v2 = ireturn-message_v2

v3 = ireturn-message_v3

v4 = ireturn-message_v4

importing

msg = i_msg.

  • EXCEPTIONS

  • NOT_FOUND = 1

  • OTHERS = 2

  • .

*IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

*ENDIF.

write:/ i_msg.

ENDLOOP.

thanks

prasanna kumar

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 06:26 AM

    Hi,

    Try using this code it may help you out.....

    WA_I_SHEADERX-UPDATEFLAG = 'U'.

    WA_I_SHEADER-INCOTERMS1 = WA_IT_UPDATE-INCO1.

    wa_I_SITEMX-ITM_NUMBER = WA_IT_UPDATE-POSNR.

    wa_i_sitemx-updateflag = 'U'.

    wa_I_SITEMX-SHORT_TEXT = 'X'.

    wa_I_SITEMX-TARGET_QTY = 'X'.

    wa_I_SITEMX-PMNTTRMS = 'X'.

    wa_I_SITEMX-INCOTERMS1 = 'X'.

    wa_I_SCHDLX-UPDATEFLAG = 'U'.

    wa_i_schdlx-SCHED_LINE = wa_it_update-etenr.

    wa_I_SCHDLX-MS_DATE = 'X'.

    wa_I_SCHDLX-REQ_QTY = 'X'.

    MOVE WA_IT_UPDATE-POSNR TO WA_I_SCHDLX-ITM_NUMBER.

    APPEND WA_I_SCHDLX TO I_SCHDLX.

    MOVE WA_IT_UPDATE-POSNR TO WA_I_SCHDL-ITM_NUMBER.

    MOVE WA_IT_UPDATE-MBDAT TO WA_I_SCHDL-MS_DATE.

    move wa_it_update-etenr to wa_i_schdl-SCHED_LINE.

    MOVE WA_IT_UPDATE-KWMENG TO WA_I_SCHDL-REQ_QTY.

    MOVE WA_IT_UPDATE-VBELN TO WA_I_VBELN-VBELN.

    MOVE WA_IT_UPDATE-POSNR TO WA_I_SITEM-ITM_NUMBER.

    MOVE WA_IT_UPDATE-MATNR TO WA_I_SITEM-MATERIAL.

    MOVE WA_IT_UPDATE-ARKTX TO WA_I_SITEM-SHORT_TEXT.

    MOVE WA_IT_UPDATE-KWMENG TO WA_I_SITEM-TARGET_QTY.

    MOVE WA_IT_UPDATE-INCO1 TO WA_I_SITEM-INCOTERMS1.

    MOVE WA_IT_UPDATE-ZTERM TO WA_I_SITEM-PMNTTRMS.

    APPEND WA_I_SHEADERX TO I_SHEADERX.

    APPEND wa_I_SITEMX to i_sitemx.

    APPEND WA_I_SCHDL TO I_SCHDL.

    APPEND WA_I_SHEADER TO I_SHEADER.

    APPEND WA_I_SITEM TO I_SITEM.

    APPEND WA_I_VBELN TO I_VBELN.

    LOOP AT BA_ITAB.

    CLEAR WA_I_VBELN.

    READ TABLE I_VBELN INTO WA_I_VBELN WITH KEY

    VBELN = BA_ITAB-VBELN.

    READ TABLE I_SITEM WITH KEY

    ITM_NUMBER = BA_ITAB-POSNR.

    READ TABLE I_SITEMX WITH KEY

    ITM_NUMBER = BA_ITAB-POSNR.

    READ TABLE I_SCHDL WITH KEY

    ITM_NUMBER = BA_ITAB-POSNR.

    READ TABLE I_SCHDLX WITH KEY

    ITM_NUMBER = BA_ITAB-POSNR.

    • SCHED_LINE = BA_ITAB_EDATU.

    READ TABLE I_TEXT WITH KEY

    ITM_NUMBER = BA_ITAB-POSNR.

    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

    EXPORTING

    SALESDOCUMENT = WA_I_VBELN

    ORDER_HEADER_IN = WA_I_SHEADER

    ORDER_HEADER_INX = WA_I_SHEADERX

    • SIMULATION =

    • BEHAVE_WHEN_ERROR = ' '

    • INT_NUMBER_ASSIGNMENT = ' '

    • LOGIC_SWITCH =

  • TABLES

  • RETURN = ZRETURN

    ORDER_ITEM_IN = I_SITEM

    ORDER_ITEM_INX = I_SITEMX

    • PARTNERS =

    • PARTNERCHANGES =

    • 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 = I_SCHDL

    SCHEDULE_LINESX = I_SCHDLX

    ORDER_TEXT = I_TEXT.

    • ORDER_KEYS =

    • CONDITIONS_IN =

    • CONDITIONS_INX =

    • EXTENSIONIN =

    *

    *

    *

    • CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

    EXPORTING

    WAIT = ' '

    IMPORTING

    RETURN = ZRETURN1.

    *

    LOOP AT ZRETURN.

    MOVE WA_I_VBELN-VBELN TO WA_ZRET-VBELN.

    MOVE ZRETURN-TYPE TO WA_ZRET-TYPE.

    MOVE ZRETURN-NUMBER TO WA_ZRET-NUMBER.

    MOVE ZRETURN-MESSAGE TO WA_ZRET-MESSAGE.

    APPEND WA_ZRET TO ZRET.

    CLEAR WA_ZRET.

    ENDLOOP.

    *

    CLEAR: WA_I_VBELN, WA_I_SHEADER, WA_I_SHEADERX, I_SITEM,

    I_SITEMX, I_SCHDL, I_SCHDLX.

    *

    *

    ENDLOOP.

Add a comment
10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.