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

Problem in BAPI_PO_CREATE1

Former Member
0 Likes
1,410

Hello All,

My requirement is to create an ARIBA PO thru BAPI_PO_CREATE1. IN order to successfully process an ARIBA PO, i need to check the gl account and cost center used. If the first two letter of the cost center is equal to 'BS', then I need to issue out an error message. I have successfully done the checking of the cost center via user exit ZXMEWU10. But my problem is, how do I prevent the creation of PO if there is an error message? It seems that the function module does not recognized that there is an error encountered and PO is still created.

Please advice.

Thanks,

Jim

8 REPLIES 8
Read only

Former Member
0 Likes
1,006

Check for RETURN in tables parameters.Internal table which gets filled when error occurs.

If not return[] is initial.

BAPI Commit.

Else.

Exit.

Endif.

-Mohan.

***Reward if useful.

Read only

Former Member
0 Likes
1,006

Hi Jim ,

BAPI will take care of Validations which comes while creation of PO, In ur case make use the point where SAP will calls this User Exit.BAPI will return message thru RETURN tables And u have to call COmmit work based on the return tables

like tghis.

<b>    return                    = l_return.--> this is BAPI table entry
if l_return[] is initial.
    call function 'BAPI_TRANSACTION_COMMIT'
*     EXPORTING
*       WAIT          =
*     IMPORTING
*       RETURN        =
      .
endif.</b>

regards

Prabhu

Read only

Former Member
0 Likes
1,006

Hello,

I checked the return table w_bapireturn[] and the error that I raised is not included there. Please advice on how to proceed.

Thanks,

Jim

Read only

Former Member
0 Likes
1,006

Hi Jim,

Just check for the Internal table , if it is not initial and has some values then there is some error with the parameters you passed into that Function Module.

The return parameter is getting filled by SAP system itself, we cannot pass the error message into that.

Regards,

Mohan

Read only

Former Member
0 Likes
1,006

hi

good

go through this l ink, i hope this ll help you to solve your problem

http://help.sap.com/saphelp_srm30/helpdata/en/0a/baf73a93ad9179e10000000a114084/content.htm

thanks

mrutyun^

Read only

Former Member
0 Likes
1,006

HI Jim

With the info you have provided, i guess the code in the user-exit is not enabled or reached while processing via BAPI.

Please place a break-point in user-exit and check to re-confirm on the same.

If itz not reached, i guess you have to either change to a different exit or do the same validation while using the BAPI.

Kind Regards

Eswar

Read only

Former Member
0 Likes
1,006

Hi Mohan,

The return internal table not only contains the error messages, but also some status or warning messages encountered by the system. What i can;t figure out is that i raised an error message but it was not recognized by the system.

Thanks,

Jim

Read only

Former Member
0 Likes
1,006

Hi Jim,

Here, I would suggest the same which I said earlier as follows,

If not return[] is initial.

BAPI Commit.

Else.

      • here you put your error message ****

Endif.

Regards,

Mohan.