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

Similar Messages

  • How to create the sales order using BAPI's ....?

    Hi Guru's,
    could you please provide how to create the sales order using BAPI's .....i need step by step process and please provide the details from scratch....basically  i don't have basic knowledge on this....please provide required inputs ....:)
    thanks in advance
    Srinivas......

    Hi Guru's thanks for your inouts and your valuble time...
    please find the program logic below...
    *& Report  ZAREPAS30
    REPORT  zarepas30.
    DATA : gs_vbeln                   TYPE  vbak-vbeln,
           gs_order_header_in         TYPE  bapisdhd1,
           gs_order_header_inx        TYPE  bapisdhd1x,
           gt_order_items_in          TYPE  STANDARD TABLE OF bapisditm,
           gwa_itab1                  TYPE  bapisditm,
           gt_order_items_inx         TYPE  STANDARD TABLE OF bapisditmx,
           gwa_itab2                  TYPE  bapisditmx,
           gt_order_partners          TYPE  STANDARD TABLE OF bapiparnr,
           gwa_itab3                  TYPE  bapiparnr,
           gt_return                  TYPE  STANDARD TABLE OF bapiret2,
           gwa_itab4                  TYPE  bapiret2.
    Sales document type
      PARAMETERS: p_auart TYPE auart OBLIGATORY.
    Sales organization
      PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    Distribution channel
      PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    Division.
      PARAMETERS: p_spart TYPE spart OBLIGATORY.
    Requested Delivery Date
      PARAMETERS: p_edatu  TYPE edatu OBLIGATORY.
    Sold-to
      PARAMETERS: p_sold  TYPE kunnr OBLIGATORY.
    Ship-to
      PARAMETERS: p_ship  TYPE kunnr OBLIGATORY.
    Material
      PARAMETERS: p_matnr TYPE matnr   OBLIGATORY.
    Quantity.
      PARAMETERS: p_menge TYPE kwmeng  OBLIGATORY.
    Plant
      PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    Start-of-selection.
      START-OF-SELECTION.
    Header data
    Sales document type
      gs_order_header_in-doc_type = p_auart.
      gs_order_header_inx-doc_type = 'X'.
    Sales organization
      gs_order_header_in-sales_org = p_vkorg.
      gs_order_header_inx-sales_org = 'X'.
    Distribution channel
      gs_order_header_in-distr_chan  = p_vtweg.
      gs_order_header_inx-distr_chan = 'X'.
    Division
      gs_order_header_in-division = p_spart.
      gs_order_header_inx-division = 'X'.
    Reguested Delivery Date
      gs_order_header_in-req_date_h = p_edatu.
      gs_order_header_inx-req_date_h = 'X'.
      gs_order_header_inx-updateflag = 'I'.
    Partner data
    Sold to
      gwa_itab3-partn_role = 'AG'.
      gwa_itab3-partn_numb = p_sold.
      APPEND gwa_itab3 TO  gt_order_partners .
    ship to
      gwa_itab3-partn_role = 'WE'.
      gwa_itab3-partn_numb = p_ship.
      APPEND gwa_itab3 TO  gt_order_partners .
    ITEM DATA
      gwa_itab2-updateflag = 'I'.
    Line item number.
      gwa_itab1-itm_number = '000010'.
      gwa_itab2-itm_number = 'X'.
    Material
      gwa_itab1-material = p_matnr.
      gwa_itab2-material = 'X'.
    Plant
      gwa_itab1-plant    = p_plant.
      gwa_itab2-plant   = 'X'.
    Quantity
      gwa_itab1-target_qty = p_menge.
      gwa_itab2-target_qty = 'X'.
      APPEND gwa_itab1 TO gt_order_items_in.
      APPEND gwa_itab2 TO gt_order_items_inx.
    Line item number.
      gwa_itab1-itm_number = '000020'.
      gwa_itab2-itm_number = 'X'.
    Material
      gwa_itab1-material = p_matnr.
      gwa_itab2-material = 'X'.
    Plant
      gwa_itab1-plant    = p_plant.
      gwa_itab2-plant   = 'X'.
    Quantity
      gwa_itab1-target_qty = p_menge.
      gwa_itab2-target_qty = 'X'.
      APPEND gwa_itab1 TO gt_order_items_in.
      APPEND gwa_itab2 TO gt_order_items_inx.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
        order_header_in               = gs_order_header_in
        ORDER_HEADER_INX              = gs_order_header_inx
      IMPORTING
        SALESDOCUMENT                 = gs_vbeln
      tables
        RETURN                        = gt_return
        ORDER_ITEMS_IN                = gt_order_items_in
        ORDER_ITEMS_INX               = gt_order_items_inx
        order_partners                = gt_order_partners.
    Check the return table.
      LOOP AT gt_return into gwa_itab4 WHERE type = 'E' OR type = 'A'.
        EXIT.
      ENDLOOP.
      IF sy-subrc = 0.
        WRITE: / 'Error occured while creating sales order '.
      ELSE.
    Commit the work.
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        WRITE: / 'Document ', gs_vbeln, ' created'.
      ENDIF.

  • 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

  • How to handle  user exits while using BAPI

    HI experts can any one help me on how to handle user exits while using BAPI. Do we need to handle it explicitly or standard  BAPI will take care of it??.
    Regards,
    Hari Krishna

    If you have added some fields using append structures for screen enhancements, then you have to use appropriate user exits to fill these data while calling BAPI.  Some BAPIs have EXTENSION structures to fill the custom data which can be processed using user exists or enhancements.
    Regards
    Vinod

  • Create Service entry sheet using BAPI in SAP

    Hi
    Experts,
    Scenario : SES will be created in third party system , once it created, txt file will be generated and placed in their server.We will be writing a program
    to pick that file and post SES in ECC using BAPI ( Idoc is not available to create SES i believe).
    I will be using BAPI_ENTRYSHEET_CREATE to create SES sheet but we dont have service masters and creating unplanned service entry sheet.
    I will be checking by passing the values manually in BAPI to create SES.
    I am passing PO no, line no and qty, value and other details to create SES.
    It is creating SES with only header data. it is not updating line item details.
    I am missing some parameters to be passed to create SES using BAPI I feel.
    I need your help to create SES using BAPI.
    What are the details to be passed to create SES in SAP using BAPI.
    Regards,
    Suresh.A

    Did you not search? Google has 3600 hits for BAPI_ENTRYSHEET_CREATE
    the second hit is a wiki from SCN with sample coding
    the third hit  has a link to a OSS note with a promising title 420334 - BAPI_ENTRYSHEET_CREATE: Model for creation

  • How to create a sales order using bapi

    hi
        i need to create a sales order using bapi.
    can any one help me

    Do NOT USE BAPI_SALESORDER_CREATEFROMDATA, that FM is obsolete!
    Use BAPI_SALESORDER_CREATEFROMDAT1 .
    To build a reference to your contract you have to supply ORDER_HEADER_IN.
    Here´s a sample:
    MOVE:
    gs_vbak-vbeln TO ls_bapisdhd1-refobjkey,
    gs_vbak-vbeln TO ls_bapisdhd1-ref_doc,
    gs_vbak-vbtyp TO ls_bapisdhd1-refdoc_cat,
    gs_vbak-auart TO ls_bapisdhd1-refdoctype.
    also gothrouh the links
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2b-%2bsimple%2bprogram%2bto%2bcreate%2bsales%2border%2busing%2bbapi

  • How to create open sales order using BAPI....?

    Hi Guru's,
    please help me how to create open sales order and which BAPI i have to use for open sales order.
    please provide any program logic related to this or step by step process.....
    that would be helpful to me.
    thanks in advance...
    Srinivas....

    Hi sreenu,
    Open PO or Open sales order means that the complete cycle is not complete. That means the Sales order is not completely delievered or is not billed or is not paid for. Only once the cycle is completed the order status shows as complete untill then its Open.
    You can use VA05 to find open sales orders.
    Similarlry open PO's are those PO's whos inbound delivery is not complete or whos goods receipt is not complete and whos payment is not done to the vendor
    U cannot directly find the open PO and open SO from any table.
    That u have to calculate from the status of the PO and SO and then check wheteher that is complete or not.
    U have table VBUP for SO status.Check out the fields in that table
    pls see the below link.
    http://abaplovers.blogspot.com/2008/02/bapi-sales-order-create-code.html
    http://msdn.microsoft.com/en-us/library/cc185190.aspx
    thjanks
    karthik

  • How to create Incoming Email Activity using BAPI or Function module

    To create an Incoming Email Activity using BAPI 'BAPI_ACTIVITYCRM_CREATEMULTI' or using 'CRM_ORDER_MAINTAIN' . what parameters i need to pass to a bapi.
    Suggest me with a solution.
    Regards,
    Sanjani

    For activity you must fill the following structures of 'CRM_ORDER_MAINTAIN'...
      CALL FUNCTION 'CRM_ORDER_MAINTAIN'
        EXPORTING
          it_activity_h             = t_activity_h
          iv_collect_exceptions = ''
        CHANGING
          ct_orderadm_h         = t_orderadm_h
          ct_input_fields       = t_input_fields
        EXCEPTIONS
          error_occurred        = 1
          document_locked       = 2
          no_change_allowed     = 3
          no_authority          = 4
          OTHERS                = 5.
    And at the end you must use also 'CRM_ORDER_SAVE' to performe the save.
    Regards.

  • How to create 'service confirm order' through bapi?

    I want to create service confirm order,
    pls help me some bapi

    Yudomg
       Try this BAPI: <b>BAPI_BUSPROCESSND_CREATEMULTI</b>
    Thanks
    Jack
    <b>Allot points if mys post helps !!!!!</b>

  • 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.

  • How to create an inbound delivery using BAPI/FM?

    Hello,
    I am looking for a BAPI/FM to create only Inbound delivery. Pleace help me on this.
    Thanks and appreciate your help
    Thanks,
    Amrutha.

    Hi,
    We succeeded to do something similar.
    We needed to create an inbound based on invoice data, with refference to items from multiple PO.
    We used FM BBP_INB_DELIVERY_CREATE, combined with enhancement of ME_CONFIRMATION_VIA_EDI for using MARA- MATNR instead of
    mara-ematn (standard logic of SAP for vendor ASN).
    In this enhancement we filled also fields:
    t_kom-vornu = t_data-belnr. "invoice number as precendent document
    t_kom-bolnr = t_data-bolnr. "bill of ladding
    t_kom-traty = t_data-trans_cat. "transport type.
    Also we had to use customizing to not display warning related to different delivery date.
    Kind regards,
    Valentina

  • Creating a sales document using BAPI in web dynpro by uploading a file

    Hi ALL,
    Can some one help me how to create a sales document using  BAPI by uploading a file as input...Can someone  provide me a sample program....
    Thanks n Regards,
    Praveenn.
    Edited by: praveenn on Aug 23, 2011 12:42 PM

    Hi Sri,
    Thx for the response...
    Here is the code that i followed for creating a BAPI_SALESORDER_CREATE1 by uploading a text file as input.
    Just create a Attribute  in the VIEW CONTEXT of type String.
    method ONACTIONCREATE_SO .
    types : Begin of ty_data,
             sales_org  type vkorg,
             doc_type   type AUART,
             DISTR_CHAN type VTWEG,
             DIVISION   type spart,
             material   type matnr,
             partn_role type PARVW,
             PARTN_NUMB type kunnr,
           end of ty_data.
      DATA  :it_table TYPE  TABLE OF ty_data,
             i_data   TYPE  TABLE OF string,
             l_string TYPE string,
             wa_table TYPE ty_Data,
             l_xstring TYPE xstring,
             fields TYPE string_table,
             lv_field TYPE string.
    DATA: wa_order_header_in TYPE BAPISDHD1,
          it_order_items_in  TYPE TABLE OF BAPISDITM,
          wa_order_items_in  TYPE BAPISDITM,
          it_order_partners  TYPE TABLE OF BAPIPARNR,
          wa_order_partners  TYPE BAPIPARNR,
          it_return TYPE TABLE OF BAPIRET2,
          wa_return TYPE BAPIRET2.
    DATA : sales_doc type bapivbeln-vbeln.
    DATA:
       node_zfinal_node  TYPE REF TO if_wd_context_node,
       elem_zfinal_node  TYPE REF TO if_wd_context_element,
       stru_zfinal_node  TYPE if_main_view=>element_zfinal_node .
    get single attribute
      wd_context->get_attribute(
      EXPORTING
      name =  'DATASOURCE'
      IMPORTING
      value = l_xstring ).
      CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
        EXPORTING
          in_xstring = l_xstring
        IMPORTING
          out_string = l_string.
    SPLIT l_string  AT cl_abap_char_utilities=>newline INTO TABLE i_data.
      LOOP AT i_data INTO l_string.
       SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
        READ TABLE fields INTO lv_field INDEX 1.
        wa_table-sales_org = lv_field.
        READ TABLE fields INTO lv_field INDEX 2.
        wa_table-doc_type = lv_field.
        READ TABLE fields INTO lv_field INDEX 3.
        wa_table-DISTR_CHAN = lv_field.
        READ TABLE fields INTO lv_field INDEX 4.
        wa_table-DIVISION = lv_field.
        READ TABLE fields INTO lv_field INDEX 5.
        wa_table-material  = lv_field.
        READ TABLE fields INTO lv_field INDEX 6.
        wa_table-partn_role  = lv_field.
        READ TABLE fields INTO lv_field INDEX 7.
        wa_table-partn_numb  = lv_field.
    APPEND wa_table TO it_table.
      ENDLOOP.
    loop at it_table into wa_table.
    clear : wa_order_header_in.
    wa_order_header_in-sales_org   = wa_table-sales_org.
    wa_order_header_in-doc_type    = wa_table-doc_type.
    wa_order_header_in-distr_chan  = wa_table-distr_chan.
    wa_order_header_in-division    = wa_table-division.
    clear : wa_order_items_in.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = wa_table-material
    IMPORTING
       OUTPUT        = wa_order_items_in-material.
    *wa_order_items_in-req_qty  = wa_table-req_qty.
    append wa_order_items_in to it_order_items_in.
    clear : wa_order_partners.
    wa_order_partners-partn_role = wa_table-partn_role.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = wa_table-partn_numb
    IMPORTING
       OUTPUT        = wa_order_partners-partn_numb
    *wa_order_partners-partn_numb = wa_table-partn_numb.
    append wa_order_partners to it_order_partners.
    endloop.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
      SALESDOCUMENTIN               =
        order_header_in               = wa_order_header_in
      ORDER_HEADER_INX              =
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
    IMPORTING
       SALESDOCUMENT                 = sales_doc
      tables
       RETURN                        = it_return
       ORDER_ITEMS_IN                = it_order_items_in
      ORDER_ITEMS_INX               =
        order_partners                = it_order_partners.
      ORDER_SCHEDULES_IN            =
    get message manager
    DATA: l_current_controller TYPE REF TO if_wd_controller,
           l_message_manager    TYPE REF TO if_wd_message_manager.
           l_current_controller ?= wd_this->wd_get_api( ).
    DATA:  v_message_text TYPE string.
    When Sales Order is created commit the data
    IF NOT sales_doc IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       EXPORTING wait = 'X'.
      CONCATENATE 'Sales Document' sales_doc 'has been created.' INTO v_message_text SEPARATED BY space.
    Report Success message
      CALL METHOD l_message_manager->report_success
      EXPORTING
      message_text = v_message_text.
      ELSE.
      v_message_text = 'Error Creating Sales Order'.
    Report Error message
    CALL METHOD l_message_manager->report_error_message
    EXPORTING
    message_text = v_message_text.
    ENDIF.
    endmethod.
    Edited by: praveenn on Aug 30, 2011 2:41 PM

  • How to create SERVICE PR using BAPI_PR_CREATE

    Hi everyone,
    How to create SERVICE PR using BAPI_PR_CREATE
    Regards,
    My Code(it doesn't work,I don't know what's wrong.):
    *& Report  ZWTEST
    REPORT  zwtest.
    DATA: header TYPE bapimereqheader,
          headerx TYPE bapimereqheaderx,
          item LIKE TABLE OF bapimereqitemimp WITH HEADER LINE,
          itemx LIKE TABLE OF bapimereqitemx WITH HEADER LINE,
          account  LIKE TABLE OF bapimereqaccount WITH HEADER LINE,
          accountx LIKE TABLE OF bapimereqaccountx WITH HEADER LINE,
          service LIKE TABLE OF bapi_srv_service_line WITH HEADER LINE,
          servicex LIKE TABLE OF bapi_srv_service_linex WITH HEADER LINE,
          serviceaccount LIKE TABLE OF  bapi_srv_acc_data WITH HEADER LINE,
          serviceaccountx  LIKE TABLE OF bapi_srv_acc_datax WITH HEADER LINE,
          preq_no LIKE  bapimereqheader-preq_no,
          lt_return LIKE TABLE OF bapiret2 WITH HEADER LINE,
          wa_return LIKE bapiret2.
    header-pr_type = 'NB'."订单类型(采购)
    headerx-pr_type = 'X'.
    CLEAR: item.
    item-preq_item = '00010'.
    item-pur_group = '426'."采购组
    item-short_text = '服务类PR'."短文本
    item-plant = '1051'."工厂
    item-matl_group = 'AS07'."物料组
    item-item_cat = '9'."项目类别
    item-acctasscat = 'K'."科目分配类别
    item-pckg_no = '0000000001'."软件包编号
    APPEND item.
    CLEAR: itemx.
    itemx-preq_item = '00010'.
    itemx-preq_itemx = 'X'.
    itemx-pur_group = 'X'."采购组
    itemx-short_text = 'X'."短文本
    itemx-plant = 'X'."工厂
    itemx-matl_group = 'X'."物料组
    itemx-item_cat = 'X'."项目类别
    itemx-acctasscat = 'X'."科目分配类别
    itemx-pckg_no = 'X'."软件包编号
    APPEND  itemx.
    CLEAR: account.
    account-preq_item = '00010'.
    account-serial_no = '01'.
    *account-quantity = '0.955'.
    *account-distr_perc = '95.5'.
    account-gl_account = '4205020000'.
    account-costcenter = '1042000001'.
    *account-co_area = 'CNOC'.
    *account-profit_ctr = '9999999999'.
    APPEND account.
    CLEAR: accountx.
    accountx-preq_item = '00010'.
    accountx-serial_no = '01'.
    accountx-preq_itemx = 'X'.
    accountx-serial_nox = 'X'.
    *accountx-quantity = 'X'.
    *accountx-distr_perc = 'X'.
    accountx-gl_account = 'X'.
    accountx-costcenter = 'X'.
    *accountx-co_area = 'X'.
    *accountx-profit_ctr = 'X'.
    APPEND accountx.
    CLEAR: service.
    service-doc_item = '00010'.
    service-outline = '0000000001'.
    service-srv_line = '0000000010'.
    service-short_text = 'service test'.
    service-quantity = '10.000'.
    service-uom = 'AU'.
    service-gross_price = '10.00'.
    service-currency = 'CNY'.
    *service-matl_group = 'AS07'."物料组
    APPEND service.
    CLEAR: servicex.
    servicex-doc_item = '00010'.
    servicex-outline = '0000000001'.
    servicex-srv_line = '0000000010'.
    servicex-short_text = 'X'.
    servicex-quantity = 'X'.
    servicex-uom = 'X'.
    servicex-gross_price = 'X'.
    servicex-currency = 'X'.
    *servicex-matl_group = 'X'.
    APPEND servicex.
    CLEAR: serviceaccount.
    serviceaccount-doc_item = '00010'.
    serviceaccount-outline = '0000000001'.
    serviceaccount-srv_line = '0000000010'.
    serviceaccount-serial_no = '01'.
    serviceaccount-serial_no_item = '01'.
    serviceaccount-percent = '100'.
    APPEND serviceaccount.
    CLEAR: serviceaccountx.
    serviceaccountx-doc_item = '00010'.
    serviceaccountx-outline = '0000000001'.
    serviceaccountx-srv_line = '0000000010'.
    serviceaccountx-serial_no = '01'.
    serviceaccountx-serial_no_item = 'X'.
    serviceaccountx-percent = 'X'.
    APPEND serviceaccountx.
    CALL FUNCTION 'BAPI_PR_CREATE'
      EXPORTING
        prheader               = header
        prheaderx              = headerx
    *   TESTRUN                =
      IMPORTING
        number                 = preq_no
    *   PRHEADEREXP            =
      TABLES
        return                 = lt_return
        pritem                 = item
        pritemx                = itemx
    *   PRITEMEXP              =
    *   PRITEMSOURCE           =
        praccount              = account
    *   PRACCOUNTPROITSEGMENT  =
        praccountx             = accountx
    *   PRADDRDELIVERY         =
    *   PRITEMTEXT             =
    *   PRHEADERTEXT           =
    *   EXTENSIONIN            =
    *   EXTENSIONOUT           =
    *   PRVERSION              =
    *   PRVERSIONX             =
    *   ALLVERSIONS            =
    *   PRCOMPONENTS           =
    *   PRCOMPONENTSX          =
    *   SERVICEOUTLINE         =
    *   SERVICEOUTLINEX        =
        servicelines           = service
        servicelinesx          = servicex
    *   SERVICELIMIT           =
    *   SERVICELIMITX          =
    *   SERVICECONTRACTLIMITS  =
    *   SERVICECONTRACTLIMITSX =
        serviceaccount         = serviceaccount
        serviceaccountx        = serviceaccountx
    *   SERVICELONGTEXTS       =
    *   SERIALNUMBER           =
    *   SERIALNUMBERX          =
    * 处理错误消息:通过判断消息的类型,来判断BAPI是否成功
    READ TABLE lt_return INTO wa_return WITH KEY type = 'E'.
    IF sy-subrc = 0.
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    ELSE.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
      WRITE: / '成功创建采购申请', preq_no.
    ENDIF.
    LOOP AT lt_return INTO wa_return.
      WRITE: / wa_return-message, wa_return-type, wa_return-id, wa_return-number.
    ENDLOOP.

    see note:
    1950319 - How to create service PR with BAPI_PR_CREATE.pdf

  • How to create a new material using a BAPI?

    Dear friends,
    How to create a new material using a BAPI? I mean without knowing the material no., how to just create a new one using function modules(BAPI)?
    Thanks a lot!

    Dear,
    New material can be created by using a BAPI_MATERIAL_SAVEDATA.
    More over their are lots of threads available on SDN on the question you raised so kindly search the SDN before posting any thread .
    Cheers
    fareed

  • How to get default values while using the transaction "BP"

    Hi Group,
    I have a query on how to get default values while using the transaction <b>BP</b>?
    The thing is:
    when I enter into the transaction "BP", I need to see some default values to some of the input fields in the screen.
    how can I achieve this?
    So please kindly let me know the procedure to achieve this.
    Thanks & Regards,
    Vishnu.

    Hi,
    The events of BDT can be used to default some fields on creating a partner.
    For this create a function module for ISDAT. attach that event in BUS7.
    In the ISDAT funtion modulethe following code should be used.
    For example to set the nationality:
    I_BUSDEFAULT-NATIO = 'DE.
    CALL FUNCTION 'BUP_BUPA_FIELDVALUES_SET'
    EXPORTING
    i_busdefault = I_BUSDEFAULT
    Regards, Smita.

Maybe you are looking for

  • Constant syncing with iTunes

    Just recently updated iTunes software and every time I plug in the iPod and it does its thing (syncing) with iTunes it wants to go through about 80 to 500 songs and re-upload them to the iPod. ( have about 1800 songs on iPod) All songs are already on

  • How to use " External Routing " in Human Task (BPEL Process)?

    Hi All, Can anyone help me to provide any url or suggestion about "External Routing" in Human task? Thanks in Advance. Sharmistha

  • How to find affected tables in the database

    Hi Friends, Is there any way to find the tables affected in the database when book a trade in the Application in Oracle. Please help me to find the affected tables. Thanks, ragu. Edited by: user533548 on Apr 3, 2009 5:08 AM Edited by: user533548 on A

  • HT201328 how can you tell by the phone if it is unlocked?

    i had my iphone unlocked from att i want to know if there ius a way to see if it is unlocked on the phone without having to jhst try another companys sim card.

  • Edit in ALV Tree

    Hi, I have created a ALV tree using CL_GUI_ALV_TREE. Here how can i make a single column as editable field Pls help Thansk