Skip to Content
0
Former Member
Jan 26, 2007 at 05:18 PM

Change item text in purchase order

1082 Views

Hi folks,

I'm trying to change some item text in the purchase order through the BAPI_PO_CHANGE

with the following test code:

REPORT zprueba_bapi_po_change.

DATA:
  itab_text LIKE TABLE OF bapiekpotx,
  wa_text   LIKE bapiekpotx,
  itab_lines LIKE TABLE OF tline,
  wa_lines   LIKE tline,
  itab_items LIKE TABLE OF BAPIEKPO,
  wa_items   LIKE BAPIEKPO.

DATA: name LIKE thead-tdname,
      id   LIKE thead-tdid,
      object LIKE thead-tdobject,
      v_result LIKE itcer.

DATA: itab_return LIKE TABLE OF BAPIRET2.

data: poorder like BAPIEKKO-PO_NUMBER.

poorder = '4500058923'.

CALL FUNCTION 'BAPI_PO_GETDETAIL'
  EXPORTING
    purchaseorder                    = poorder
   ITEMS                            = 'X'
*   ACCOUNT_ASSIGNMENT               = ' '
*   SCHEDULES                        = ' '
*   HISTORY                          = ' '
   item_texts                       = 'X'
*   HEADER_TEXTS                     = ' '
*   SERVICES                         = ' '
*   CONFIRMATIONS                    = ' '
*   SERVICE_TEXTS                    = ' '
*   EXTENSIONS                       = ' '
* IMPORTING
*   PO_HEADER                        =
*   PO_ADDRESS                       =
 TABLES
*   PO_HEADER_TEXTS                  =
   PO_ITEMS                         = itab_items
*   PO_ITEM_ACCOUNT_ASSIGNMENT       =
*   PO_ITEM_SCHEDULES                =
*   PO_ITEM_CONFIRMATIONS            =
   po_item_texts                    = itab_text
*   PO_ITEM_HISTORY                  =
*   PO_ITEM_HISTORY_TOTALS           =
*   PO_ITEM_LIMITS                   =
*   PO_ITEM_CONTRACT_LIMITS          =
*   PO_ITEM_SERVICES                 =
*   PO_ITEM_SRV_ACCASS_VALUES        =
*   RETURN                           =
*   PO_SERVICES_TEXTS                =
*   EXTENSIONOUT                     =
          .


COMMIT WORK AND WAIT.

name = '600007545900001'.
id = 'A01'.
object = 'EKPO'.

CALL FUNCTION 'READ_TEXT'
  EXPORTING
*   CLIENT                        = SY-MANDT
    id                            = id
    language                      = sy-langu
    name                          = name
    object                        = object
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
* IMPORTING
*   HEADER                        =
  TABLES
    lines                         = itab_lines
* EXCEPTIONS
*   ID                            = 1
*   LANGUAGE                      = 2
*   NAME                          = 3
*   NOT_FOUND                     = 4
*   OBJECT                        = 5
*   REFERENCE_CHECK               = 6
*   WRONG_ACCESS_TO_ARCHIVE       = 7
*   OTHERS                        = 8
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

LOOP AT itab_lines INTO wa_lines.
  CLEAR wa_text.
  wa_text-po_number = poorder.
  wa_text-po_item = '00001'.
  wa_text-text_form = wa_lines-tdformat.
  wa_text-text_line = wa_lines-tdline.
  wa_text-text_id = 'F03'.
  APPEND wa_text TO itab_text.
ENDLOOP.

SORT itab_text BY po_item text_id.

CALL FUNCTION 'BAPI_PO_CHANGE'
  EXPORTING
    purchaseorder                = poorder
*   POHEADER                     =
*   POHEADERX                    =
*   POADDRVENDOR                 =
*   TESTRUN                      =
*   MEMORY_UNCOMPLETE            =
*   MEMORY_COMPLETE              =
*   NO_MESSAGING                 =
*   NO_MESSAGE_REQ               =
*   NO_AUTHORITY                 =
*   NO_PRICE_FROM_PO             =
* IMPORTING
*   EXPHEADER                    =
TABLES
   RETURN                       = itab_return
*   POITEM                       =
*   POITEMX                      =
*   POADDRDELIVERY               =
*   POSCHEDULE                   =
*   POSCHEDULEX                  =
*   POACCOUNT                    =
*   POACCOUNTPROFITSEGMENT       =
*   POACCOUNTX                   =
*   POCONDHEADER                 =
*   POCONDHEADERX                =
*   POCOND                       =
*   POCONDX                      =
*   POLIMITS                     =
*   POCONTRACTLIMITS             =
*   POSERVICES                   =
*   POSRVACCESSVALUES            =
*   POSERVICESTEXT               =
*   EXTENSIONIN                  =
*   EXTENSIONOUT                 =
*   POTEXTHEADER                 =
   POTEXTITEM                   = itab_text
*   POPARTNER                    =
          .
COMMIT WORK AND WAIT.

However this code isn't updating the text. Does anyone could tell me what i'm missing?

Thanks for your help.

Kind Regards,

Gilberto Li