Application Development and Automation 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: 
Read only

Idoc-BAPI Commit failing in background?

vsubbakrishna
Participant
0 Kudos
524

Hi all,

To post the Incoming Idocs, I have created an Inbound FM ZIDOC_INPUT_ZSUBMIGO and inside this I am calliing another FM ZSUB_CRT_MIGO_CREATE which actually creates the Material Document and I have included "Commit" after each of the calls.

But the problem is the idoc does't create the material doc during normal flow in background, but when i process the idoc using we19 manually it is posting. I am wondering why the idoc is not creating the Material doc whenever it has been received at the receiver.Status shows 53 when received at the receiver end.

Appreciate ur inputs.

Thanks,

Subba

9 REPLIES 9
Read only

jaideepsharma
Active Contributor
0 Kudos
362

Hi,

Put a wait statement after ZSUB_CRT_MIGO_CREATE funciton module call and test again in background.

KR Jaideep,

Read only

0 Kudos
362

Hi Jai,

I tried But still it works thru we19 as before, but not automatically when the idoc arrives at destination.

This is bit strange.

Thanks,

Subba

Read only

0 Kudos
362

Hi,

Yes, it is strange. Can you please send the code snippet of both the function modules ?

KR Jaideep,

Read only

0 Kudos
362

In Function module ZIDOC_INPUT_ZSUBMIGO

CALL FUNCTION 'ZSUB_CRT_MIGO_CREATE'

EXPORTING

GOODSMVT_HEADER = GOODSMVT_HEADER

GOODSMVT_CODE = GOODSMVT_CODE

TESTRUN = TESTRUN

IMPORTING

MATERIALDOCUMENT = MATERIALDOCUMENT

MATDOCUMENTYEAR = MATDOCUMENTYEAR

TABLES

GOODSMVT_ITEM = GOODSMVT_ITEM

RETURN = RETURN

EXCEPTIONS

OTHERS = 1.

commit work.

Inside the above FM i am calling the standard FM

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

GOODSMVT_HEADER = GOODSMVT_HEADER

GOODSMVT_CODE = GOODSMVT_CODE

TESTRUN = TESTRUN

  • GOODSMVT_REF_EWM =

IMPORTING

  • GOODSMVT_HEADRET =

MATERIALDOCUMENT = MATERIALDOCUMENT

MATDOCUMENTYEAR = MATDOCUMENTYEAR

TABLES

GOODSMVT_ITEM = GOODSMVT_ITEM

  • GOODSMVT_SERIALNUMBER =

RETURN = RETURN

  • GOODSMVT_SERV_PART_DATA =

  • EXTENSIONIN =

.

commit work.

Thanks,

Subba

Read only

Sandra_Rossi
Active Contributor
0 Kudos
362

Are you sure your function module is called in background? (just add an abort message in your code to be sure)

Are you sure the control record is the same in the 2 scenarii?

How do you test with WE19, which button? (standard receipt, function module...)

Read only

0 Kudos
362

Hi Sandra,

I use "Standard inbound" in WE19 and it perfectly triggers my code pasted earlier and Material Document is successfuly posted and can be viewed in MB03 txn.

Only problem is why the posting is not happening as soon as idoc is received and is working via we19 ie manually trigger.

Thanks,

Subba

Read only

0 Kudos
362

Hi,

You may try calling CALL FUNCTION 'BAPI_TRAN.. COMMIT' starting new task 'abc'.

once your Z-Function Module call finishes.

At put a wait statement for some 4-5 seconds.

Thanks,

Preyansh

Read only

0 Kudos
362

No, I was wondering whether your function module was really triggered in "background in the normal flow" as you said ? I was thinking of control record differences, and especially distribution. Are you executing via ALE distribution, or via custom program, or something else? Is it executed under a different user?

Note that some programs may act differently when it is in background, but it's rare.

What I personally do to find out the difference between 2 runs which I presume should be identical, is to trace procedure calls using SE30 (create a variant with "no aggregation" flag checked, and display result with button "call hierarchy"). Do a visual comparison between the 2 results.

Read only

vsubbakrishna
Participant
0 Kudos
362

solved