BAPI_PO_CHANGE work?

hi everybody. I'm trying to use the bapi BAPI_PO_CHANGE, but I no have luck to make it work. I need to enter in the purchase order, select one o several item, in the item selected I need to mark the check "Closed" in every item. and then close the item.
can you help me??? thanks for your time!!!
Oscar

my code is like this:
  CALL FUNCTION 'BAPI_PO_GETDETAIL'
    EXPORTING
      purchaseorder                    = ebeln
      items                            = 'X'
      history                          = 'X'
      extensions                       = 'X'
    IMPORTING
      po_header                        = po_header
    TABLES
      po_items                         = po_items
      po_item_history                  = po_item_history
      return                           = retorno_get
      extensionout                     = extensionout.
  MOVE-CORRESPONDING po_header TO poheader.
  LOOP AT po_items.
    CLEAR: poitem, poitemx.
    MOVE-CORRESPONDING po_items TO poitem.
    poitem-no_more_gr = 'X'.
    poitem-final_inv = 'X'.
    poitem-deliv_compl = 'X'.
    poitem-delete_ind = 'X'.
    APPEND poitem.
    poitemx-po_item = poitem-po_item.
    poitemx-no_more_gr = 'X'.
    poitemx-po_itemx = 'X'.
    poitemx-final_inv = 'X'.
    poitemx-deliv_compl = 'X'.
    poitemx-delete_ind = 'X'.
    APPEND poitemx.
  ENDLOOP.
  CLEAR: poitem, poitemx,
         poheader, poheaderx.
  CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
      purchaseorder                = ebeln
      poheader                     = poheader
      poheaderx                    = poheaderx
    POADDRVENDOR                 =
      testrun                      = p_test
      memory_uncomplete            = 'X'
    MEMORY_COMPLETE              =
    POEXPIMPHEADER               =
    POEXPIMPHEADERX              =
    VERSIONS                     =
    NO_MESSAGING                 =
    NO_MESSAGE_REQ               =
    NO_AUTHORITY                 =
    NO_PRICE_FROM_PO             =
    IMPORTING
      expheader                    = expheader
    EXPPOEXPIMPHEADER            =
    TABLES
      return                       = retorno
      poitem                       = poitem
      poitemx                      = poitemx
    POADDRDELIVERY               =
    POSCHEDULE                   =
    POSCHEDULEX                  =
    POACCOUNT                    =
    POACCOUNTPROFITSEGMENT       =
    POACCOUNTX                   =
    POCONDHEADER                 =
    POCONDHEADERX                =
    POCOND                       =
    POCONDX                      =
    POLIMITS                     =
    POCONTRACTLIMITS             =
    POSERVICES                   =
    POSRVACCESSVALUES            =
    POSERVICESTEXT               =
      extensionin                  = extensionin
      extensionout                 = extensionout
    POEXPIMPITEM                 =
    POEXPIMPITEMX                =
    POTEXTHEADER                 =
    POTEXTITEM                   =
    ALLVERSIONS                  =
    POPARTNER                    =
  IF p_test <> 'X'.
    COMMIT WORK AND WAIT.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait   = 'X'
      IMPORTING
        return = retorno.
  ENDIF.

Similar Messages

  • Does BAPI_PO_CHANGE work for ME22?

    Hello,
    There is background program which is run at regular intervals, which changes the PO unit even when there is a GR created.
    So if I go to ME22n and change the order and  save , PO unit is getting converted automatically. This is due to background program , but the same is not happening with ME22.
    I want to know whether BAPI_PO_CHANGE has any affect on ME22.

    Hi,
    Next time try to share informations with details.
    Because you didn't I can just think that there can be some User-Exit in ME22N. Furthemore Us-Ex in both of this transaction are the same.
    So maybe there is some condition like:
    IF sy-tcode = 'ME22N'.
    quite common practise ...
    Best regards.

  • BAPI_PO_CHANGE to change Delivery Date not working.

    I'm using BAPI_PO_CHANGE to change the Delivery Date of a PO, but it's not changing it to the value that I pass it.  It changes the Delivery date but not to what's been passed to it but some date that I have no clue where it comes from.  Anyone have any solution to this issue?
    Below is my code snippet:
        MOVE: ctab-qty_packed     TO schdo-quantity,
              zrecv_ship-eta_date TO schdo-delivery_date.
        MODIFY schdo INDEX ix.
        MOVE: schdo-po_item       TO schdx-po_item,
              schdo-sched_line    TO schdx-sched_line,
              'X'                 TO schdx-po_itemx,
              'X'                 TO schdx-sched_linex,
              'X'                 TO schdx-delivery_date,
              'X'                 TO schdx-quantity,
              'X'                 TO schdx-stat_date.
        APPEND schdx.
        IF qty > 0.
          ADD 1 TO schdo-sched_line.
          MOVE: qty               TO schdo-quantity,
                ndate             TO schdo-stat_date.
          APPEND schdo.
          MOVE: schdo-po_item     TO schdx-po_item,
                schdo-sched_line  TO schdx-sched_line,
                'X'               TO schdx-po_itemx,
                'X'               TO schdx-sched_linex,
                'X'               TO schdx-delivery_date,
                'X'               TO schdx-quantity,
                'X'               TO schdx-stat_date.
          APPEND schdx.
        ENDIF.
          CALL FUNCTION 'BAPI_PO_CHANGE'
            EXPORTING
              purchaseorder = ctab-ebeln
            TABLES
              return        = ret
              poschedule    = schdo
              poschedulex   = schdx
              potextheader  = hdr_txt.

    Ok, I figured out the issue.
    It seems like the Delivery_Date field in BAPIMEPOSCHEDULE is not a date component rather it's a CHAR(10) field so therefore when reading in the SAP Date, it wasn't converting it properly.
    As long as the date entered into that field is like "MM/dd/yyyy" it will overwrite the original delivery date that was present.

  • How to change the open quantity of PO / STO using  BAPI_PO_CHANGE

    Hi Friends,
    How can I change the open quantity in ME22 using the BAPI BAPI_PO_CHANGE...
    I am getting some errors..The values I am passing to the BAPI are:-
    *-- Purchase Order document
        lv_purchaseorder = tbl_join-ebeln.
    *-- Calculate Open quantity
        lv_quantity = ( tbl_join-menge - tbl_join-wemng ).
    *-- Fills Schedule quantity to be processed.
        tbl_poschedule-po_item      = tbl_join-ebelp.
        tbl_poschedule-sched_line   = tbl_join-etenr.
        tbl_poschedule-quantity     = lv_quantity.
        APPEND tbl_poschedule.
    *-- Marks the Schedule quantity to be processed.
        tbl_poschedulex-po_item     = tbl_join-ebelp.
        tbl_poschedulex-sched_line  = tbl_join-etenr.
        tbl_poschedulex-po_itemx    = c_true.
        tbl_poschedulex-sched_linex = c_true.
        tbl_poschedulex-quantity    = c_true.
        APPEND tbl_poschedulex.
    CALL FUNCTION 'BAPI_PO_CHANGE'
          EXPORTING
            PURCHASEORDER                = lv_purchaseorder
          POHEADER                     =
          POHEADERX                    =
          POADDRVENDOR                 =
            TESTRUN                      = 'X'
       IMPORTING
          EXPHEADER                    =
          EXPPOEXPIMPHEADER            =
         TABLES
           RETURN                       = tbl_return
           POSCHEDULE                   = tbl_poschedule
           POSCHEDULEX                  = tbl_poschedulex.
    Is there any other required fields needs to be passed to change the open quantity..
    I am checking in ME22...
    The scheduled quantity is 20.
    Delivered quantity is 15.
    Open quantity is 5   and ( this field is in non-editable display )
    Delivery date  is 10.10.2002  ( which is in past )
    Now using this BAPI ..I want to post the remaining open quantity which is " 5 "
    How can i do this ?? Please help.

    Hi Hari
    Please check after making the following changes:
    *-- Marks the Schedule quantity to be processed.
    tbl_poschedulex-po_item = tbl_join-ebelp.
    tbl_poschedulex-sched_line = tbl_join-etenr.
    <b>tbl_poschedulex-po_itemx = 'U'. "c_true.
    *tbl_poschedulex-sched_linex = c_true.</b>
    tbl_poschedulex-quantity = c_true.
    APPEND tbl_poschedulex.
    If still you do not get the desired function working add the below code:
    tbl_poitem-po_item = tbl_join-ebelp.
    tbl_poitem-quantity = lv_quantity.
    append tbl_poitem.
    tbl_poitemx-po_item = tbl_join-ebelp.
    tbl_poitemx-po_itemx = 'U'.
    tbl_poitemx-quantity = c_true.
    append tbl_poitemx.
    Hope this helps.
    Kind Regards
    Eswar

  • Deletion of schedule line in PO using BAPI_PO_CHANGE

    Hi ,
    Can anyone give me the code to delete a schedule line in a po using the bapi bapi_po_change.
    Useful answers will be rewarded.
    Regards,
    Sowmya.

    Hi,
    Refer below code
    *&      Form  sub_populate_data
          text
    FORM sub_populate_data .
    *--Local Variables
      DATA : l_ipdate      TYPE rc65a-datefrom,
             l_fdate       TYPE sy-datum.
      IF NOT it_succ_file[] IS INITIAL.
        LOOP AT it_succ_file INTO st_succ_file.
          st_ipfile = st_succ_file.
    *--Sales Document
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = st_ipfile-vbeln
            IMPORTING
              output = st_salesdoc.
          st_ord_headx-updateflag = c_u.
    *--Sales Document Item
          st_schedule_line-itm_number = st_ipfile-posnr.
          st_schedule_linex-itm_number = st_ipfile-posnr.
          st_schedule_linex-updateflag = c_i.
    *--Schedule line date
          l_ipdate = st_ipfile-edatu.
    *--Call function module to convert the date format into current user format
          CALL FUNCTION 'CY_CONVERT_DATE'
            EXPORTING
              date_string_imp = l_ipdate
            IMPORTING
              date_exp        = l_fdate.
          st_schedule_line-dlv_date = l_fdate.
          st_schedule_linex-dlv_date = c_chk.
          st_schedule_line-req_date = l_fdate.
          st_schedule_linex-req_date = c_chk.
    *--Order quantity in sales units
          st_schedule_line-req_qty = st_ipfile-wmeng.
          st_schedule_linex-req_qty = c_chk.
          APPEND st_schedule_line TO it_schedule_line.
          APPEND st_schedule_linex TO it_schedule_linex.
    *--Clear
          CLEAR : st_schedule_line,
                  st_schedule_linex.
          AT END OF posnr.
    *--Perform to delete the existing schedule line
            PERFORM sub_delete_schedule_line.
          ENDAT.
          AT END OF vbeln.
    *--Clear
            CLEAR : st_erfile.
            READ TABLE it_erfile INTO st_erfile WITH KEY vbeln = st_ipfile-vbeln
                                                         posnr = st_ipfile-posnr
                                                         BINARY SEARCH.
            IF sy-subrc EQ 0.
              g_error_records = g_error_records + 1.
              g_total_records = g_total_records + 1.
            ELSE.
    *--Call the bapi to update sales order schedule line
              PERFORM sub_call_bapi.
            ENDIF.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " sub_populate_data
    *&      Form  sub_call_bapi
          text
    FORM sub_call_bapi.
      g_total_records = g_total_records + 1.
    *--Call BAPI to update sales order schedule line for simulation mode
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument    = st_salesdoc
          order_header_inx = st_ord_headx
          simulation       = c_chk
        TABLES
          return           = it_return
          schedule_lines   = it_schedule_line
          schedule_linesx  = it_schedule_linex.
      IF NOT it_return[] IS INITIAL.
        READ TABLE it_return INTO st_return WITH KEY type = c_e.
        IF sy-subrc EQ 0.
          g_error_records = g_error_records + 1.
        ELSE.
          REFRESH : it_return.
    *--Call BAPI to update sales order schedule line
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
            EXPORTING
              salesdocument    = st_salesdoc
              order_header_inx = st_ord_headx
            TABLES
              return           = it_return
              schedule_lines   = it_schedule_line
              schedule_linesx  = it_schedule_linex.
        ENDIF.
        LOOP AT it_return INTO st_return
                          WHERE type EQ c_e.
          st_erfile = st_ipfile.
          st_erfile-message = st_return-message.
          APPEND st_erfile TO it_erfile.
          APPEND st_erfile TO it_file.
          CLEAR : st_return.
        ENDLOOP.
      ENDIF.
      IF it_file[] IS INITIAL.
    *--Call BAPI transaction commit to change the schedule line
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = c_chk.
      ELSE.
        ROLLBACK WORK.
    *--Call BAPI transaction rollback to rollback the schedule line
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      ENDIF.
    *--Clear
      CLEAR : st_salesdoc,
              st_ord_headx.
    *--Refresh
      REFRESH : it_return,
                it_schedule_line,
                it_schedule_linex.
    ENDFORM.                    " sub_call_bapi
    Regards,
    Prashant

  • Unchecked final invoice and delivery completed indicator via BAPI_PO_CHANGE

    Hi All,
    Is it possible to reset the final invoice and delivery completed indicators of PO in ME23N using BAPI_PO_CHANGE? I need to unchecked the final invoice and delivery completed indicators for all POs in our system that were accidentally updated to delivery completed and final invoice by the user.
    Points will be rewared.

    what i did now is to create a prototype program like the one below:
    CONSTANTS c_po TYPE bapimepoheader-po_number VALUE '0040001816'.
    DATA: t_poitem-po TYPE bapimepoheader-po_number,
          t_return TYPE STANDARD TABLE OF bapiret2,
          t_poitem TYPE STANDARD TABLE OF bapimepoitem,
          t_poitemx TYPE STANDARD TABLE OF bapimepoitemx,
          x_return TYPE bapiret2,
          x_poitem TYPE bapimepoitem,
          x_poitemx TYPE bapimepoitemx.
    t_poitem-po = c_po.
    x_poitem-no_more_gr = 'X'.
    x_poitemx-no_more_gr = 'X'.
    x_poitem-final_inv = 'X'.
    x_poitemx-final_inv = 'X'.
    x_poitem-po_item = c_po.
    x_poitemx-po_item = c_po.
    APPEND x_poitem TO t_poitem.
    APPEND x_poitemx TO t_poitemx.
    CALL FUNCTION 'BAPI_PO_CHANGE'
      EXPORTING
        purchaseorder  = t_poitem-po
        no_messaging   = 'X'
        no_message_req = 'X'
      TABLES
        return         = t_return
        poitem         = t_poitem
        poitemx        = t_poitemx.
    IF sy-subrc = 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDIF.
    The program is working if you will mark the PO as delivery completed and final invoice with suppressed output. The problem is i need to do the reverse which is to unmark. I replaced the value of no_more_gr and final_inv from 'X' to space but it is not working.

  • BAPI_PO_CHANGE "No account assignment for service 0000010" SE 518 Error

    Hi  Friends,
    I am using BAPI_PO_CHANGE to add new line item with service data to purchase order.
    For one scenario BAPI give me above error is "No account assignment for service 0000010" SE 518 .
    basically when i pass outline aggrement and contract item to bapi i am getting this error.....according to my observation in outline agrement account assignment is maintain as 'U' but i want to pass outline agrement as 'K' or 'N' so i am passing this into BAPI parameters ,however i feel somewhere it is getting conflict  so it giving above error...
    Please guide,
    Thanks & Regards,
    Bhaskar

    Hi Seini,
    Thanks for reply ..
    I have pass contract number to BAPI ....and i also pass cost center and GL account to account assignment but still bapi giving same error.....I am totally stuck into this i tried a lot with different options..for other scenario BAPI works fine but when I pass contract number with account assignment 'U' and I want to change this 'U' to 'K' or 'N'  for this I pass account assignment to PO line item but BAPI fails in this perticular scenario.

  • Free_Item in BAPI_PO_CHANGE

    Hi,
    I want to make price = 0 in PO line Item. I'm using BAPI_PO_CHANGE with this code:
    DATA: gs_ekpo TYPE ekpo.
    DATA: gt_return TYPE TABLE OF bapiret2.
    DATA: gs_return TYPE bapiret2.
    DATA: gt_bapimepoitem TYPE TABLE OF bapimepoitem.
    DATA: gt_bapimepoitemx TYPE TABLE OF bapimepoitemx.
    DATA: gs_bapimepoitem TYPE bapimepoitem.
    DATA: gs_bapimepoitemx TYPE bapimepoitemx.
    PARAMETERS: p_ebeln LIKE ekpo-ebeln DEFAULT '1000901140'.
    PARAMETERS: p_ebelp LIKE ekpo-ebelp DEFAULT '1'.
    CLEAR: gs_ekpo,
           gs_return,
           gt_return[],
           gs_bapimepoitem,
           gs_bapimepoitemx,
           gt_bapimepoitem[],
           gt_bapimepoitemx[].
    SELECT SINGLE * FROM ekpo INTO gs_ekpo
    WHERE
          ebeln = p_ebeln AND
          ebelp = p_ebelp.
    IF sy-subrc = 0.
      gs_bapimepoitem-po_item = gs_ekpo-ebelp.
      gs_bapimepoitem-free_item = 'X'.
      APPEND gs_bapimepoitem TO gt_bapimepoitem.
      gs_bapimepoitemx-po_item = gs_ekpo-ebelp.
      gs_bapimepoitemx-free_item = 'X'.
      APPEND gs_bapimepoitemx TO gt_bapimepoitemx.
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          purchaseorder = gs_ekpo-ebeln
        TABLES
          return        = gt_return
          poitem        = gt_bapimepoitem
          poitemx       = gt_bapimepoitemx.
      READ TABLE gt_return INTO gs_return WITH KEY type = 'E'.
      IF sy-subrc EQ 0.
    *- errors
        WRITE:/ 'E', gs_ekpo-ebeln, gs_ekpo-ebelp, 'BAPI',
        gs_return-message.
      ELSE.
    *- success
        CLEAR: gs_return,
               gt_return[].
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait   = 'X'
          IMPORTING
            return = gs_return.
      ENDIF.
    ENDIF.
    The program run succsefely, but it does not update the price on the line item to value 0.
    Any Help please? i have SAP 4.72 with SAPKH47016.
    Thanks.

    Hi
    Try using the BADI to change the price.
    Implement BADI definition (ME_PROCESS_PO_CUST) and create a class and implemented the interface (IF_EX_ME_PROCESS_PO_CUST) and use the methods (PROCESS_ITEM) - GET_DATA and SET_DATA to change the price
    Pls let me know, whether it works
    Regards
    Madhan Doraikannan

  • Problem with BAPI_PO_CHANGE in adding services

    Hello,
    I have a problem in using BAPI_PO_CHANGE in adding new services for an existing po_item . I fill the table POITEM, POITEMX. Then I fill the POACCOUNT and POACCOUNTX table. Lastly I fill the table POSERVICES, POSRVACCESSVALUES. After running it with commit step. I get as return:
    The purchase order .... was updated. But if I look at my purchase order with trans. me23n, there was nothing added. Thus, I do not know what I forget. So it will be great, if someone can provide an example in correct filling the table.
    In Table POSERVICES I add for the field PCKG_NO the value : 0000000001, is this correct? because I will add new services positions.
    Thanks in advance for your support.
    Kind regards,
    Erkan

    Hello Anuradha,
    yes, I used the BAPI Commit command but it did not work.
    Kind regards,
    Erkan

  • BAPI_PO_CHANGE document number leading zero problem

    Hi experts,
    The following code clears the "Delivery Complete" flag on a list of Purchase Orders uploaded from a CSV file.
    The PO number is 9 digits long, however, in EKPO table it is stored as 10 digits (prefixed with a zero). The BAPI does not recognise the document number unless it is prefixed with a zero in the CSV file (which adds extra work for the user to create custom format in Excel to add the leading zero).
    What code is required for the BAPI to recognise the 9 digit number without the leading zero?   Perhaps the leading zero could be hard-coded into the program?
    Any advice is much appreciated.  Thanks for your time.
    REPORT  Z_MASS_REMOVE_FDI_DCI_BAPI.
    *Check if file exists
    DATA: rc TYPE sy-ucomm.
    CALL FUNCTION 'WS_QUERY'
           EXPORTING
                query    = 'FE'  "File Exist?
                filename = 'X:\STO.TXT'
           IMPORTING
               return   = rc.
    IF rc EQ 0.
      WRITE: / 'File does not exist'.
    ENDIF.
    TYPES: BEGIN OF ty_tab,
            DOCNO(10),
            ITEM(4),
           END OF ty_tab.
    DATA : it_tab TYPE STANDARD TABLE OF ty_tab,
           wa_tab TYPE ty_tab.
    START-OF-SELECTION.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename = 'X:\STO.TXT'
    *     FILETYPE = 'ASC
          has_field_separator = 'X'
    *     HEADER_LENGTH = 0
    *     READ_BY_LINE = 'X'
    *     IMPORTING
    *     FILELENGTH =
    *     HEADER =
          TABLES
          data_tab = it_tab
          EXCEPTIONS
          file_open_error = 1
          file_read_error = 2
          no_batch = 3
          gui_refuse_filetransfer = 4
          invalid_type = 5
          no_authority = 6
          unknown_error = 7
          bad_data_format = 8
          header_not_allowed = 9
          separator_not_allowed = 10
          header_too_long = 11
          unknown_dp_error = 12
          access_denied = 13
          dp_out_of_memory = 14
          disk_full = 15
          dp_timeout = 16
          OTHERS = 17.
    END-OF-SELECTION.
    LOOP AT it_tab INTO wa_tab.
      WRITE:/ 'DOCUMENT: ',
      wa_tab-DOCNO,
      ' ITEM: ',
      wa_tab-ITEM.
      WRITE: / '-----------------------------------------------------------------------'.
      DATA: s_header TYPE bapimepoheader,
            s_headerx TYPE bapimepoheaderx,
            s_item TYPE bapimepoitem,
            s_itemx TYPE bapimepoitemx,
            i_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
            i_extension TYPE bapiparex OCCURS 0 WITH HEADER LINE,
            s_bapimepoheader TYPE bapimepoheader,
            s_bapimepoheaderx TYPE bapimepoheaderx,
            s_bapimepoitem TYPE bapimepoitem occurs 0 with header line,
            s_bapimepoitemX TYPE bapimepoitemX occurs 0 with header line,
            wa_message TYPE c LENGTH 100.
      s_bapimepoheaderx-po_number = wa_tab-DOCNO.
      s_bapimepoheader-po_number = wa_tab-DOCNO.
      s_bapimepoitemx-PO_ITEM = wa_tab-ITEM.
      s_bapimepoitem-PO_ITEM = wa_tab-ITEM.
    *Remove Delivery Complete Indicator (DCI)
      s_bapimepoitemx-NO_MORE_GR = 'X'.
      s_bapimepoitem-NO_MORE_GR = ' '.
      append s_bapimepoitem.
      clear s_bapimepoitem.
      append s_bapimepoitemx.
      clear s_bapimepoitemx.
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          purchaseorder = wa_tab-DOCNO
        TABLES
          return        = i_return
          poitem        = s_bapimepoitem
          poitemx      =  s_bapimepoitemx.
    *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.
      WRITE: / '-----------------------------------------------------------------------'.
      refresh : s_bapimepoitem,s_bapimepoitemx.
    ENDLOOP.

    hi,
    Use the conversion exit to make it as 10 digit char CONVERSION_EXIT_ALPHA_INPUT.

  • BAPI_PO_CHANGE me22n add profit center for purchase requisition number

    Hello all,
    I have to add an item line for a specific sales order( p_vbeln ).
    for that i use BAPI_SALESORDER_CHANGE and it works and the item is inserted.
    ( p_posnr = sales order item and ln_etnr = schedule_line = 1 )
    Now I have to maintain the specific po item line and to insert the Profit Center related to the Purchase Requisition Number that was assigned to the above sales order item like using transaction ME22N.
    when i use the transaction all i have to do is to ADD the Purchase requisition number to the PO Order Number and to add the PROFIT CENTER.
    for this i use BAPI_PO_CHANGE.
    i colect the folowing data:
    from table VBFA( vbelv = sales order number vbeln = l_ebeln)
    PO Number = p_ebeln.
    from table VBEP ( vbeln = sales order number, posnr = the previously inserted sales order item )
    Purchase Requisition Number = l_banfn
    Purchase Requisition Item = l_bnfpo
    from table VBAP (vbeln = sales order number, posnr = the previously inserted sales order item )
    Profit Center = l_prctr
    from table EKKN
    select max(  ebelp )
    from ekkn
    into l_ebelp
    where ebeln = l_ebeln.
    add 10 to l_ebelp
    Purchase Order Item = l_ebelp .
    and i move the data:
      i_t_poitem-po_item = l_ebelp.
      i_t_poitem-preq_no = l_banfn.
      i_t_poitem-preq_item = l_bnfpo.
      i_t_poitem-acctasscat = cc_x.
      APPEND i_t_poitem.
      i_t_poitemx-po_item = l_ebelp.
      i_t_poitemx-po_itemx = cc_x.
      i_t_poitemx-preq_no = cc_x.
      i_t_poitemx-preq_item = cc_x.
      i_t_poitemx-acctasscat = cc_x.
      APPEND i_t_poitemx.
      i_t_poaccount-po_item = l_ebelp.
      i_t_poaccount-itm_number = p_posnr.
      i_t_poaccount-SCHED_LINE = ln_etnr.
      i_t_poaccount-profit_ctr = l_prctr.
      APPEND i_t_poaccount.
      i_t_poaccountx-po_item = l_ebelp.
      i_t_poaccountx-profit_ctr = cc_x.
      APPEND i_t_poaccountx.
    then i use the function BAPI_PO_CHANGE:
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          purchaseorder                = p_ebeln
          testrun                          = l_test
       TABLES
         return                            = i_t_return_po
         poitem                          = i_t_poitem
         poitemx                        = i_t_poitemx
         poaccount                    = i_t_poaccount
         poaccountx                   = i_t_poaccountx.
    BUT i get the folowing result ( messages in return table)
    Insert item for PO-order                                                                               
    Message:  Changing of PO using Enjoy BAPI unsuccessful ;                                                
      Message:  Purchase order item 00120 still contains faulty account assignments ;   
      Message:  Enter Profit Center ;                         
    what should i do?
    best regards,
    emilia

    hello,
    i debugged the function.
    first the data from poaccount is copied in lt_account.
    then this happens:
      PERFORM get_current_data
          TABLES    poitem               poschedule               poaccount
                    pocondheader         pocond
                    extensionout
                    poexpimpitem         allversions              popartner
                    potextheader         potextitem               return
          USING
                    l_po                 lf_header_currency
          CHANGING
                    expheader            exppoexpimpheader.
      exppoexpimpheader = poexpimpheader. "foreign trade export workaround
    after this form is executed poaccount-profit_ctr is empty.
    lt_account-profit_ctr in not empty but then it is not anymore.
    in the form this happens:
    item data
      CALL METHOD im_po->get_items
        IMPORTING
          ex_items = lt_items.
      LOOP AT lt_items INTO an_item.
        l_item ?= an_item-model.
        CALL METHOD l_item->get_data
          IMPORTING
            ex_data = ls_mepoitem.
        ls_mepoitem-ebeln = ls_header-ebeln.
        APPEND ls_mepoitem TO lt_item.
    schedules
    accountings*
        CALL METHOD l_item->get_po_accountings
          IMPORTING
            ex_accountings = lt_accountings.
        LOOP AT lt_accountings INTO an_item.
          l_accounting ?= an_item-model.
          CALL METHOD l_accounting->get_data
            IMPORTING
              ex_data = ls_mepoaccounting.
          ls_mepoaccounting-ebeln = ls_header-ebeln.
          APPEND ls_mepoaccounting TO lt_account.
        ENDLOOP.
    item conditions
    foreign trade (item data; EIPO)
      ENDLOOP.
    so it acctualy copies every item from purchase number ebeln in lt_item.
    for each one of them it copies the account data into lt_account.
    so the last loop is for the item that i want to enhance.
    here it copies all the necessary data in lt_account except of course the profit center because that's the one that i need to insert.
    after this loop there is a form:
      PERFORM move_account_out TABLES lt_account
                                                                ext_poaccount
                               USING  header_currency.
    where the ext_poaccount is the poaccount parameter.
    this form:
    clears ext_poaccount.
    copies the data from lt_account into ext_poaccount.
    and returns the ext_poaccount with the empty Profit center field
    and so after performing get_current_data my parameter is deleted.
    then it's almost the end of the function and nothing else related to the poaccount parameter.
    so it's no use for me to insert the field Profit_Center?
    is there another FM that i should use to be able to insert the profit center?
    what should i do?
    Best regards,
    Emilia

  • BAPI_PO_CHANGE, Pricing condition valueis not updating

    Hi Experts,
    I need to update the one of the Pricing condition amount in PO.
    I am using BAPI_PO_CHANGE by passing PO number, POCOND
    and POCONDX.
    i need to update the pricing condition amount say from 10 to 15.
    I am passing the same in POCOND-COND_VALUE = '15.00000'
    and CHANGE_ID = 'U'.
    Please let me know the sol, Definitely points will be awarded.
    or cant we change the pricing condition value by BAPI. Please confirm.
    Thanks,
    Shaik Bhasha

    Hi,
    I believe you can use this BAPI to PO conditions..
    Check this code..
    PARAMETERS: p_ebeln LIKE ekko-ebeln.
    DATA: t_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
    DATA: t_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
    DATA: t_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    DATA: t_cond LIKE bapimepocond OCCURS 0 WITH HEADER LINE.
    DATA: t_condx LIKE bapimepocondx OCCURS 0 WITH HEADER LINE.
    t_poitem-po_item = '00010'.
    t_poitem-net_price = '17.00'.
    APPEND t_poitem.
    t_poitemx-po_item = '00010'.
    t_poitemx-net_price = 'X'.
    t_poitemx-po_itemx = 'X'.
    APPEND t_poitemx.
    t_cond-itm_number = '00010'.
    t_cond-cond_type = 'P000'.
    t_cond-cond_value = '17.00'.
    t_cond-currency = 'USD'.
    t_cond-change_id = 'U'.
    APPEND t_cond.
    t_condx-itm_number = '00010'.
    t_condx-itm_numberx = 'X'.
    t_condx-cond_type = 'X'.
    t_condx-cond_value = 'X'.
    t_condx-currency = 'X'.
    t_cond-change_id = 'X'.
    APPEND t_condx.
    CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
    purchaseorder = p_ebeln
    TABLES
    return = t_return
    poitem = t_poitem
    poitemx = t_poitemx
    pocond = t_cond
    pocondx = t_condx.
    COMMIT WORK.
    The above code works fine for me...
    Thanks,
    Naren

  • BAPI_PO_CHANGE is not changing the PARTNER NO.

    Hello experts,
    I wanted to change the partner no. using  BAPI_PO_CHANGE, in SE37, but its not working. It saying, 'Error transferring ExtensionIn data for enhancement CI_EKPODB'. Can you please help me?
    Regards,
    David.

    Hi
    I've tried this code in my system:
    DATA: return    TYPE TABLE OF bapiret2 WITH HEADER LINE.
    DATA: popartner TYPE TABLE OF bapiekkop WITH HEADER LINE.
    DATA: error     TYPE flag.
    popartner-partnerdesc = 'GS'.
    popartner-langu       = sy-langu.
    popartner-buspartno   = '0070005647'.
    APPEND popartner.
    CALL FUNCTION 'BAPI_PO_CHANGE'
      EXPORTING
        purchaseorder = '8500000393'
      TABLES
        return        = return
        popartner     = popartner.
    LOOP AT return.
      WRITE / return-message.
    * Check error
      IF return-type = 'E' OR return-type = 'A'.
        error = 'X'.
      ENDIF.
    ENDLOOP.
    CHECK error IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    It works fine
    Max

  • BAPI_PO_CHANGE - Change Condition Value

    Hi,
    I want to change the Condition value for a particular Condition type using BAPI_PO_CHANGE.
    I am populating values for following
    Import parameters
    PURCHASEORDER
    POHEADER (Fields PO_NUMBER)
    POHEADERX (Fields PO_PO_NUMBER = X)
    Tables
    POITEM (Fields PO_ITEM, PLANT, STGE_LOC
    POITEMX (Field PO_ITEM, PO_ITEMX = X, PLANT = X, STGE_LOC= X)
    POCOND (Fields COND_TYPE, COND_VALUE, CURRENCY)
    POCONDX (Fields COND_TYPE = X, COND_VALUE = X, CURRENCY = X)
    But PO condition value is not getting changed...
    Regards,
    Balaji Viswanath.

    Hi,
    I got the answer from Naren's earlier post... Given the answer below...
    Hi,
    I believe you can use this BAPI to PO conditions..
    Check this code..
    PARAMETERS: p_ebeln LIKE ekko-ebeln.
    DATA: t_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
    DATA: t_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
    DATA: t_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    DATA: t_cond LIKE bapimepocond OCCURS 0 WITH HEADER LINE.
    DATA: t_condx LIKE bapimepocondx OCCURS 0 WITH HEADER LINE.
    t_poitem-po_item = '00010'.
    t_poitem-net_price = '17.00'.
    APPEND t_poitem.
    t_poitemx-po_item = '00010'.
    t_poitemx-net_price = 'X'.
    t_poitemx-po_itemx = 'X'.
    APPEND t_poitemx.
    t_cond-itm_number = '00010'.
    t_cond-cond_type = 'P000'.
    t_cond-cond_value = '17.00'.
    t_cond-currency = 'USD'.
    t_cond-change_id = 'U'.
    APPEND t_cond.
    t_condx-itm_number = '00010'.
    t_condx-itm_numberx = 'X'.
    t_condx-cond_type = 'X'.
    t_condx-cond_value = 'X'.
    t_condx-currency = 'X'.
    t_cond-change_id = 'X'.
    APPEND t_condx.
    CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
    purchaseorder = p_ebeln
    TABLES
    return = t_return
    poitem = t_poitem
    poitemx = t_poitemx
    pocond = t_cond
    pocondx = t_condx.
    COMMIT WORK.
    The above code works fine for me...
    Thanks,
    Naren

  • BAPI_PO_CHANGE: Email Message Output Not Sent (External Send)

    Hello,
    I'm hoping someone has seen this issue before.  In a Z-program within our ECC system, I am updating various fields via BAPI_PO_CHANGE and the changes are successfully saved and committed to the database.  When the output determination for the purchase order is "print", there are no problems - the print output occurs as expected based on the appropriate settings.  However, when I change a PO in the exact same way, but the output determination for the PO is "external send" (i.e. email) with the same fields etc... the messages are updated as having been generated, but the email is never sent from the system.  NAST shows the record of it as processed successfully as well.
    Does anyone have any idea why this might be occurring?
    Any help will be appreciated.
    Thanks in advance,
    Leslie

    Execute SCOT Transaction.
    FIrst
    From the Menu, View -> Node
    Expand the "SMTP" -> "INT" ->
    By default BASIS would have set it to your own company domain.
    The domain of the email address for example john.doe - at - yahoo - dot - com which is yahoo - dot - com should be listed in there.
    If it is not, then you have to work with your Basis team to set it up.
    Alternatively,
    From the Menu, View -> Routing
    You will see the list of domains it is restricted for.
    Second,
    Most emails coming from SAP get routed to your main email SMTP Server which is hosted using Microsoft Exchange.
    The emails from SAP get forwarded to this SMTP server for distribution.
    Check whether there is any filter or restriction setup for any emails coming from SAP.
    You may have to contact your Exchange Admins for this.
    Work with your Basis team to do it.
    Finally,
    Execute program RSCONN03 to do a routing test.
    Hope this helps.

Maybe you are looking for

  • Automated Report Generation fortnightly...

    Dear SAP Guru's We need to generate few Reports automatically and send the output in Excel format to few user's mailbox through job scheduling on fortnightly basis. How could we choose the fortnight period in job scheduling and data selection period

  • How to reconnect master files in recovered folder to Aperture

    Aperture 3 crashed and somehow it spit out all its master files and dumped them in a directory called 'Pictures Recovered Photos'. All files in Aperture show the 'Master Not Found' badge (arrow with yellow exclamation point triangle). How do I tell A

  • Please bring up The Cloud Server So I Can Print!

    Two days and missing print jobs is too much. In my eprintCenter it shows that my HP photosmart D110 printer is Connected <-----<<<<< is Ready.<-----<<<<< Two pending print jobs are shown. I did several refreshes it this stays the same. <---<<<< OK I

  • Adobe CS5 shortcuts undone in Mavericks

    Is it normal that in Mavericks "spacebar+command" doesn't zoom in anymore in Illustrator and Photoshop and most likely InDesign as well. Also turning items with shift holding, doesn't take the 45° and 90° anymore in Illustrator. I wonder if there are

  • My volumne goes off by itself on my nano...i reset it...still happening...what is the deal?

    I have an Ipod Nano 6th generation....the volumne fades out by itself while listening to music.  I press the volumne up button....and then it happens again.  I did a system restore...it is still happening.  Any help would be great!