Skip to Content
avatar image
Former Member

BAPI_PO_CHANGE custom field does not updated

Hi Experts,

I have to populate the custom fields via BAPI 'BAPI_PO_CHANGE' but the custom fields did not update.

I refered below thread..

populate custom fields in EKPO using Bapi_po_change

I have included custom fields in both custom structures CI_EKPODB and CI_EKPODBX after that I followed the sample code from above thread. Please advise me, what Iu2019m missed?

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 12, 2011 at 07:38 AM

    Hi,

    Since you extended the stucture CI_EKPODB, hope you want to update the item table(EKPO).

    DATA: WA_BAPI_POITEM like BAPI_TE_MEPOITEM,

    WA_BAPI_POITEMX like BAPI_TE_MEPOITEMX,

    IT_EXTENSIONIN type standard table of BAPIPAREX,

    WA_EXTENSIONIN type BAPIPAREX.

    WA_BAPI_POITEM-PO_ITEM = V_EBELP. " item no

    WA_BAPI_POITEM-ZZ_Field1= '0001'.

    WA_BAPI_POITEM-ZZ_Field2= 'ABCD'.

    WA_BAPI_POITEMX-PO_ITEM = V_EBELP. " same item no

    WA_BAPI_POITEMX-ZZ_Field1= 'X'.

    WA_BAPI_POITEMX-ZZ_Field1= 'X'.

    *Appending to extensionin table

    WA_EXTENSIONIN-STRUCTURE = 'BAPI_TE_MEPOITEM'.

    WA_EXTENSIONIN-VALUEPART1 = WA_BAPI_POITEM.

    append WA_EXTENSIONIN to IT_EXTENSIONIN.

    clear: WA_EXTENSIONIN.

    WA_EXTENSIONIN-STRUCTURE = 'BAPI_TE_MEPOITEMX'.

    WA_EXTENSIONIN-VALUEPART1 = WA_BAPI_POITEMX.

    append WA_EXTENSIONIN to IT_EXTENSIONIN.

    finally call the bapi

    call function 'BAPI_PO_CHANGE'

    exporting

    PURCHASEORDER = PURCHASEORDER

    tables

    RETURN = RETURN

    POITEM = IT_POITEM

    POITEMX = IT_POITEMX

    EXTENSIONIN = IT_EXTENSIONIN

    exceptions

    others = 1.

    Please use the above code. Let me know if you have any concerns.

    Regards,

    Sajith

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Sajith,

      The below code am using in report, please check if anything wrong.

      DATA: bapi_te_mepoitem LIKE bapi_te_mepoitem,

      bapi_te_mepoitemx LIKE bapi_te_mepoitemx,

      l_extensionin TYPE TABLE OF bapiparex WITH HEADER LINE,

      l_extensionout TYPE TABLE OF bapiparex .

      bapi_te_mepoitem-po_item = '10'.

      bapi_te_mepoitem-zzebeln = '0000001234'.

      MOVE 'BAPI_TE_MEPOITEM' TO l_extensionin-structure.

      MOVE bapi_te_mepoitem TO l_extensionin-valuepart1.

      APPEND l_extensionin.

      bapi_te_mepoitemx-po_item = '10'.

      bapi_te_mepoitemx-zzebeln = 'X'.

      MOVE 'BAPI_TE_MEPOITEMX' TO l_extensionin-structure.

      MOVE bapi_te_mepoitemx TO l_extensionin-valuepart1.

      APPEND l_extensionin.

      CALL FUNCTION 'BAPI_PO_CHANGE'

      EXPORTING

      purchaseorder = '0000023456'

      TABLES

      return = t_bapireturn

      poitem = t_bapi_poitem

      poitemx = t_bapi_poitemx

      extensionin = l_extensionin

      extensionout = l_extensionout.

      READ TABLE t_bapireturn WITH KEY type = 'E' TRANSPORTING NO FIELDS.

      IF sy-subrc NE 0.

      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

      EXPORTING

      wait = 'X'.

      ENDIF.

      Thanks.

  • avatar image
    Former Member
    Jan 12, 2011 at 09:55 AM

    Hi Stars,

    In BAPI_TE_MEPOHEADERX, How are you declaring the fields? The fields should be of same name, but of length 1(component type BAPIUPDATE). Please verify that once.

    In debugging mode, come to PERFORM move_extensionin, there check whether the values are populating correctly in the internal tables cht_poitem, cht_poitemx.

    Regards,

    Sajith

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi..,

      Just pass the values at zzebeln once again,

      e.g.,

      bapi_te_mepoitemx-po_item = '10'.

      bapi_te_mepoitemx-zzebeln = ' '0000001234'.

      Regards.

  • avatar image
    Former Member
    Jan 12, 2011 at 07:46 AM

    Dear Stars ;

    Some BAPI needs at the end "commit work".

    Check your code.

    clear return_t[].

    call function 'BAPI_PO_CHANGE'

    exporting

    purchaseorder = ebeln

    tables

    return = return_t

    • poitem = lt_item

    • poitemx = lt_itemx

    extensionin = lt_extensionin.

    commit work and wait.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 12, 2011 at 09:07 AM

    Hi Stars,

    The code looks fine. Is it working? let me know if you have any concerns.

    Regards,

    Sajith

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Sajith,

      When I change the PO with ZZEBELN value it didnu2019t update the value in EKPO, also it cleared the old value.

      Thanks.

  • avatar image
    Former Member
    Jan 12, 2011 at 10:52 AM

    Hi Stars,

    I don't find any reason for not updating the ekpo table.For me, the same code worked. try for some other PO number or even for different line item.

    Regards,

    Sajith

    Add comment
    10|10000 characters needed characters exceeded