<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using BAPI_PO_CHANGE to update custom field in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975245#M1339922</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The ZZSCOPE custom field is currently only updated using IDOC type PORDCH which has been extended to use bapi_te_mepoheader to update the custom fields.  So I have taken this logic to write my program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not an ABAP developer and my ABAP knowledge is limited.  I am having difficulty understanding the BAPI documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you able to provide more specific guidance / code examples?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Aug 2009 04:29:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-05T04:29:26Z</dc:date>
    <item>
      <title>Using BAPI_PO_CHANGE to update custom field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975243#M1339920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following code updates the 'Your Reference' field on PO header using BAPI_PO_CHANGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is also supposed to update a custom field on PO header (ZZSCOPE), but I cant seem to get that bit to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The custom field is contained in BAPI_TE_MEPOHEADER (BAPI Interface for Customer Enhancements for MEPOHEADER).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please advise the code which I am missing (I suspect I am missing a couple of lines of code during CALL FUNCTION 'BAPI_PO_CHANGE')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any advice is much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  Z_MASS_UNLOCK_PO.

PARAMETERS: DOCNO(10) OBLIGATORY,
            MESSAGE(20) OBLIGATORY.

DATA: s_header TYPE bapimepoheader,
        s_headerx TYPE bapimepoheaderx,
        s_TE_header TYPE bapi_te_mepoheader,
        s_TE_headerx TYPE bapi_te_mepoheaderx,
        i_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
        i_extension TYPE bapiparex OCCURS 0 WITH HEADER LINE,
        s_bapimepoheader TYPE bapimepoheader occurs 0 with header line,
        s_bapimepoheaderx TYPE bapimepoheaderx occurs 0 with header line,
        s_bapi_te_mepoheader TYPE bapi_te_mepoheader occurs 0 with header line,
        s_bapi_te_mepoheaderx TYPE bapi_te_mepoheaderx occurs 0 with header line,
        wa_message TYPE c LENGTH 100.

  s_bapimepoheaderx-po_number = 'X'.
  s_bapimepoheader-po_number = DOCNO.

*Update 'Your Reference' field
  s_bapimepoheaderx-REF_1 = 'X'.
  s_bapimepoheader-REF_1 = MESSAGE.

*Update 'ZZSCOPE' field
  s_bapi_te_mepoheaderx-ZZSCOPE = 'X'.
  s_bapi_te_mepoheader-ZZSCOPE = 'TEST123'.

  CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
      purchaseorder = DOCNO
      POHEADER      = s_bapimepoheader
      POHEADERX     = s_bapimepoheaderx
    TABLES
      return        = i_return.

*Message types: S Success, E Error, W Warning, I Info, A Abort

*Supress all Warning Messages
 DELETE i_return WHERE ( TYPE EQ 'W' ).


*Commit only if no errors have been returned
  read table i_return with key type = 'E'.
  if sy-subrc ne 0.
    COMMIT WORK AND WAIT.
  endif.

*Display Return Messages on Screen
  LOOP AT i_return.
    WRITE: /   'RETURN MESSAGE: ',
    'ID: ',
    i_return-id,
    ' TYPE: ',
    i_return-type,
    ' NUMBER: ',
    i_return-number,
    ' ',
    i_return-message.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2009 00:59:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975243#M1339920</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-05T00:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Using BAPI_PO_CHANGE to update custom field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975244#M1339921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I dont understand your purpose.&lt;/P&gt;&lt;P&gt;Why have you extended bapi_te_mepoheader the structure?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont see that getting passed to the BAPI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to populate the below tables and send to the BAPI for custom fields. You can get more information about it in the Documentation of the BAPI.&lt;/P&gt;&lt;P&gt;*"      EXTENSIONIN STRUCTURE  BAPIPAREX OPTIONAL&lt;/P&gt;&lt;P&gt;*"      EXTENSIONOUT STRUCTURE  BAPIPAREX OPTIONAL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2009 03:10:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975244#M1339921</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-05T03:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using BAPI_PO_CHANGE to update custom field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975245#M1339922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The ZZSCOPE custom field is currently only updated using IDOC type PORDCH which has been extended to use bapi_te_mepoheader to update the custom fields.  So I have taken this logic to write my program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not an ABAP developer and my ABAP knowledge is limited.  I am having difficulty understanding the BAPI documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you able to provide more specific guidance / code examples?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2009 04:29:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975245#M1339922</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-05T04:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Using BAPI_PO_CHANGE to update custom field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975246#M1339923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I had same requirment and seems to be working. &lt;/P&gt;&lt;P&gt;Please look in following code.&lt;/P&gt;&lt;P&gt;We have a custom field EKKO-ZZDELIVERYDATE. &lt;/P&gt;&lt;P&gt;To work with BAPI, this field must be included in two structures: &lt;/P&gt;&lt;P&gt;1) BAPI_TE_MEPOHEADER, there is an include CI_EKKODB. Add the Z field there with the same type as on EKKO. (I actually didn't have to do this - either somebody has already done this or it happened automatically when the field was added, not sure).&lt;/P&gt;&lt;P&gt;2) BAPI_TE_MEPOHEADERX, include CI_EKKODBX. Add the field with the same name but type BAPIUPDATE (!). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS:  p_ebeln TYPE ebeln,
             p_date LIKE sy-datum.
 
DATA: s_header TYPE bapimepoheader,
      s_headerx TYPE bapimepoheaderx,
      i_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
      i_extension TYPE bapiparex OCCURS 0 WITH HEADER LINE,
      s_bapi_te_mepoheader TYPE bapi_te_mepoheader,
      s_bapi_te_mepoheaderx TYPE bapi_te_mepoheaderx,
      wa_date TYPE ekko-zzdeliverydate,
      wa_message TYPE c LENGTH 100.
 
s_bapi_te_mepoheaderx-po_number = p_ebeln.
s_bapi_te_mepoheaderx-zzdeliverydate = 'X'.
s_bapi_te_mepoheader-po_number = p_ebeln.
s_bapi_te_mepoheader-zzdeliverydate = p_date.
i_extension-structure = 'BAPI_TE_MEPOHEADER'.
i_extension-valuepart1 = s_bapi_te_mepoheader.
APPEND i_extension.
i_extension-structure = 'BAPI_TE_MEPOHEADERX'.
i_extension-valuepart1 = s_bapi_te_mepoheaderx.
APPEND i_extension.
 
s_header-po_number = p_ebeln.
 
CALL FUNCTION 'BAPI_PO_CHANGE'
  EXPORTING
    purchaseorder = p_ebeln
  TABLES
    return        = i_return
    extensionin   = i_extension.
 
COMMIT WORK.
LOOP AT i_return.
  MESSAGE ID   i_return-id
       TYPE    i_return-type
       NUMBER  i_return-number WITH
               i_return-message_v1
               i_return-message_v2
               i_return-message_v3
               i_return-message_v4.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;ShreeMohan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2009 05:39:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975246#M1339923</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-05T05:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using BAPI_PO_CHANGE to update custom field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975247#M1339924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ShreeMohan, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using your sample code I have managed to complete my program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot thank you enough for your assistance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;akagus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2009 06:35:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975247#M1339924</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-05T06:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using BAPI_PO_CHANGE to update custom field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975248#M1339925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ShreeMohan and Akagus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   I am trying to do the same to unlock the po at the header fiield using a custom field called 'zzpoblock'.  This field is a checked field.  I used a combintion of the sample coding that both of you presented.  I got a warning issued on my program.&lt;/P&gt;&lt;P&gt;The warning is  'Error transferring ExtensionIn data for Enhancement CI_EKPODB'.&lt;/P&gt;&lt;P&gt;The program ran and I am unable to get zzpoblock to become blank.    I  think i have to manipulate with ExtensionIN data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you get the warning in your program ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Joyce&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2009 21:14:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975248#M1339925</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-14T21:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using BAPI_PO_CHANGE to update custom field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975249#M1339926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unable to activate this code due to error "I_EXTENSION-VALUEPART1" and "S_BAPI_TE_MEPOHEADER" are not mutually convertible in Unicode systems in the line &lt;STRONG&gt;'i_extension-valuepart1 = s_bapi_te_mepoheader.'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Please suggest me how to activate this code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Mar 2016 13:28:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975249#M1339926</guid>
      <dc:creator>former_member207481</dc:creator>
      <dc:date>2016-03-14T13:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using BAPI_PO_CHANGE to update custom field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975250#M1339927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that means you have added a field that is not of type character (CHAR, NUMC, DATS etc.) to CI_EKPODB. That doesn't work since the field Transport is done by writing the record with the Extension fields to a Long character string. On Unicode Systems you cannot write a data structure containing a binary field to a text string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You Need to make sure all fields in CI_EKPODB are character based fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Oliver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2016 12:53:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-po-change-to-update-custom-field/m-p/5975250#M1339927</guid>
      <dc:creator>oliver_wurm</dc:creator>
      <dc:date>2016-06-21T12:53:46Z</dc:date>
    </item>
  </channel>
</rss>

