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: 

Planned Indpendent Requirement BAPI question...

Former Member
0 Kudos

Hi all,

I have created a program that will load PIRs from a file using the PIR BAPI. When I execute MS04 I found that the loaded PIRs are not associated with a program. So, I went back to MD61 and discovered that on the second screen of the transaction you can click the header link and enter a 'Q' under account assignment. When you click enter a subscreen opens that allows you to enter a WBS that represents a program. How do I accomplish the same via the BAPI. Thanks in advance.

Mat

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Mathew,

Try the following code in include 'ZX60EU01':

data:

l_matnr type pbpt-matnr,

l_posnr type pbpt-posnr,

l_werks type pbpt-werks.

l_matnr = fxpbpt-matnr.

l_posnr = fxpbpt-posnr.

l_werks = fxpbpt-werks.

fxpbpt-knttp = 'Q'.

modify fxpbpt

transporting knttp

where posnr = l_posnr

and matnr = l_matnr

and werks = l_werks.

7 REPLIES 7

Former Member
0 Kudos

Hi,

I doubt you would be able to pass the account assignment or the WBS as the BAPI parameters for PIR BAPI.

There is a function-exit which is inside this BAPI, which you can specifically use to populate the account assignment and WBS.

Inside the BAPI 'BAPI_REQUIREMENTS_CREATE', there is a function module 'REQUIREMENTS_MAINTAIN' at line no. 96.

Inside this function module 'REQUIREMENTS_MAINTAIN', there is a subroutine call 'PERFORM USER_EXIT_001 TABLES EPBPT EPBET' at line no. 75 which contains the customer function.

Inside this customer function 'CUSTOMER-FUNCTION '001'' you could populate the 'PBPT-KNTTP' for account assignment and 'PBPT-PSPEL' for the WBS.

Regards,

Sathish

Message was edited by: Sathish Poomelil

0 Kudos

Sathish,

Great tip! I've thoroughly investigated the code as per your suggestion. I notice that any value I set in the customer function 001 appears to be lost as soon as control is returned to the REQUIREMENTS_MAINTAIN function module. For instance...if I do a simple assignment of a value to PBPT-KNTTP the field is reset to NULL. How do I overcome this issue?

Mat

0 Kudos

Hi Mathew,

After assigning the value to KNTTP, did you modify the internal table?

**-assign value

fdpbpt-knttp = 'Q'.

**-Modify internal table

modify fdpbpt transporting knttp.

0 Kudos

Satish,

I've also discovered that I have to add the KNTTP field to BAPISITEMR and then pass it as an optional parameter in the BAPI. That is the only way the field is recognized and the code will execute.

regards,

Mat

0 Kudos

Satish,

The modify causes a dump...stating there is no cursor available to perform the create, change or delete.

regards,

Mat

Former Member
0 Kudos

Hi Mathew,

Try the following code in include 'ZX60EU01':

data:

l_matnr type pbpt-matnr,

l_posnr type pbpt-posnr,

l_werks type pbpt-werks.

l_matnr = fxpbpt-matnr.

l_posnr = fxpbpt-posnr.

l_werks = fxpbpt-werks.

fxpbpt-knttp = 'Q'.

modify fxpbpt

transporting knttp

where posnr = l_posnr

and matnr = l_matnr

and werks = l_werks.

0 Kudos

Satish,

mgmnt will not allow me to do the modify in the user exit. i decided to create a z_bapi. i've added the necessary fields to the struct and changed the code in the bapi to include my fields in the create / change of the modified bapi. This will mean extra work to review bapi on SAP version upgrade but it appears to be a graceful solution to my problem. Thanks much for your help.

regards,

Mat