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: 

Unable to update EKET custom field using BAPT_PO_CHANGE

Former Member
0 Kudos

Hello Everyone,

I am unable to update EKET custom field data using BAPI_PO_CHANGE.

below is my code (can anyone let me know where am I going wrong , the same bapi (BAPI_PO_CHANGE) is working fine for update custom field data for EKPO but it is not working for EKET , please let me know the issue)

    str_schedule-po_item = str_schedulex-po_item = wa_sto_sch-ebelp.

     str_schedule-SCHED_LINE = str_schedulex-SCHED_LINE = wa_sto_sch-etenr.

     APPEND str_schedule  TO lt_schedule.

     APPEND str_schedulex TO lt_schedulex.

*------------------------*

*-New Z-fields in EKPO  -*

*------------------------*

     str_BAPI_TE_MEPOSCHEDULEX-EBELP_KEY          = wa_sto_sch-ebelp.

     str_BAPI_TE_MEPOSCHEDULEX-ETENR_KEY          = wa_sto_sch-etenr.

     str_BAPI_TE_MEPOSCHEDULEX-ZZSENT_TO_OTM      = 'X'.

*   str_BAPI_TE_MEPOSCHEDULE-EBeln                = ekpo-ebeln.

     str_BAPI_TE_MEPOSCHEDULE-EBELP               = wa_sto_sch-ebelp.

     str_BAPI_TE_MEPOSCHEDULE-ETENR               = wa_sto_sch-etenr.

     if wa_sto_sch-lpein = 'X'.

     str_BAPI_TE_MEPOSCHEDULE-ZZSENT_TO_OTM       = 'R'.

     elseif

     str_BAPI_TE_MEPOSCHEDULE-ZZSENT_TO_OTM       = 'W'.

     endif.

     str_extensionin-structure        = 'BAPI_TE_MEPOSCHEDULE'.

     str_extensionin-valuepart1       = str_BAPI_TE_MEPOSCHEDULE.

     APPEND str_extensionin TO lt_extensionin.

     str_extensionin-structure        = 'BAPI_TE_MEPOSCHEDULEX'.

     str_extensionin-valuepart1       = str_bapi_te_MEPOSCHEDULEx.

     APPEND str_extensionin TO lt_extensionin.

endloop.

     CALL FUNCTION 'BAPI_PO_CHANGE'

       EXPORTING

         purchaseorder                = ekpo-ebeln

       TABLES

        RETURN                       = i_return1

        POSCHEDULE                   = lt_schedule

        POSCHEDULEX                  = lt_schedulex

        EXTENSIONIN                  = lt_extensionin.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

       EXPORTING

         wait = 'X'.

If any one has updated the EKET custom field using any other BAPI or by any other method please mention the same.

Thanks in Advance.

Regards,

Aniket Kumar

8 REPLIES 8

SimoneMilesi
Active Contributor
0 Kudos

As per general rules, custom fields on standard table should be managed via EXTENSIONING table.

Problem: for EKET Table we do not have any extensionin available in BAPI_PO_CHANGE, just these.

0 Kudos

Hi Simone,

Thanks for your instant reply.

can you tell me if I have to update EKET custom field data , how can I do it.

Regards,

Aniket

0 Kudos

In my opinion you cannot update custom fields on schedule table using this bapi.

Former Member
0 Kudos

Hi

The version of BAPI_PO_CHANGE (in my system) doesn't support the extension for schedule data, but only for header, item and accounting

Max

0 Kudos

Thanks for your instant reply max .

Can you tell me how to update EKET custom field data

Regards,

Aniket

0 Kudos

Hello Aniket ,

I had uploaded EKPO extension field using the  BAPI_PO_CHANGE with same procedure, I never tried with Schedule Line .

What is Return message table i_return1 you are getting in the Function Module ???

I am not sure it will work or not but i m giving help you on trial and error method.

Try make this internal table lt_schedule and lt_schedulex as empty and try it once.

0 Kudos

Hi Madhu,

The 'I_return1'  table used to return with 'No data has been changed' .

you want me to clear lt_schedule and lt_schedulex , but i don't think it will help me because in those table i am passing the ebelp(item no.) and etenr (schedule line ) , corresponding to which i have to update the z-field .

i have done same for EKPO table and its working fine below is the code (just to compare)

CLEAR: lt_item[], lt_itemx[], lt_extensionin[].

     str_item-po_item = str_itemx-po_item = ekpo-ebelp.

     APPEND str_item  TO lt_item.

     APPEND str_itemx TO lt_itemx.

*------------------------*

*-New Z-fields in EKPO  -*

*------------------------*

     str_bapi_te_mepoitemx-po_item         = ekpo-ebelp.

     str_bapi_te_mepoitemx-zzdest_wellsite   = 'X'.

     str_bapi_te_mepoitemx-zzkostl_tms       = 'X'.

     str_bapi_te_mepoitem-po_item          = ekpo-ebelp.

     str_bapi_te_mepoitem-zzdest_wellsite  = ekpo-zzdest_wellsite.

     str_bapi_te_mepoitem-zzkostl_tms      = ekpo-zzkostl_tms .

     str_extensionin-structure        = 'BAPI_TE_MEPOITEM'.

     str_extensionin-valuepart1       = str_bapi_te_mepoitem.

     APPEND str_extensionin TO lt_extensionin.

     str_extensionin-structure        = 'BAPI_TE_MEPOITEMX'.

     str_extensionin-valuepart1       = str_bapi_te_mepoitemx.

     APPEND str_extensionin TO lt_extensionin.

     CALL FUNCTION 'BAPI_PO_CHANGE'

       EXPORTING

         purchaseorder = ekpo-ebeln

       TABLES

         return        = i_return

         poitem        = lt_item

         poitemx       = lt_itemx

         extensionin   = lt_extensionin.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

       EXPORTING

         wait = 'X'.

Regards,

Aniket

0 Kudos

Hi

You can try to use the BADI  ME_BAPI_PO_CUST, method INBOUND

Max