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: 

Get OT immediatly after processing bapi BAPI_REPMANCONF1_CREATE_MTS

jgaia
Explorer
0 Kudos

Hi All

The requirement is to develop a custom program that after runs BAPI_REPMANCONF1_CREATE_MTS and BAPI_TRANSACTION_COMMIT exporting wait = 'X'....

At the same program I need to obtain the OT number. The problem is that although everthing runs OK - I can see OT at LB03 transaction after the end of the program - I can't obtain the OT number at runtime.

I tried:

- BAPI_TRANSACTION_COMMIT exporting WAIT = 'X' ;

- wait up to '5' seconds

- do ... enddo

- commit work and wait

but nothing is working.

If I stop the program and debug it, then my SELECT to obtain the OT number, runs OK.

Probably there is a delay between the creation of the OT and the end of the program.

Could you help me?

Thanks in advance

Joao Gaia

3 REPLIES 3

joo_gaia
Explorer
0 Kudos

Let me clarify the problem:


.

.

.

set update local

call function 'BAPI_REPMANCONF1_CREATE_MTS'

.

.

.

if ( t_return-type eq 'S' ) or (t_return-type eq ' ')

commit work and wait

.

.

.

do.....

select single b~tanum

into ot

from mseg as a inner join ltbp as b on

a~lgnum eq b~lgnum and

a~tbnum eq b~tbnum and
a~tbpos  eq b~tbpos

where a~mblnr = belnr.

if sy-subrc eq 0.

  exit.

else.

  wait up to 3 seconds.

endif.

enddo.

The issue is that I am not getting the Transfer Order Number at runtime. I need to show the TO before the end of the report.

Could you please help me?

Thanks in advance.

Joao Gaia

Caetano
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi João

The OT creation is called in the update process, after the confirmation. That means, it happens after the BAPI commit.

Do you get the number when your are running the loop and waiting for 3 seconds?

BR
Caetano

0 Kudos

Hi Caetano

Thank you for your response.

If I debug the program I can see that the select statment is OK - I get the OT number.

But the strange thing is that when I run the program (in fact an  "Z"  RFC ) , I can't get the OT number and the WAIT instruction is not working. But after the end of the program, I can see the OT number OK in the transaction LB03.

Could you please advise?

Thank you!

Joao Gaia