cancel
Showing results for 
Search instead for 
Did you mean: 

Custom PO header field value is not saving in EKKO table

0 Kudos

Hi Experts,

  We are adding 2 custom header fields FIELD1(char 20) and FIELD2(description of FIELD1, char 255) to SRM PO screen. CI_EKKODB and CI_EKKODBX structures enhanced in ECC to add these fields to EKKO table. FIELD2 is getting populated in EKKO table when PO is created but FIELD1 is not getting populated.

Enhanced the inbound BADI(BBP_PO_INBOUND_BADI) in ECC (IF_EX_BBP_PO_INBOUND_BADI~BBP_MAP_BEFORE_BAPI) for populating bapi_extensionin. Populated values are reaching ECC fine and can be retrieved within this BADI, but even if we map both the fields only one field updates in EKKO.


Tried maintaining table BBP_CUFMAP in ECC for both fields but no success.

  

Accepted Solutions (0)

Answers (2)

Answers (2)

TanmayVerma
Active Participant
0 Kudos

Hi Ann,

From the issue description i can guess that the values are reaching correctly from SRM to ECC but one of the field is getting lost after that.

Is the FIELD1 a non- character field ?

How is the PO fields being updated. Is the BAPI_PO_CREATE1 / BAPI_PO_CHANGE being called ?

These BAPIs only support character type fields to be added to bapi_extensionin. Can you check if you are getting Error ME 887 in the response,

In order to map the non- character fields you will have to implement the BADI ME_BAPI_PO_CUST method map2i_extensionin in ECC.

Within the implementation you can use the below code to map the fields correctly.

METHOD if_ex_me_bapi_po_create_02~map2i_extensionin.

     DATA: ls_temp TYPE bapi_te_mepoitem.

*--perform mapping only if there is at least one packed field

     CHECK im_error EQ cl_mmpur_constants=>yes.

     CALL METHOD cl_abap_container_utilities=>read_container_c

       EXPORTING

         im_container           = im_container

       IMPORTING

         ex_value               = ls_temp

       EXCEPTIONS

         illegal_parameter_type = 1

         OTHERS                 = 2.

     IF sy-subrc EQ 0.

       MOVE-CORRESPONDING ls_temp TO ch_struc.

     ENDIF.

ENDMETHOD.



~Regards,

Tanmay.

ricardo_romeromata
Active Contributor
0 Kudos

Hi,

It's strange.

Could you share a snippet of your code in badi BBP_PO_INBOUND_BADI ?

May be there is a problem with the offsets in the extensionin structure. Do you have more custom fields in EKKO table?

0 Kudos

Hi Ricardo,

CI_EKKODB and CI_EKKODBX contains only these two custom fields

Below is the code used in the BADI

DATA: x_bapi_te_mepoheader    TYPE bapi_te_mepoheader,

       x_bapi_te_mepoheaderx   TYPE bapi_te_mepoheaderx,

       x_customer_field        TYPE bbps_if_customer_fields,

       x_customer_field1        TYPE bbps_if_customer_fields,

       x_extensionin           TYPE bapiparex.

DATA: l_txt_960(960) TYPE c.

CONSTANTS: c_poheader(8)             VALUE 'POHEADER',

            c_field1(6)          VALUE 'FIELD1',

            c_field2(6)        VALUE 'FIELD2',

            c_bapi_te_mepoheader(18VALUE 'BAPI_TE_MEPOHEADER',

            c_bapi_te_mepoheaderx(19) VALUE 'BAPI_TE_MEPOHEADERX',

            c_x                       VALUE 'X'.

MOVE bbp_poheader-po_number TO x_bapi_te_mepoheader-po_number.

MOVE bbp_poheader-po_number TO x_bapi_te_mepoheaderx-po_number.

CLEAR  x_customer_field1.

READ TABLE bbp_customer_fields INTO x_customer_field1

                  WITH KEY refobject = 'POHEADER'

                           fieldname = 'FIELD2'.

READ TABLE bbp_customer_fields INTO x_customer_field

                    WITH KEY refobject = 'POHEADER'

                             fieldname 'FIELD1'.

IF sy-subrc EQ 0.

   MOVE x_customer_field-container TO

   x_bapi_te_mepoheader-field1.

   x_bapi_te_mepoheaderx-field1 = 'X'.

   IF x_customer_field1 IS NOT INITIAL.

     MOVE x_customer_field1-container TO

   x_bapi_te_mepoheader-field2.

     x_bapi_te_mepoheaderx-field2 = 'X'.

   ENDIF.

ENDIF.

CLEARx_extensionin,l_txt_960.

WRITE x_bapi_te_mepoheader TO l_txt_960 LEFT-JUSTIFIED.

x_extensionin-structure = 'BAPI_TE_MEPOHEADER'.

x_extensionin-valuepart1 = l_txt_960(240).

x_extensionin-valuepart2 = l_txt_960+240(240).

APPEND x_extensionin TO bapi_extensionin.

CLEARx_extensionin,l_txt_960.

WRITE x_bapi_te_mepoheaderx TO l_txt_960 LEFT-JUSTIFIED.

x_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.

x_extensionin-valuepart1 = l_txt_960(240).

x_extensionin-valuepart2 = l_txt_960+240(240).

APPEND x_extensionin TO bapi_extensionin.



When we added one more dummy field to EKKO table(similar to FIELD1) and populated the value of FIELD1 to it,we are able to see the value in EKKO . But same thing doesn't work with our original field1.

ricardo_romeromata
Active Contributor
0 Kudos

It seems that is ok although the code is a bit messy...

Have you check if the EXTENSIONIN table is empty? may be you don't need to do an append but a modify.

Try with this code.


Check after the excution the table EXTENSIONIN is filled correctly.


DATA:

     ls_extensionin             TYPE bapiparex.

FIELD-SYMBOLS:

     <ls_bapi_te_mepoheader>    TYPE bapi_te_mepoheader,

     <ls_bapi_te_mepoheaderx>   TYPE bapi_te_mepoheaderx.

CLEAR ls_extensionin.

ls_extensionin-structure = 'BAPI_TE_MEPOHEADER'.

ASSIGN ls_extensionin+30(960) TO <ls_bapi_te_mepoheader> CASTING.

IF sy-subrc EQ 0.

   READ TABLE bbp_customer_fields INTO ls_customer_fields WITH KEY fieldname = 'FIELD1'

                                                                   refobject = 'POHEADER'.

   IF sy-subrc EQ 0.

     <ls_bapi_te_mepoheader>-field1 = ls_customer_fields-container.

     READ TABLE bbp_customer_fields INTO ls_customer_fields WITH KEY fieldname = 'FIELD2'

                                                                     refobject = 'POHEADER'.

     IF sy-subrc EQ 0.

       <ls_bapi_te_mepoheader>-field2 = ls_customer_fields-container.

     ENDIF.

     APPEND ls_extensionin TO bapi_extensionin.

     CLEAR ls_extensionin.

     ls_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.

     ASSIGN ls_extensionin+30(960) TO <ls_bapi_te_mepoheaderx> CASTING.

     IF sy-subrc EQ 0.

       <ls_bapi_te_mepoheadersx>-field1 = abap_true.

       <ls_bapi_te_mepoheadersx>-field2 = abap_true.

       APPEND ls_extensionin TO bapi_extensionin.

     ENDIF.

   ENDIF.

ENDIF.

priyaranjan_gupta
Participant
0 Kudos

Hi Ricardo,

Thanks for the response. What we have noticed, custom fields are already available in  bapi_extensionin.

So , code to append or modify is removed.

Still only description is getting populated not the other field.