cancel
Showing results for 
Search instead for 
Did you mean: 

Sales - Document Flow

Former Member
0 Kudos

Hi All,

I am trying to manually update the document flow on an order in a follow up function from a notification.

After the order is created I am calling BAPI_SALESORDER_CHANGE to update the flow like this:

call function 'BAPI_SALESORDER_CHANGE'
              exporting
                salesdocument    = vbak-vbeln
                order_header_inx = la_head_chg
              tables
                return           = lt_return
                order_item_in    = lt_order_item_in
                order_item_inx   = lt_order_item_inx.

            call function 'BAPI_TRANSACTION_COMMIT'
              exporting
                wait = 'X'.

            commit work and wait.

This seems to work fine and I can see the correct flow in the diagram on the order. However the table VBFA is not being updated with a corresponding entry which seems strange as I can't see any other document flow tables.

This is causing an issue where I am trying to update the profit center with a field from the flow at a later stage.

Any ideas what's happening here?

Thanks

Gregor

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member217082
Active Contributor
0 Kudos

Hi George

Also include salesdocument = vbak-vbelv under exporting and then check wheather VBFA table is getting updated or not for document flow

I have included the salesdocument = vbak-vbelv in the program and thats why i have copied your program and updated the program by including the salesdocument = vbak-vbelv , so just check this and check this updated program , wheather the VBFA table is working or not

call function 'BAPI_SALESORDER_CHANGE'

exporting

salesdocument = vbak-vbeln

salesdocument = vbak-vbelv

order_header_inx = la_head_chg

tables

return = lt_return

order_item_in = lt_order_item_in

order_item_inx = lt_order_item_inx.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'.

commit work and wait.

Regards

Srinath

Former Member
0 Kudos

Hi Srinath,

Thanks for your input but you can't specify BAPI arguments twice like this:

salesdocument = vbak-vbeln
salesdocument = vbak-vbelv

Did you mean a different field?

former_member217082
Active Contributor
0 Kudos

Hi Gregor

The VBELN feild is for subsequent document and VBELV is for preceding document.

So now as you said if we should not write both then how you will be writing , use that logic and then execute the program and then check wheather the flow is getting updated or not

Regards

Srinath

Former Member
0 Kudos

Hey Srinath,

Those document numbers are specified in the import structure order_item in:

wa_order_item_in-itm_number = la_vbap-posnr.
            wa_order_item_in-material = g_bvbapkom-matnr.
            wa_order_item_in-ref_doc = la_contract-vbeln.
            wa_order_item_in-ref_doc_it = la_contract-posnr.
*            wa_order_item_inx-profit_ctr = la_contract-vbeln.
            wa_order_item_in-ref_doc_ca = 'G'. "G = Contract

            append wa_order_item_in to lt_order_item_in.

Something weird is going on!

former_member217082
Active Contributor
0 Kudos

Hi Gregor

In the import structure order_item you have given that wa_order_item_in-ref_doc_ca = 'G'. "G = Contract, that means only the contract reference documents will be getting updated. Just include another logic telling that wa_order_item_in-ref_doc = la_contract-vbelv .After including then check wheather that table is getting updated or not

Also integrate with the ABAP consultants and then check

Regards

Srinath

Former Member
0 Kudos

Hi Srinath,

I have already included that line, it is in the previous code sample I posted.

Former Member
0 Kudos

I still don't know where it's kept but I am closing this thread.

Some info for anyone else with this problem:

-There is a FM to retreive document flow: SD_DOCUMENT_FLOW_GET

-The field XVBAP-VGBEL in the MV45AFZZ user exits contains the preceding dosument.

-SD document flow - here be dragons!