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: 

Create Purchase Requisition

former_member1167366
Participant
0 Kudos

Hi experts,

I'd like to Create a Purchase Requisition by bapi: BAPI_REQUISITION_CREATE.

In this Purchase Requisition, i'd like to have Activity Type which is in EBKN: EBKN-LSTAR.

In the bapi, i don't find a field corresponding to LSTAR.

Any idea?

Thx.

Regards,

Mehdi

5 REPLIES 5

Former Member
0 Kudos

Hello Mehdi,

You have to fill in the table extensionin in the entry of your bapi, with the data that you did not found:

*" EXTENSIONIN STRUCTURE BAPIPAREX OPTIONAL

You have to put 'BAPI_TE_REQUISITION_ACCOUNT' into extensionin-structure.

Then in the structure BAPI_TE_REQUISITION_ACCOUNT (SE11) you have to add LSTAR.

Then you can put a break point in this Include: LMEWQF01, then you will see what system will do:

then with this instruction:

MOVE-CORRESPONDING wa_bapi_te_account TO cht_ebkn."#EC ENHOK

System will transfer data of extensionin into cht_ebkn-lstar

I hope that it was helpful for you.

Yassine NEJMY

0 Kudos

Hello Yassine,

Thx for your help.

I coud not add LSTAR in structure BAPI_TE_REQUISITION_ACCOUNT in an append which is in table EBKN, i have the error message: you cannot have 2 fields LSTAR, because LSTAR exists in table EBKN.

By creating field LSTAR in another append in structure BAPI_TE_REQUISITION_ACCOUNT, there is no mapping between LSTAR of BAPI_TE_REQUISITION_ACCOUNT and EBKN-LSTAR.

Do you have an idea?

Thx,

Regards,

Mehdi

0 Kudos

Try Using BAPI_PR_CREATE ( Enjoy Transaction...!)

Hope it helps

0 Kudos

Hi Anup

I cannot use BAPI_PR_CREATE because i'm working on the Idoc PREQCR which uses BAPI_REQUIREMENT_CREATE

thx.

Regards,

Mehdi

former_member206439
Contributor
0 Kudos

Hi Mehdi,

BAPI_REQUISITION_CREATE.

you have this user exit.

EXIT_SAPLMEWQ_001

In thgis you can populate the missing field values under extension table

extensionin            = extensionin

Sample code for extension.

DATA LT_EXTENSION TYPE TABLE OF BAPIPAREX.
DATA WA_EXTENSION LIKE LINE OF LT_EXTENSION.

  LOOP AT requisition_items INTO WA_ITEM.
    LV_COUNT = LV_COUNT + 1.
    LV_CHAR1 = LV_COUNT.
    CONCATENATE '000' LV_CHAR1 '0' INTO LV_ITEMNUMBER.
* Extensionstruktur füllen
    WA_EXTENSION-STRUCTURE = 'BAPI_TE_REQUISITION_ITEM'.
* Positionnumber (5)=00010, Fieldcontent of Zzlfdatx = X, Fieldcontent of ZZlfdat = lfdat
    WA_EXTENSION-VALUEPART1 = WA_SC_ITEM-DELIV_DATE.
    CONCATENATE LV_ITEMNUMBER  WA_SC_ITEM-DELIV_DATE INTO WA_EXTENSION-VALUEPART1 RESPECTING BLANKS.
    APPEND WA_EXTENSION TO LT_EXTENSION.
    CLEAR WA_EXTENSION.
    CS_RQ_DOCUMENT-IT_EXTENSIONIN = LT_EXTENSION.
  ENDLOOP.

let me know if there are any issues.

Thanks

Naresh