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: 

How to get the number of created document?

Former Member
0 Kudos
688

Hi all,

My first program in ABAP works very well. Thanks to all who helped me

I would like only one function to it.

The program read data from excel file and generates document using BDC.

I use this statement:

call transaction 'F-65' using bdcdatafile

I count the number of documents which have been generated or refeused because of error using the sy-subrc function.

if sy-subrc <> 0.

counter for errors

else.

counter for generated documents

endif.

Finally program displays these number on the last screen and the user knows if there everything is ok. For example this is a sample screen:

-


1. OK.

2. OK.

3. Error.

Number of imported documents (2)

Errors (1)

-


However, I would like to add one information to these screen. If the document is saved it gets its own number.

Is any possibility to get this number for displaying?

Maybe there is a function which returns this number.

I want to get the scren like this:

1. OK. Document No. 10000001

2. OK. Document No. 10000002

3. Error

Best regards

Arek

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
265

The document number should be being passed back via a message. You need to specifiy to return any messages in the messtab when calling the transaction.



DATA: MESSTAB type table of BDCMSGCOLL WITH HEADER LINE.



call transaction 'F-65' using bdcdatafile
                        messages into messtab.

Messtab will have the messages after the call, you can then read this internal table and check for the success message, usually the document number is in the first variable field, MSGV1.

Regards,

Rich Heilman

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
266

The document number should be being passed back via a message. You need to specifiy to return any messages in the messtab when calling the transaction.



DATA: MESSTAB type table of BDCMSGCOLL WITH HEADER LINE.



call transaction 'F-65' using bdcdatafile
                        messages into messtab.

Messtab will have the messages after the call, you can then read this internal table and check for the success message, usually the document number is in the first variable field, MSGV1.

Regards,

Rich Heilman

Former Member
0 Kudos
265

thx a lot. It works