04-10-2012 5:35 PM
Hi Experts,
I am using bapi 'bapi_requisition_create'. i need to populate value to RESLO field through this bapi which is available in EBAN table. but this field not available in BAPIEBANC Structure.
Can anyone let me how to go with this.
please let me know enhancement name if we need to go with enhancement.
Thanks & Regards,
Harikrishna.G
04-11-2012 8:50 AM
In the BAPI BAPI_REQUISITION_CREATE only two standard extension structure are possible BAPI_TE_REQUISITION_ACCOUNT and BAPI_TE_REQUISITION_ITEM (for EBAN). You can check the form pr_extensionin called in the BAPI where the logic is written. But these will be used only if NEW Z-FIELDS are added to the table because the CI include structure CI_EBANDB is also included in EBAN.
In one line YOU CANNOT USE THE ABOVE extension directly.
WORKAROUND :-
This should work
1) Create a zstructure say ZMYSTRUCT with the following fields
PREQ_ITEM BNFPO
RESLO RESLO
2) Populate the extension table while calling bapi similar to the below code
L_wa_ZMYSTRUCT-PREQ_ITEM = ‘001’. “ Your item number
L_wa_ZMYSTRUCT-reslo = ‘0001’ . “your storage location.
BAPIPAREX-STRUCTURE = ‘ZMYSTRUCT’. “ Any unique name
BAPIPAREX-VALUEPART1 = L_wa_ZMYSTRUCT.
Put the following code
Data : L_wa_ZMYSTRUCT type ZMYSTRUCT.
LOOP AT extensionin.
CASE extensionin-structure.*
WHEN 'ZMYSTRUCT'.
L_wa_ZMYSTRUCT = extensionin-VALUEPART1.
READ TABLE cht_eban
WITH KEY bnfpo = L_wa_ZMYSTRUCT-preq_item.
IF sy-subrc IS INITIAL.
CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.
MOVE-CORRESPONDING
L_wa_ZMYSTRUCT TO cht_eban. "#EC ENHOK
ENDCATCH.
IF sy-subrc IS INITIAL.
MODIFY cht_eban INDEX sy-tabix.
ELSE.
parameter = 'BAPI_TE_REQUISITION_ITEM'.
row = wa_bapi_te_item-preq_item.
PERFORM fill_bapireturn TABLES cht_return
USING 'E'
'W5'
'061'
'ZMYSTRUCT'
space
space
space.
ENDIF.
ENDIF.
ENDCASE.
ENDLOOP.
04-11-2012 5:08 AM
Hi Harish,
Please check with your functional team why Iss. Stor. Loc is not existed in purchase requisition.Check with them and post.Append the fields in CI_EBANDB and see part of a MEREQ001.
Regards,
Madhu.
04-11-2012 8:50 AM
In the BAPI BAPI_REQUISITION_CREATE only two standard extension structure are possible BAPI_TE_REQUISITION_ACCOUNT and BAPI_TE_REQUISITION_ITEM (for EBAN). You can check the form pr_extensionin called in the BAPI where the logic is written. But these will be used only if NEW Z-FIELDS are added to the table because the CI include structure CI_EBANDB is also included in EBAN.
In one line YOU CANNOT USE THE ABOVE extension directly.
WORKAROUND :-
This should work
1) Create a zstructure say ZMYSTRUCT with the following fields
PREQ_ITEM BNFPO
RESLO RESLO
2) Populate the extension table while calling bapi similar to the below code
L_wa_ZMYSTRUCT-PREQ_ITEM = ‘001’. “ Your item number
L_wa_ZMYSTRUCT-reslo = ‘0001’ . “your storage location.
BAPIPAREX-STRUCTURE = ‘ZMYSTRUCT’. “ Any unique name
BAPIPAREX-VALUEPART1 = L_wa_ZMYSTRUCT.
Put the following code
Data : L_wa_ZMYSTRUCT type ZMYSTRUCT.
LOOP AT extensionin.
CASE extensionin-structure.*
WHEN 'ZMYSTRUCT'.
L_wa_ZMYSTRUCT = extensionin-VALUEPART1.
READ TABLE cht_eban
WITH KEY bnfpo = L_wa_ZMYSTRUCT-preq_item.
IF sy-subrc IS INITIAL.
CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.
MOVE-CORRESPONDING
L_wa_ZMYSTRUCT TO cht_eban. "#EC ENHOK
ENDCATCH.
IF sy-subrc IS INITIAL.
MODIFY cht_eban INDEX sy-tabix.
ELSE.
parameter = 'BAPI_TE_REQUISITION_ITEM'.
row = wa_bapi_te_item-preq_item.
PERFORM fill_bapireturn TABLES cht_return
USING 'E'
'W5'
'061'
'ZMYSTRUCT'
space
space
space.
ENDIF.
ENDIF.
ENDCASE.
ENDLOOP.
04-13-2012 4:16 PM
Hi Kumar ..Excellent ..Code is working now..thnx
I need some more help.
I am using BAPI_REQUISITION_CHANGE for change PR. As in previoue case RESLO field is not available in this and Extensionin is also not available. I tried with BAPI_PR_CREATE also, but it is not updating. Please give me a good suggestion as you did previously.
Thanks in Advance.
Harikrishna
04-13-2012 4:28 PM
Great to know that it works
I am not sure if I can help on the second one.
I would suggest please mark the correct answer close the thread and start a new one. Let's see if we can do anythig there.
04-16-2012 3:20 AM
Hi Hari,
Did yo check the indicators to update the filed.
Regards,
Madhu.
04-16-2012 7:39 AM