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 extention

Former Member
0 Likes
2,076

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

1 ACCEPTED SOLUTION
Read only

Private_Member_49934
Product and Topic Expert
Product and Topic Expert
0 Likes
1,573

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.

  1. Go to form pr_extensionin of the bapi ( include LMEWQF01 ). Create  implicit enhancement point implementation at the END OF FORM ( before the statement ENDFORM.  ).

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.

6 REPLIES 6
Read only

madhu_vadlamani
Active Contributor
0 Likes
1,573

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.

Read only

Private_Member_49934
Product and Topic Expert
Product and Topic Expert
0 Likes
1,574

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.

  1. Go to form pr_extensionin of the bapi ( include LMEWQF01 ). Create  implicit enhancement point implementation at the END OF FORM ( before the statement ENDFORM.  ).

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.

Read only

0 Likes
1,573

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

Read only

0 Likes
1,573

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.

Read only

0 Likes
1,573

Hi Hari,

Did yo check the indicators to update the filed.

Regards,

Madhu.

Read only

0 Likes
1,573

Hi I have checked Indicators also..

Regards

Harikrishna.G