05-06-2010 3:54 PM
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
05-06-2010 4:58 PM
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
05-07-2010 11:04 AM
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
05-07-2010 11:16 AM
05-07-2010 11:37 AM
Hi Anup
I cannot use BAPI_PR_CREATE because i'm working on the Idoc PREQCR which uses BAPI_REQUIREMENT_CREATE
thx.
Regards,
Mehdi
05-06-2010 5:18 PM
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