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: 

Change sales order values from Inbound Idoc

Former Member
0 Kudos

Hi all,

In my scenario i have to change sales document automatically(Workflow) by getting the values from the inbound idoc ordchg (one more thing i dont want to create another sales document). Is there is any function module? please tell me how to do this.

Regards,

Adithan S.

3 REPLIES 3

Former Member
0 Kudos

Hi Adithan;

You can read the IDoc information using the function IDOC_READ_COMPLETELY as demonstrated in the example below:

DATA: int_edidd TYPE STANDARD TABLE OF edidd WITH HEADER LINE,
       wf_docnum type edidc-docnum.

MOVE: 'IDOC_NUMBER' to wf_docnum.

CLEAR int_edidd.
REFRESH int_edidd.
CALL FUNCTION 'IDOC_READ_COMPLETELY'
     EXPORTING
          document_number         = wf_docnum
     TABLES
          int_edidd               = int_edidd
     EXCEPTIONS
           document_not_exist      = 1
           document_number_invalid = 2
           OTHERS                  = 3.

After that call, you can loop through int_edidd to get at the segment information you need.

You can update the sales order using BAPI_SALESORDER_CHANGE. Below is an example of updating line 10 of a sales order with a new material number.

DATA: l_vbeln LIKE bapivbeln-vbeln,
      so_headx TYPE bapisdh1x,
      change_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
      so_item_in TYPE bapisditm OCCURS 0 WITH HEADER LINE,
      so_item_inx TYPE bapisditmx OCCURS 0 WITH HEADER LINE.

MOVE 'U' TO so_headx-updateflag.

MOVE <insert sales order number here> to l_vbeln.

MOVE:  '00010' TO so_item_in-itm_number,
       'MATERIAL_NUMBER' TO so_item_in-material.
APPEND so_item_in.

MOVE: '00010' TO so_item_inx-itm_number,
      'U' TO so_item_inx-updateflag,
      'X' TO so_item_inx-material.
APPEND so_item_inx.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
     EXPORTING
          salesdocument    = l_vbeln
          order_header_inx = so_headx
     TABLES
          return           = change_return
          order_item_in    = so_item_in
          order_item_inx   = so_item_inx.

Cheers,

John

Former Member
0 Kudos

Hi!

For inbound ORDCHG there is standard process code ORDC, which is based on FM IDOC_INPUT_ORDCHG - you can try this one and see whether custom enhancements needed.

Do you mean you have to set up workflow-based error handling? If so, check standard tasks using SWU0 for object type IDOCORDCHG and event inputErrorOccurred (those specified in process code ORDC settings) and proceed with following workflow settings (event linkage activation and so on using PFTC).

Regards,

Maxim.

Regards,

Maxim.

Former Member
0 Kudos

Hi Adithan ,

I m also working on same scenario,and very new to workflow so can you plz help me with this.

As per the initial analysis :

1.The Customer sends in a Sales Order Change Request (860) Idoc.

2.As Idoc comes in, a Function Module will be called for Sales Order Change.

3.In this FM (IDOC_INPUT_ORDCHG) we will find the user exit to trigger a workflow.

4.This workflow will send a mail to responsible agent saying this SO# and material# needs to be changed, this mail will provide the agent with decision making to accept or reject the change.

5.If agent accepts the changes, Sales order will change automatically .

Is my understanding right .Can u plz guide me with this workflow .

Thanks,

Yatin .