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

Test BAPI + real post?

Former Member
0 Likes
2,411

Dear all,

How can I test a BAPI & get an actual result in the table?

Now, when I test a BAPI, the only result that I get is the line: "Document posted successfully ...", but I want to check if all the needed information is written down into the table.

Now I do my testing via SE37 + enter BAPI name + hit the F8 button. I've read on a website or in a help document, that for actual postings, you have to do "commit" or sth, but that's all I could find. Don't know how or where.

Anyone in here knows how I can get a result in the table, make an actual posting via a BAPI?

Thanks,

Kr

13 REPLIES 13
Read only

FredericGirod
Active Contributor
0 Likes
1,961

Hi,

when you would like to test a BAPI in SE37, you have to use in the menu the option : test sequence (SHIFT + F8).

Set in the first line your BAPI and in the second line the BAPI :BAPI_TRANSACTION_COMMIT.

That will save all your data like a real use of the BAPI.

Rgd

Frédéric

Read only

Former Member
0 Likes
1,961

Hi,

if it is from SE37, then you should run test sequence.

frist from menu function module-> test->test sequence

one popup comes there enter your BAPI first, then enter BAPI_TRANSACTION_COMMIT then say ok, and then Run the FM .

Regards

vijay

Read only

0 Likes
1,961

Thanks for you reply, it helped. It worked 1 time, but now I can't get it to work again :s

When I run the BAPI_TRANSACTIO_COMMIT, the return result just says:

Export parameters Value

RETURN 000

Read only

0 Likes
1,961

Hi,

If you are testing in se37 using test sequences, then immediately after the execution of the bapi, you would get the message that the doc has been created.

Then the bapi_transaction_commit will be executed which will return a table which has the same name 'result' but it doesn't have the document number.

Regards,

Ravi

Read only

0 Likes
1,961

Hi Boiler,

Is the document created or not. and try to write the code and see the effect how it is doing for return table parameter.

from SE37 that is how you need to Test the BAPI's.

Regards

vijay

Read only

0 Likes
1,961

Hi all,

The document is not created. It only worked once & then I got also some feedback after the BAPI_TRANSACTION_COMMIT had run. Now I check in the table, but no new documents were posted..

I can write the statement "commit work" in the ABAP code, but since I'm not a programmer, I don't know where to write that.

There is a difference between the BAPI COMMIT & the statement commit work: the bapi is for external, could that make any difference?

the object type I use is BKPFF, that should be alright, since the TTYP table says that this is a direct Acc document posting.

Read only

0 Likes
1,961

what is the BAPI you are using,,,

Regards

vijay

Read only

0 Likes
1,961

I use the BAPI's:

BAPI_ACC_INVOICE_RECEIPT_POST

BAPI_ACC_DOCUMENT_POST (for G/L postings) -> this one worked for 2 times.

OBJ_TYPE: I use BKPFF.

Could it have sth to do with the WAIT value I have to fill in before the COMMIT BAPI runs?

Message was edited by: Boiler

Read only

0 Likes
1,961

Allrigth guys,

You were all correct!

The problem is that using the BAPI seems to give in the document number as a TEXT.

So when I want to look at the BSEG table and enter a range: 51400000 until 51400020, the newly created documents will not be shown. Only the ones created "online" via FB60 in SAP. So that's why I could not see them & though they were not created....

When I enter a range like I would be doing for text: 514* then my newly created documents show up!! This means troubles! Anyone would know how to solve this??

Read only

0 Likes
1,961

Hi,

so you mean to say it is working. and where you are looking for docment (in BSEG table) try to give <b>0051400000</b>

since it is associated with converison routine.

Regards

vijay

Read only

0 Likes
1,961

I tried to enter with preceeding 0's, but the I click the "process" button or when I go to another line, the 0's are taken away by the system. So in my entry it is seen as numbers, but when it posts, it appears as text.

This is for the BAPI BAPI_ACC_INVOICE_RECEIPT_POST.

Could this be a bug?

Read only

0 Likes
1,961

This message was moderated.

Read only

Former Member
0 Likes
1,961

Hi Kr,

Generally we call BAPI inside abap program. Most of the Bapi's need explicit Commit work to commit data in database tables. That means you should commit work after calling bapis in program.

ABAP statment to commit work is " Commit Work"..

OR

call Bapi "BAPI_TRANSACTION_COMMIT"..

OR

if you want to test it using SE37 as Vijay / Frédéric has suggested you can set in the first line your BAPI and in the second line the BAPI :BAPI_TRANSACTION_COMMIT.

Hope this will answer your question.

Cheers,

Nilesh