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

BAPI BAPI_PR_CREATE Error : Enter G/L Account...

Former Member
0 Likes
2,238

Hieee...

I have used the BAPI function on BAPI_PR_CREATE to do PR conversion.

I have assigned the values to praccount and praccountx. However, I got return errors like :

Enter G/L Account.

Enter Cost Center.

etc...

I debugged in the BAPI_PR_CREATE, the statement failed at this line:

lr_bapi->set_account( im_account = praccount[] im_accountx   = praccountx[] ).

Then, I further debugged into this line of code, in the method set_account:


  METHOD set_account.
    my_bapi_account = im_account.
    my_bapi_accountx = im_accountx.
    SORT: my_bapi_account BY preq_item serial_no,
          my_bapi_accountx BY preq_item serial_no.
    CHECK me->my_actyp EQ if_bapi_mereq~ver.
    LOOP AT me->my_bapi_account ASSIGNING <new>.
      AT NEW preq_item.
        CALL METHOD me->check_bnfpo( <new> ).
      ENDAT.
    ENDLOOP.
  ENDMETHOD.  

I found out that this line of code is always failed and thus exiting the method.

 CHECK me->my_actyp EQ if_bapi_mereq~ver. 

The 'if_bapi_mereq~ver' is always having the value 'V', while the 'me->my_actyp' is always having the value 'H' (when it first called in the standard function in BAPI function BAPI_PR_CREATE).


CREATE OBJECT lr_bapi EXPORTING im_preq_no = prheader-preq_no
                                  im_actyp   = if_bapi_mereq=>hin
                                  im_testrun = testrun.

I am not sure if this part is the part which went wrong. But, apparently, the account assignment values are passing properly, it is just until this part and then going back to the

BAPI function BAPI_PR_CREATE, the 'MY_BAPI_ACCOUNT' is not having any value.

Has anyone experienced this kind of error before? Please share how you solve the problem if you have faced before.

Thank you.

3 REPLIES 3
Read only

Former Member
0 Likes
879

Hi

I hope you are passing item number to

PREQ_ITEM in both PRACCOUNT and PRACCOUNTX

Regards

Madhan D

Read only

0 Likes
879

Yup, I passed the item number already and populated the praccountx. But it's still not populating the data.

Thanks.

Read only

Former Member
0 Likes
879

Hi

What is the version of SAP you are using

If your R/3 release is lower than ERP 2005, SAP is recommending not to use BAPI_PR_CREATE.

Refer to OSS note - Note 565099 - New BAPIs for the purchase requisition object (BUS2105)

Try to use BAPI_REQUISITION_CREATE

Regards

Madhan D