cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with BAPI_ALM_ORDER_MAINTAIN

Former Member
0 Kudos
1,539

Hi,

I need to change the Functional location in an order according to the corresponding updation of the equipment's functional location.

I am using BAPI_ALM_ORDER_MAINTAIN to do this but it is not working. It works some time and doesnt work sometimes.

I have used commit work and Buffer_refresh_all to clear the buffers before the BAPI . But still the order is not getting updated.

Following is my code snippet.


****Update the equipment 

    CALL FUNCTION 'BAPI_EQUI_INSTALL'
      EXPORTING
        equipment    = gs_relocate_mem-equnr
        data_install = ls_install
      IMPORTING
        return       = gs_return3.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait   = gc_x


****Update the order

    ls_methods-objecttype = gc_header .
    ls_methods-method = gc_change .
    ls_methods-objectkey = gs_relocate_mem-aufnr.
    APPEND ls_methods TO lt_methods.
    CLEAR ls_methods.
    ls_methods-refnumber = 1.
    ls_methods-objecttype = ''.
    ls_methods-method = gc_save.
    ls_methods-objectkey = ''.
    APPEND ls_methods TO lt_methods.
    CLEAR ls_methods.
    ls_header1-orderid = gs_relocate_mem-aufnr.
    ls_header1-order_type = gc_zpt2.
    ls_header1-funct_loc = lv_tplnr.
    ls_header1-equipment =gs_relocate_mem-equnr
    APPEND ls_header1 TO lt_header1.
    CLEAR ls_header1.
    ls_header_update1-orderid = gs_relocate_mem-aufnr.
    ls_header_update1-funct_loc = gc_x.
    ls_header_update1-equipment = gc_x.
    APPEND ls_header_update1 TO lt_header_update1.
    CLEAR ls_header_update1.
    CALL FUNCTION 'BUFFER_REFRESH_ALL'.
    CALL FUNCTION 'CO_ZF_DATA_RESET_COMPLETE'
      EXPORTING
        i_no_ocm_reset = ' '
        i_status_reset = 'X'.
    REFRESH gt_return4.
    CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
      TABLES
        it_methods   = lt_methods
        it_header    = lt_header1
        it_header_up = lt_header_update1
        return       = gt_return4.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait   = gc_x

Edited by: Deepti Vohra on Jan 5, 2011 9:25 AM

View Entire Topic
former_member778253
Active Participant
0 Kudos

Hi

Once check the BAPI documentation... and also check whether you are passing all the required data to the BAPI function module or not...