How to change Service order quantity using BAPI/FM

Hi All,
Can any body tell me how to change the Service Order quantity (in IW32) using a FM or a BAPI.
I tried using the BAPI: BAPI_ALM_ORDER_MAINTAIN but I am unable to change the quantity. May be I might be missing some parameter. If anybody has done this please let me know the parameters that needs to be passed or if there is any other way out.
Points will be rewarded to useful answers!!
Thanks,
Susanth.

Hi!
I have used this BAPI.read the documentation properly and after calling this bapi call BAPI_TRANSACTION_COMMIT then only expected results com n get saved.
for ex:
call function 'BAPI_ALM_ORDER_MAINTAIN'
    tables
      it_methods              = itab_methods
      it_header               = itab_header
  IT_HEADER_UP            =
      it_header_srv           = itab_header_srv
  IT_HEADER_SRV_UP        =
      it_userstatus           = itab_userstatus
      it_partner              = itab_partner
  IT_PARTNER_UP           =
      it_operation            = itab_operation
  IT_OPERATION_UP         =
      it_relation             = itab_relation
  IT_RELATION_UP          =
      it_component            = itab_component
  IT_COMPONENT_UP         =
      it_objectlist           = itab_objectlist
  IT_OBJECTLIST_UP        =
      it_olist_relation       = itab_olist_relation
      it_text                 = itab_text
      it_text_lines           = it_text_lines
      it_srule                = itab_srule
  IT_SRULE_UP             =
      it_tasklists            = itab_tasklists
      extension_in            = itab_extension_in
      return                  = itab_return
      et_numbers              = itab_et_numbers
  call function 'BAPI_TRANSACTION_COMMIT'
   exporting
     wait          = 'X'
IMPORTING
  RETURN        =
reward points if helpful.

Similar Messages

  • Service order creation using bapi with repair order number

    Hi experts,
    Pls suggest me a BAPI to create a service order for those repair orders where a PGR has been done(for return delivery type : LR).
    The plant should be 0260 with storage location wh01 and item category ZRRE
    Creation of a service order with repair order type SM03 is not allowed in iw31.
    thanks and regards,
    Vijayb.

    Hi prakash,
    Thank u for the BAPI
    But an error is being displayed saying that the REFURBISHMENT ORDERS CANNOT BE PROCESSED USING BAPI.
    ERROR DURING PROCESSING OF BAPI METHODS.
    This is while u pass the order type as either ZM03 or SM01or SM02 or SM03.
    pls help me on that.
    thanks and regards,
    Vijayb.

  • How to create service PO while using BAPI

    Dear Experts
    I am getting error while creating Service PO using BAPI
    E 518
    No account assignment exists for service line 0000000010
    E 518
    No account assignment exists for service line 0000000010
    TYPES : BEGIN OF ty_header,
            po_no(10)   TYPE n,
            purch_org   TYPE bapimepoheader-purch_org,
            pur_group   TYPE bapimepoheader-pur_group,
            doc_type    TYPE bapimepoheader-doc_type,
            vendor      TYPE bapimepoheader-vendor,
            doc_date    TYPE bapimepoheader-doc_date,
            currency    TYPE bapimepoheader-currency,
            comp_code   TYPE bapimepoheader-comp_code,
            END OF ty_header,
            BEGIN OF ty_item,
            po_no(10)   TYPE n,                             " Internal Use
            po_item     TYPE bapimepoitem-po_item,
            acctasscat  TYPE bapimepoitem-acctasscat,
            short_text  TYPE bapimepoitem-short_text,
            plant       TYPE bapimepoitem-plant,
            pckg_no     TYPE bapimepoitem-pckg_no,
            stge_loc    TYPE bapimepoitem-stge_loc,
            quantity    TYPE bapimepoitem-quantity,
            po_unit     TYPE bapimepoitem-po_unit,
            po_price    TYPE bapimepoitem-po_price,
            net_price   TYPE bapimepoitem-net_price,
            price_unit  TYPE bapimepoitem-price_unit,
            orderpr_un  TYPE bapimepoitem-orderpr_un,
            delivery_date TYPE bapimeposchedule-delivery_date,              " bapimeposchedule
            matl_group  TYPE bapimepoitem-matl_group,
            tax_code    TYPE bapimepoitem-tax_code,
            END OF ty_item,
            BEGIN OF ty_service,
            po_no(10)   TYPE  n,                            " Internal Use
            po_item     TYPE  bapimepoitem-po_item,         " Internal Use
            pckg_no     TYPE  bapiesllc-pckg_no,
            line_no     TYPE  bapiesllc-line_no,
            ext_line    TYPE  bapiesllc-ext_line,
            outl_ind    TYPE  bapiesllc-outl_ind,
            subpckg_no  TYPE  bapiesllc-subpckg_no,
            serial_no   TYPE  bapiesklc-serial_no,           " bapiesklc
            short_text  TYPE  bapiesllc-short_text,
            quantity    TYPE  bapiesllc-quantity,
            base_uom    TYPE  bapiesllc-base_uom,
            gr_price    TYPE  bapiesllc-gr_price,
            matl_group  TYPE  bapiesllc-matl_group,
            END OF ty_service,
            BEGIN OF ty_poaccount,
            po_no(10)   TYPE n,                             " Internal Use
            po_item      TYPE bapimepoaccount-po_item,
            serial_no    TYPE bapimepoaccount-serial_no,
            gl_account   TYPE bapimepoaccount-gl_account,
            costcenter   TYPE bapimepoaccount-costcenter,
            asset_no     TYPE bapimepoaccount-asset_no,
            orderid      TYPE bapimepoaccount-orderid,
            END OF ty_poaccount.
    DATA : it_header TYPE TABLE OF ty_header,
           wa_header TYPE ty_header,
           it_item   TYPE TABLE OF ty_item,
           wa_item   TYPE ty_item,
           it_service TYPE TABLE OF ty_service,
           wa_service TYPE ty_service,
           it_account TYPE TABLE OF ty_poaccount,
           wa_account TYPE ty_poaccount.
    DATA : it_excel1 TYPE TABLE OF alsmex_tabline,
           wa_excel1 TYPE alsmex_tabline,
           it_excel2 TYPE TABLE OF alsmex_tabline,
           wa_excel2 TYPE alsmex_tabline,
           it_excel3 TYPE TABLE OF alsmex_tabline,
           wa_excel3 TYPE alsmex_tabline,
           it_excel4 TYPE TABLE OF alsmex_tabline,
           wa_excel4 TYPE alsmex_tabline.
    DATA : number TYPE string,
           number1 TYPE string.
    ********** BAPI**************
    CONSTANTS : c_x VALUE 'X'.
    *Structures to hold PO header data
    DATA : header LIKE bapimepoheader ,
           headerx LIKE bapimepoheaderx .
    *Internal Tables to hold PO ITEM DATA
    DATA : item LIKE bapimepoitem OCCURS 0 WITH HEADER LINE,
           itemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
    *Structures to hold PO schedule data
    DATA : itemschedule LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE ,
           itemschedulex LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE .
    *Structures to hold PO services data
    DATA : services LIKE bapiesllc OCCURS 0 WITH HEADER LINE .
    *Structures to hold PO (distrib.imputac.lín.servicios) data
    DATA : posrvaccessvalues LIKE bapiesklc OCCURS 0 WITH HEADER LINE .
    *Structures to hold PO account data
    DATA : account  LIKE bapimepoaccount OCCURS 0 WITH HEADER LINE ,
           accountx LIKE bapimepoaccountx OCCURS 0 WITH HEADER LINE .
    *Internal table to hold messages from BAPI call
    DATA : return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
           purchaseorder LIKE bapimepoheader-po_number.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : p_file1 TYPE rlgrap-filename OBLIGATORY,
                 p_brow1 TYPE i,
                 p_erow1 TYPE i.
    SELECTION-SCREEN : END OF BLOCK b1.
    SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS : p_file2 TYPE rlgrap-filename OBLIGATORY,
                 p_brow2 TYPE i,
                 p_erow2 TYPE i.
    SELECTION-SCREEN : END OF BLOCK b2.
    SELECTION-SCREEN : BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS : p_file3 TYPE rlgrap-filename OBLIGATORY,
                 p_brow3 TYPE i,
                 p_erow3 TYPE i.
    SELECTION-SCREEN : END OF BLOCK b3.
    SELECTION-SCREEN : BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
    PARAMETERS : p_file4 TYPE rlgrap-filename OBLIGATORY,
                 p_brow4 TYPE i,
                 p_erow4 TYPE i.
    SELECTION-SCREEN : END OF BLOCK b4.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = p_file1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file2.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = p_file2.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file3.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = p_file3.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file4.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = p_file4.
    START-OF-SELECTION.
      PERFORM excel_to_itab.
      PERFORM get_final.
    *&      Form  excel_to_itab
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM excel_to_itab .
    ************** Excel 1
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                      = p_file1
          i_begin_col                   = '1'
          i_begin_row                   = p_brow1
          i_end_col                     = '08'
          i_end_row                     = p_erow1
        TABLES
          intern                        = it_excel1
    * EXCEPTIONS
    *   INCONSISTENT_PARAMETERS       = 1
    *   UPLOAD_OLE                    = 2
    *   OTHERS                        = 3
      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 it_excel1  INTO wa_excel1.
        CASE wa_excel1-col.
          WHEN '0001'.
            wa_header-po_no = wa_excel1-value.
          WHEN '0002'.
            wa_header-purch_org = wa_excel1-value.
          WHEN '0003'.
            wa_header-pur_group = wa_excel1-value.
          WHEN '0004'.
            wa_header-doc_type = wa_excel1-value.
          WHEN '0005'.
            wa_header-vendor = wa_excel1-value.
          WHEN '0006'.
            wa_header-doc_date = wa_excel1-value.
          WHEN '0007'.
            wa_header-currency = wa_excel1-value.
          WHEN '0008'.
            wa_header-comp_code = wa_excel1-value.
        ENDCASE.
        AT END OF row.
          APPEND wa_header TO it_header.
          CLEAR wa_header.
        ENDAT.
      ENDLOOP.
    ************** Excel 2
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
          EXPORTING
            filename                      = p_file2
            i_begin_col                   = '1'
            i_begin_row                   = p_brow2
            i_end_col                     = '16'
            i_end_row                     = p_erow2
          TABLES
            intern                        = it_excel2
    * EXCEPTIONS
    *   INCONSISTENT_PARAMETERS       = 1
    *   UPLOAD_OLE                    = 2
    *   OTHERS                        = 3
      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 it_excel2 INTO wa_excel2.
        CASE wa_excel2-col.
          WHEN '0001'.
            wa_item-po_no = wa_excel2-value.
          WHEN '0002'.
            wa_item-po_item = wa_excel2-value.
          WHEN '0003'.
            wa_item-acctasscat = wa_excel2-value.
          WHEN '0004'.
            wa_item-short_text = wa_excel2-value.
          WHEN '0005'.
            wa_item-plant = wa_excel2-value.
          WHEN '0006'.
            wa_item-pckg_no  = wa_excel2-value.
          WHEN '0007'.
            wa_item-stge_loc = wa_excel2-value.
          WHEN '0008'.
            wa_item-quantity = wa_excel2-value.
          WHEN '0009'.
            wa_item-po_unit = wa_excel2-value.
          WHEN '0010'.
            wa_item-po_price = wa_excel2-value.
          WHEN '0011'.
            wa_item-net_price = wa_excel2-value.
          WHEN '0012'.
            wa_item-price_unit = wa_excel2-value.
          WHEN '0013'.
            wa_item-orderpr_un = wa_excel2-value.
          WHEN '0014'.
            wa_item-delivery_date  = wa_excel2-value.
          WHEN '0015'.
            wa_item-matl_group = wa_excel2-value.
          WHEN '0016'.
            wa_item-tax_code  = wa_excel2-value.
        ENDCASE.
        AT END OF row.
          APPEND wa_item TO it_item.
          CLEAR wa_item.
        ENDAT.
      ENDLOOP.
    ************** Excel 3
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
          EXPORTING
            filename                      = p_file3
            i_begin_col                   = '1'
            i_begin_row                   = p_brow3
            i_end_col                     = '13'
            i_end_row                     = p_erow3
          TABLES
            intern                        = it_excel3
    * EXCEPTIONS
    *   INCONSISTENT_PARAMETERS       = 1
    *   UPLOAD_OLE                    = 2
    *   OTHERS                        = 3
      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 it_excel3 INTO wa_excel3.
        CASE wa_excel3-col.
          WHEN '0001'.
            wa_service-po_no = wa_excel3-value.
          WHEN '0002'.
            wa_service-po_item = wa_excel3-value.
          WHEN '0003'.
            wa_service-pckg_no = wa_excel3-value.
          WHEN '0004'.
            wa_service-line_no = wa_excel3-value.
          WHEN '0005'.
            wa_service-ext_line = wa_excel3-value.
          WHEN '0006'.
            wa_service-outl_ind = wa_excel3-value.
          WHEN '0007'.
            wa_service-subpckg_no = wa_excel3-value.
          WHEN '0008'.
            wa_service-serial_no = wa_excel3-value.
          WHEN '0009'.
            wa_service-short_text = wa_excel3-value.
          WHEN '0010'.
            wa_service-quantity = wa_excel3-value.
          WHEN '0011'.
            wa_service-base_uom = wa_excel3-value.
          WHEN '0012'.
            wa_service-gr_price = wa_excel3-value.
          WHEN '0013'.
            wa_service-matl_group = wa_excel3-value.
        ENDCASE.
        AT END OF row.
          APPEND wa_service TO it_service.
          CLEAR wa_service.
        ENDAT.
      ENDLOOP.
    ************** Excel 3
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
          EXPORTING
            filename                      = p_file4
            i_begin_col                   = '1'
            i_begin_row                   = p_brow4
            i_end_col                     = '07'
            i_end_row                     = p_erow4
          TABLES
            intern                        = it_excel4
    * EXCEPTIONS
    *   INCONSISTENT_PARAMETERS       = 1
    *   UPLOAD_OLE                    = 2
    *   OTHERS                        = 3
      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 it_excel4 INTO wa_excel4.
        CASE wa_excel4-col.
          WHEN '0001'.
            wa_account-po_no  = wa_excel4-value.
          WHEN '0002'.
            wa_account-po_item  = wa_excel4-value.
          WHEN '0003'.
            wa_account-serial_no = wa_excel4-value.
          WHEN '0004'.
            wa_account-gl_account = wa_excel4-value.
          WHEN '0005'.
            wa_account-costcenter = wa_excel4-value.
          WHEN '0006'.
            wa_account-asset_no = wa_excel4-value.
          WHEN '0007'.
            wa_account-orderid  = wa_excel4-value.
        ENDCASE.
        AT END OF row.
          APPEND wa_account TO it_account.
          CLEAR wa_account.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " excel_to_itab
    *&      Form  GET_FINAL
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM get_final .
      LOOP AT it_header INTO wa_header.
    *  BAPI HEADER
        header-purch_org  = wa_header-purch_org.
        header-pur_group  = wa_header-pur_group.
        header-doc_type   = wa_header-doc_type.
        header-vendor     = wa_header-vendor.
        header-doc_date   = wa_header-doc_date.
        header-currency   = wa_header-currency.
        header-comp_code  = wa_header-comp_code.
    * BAPI HEADERX
        headerx-comp_code = c_x.
        headerx-doc_type = c_x.
        headerx-vendor = c_x.
        headerx-creat_date = c_x.
        headerx-created_by = c_x.
        headerx-purch_org = c_x.
        headerx-pur_group = c_x.
        headerx-langu = c_x.
        headerx-sales_pers = c_x.
        headerx-currency = c_x.
        headerx-doc_date = c_x.           " Added
        LOOP AT it_item INTO wa_item WHERE po_no = wa_header-po_no.
          CALL FUNCTION 'NUMBER_GET_NEXT'
             EXPORTING
               nr_range_nr                   = '01'
               object                        = 'SERVICE'
    *   quantity                      = '1'
    *   SUBOBJECT                     = ' '
    *   TOYEAR                        = '0000'
    *   IGNORE_BUFFER                 = ' '
              IMPORTING
              number                        =    number
    *   QUANTITY                      =
    *   RETURNCODE                    =
    * EXCEPTIONS
    *   INTERVAL_NOT_FOUND            = 1
    *   NUMBER_RANGE_NOT_INTERN       = 2
    *   OBJECT_NOT_FOUND              = 3
    *   QUANTITY_IS_0                 = 4
    *   QUANTITY_IS_NOT_1             = 5
    *   INTERVAL_OVERFLOW             = 6
    *   BUFFER_OVERFLOW               = 7
    *   OTHERS                        = 8
          IF sy-subrc <> 0.
    * Implement suitable error handling here
          ENDIF.
          item-po_item        =     wa_item-po_item.
          item-acctasscat     =     wa_item-acctasscat.
          item-item_cat       =     '9'.
          item-short_text     =     wa_item-short_text.
          item-plant          =     wa_item-plant.
          item-pckg_no        =     number.
          item-stge_loc       =     wa_item-stge_loc.
          item-quantity       =     wa_item-quantity.
          item-po_unit        =     wa_item-po_unit.
          item-po_price       =     wa_item-po_price.
          item-net_price      =     wa_item-net_price.
          item-price_unit     =     wa_item-price_unit.
          item-orderpr_un     =     wa_item-orderpr_un.
          item-matl_group     =     wa_item-matl_group.
          item-tax_code       =     wa_item-tax_code.
          APPEND item.
          CLEAR item.
          itemx-po_item = wa_item-po_item.
          itemx-item_cat =  c_x.
          itemx-po_itemx = c_x.
          itemx-short_text = c_x.
          itemx-quantity = c_x.
          itemx-tax_code = c_x.
          itemx-acctasscat = c_x.
          itemx-item_cat = c_x.
          itemx-matl_group = c_x.
          itemx-plant = c_x.
          itemx-trackingno = c_x.
          itemx-agreement = c_x.
          itemx-agmt_item = c_x.
          itemx-stge_loc = c_x.
          itemx-quantity = c_x.
          itemx-po_unit = c_x.
          itemx-conv_num1 = c_x.
          itemx-conv_den1 = c_x.
          itemx-net_price = c_x.
          itemx-price_unit = c_x.
          itemx-gr_pr_time = c_x.
          itemx-prnt_price = c_x.
          itemx-unlimited_dlv = c_x.
          itemx-gr_ind = c_x .
          itemx-ir_ind = c_x .
          itemx-gr_basediv = c_x .
          itemx-pckg_no = c_x.
          itemx-po_price = c_x.         " Added
          itemx-orderpr_un = c_x.         " Added
          APPEND itemx.
          CLEAR itemx.
          itemschedule-po_item = wa_item-po_item.
          itemschedule-del_datcat_ext = 'D'.
          itemschedule-delivery_date =  wa_item-delivery_date.
          APPEND itemschedule.
          CLEAR itemschedule.
          itemschedulex-po_item = wa_item-po_item.
          itemschedulex-po_itemx = c_x .
          itemschedulex-del_datcat_ext = c_x.
          itemschedulex-delivery_date = c_x .
          APPEND itemschedulex.
          CLEAR itemschedulex.
          LOOP AT  it_service INTO wa_service WHERE po_no = wa_item-po_no AND po_item = wa_item-po_item.
            IF  wa_service-outl_ind IS INITIAL.
    IF number1 IS INITIAL.
              CALL FUNCTION 'NUMBER_GET_NEXT'
                EXPORTING
                  nr_range_nr                   = '01'
                  object                        = 'SERVICE'
    *   quantity                      = '1'
    *   SUBOBJECT                     = ' '
    *   TOYEAR                        = '0000'
    *   IGNORE_BUFFER                 = ' '
                 IMPORTING
                 number                        =    number1
    *   QUANTITY                      =
    *   RETURNCODE                    =
    * EXCEPTIONS
    *   INTERVAL_NOT_FOUND            = 1
    *   NUMBER_RANGE_NOT_INTERN       = 2
    *   OBJECT_NOT_FOUND              = 3
    *   QUANTITY_IS_0                 = 4
    *   QUANTITY_IS_NOT_1             = 5
    *   INTERVAL_OVERFLOW             = 6
    *   BUFFER_OVERFLOW               = 7
    *   OTHERS                        = 8
              IF sy-subrc <> 0.
    * Implement suitable error handling here
              ENDIF.
              services-pckg_no      =  number.
              services-line_no      =  '1'.
              services-ext_line     =  '0'.
              services-outl_ind     =  'X'.
              services-subpckg_no   =  number1.
    *          services-short_text   =  wa_service-short_text.
    *          services-quantity     =  wa_service-quantity.
    *          services-base_uom     =  wa_service-base_uom.
    *          services-gr_price     =  wa_service-gr_price.
    *          services-matl_group   =  wa_service-matl_group.
              APPEND  services.
              CLEAR services.
    ENDIF.
    *        ELSE.
              services-pckg_no      =  number1.
              services-line_no      =  wa_service-line_no.
              services-ext_line     =  wa_service-ext_line.
    *          services-outl_ind     =  wa_service-outl_ind.
              services-subpckg_no   =  '0'.
              services-short_text   =  wa_service-short_text.
              services-quantity     =  wa_service-quantity.
              services-base_uom     =  wa_service-base_uom.
              services-gr_price     =  wa_service-gr_price.
              services-matl_group   =  wa_service-matl_group.
              APPEND  services.
              CLEAR services.
            ENDIF.
            IF wa_service-outl_ind IS INITIAL.
              posrvaccessvalues-pckg_no =  number1.
              posrvaccessvalues-line_no = wa_service-line_no.
              posrvaccessvalues-serno_line = '01'.
              posrvaccessvalues-serial_no = wa_service-serial_no.
    *          posrvaccessvalues-percentage = '100'.
              APPEND posrvaccessvalues . CLEAR posrvaccessvalues.
            ENDIF.
          ENDLOOP.
          LOOP AT it_account INTO wa_account WHERE po_no = wa_item-po_no AND po_item = wa_item-po_item.
            account-po_item         =       wa_account-po_item.
            account-serial_no       =       wa_account-serial_no.
            account-gl_account      =       wa_account-gl_account.
            account-costcenter      =       wa_account-costcenter.
            account-asset_no        =       wa_account-asset_no.
            account-orderid         =       wa_account-orderid.
            APPEND account.
            CLEAR account.
            accountx-po_item = wa_account-po_item.
            accountx-po_itemx = c_x .
            accountx-serial_no = wa_account-serial_no.
            accountx-serial_nox = c_x .
    *        accountx-creat_date = c_x .
            accountx-costcenter = c_x .
            accountx-gl_account = c_x .
    *        accountx-co_area = c_x .
    *        accountx-tax_code = c_x .
    *        accountx-asset_no        = c_x .   " Added
    *        accountx-orderid         = c_x .   " Added
            APPEND accountx. CLEAR accountx.
          ENDLOOP.
        ENDLOOP.
        CALL FUNCTION 'BAPI_PO_CREATE1'
          EXPORTING
            poheader          = header
            poheaderx         = headerx
    *       POADDRVENDOR      =
    *       TESTRUN           =
          IMPORTING
            exppurchaseorder  = purchaseorder
    *       EXPHEADER         =
    *       EXPPOEXPIMPHEADER =
          TABLES
            return            = return
            poitem            = item
            poitemx           = itemx
            poschedule        = itemschedule
            poschedulex       = itemschedulex
            poaccount         = account
            poaccountx        = accountx
            poservices        = services.
        posrvaccessvalues = posrvaccessvalues.
        IF purchaseorder IS NOT INITIAL.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.
        ENDIF.
        LOOP AT return.
          WRITE : / return-type, return-number, return-message.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " GET_FINAL

    Hi ganesh,
    Please look at the SAP note 376424 - BAPI_PO_CREATE1: Error messages for parked POs.
    Sap recommends to install the support service pack. Take a look at the note for detailed understanding.
    Also take a look at SAP NOte
    767284 - SE518 occurs although account assignment is supplied to BAPI (this requires Note 552114 must be applied as a prerequisite)
    Consider contacting basis team after your analysis about the issue.
    Regards,
    Sivaganesh

  • Changing the delivered quantity using  BAPI

    As  per the reqt,  for Internal customers  I m changing the delivered qty (LIPS-LFIMG) to a rounded quantity based on the KNMT-RDPRF(full box qty) value.
    I m passing the rounded quantity  to an BAPI_OUTB_DELIVERY_CHANGE , expecting it to change the delivery quantity value from the all the related delivery tables like the LIPS and others.
    But this BAPI is not functioning as desired, what might be the error and is there any other option by which which I can change  the deliverey quantity to an rounded qty in the field LIPS-LFIMG.
    Please help to resolve this.

    Hi Vishnu,
    At first I was surprised to see this question. We cannot change material number. Hence there are 2 options available:
    1) Create a copy of the material and change the material number to what you want at the time of creation of the new material by inserting code in the fm that generates a material number.
    2) use the field material_external to store the material number required. This field is available in the import parameter 'HEADDATA' of BAPI_MATERIAL_SAVEDATA.
    The second option should be better.
    Regards,
    Nimish

  • How to update Sales Order status using  BAPI_SALESORDER_CHANGE

    Hi,
    I want to update Sales Order status using BAPI_SALESORDER_CHANGE, this BAPI is called from middle ware, but there is no parameter to pass the status value to this function, please help me how to update sales order status using BAPI only.
    Thanks
    RK

    Hi,
    Can u give me details of what status u would like to update in sales order.
    If we are able to update the status from VA02, Then BAPI will assist for the same.
    Regards.

  • Change only material qunatity in sales order by using BAPI

    Hi All,
    How to change only the material quantity in existing sales order by using BAPI.
    Please help me in this regards.
    Regards
    Deekshitha.

    Hi
    See the sample code and do accordingly
    REPORT Z_SALES_ORDER_CHANGE
    NO STANDARD PAGE HEADING
    LINE-SIZE 132
    LINE-COUNT 65(0)
    MESSAGE-ID ZZ.
    TABLES: VBAP.
    DATA:
    V_FILEIN(90) TYPE C,
    V_RECIN TYPE I,
    V_RECVBAP TYPE I,
    V_RECORDER TYPE I,
    V_VBELN LIKE VBAP-VBELN,
    ORDERHEADERINX LIKE BAPISDH1X.
    DATA: BEGIN OF I_ORDERS OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    BRGEW(18) TYPE C,
    VOLUM(18) TYPE C,
    END OF I_ORDERS.
    DATA: BEGIN OF I_OUTPUT OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    GEWEI LIKE VBAP-GEWEI,
    BRGEW LIKE VBAP-BRGEW,
    VOLUM LIKE VBAP-VOLUM,
    CKWGT TYPE C,
    CKVOL TYPE C,
    END OF I_OUTPUT.
    DATA: BEGIN OF ORDERITEMIN OCCURS 0.
    INCLUDE STRUCTURE BAPISDITM.
    DATA: END OF ORDERITEMIN.
    DATA: BEGIN OF ORDERITEMINX OCCURS 0.
    INCLUDE STRUCTURE BAPISDITMX.
    DATA: END OF ORDERITEMINX.
    DATA: BEGIN OF RETURN OCCURS 0.
    INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF RETURN.
    DATA: BEGIN OF BAPIRETURN OCCURS 0.
    INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF BAPIRETURN.
    PARAMETERS:
    P_PATH(45) TYPE C DEFAULT '/usr/users/ftpsapom/' LOWER CASE,
    P_FNAME(32) TYPE C DEFAULT '/sweetjo.txt' LOWER CASE.
    START-OF-SELECTION.
    CONCATENATE PATH AND FILE NAME INTO ONE VARIABLE
    CONCATENATE P_PATH P_FNAME INTO V_FILEIN.
    OPEN DATASET
    IF V_FILEIN IS INITIAL.
    MESSAGE E002 WITH 'FILE' V_FILEIN 'DOES NOT CONTAIN ANY DATA!'.
    ELSE.
    OPEN DATASET V_FILEIN
    FOR INPUT
    IN TEXT MODE.
    IF SY-SUBRC = 0.
    READ DATASET
    DO.
    READ DATASET V_FILEIN INTO I_ORDERS.
    IF SY-SUBRC = 0.
    APPEND I_ORDERS.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    CLOSE DATASET
    CLOSE DATASET V_FILEIN.
    IF SY-SUBRC <> 0.
    MESSAGE E002 WITH 'ERROR - CLOSING' V_FILEIN.
    ENDIF.
    ELSE.
    MESSAGE E002 WITH 'ERROR - COULD NOT OPEN' V_FILEIN.
    ENDIF.
    ENDIF.
    SORT AND REMOVE DUPLICATES FROM I_ORDERS
    SORT I_ORDERS BY VBELN POSNR.
    DELETE ADJACENT DUPLICATES FROM I_ORDERS.
    POPULATE I_OUTPUT
    LOOP AT I_ORDERS.
    SHIFT I_ORDERS-POSNR LEFT DELETING LEADING SPACE.
    CONCATENATE '0' I_ORDERS-POSNR INTO I_ORDERS-POSNR.
    SELECT SINGLE BRGEW VOLUM
    FROM VBAP
    INTO (VBAP-BRGEW, VBAP-VOLUM)
    WHERE VBELN = I_ORDERS-VBELN
    AND POSNR = I_ORDERS-POSNR.
    IF SY-SUBRC = 0.
    IF VBAP-BRGEW = 0.
    I_OUTPUT-CKWGT = 'X'.
    ENDIF.
    IF VBAP-VOLUM = 0.
    I_OUTPUT-CKVOL = 'X'.
    ENDIF.
    I_OUTPUT-VBELN = I_ORDERS-VBELN.
    I_OUTPUT-POSNR = I_ORDERS-POSNR.
    I_OUTPUT-GEWEI = 'ST'.
    I_OUTPUT-BRGEW = I_ORDERS-BRGEW.
    I_OUTPUT-VOLUM = I_ORDERS-VOLUM.
    APPEND I_OUTPUT.
    CLEAR: I_OUTPUT.
    ENDIF.
    V_RECIN = V_RECIN + 1.
    ENDLOOP.
    POPULATE BAPI DATA AND RUN BAPI
    CLEAR: ORDERHEADERINX, ORDERITEMIN, ORDERITEMINX,
    RETURN, BAPIRETURN.
    REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
    ORDERHEADERINX-UPDATEFLAG = 'U'.
    LOOP AT I_OUTPUT WHERE CKWGT = 'X' OR CKVOL = 'X'.
    V_RECVBAP = V_RECVBAP + 1.
    IF I_OUTPUT-VBELN <> V_VBELN AND SY-TABIX <> 1.
    V_RECORDER = V_RECORDER + 1.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    SALESDOCUMENT = V_VBELN
    ORDER_HEADER_INX = ORDERHEADERINX
    TABLES
    RETURN = RETURN
    ORDER_ITEM_IN = ORDERITEMIN
    ORDER_ITEM_INX = ORDERITEMINX.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = 'X'
    IMPORTING
    RETURN = BAPIRETURN.
    WRITE OUT RETURN
    LOOP AT RETURN.
    WRITE: / RETURN.
    ENDLOOP.
    WRITE: / BAPIRETURN.
    SKIP.
    CLEAR: ORDERITEMIN, ORDERITEMINX,
    RETURN, BAPIRETURN.
    REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
    ENDIF.
    ORDERITEMIN-ITM_NUMBER = I_OUTPUT-POSNR.
    ORDERITEMIN-UNTOF_WGHT = I_OUTPUT-GEWEI.
    IF NOT I_OUTPUT-CKWGT IS INITIAL.
    ORDERITEMIN-GROSS_WGHT = I_OUTPUT-BRGEW.
    ORDERITEMINX-GROSS_WGHT = 'X'.
    ENDIF.
    IF NOT I_OUTPUT-CKVOL IS INITIAL.
    ORDERITEMIN-VOLUME = I_OUTPUT-VOLUM.
    ORDERITEMINX-VOLUME = 'X'.
    ENDIF.
    APPEND ORDERITEMIN.
    ORDERITEMINX-ITM_NUMBER = I_OUTPUT-POSNR.
    ORDERITEMINX-UNTOF_WGHT = 'X'.
    ORDERITEMINX-UPDATEFLAG = 'U'.
    APPEND ORDERITEMINX.
    V_VBELN = I_OUTPUT-VBELN.
    ENDLOOP.
    RUN BAPI ON LAST ORDER
    IF NOT ORDERITEMIN IS INITIAL.
    V_RECORDER = V_RECORDER + 1.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    SALESDOCUMENT = V_VBELN
    ORDER_HEADER_INX = ORDERHEADERINX
    TABLES
    RETURN = RETURN
    ORDER_ITEM_IN = ORDERITEMIN
    ORDER_ITEM_INX = ORDERITEMINX.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = 'X'
    IMPORTING
    RETURN = BAPIRETURN.
    WRITE OUT RETURN
    LOOP AT RETURN.
    WRITE: / RETURN.
    ENDLOOP.
    WRITE: / BAPIRETURN.
    SKIP.
    ENDIF.
    WRITE OUT RECORD COUNT FROM FILE
    WRITE: / 'RECORD COUNT FROM FILE ', V_RECIN.
    SKIP.
    WRITE OUT RECORD COUNT FROM FILE
    WRITE: / 'RECORD COUNT OF LINES TO CHANGE ', V_RECVBAP.
    SKIP.
    WRITE OUT RECORD COUNT FROM FILE
    WRITE: / 'RECORD COUNT OF ORDERS TO CHANGE ', V_RECORDER.
    SKIP.
    TOP OF PAGE
    TOP-OF-PAGE.
    WRITE:/1(5) TEXT-H01, 6(8) SY-DATUM MM/DD/YY,
    100(8) TEXT-H02, 126(8) SY-PAGNO.
    WRITE:/1(5) TEXT-H03, 6(8) SY-UZEIT USING EDIT MASK '__:__:__',
    20(77) TEXT-H04,
    100(8) TEXT-H05, 108(25) SY-REPID.
    WRITE:/1(6) TEXT-H06, 8(12) SY-UNAME,
    20(4) TEXT-H07, 25(32) SY-HOST,
    100(13) TEXT-H08, 121(8) SY-SYSID,
    129 '/', 130(3) SY-MANDT.
    ULINE.
    SKIP.
    Reward points if useful
    Regards
    Anji

  • How to change page order in Acrobat Porfolio?

    How to change page order in Acrobat Porfolio? In older versions it use to be much easier to drag and drop the page order. I don't see any menu options on arranging the pag order. Any ideas? Thanks.
    I would post a screenshot but they have been disabled on these forums.

    You should ask in the Reader forum. But my guess is that Reader there is nothing you can do. Acrobat allows you to move pages around, but not Reader.

  • How to change to order of sorter

    If I use Move up/down column
    the list page will order by ascending by the sort field, that mean the latest data will be in the last page, therefore I want to change the order
    I found some code seems related to the sort function
    $tso_listdrama_ship_main1 = new TSO_TableSorter("rsdrama_ship_main1", "tso_listdrama_ship_main1");
    $tso_listdrama_ship_main1->addColumn("drama_ship_main.sm_sort DESC"); // Order column
    $tso_listdrama_ship_main1->setDefault("drama_ship_main.sm_sort DESC");
    $tso_listdrama_ship_main1->Execute();
    // Defining List Recordset variable
    $NXTSort_rsdrama_ship_main1 = "drama_ship_main.sm_sort DESC";
    if (isset($_SESSION['sorter_tso_listdrama_ship_main1'])) {
      $NXTSort_rsdrama_ship_main1 = $_SESSION['sorter_tso_listdrama_ship_main1'];
    I add DESC after all the sort field, but it's not work.

    Hi Jason,
    How to change the order of tables within sheets
    Make a table active by clicking in it once to select that table, then drag it by the 'bullseye' (top left, I have placed a red circle to show the bullseye):
    After dragging the table down:
    Table 1 is now below Table 2.
    The blue line is an Alignment Guide
    Two types of Guide:
    1. Menu > View >Show Rulers. Drag Alignment Guides from a ruler to where you want them.
    2. Menu > Numbers > Preferences > Rulers > Alignment Guides. Turn on (tick) both guides. That allows you to align objects with *each other* (as well as with the ruler guides). These guides help to align objects left, middle, right, top, bottom.
    Alignment Guides do not show unless you are moving an object.
    to drag/move table to another sheet in the one file
    Not possible in Numbers 3. The Sheets Pane has gone. Instead, select the entire table (click once in the table to make it active, then click on the bullseye). Copy (or Cut if you are brave). Go to another Sheet and Paste.
    Also can you change the size of sheet tab width on tab toolbar, so I can see more sheets at once??
    No. Let's hope this will be added in future updates. However, you can drag a Sheet tab left or right to reorder them.
    Another tip: each Sheet tab shows the contents of that Sheet, with some options such as Duplicate and Delete:
    Regards,
    Ian.

  • Sb CS4 multi-track file how to change track order

    I can't figure out how to change the order of the tracks in my multi-track file. Can anybody advise? Thanks.

    Thanks for checking. BTW are you using CS4 or CS5? I wonder if that has been added in the new version. I might install the trial version to see.

  • Creating Service entry sheet using bapi  BAPI_ENTRYSHEET_CREATE

    Hello Guys,
    I  am trying to create a service entry sheet for single line item only using bapi  BAPI_ENTRYSHEET_CREATE.
    its is creating Service entry document but not populating the line item  for me (here only one line item for me).
    If you guys have sample code (how the poupulate the internal tables)  could you please send it across?.
    Thanks in Advance..
    Steevan

    Hi,
    Creating Service entry sheet using bapi  BAPI_ENTRYSHEET_CREATE
    For creating service entry sheet follow below link and it helps to you.
    http://wiki.sdn.sap.com/wiki/display/ABAP/CreatingServiceEntrySheetusing+BAPI
    Regards,
    Sekhar

  • Unable to change the order quantity value during save of sales order

    Hi Experts,
    There is a need to change the order quantity value, based on some conditions, when pressed 'ENTER' or during 'SAVE' of the sales order (VA01, VA02).
    We are trying to change the order quantity value (KWMENG) in table XVBAP in the subroutines userexit_field_modification, userexit_save_document and userexit_save_document_prepare of the user exit 'MV45AFZZ'. But the change is not replicated to field on GUI.
    The order quantity value can be changed in subroutine 'userexit_move_field_to_vbap', but the subroutine is not getting triggered when user changes only the order quantity on screen.
    Please help us in resolving this issue.
    Regards,
    Santosh

    Thanks for your time guys. The issue is resolved.
    SAP is not triggering the vbap user exit as the order quantity on screen is in structure RV45A.
    There are two ways of resolving the issue.
    1. Implement the SAP note #513342 - Quantity change and USEREXIT_MOVE_FIELD_TO_VBAP. But, it is SAP modification note.
    2. Write the code in VBEP exit of MV45AFZZ. This user exit is called whenever the order quantity is changed. But, it is called multiple times in some cases. Hence, need to write code to limit our code execution only once e.g. maintain a global table with our quantity & uom. Check when the quantity and uom in our table is same as quantity on screen. If not, exit from user-exit.
    Edited by: Santosh Kacham on Nov 11, 2011 6:37 AM

  • How to change purchase order's cost center in batch

    Dear all :
    how to change purchase order's cost center in batch?

    Dear Manish :
    thanks so much for you reply.
    the filed which i wanted to change it's content is cost center (KOSTL) in table EKKN.
    i couldn't find it in this t-code when i select fields.

  • Reena Prabhakar - Sales order creation Using BAPI

    Hi Reena,
    This is Dinesh,i also face problem in Sales order creation using BAPI if you can send me the code it would be great help to me.
    Regards,
    Dinesh

    Anyhow, here is the code that I am using currently which works perfectly well. Not sure if it will be of any help to you, since the values to the BAPI come from the Webdynpro application. I have values stored in my "Test data directory" which I use for testing from the backend.
    FUNCTION ztest.
    Call the BAPI to create Sales Order
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
          order_header_in     = l_order_header
        IMPORTING
          salesdocument       = l_salesdocument
        TABLES
          return              = it_return
          order_items_in      = it_order_items
          order_partners      = it_order_partners
          order_schedules_in  = it_order_schdl
          order_conditions_in = it_order_conditions
          order_text          = it_order_text.
      READ TABLE it_return WITH KEY type = 'E'.
      IF sy-subrc = 0.
    *-- error occured
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      ELSE.
    *-- no error
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.
    ENDFUNCTION.

  • Need sales order creation using bapi in oops

    need code for sales order creation using bapi in oops

    hi rocky,
              could you pls give a bit explanation on what you are expecting.
    regards,
    Pavan

  • Mass sales order creation using BAPI

    Dear All,
    Can anyone help in  mass sales order creation using Bapi BAPI_SALESORDER_CREATEFROMDAT2.
    For example if i want to create 3 sales order with three item per order . i am populating
    HEADER = 3 Records
    Item   = 9 records
    schedule = 9 records
    partner  = 1 record.
    Then after populating the records I am calling Bapi BAPI_SALESORDER_CREATEFROMDAT2
    to create order. It should have created three order but unfortunately it creates
    only one sales order. I debugged and found that records are correct both in header,
    item, scheudle and partners.
    Could you please guide me what I am missing for creation of mass orders.
    I appreciate your time and many thanks in advance.
    cheers
    chandra

    Hi Chandra,
    Do like this.
    Loop at Header table into wa_header.
    *-- Move BAPI Header data
    Loop at item table into wa_item where condition.
    *--  in this move all Item and Schedule line item  to the BAPI.
      At end of item .
    Use the below function modules.
    BAPI_SALESORDER_CREATEFROMDAT2
    BAPI_TRANSACTION_COMMIT.
    Endloop.
    Endloop.
    Regards,
    Balavardhan.K

Maybe you are looking for

  • New Infinity 2 Customer

    Hi. I have had Infinity 2 connected since 10th May.  I understand it takes 10 days for the connection speed to stabilize. The system should try different speeds as it did when I first had fibre.  Speeds were as high as 20Mbps before we had a consista

  • I lost all of the contacts and photos on my iPhone after accidentally restoring it to my iPod's data, is there a way to get back that info?

    I just got a new iPhone and it had not been backed up on my computer until now.  Are the contacts saved elsewhere?  It seems as though all of the stuff saved on my iPhone has been replaced with all of the stuff saved on my iPad touch, even the tabs I

  • Close Tab

    I'm working on a Web Page and was wondering if it is possible to close the current tab in IE, or Firefox, using a Exit button and Action script? Something so the user wouldn't have to go up and click the X in the upper right corner.

  • How do I get rid of error message when I try to delete an email in MAIL?

    In MAIL, in only one of my 4 email account inboxes, when I try to delete or move an email to Trash, I get the following error message: "The destination mailbox "(null)" does not allow messages to be moved to it."  How do I rectify this?

  • Mac Hard Drive problems

    So recently My Macbooks hard drive crashed so I was forced to buy a new one but I don't have an OS disk and I don't think the laptop came with one. Am I just screwed or would mac support give me another cd of the same version my compture came with? I