How to creating Service Contract using BAPI_SLSTRANSACT_CREATEMULTI

Hi,
In my requirement, I have to create a Service Contract from flat file by using BAPI - BAPI_SLSTRANSACT_CREATEMULTI  and data which are comming from flat files are, Serial number, Sold-to party, Ship-to party, Installation date, Contract start date, Contract end date, Service profile, Response profile.
Please suggest me what are the Import parameters should I pass in this BAPI to create Service Contract?
Thanks in Advance,
Deepesh

Hi All,
for everybody's benefit (and to avoid you the time I've spent to work this out...), here is a working example on how to create an sales order (TA) via the BAPI_SLSTRANSACT_CREATEMULTI.
Not really a Service Contract, but it tells you how to call the BAPI.
Points appreciated, if you find this helpful...
I use the convention entryField for the values that should be set based on your system.
Cheers
G
*& Report  ZZGVBAPISALESORDER
REPORT  ZZGVBAPISALESORDER.
include constants
include crm_direct.
// GUIDs
data: lv_guid_h       type GUID_32,
      lv_guid_i       type GUID_32,
      lv_guid_sl      type GUID_32,
      lv_guid_p       type GUID_32.
// Handles
data: lv_current_handle type crmt_handle,
      lv_handle_h      type crmt_handle,
      lv_handle_i      type crmt_handle,
      lv_handle_sl     type crmt_handle,
      lv_handle_p      type crmt_handle.
// Administration header + item + etc
data: lt_salesorder_header type table of bapibus20001_header_ins,
      ls_salesorder_header type bapibus20001_header_ins,
      lt_salesorder_item   type table of bapibus20001_item,
      ls_salesorder_item   type bapibus20001_item,
      lt_scheduleline      type table of BAPIBUS20001_SCHEDLIN,
      ls_scheduleline      type BAPIBUS20001_SCHEDLIN,
      lt_partner           type table of BAPIBUS20001_PARTNER_INS,
      ls_partner           type BAPIBUS20001_PARTNER_INS,
      ls_logical_key       TYPE crmt_partner_logic_partner_key,
      lt_organisation      type table of BAPIBUS20001_ORGMAN_INS,
      ls_organisation      type BAPIBUS20001_ORGMAN_INS.
// Saved sales orders
data: lt_saved_process type table of bapibus20001_object_id,
      ls_saved_process type bapibus20001_object_id,
      ls_salesorder    type CRMT_RETURN_OBJECTS_STRUC.
data: lt_input_fields type table of bapibus20001_input_fields,
      ls_input_fields type bapibus20001_input_fields,
      lt_return type table of bapiret2,
      ls_return type bapiret2.
// Macro definition to populate structure and input field
This, called as
setfield ls_salesorder_header GUID lv_guid_h
is exploded as
ls_salesorder_header-GUID = lv_guid_h.
ls_input_fields-fieldname = 'GUID'.
append ls_input_fields to lt_input_fields.
Note 1: &2 (field name) MUST be uppercase
Note 2: for the salesorder header, I haven't used the macro,
to show how the code should look.
I've used the macro everywhere else.
define setfield.
  &1-&2          = &3.
  ls_input_fields-fieldname  = '&2'.
  append ls_input_fields to lt_input_fields.
end-of-definition.
// end of macro definition
  // fill order administration header
perform get_guid changing lv_guid_h.
add 1 to lv_handle_h.
ls_salesorder_header-guid          = lv_guid_h.
ls_salesorder_header-handle        = lv_handle_h.
ls_salesorder_header-process_type  = 'TA'.
clear ls_input_fields.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_guid = lv_guid_h.
*ls_input_fields-ref_kind   = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-orderadm_h.
ls_input_fields-fieldname  = 'GUID'.
append ls_input_fields to lt_input_fields.
ls_input_fields-fieldname  = 'HANDLE'.
append ls_input_fields to lt_input_fields.
ls_input_fields-fieldname  = 'PROCESS_TYPE'.
append ls_input_fields to lt_input_fields.
append ls_salesorder_header to lt_salesorder_header.
  // fill organisation data (I needed this, you may rely on
sales org determination instead...)
clear ls_input_fields.
ls_input_fields-ref_handle  = lv_handle_h.
ls_input_fields-ref_guid    = lv_guid_h.
ls_input_fields-ref_kind    = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname  = gc_object_name-orgman.
setfield ls_organisation REF_GUID lv_guid_h.
setfield ls_organisation REF_HANDLE lv_handle_h.
setfield ls_organisation REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_organisation SALES_ORG_RESP salesOrgResp(input).
setfield ls_organisation SALES_ORG salesOrg(input).
setfield ls_organisation DIS_CHANNEL disChannel(input).
append ls_organisation to lt_organisation.
  // fill order administration item
perform get_guid changing lv_guid_i.
lv_handle_i = lv_handle_h.
add 1 to lv_handle_i.
clear ls_input_fields.
ls_input_fields-ref_guid   = lv_guid_i.
ls_input_fields-ref_handle  = lv_handle_i.
*ls_input_fields-ref_kind   = gc_object_ref_kind-orderadm_i.
ls_input_fields-objectname = gc_object_name-orderadm_i.
setfield ls_salesorder_item GUID lv_guid_i.
setfield ls_salesorder_item HEADER lv_guid_h.
setfield ls_salesorder_item HANDLE lv_handle_i.
setfield ls_salesorder_item HEADER_HANDLE lv_handle_h.
setfield ls_salesorder_item ORDERED_PROD product(input).
*_set_field ls_salesorder_item ITM_TYPE 'TAN'.
setfield ls_salesorder_item MODE 'A'.
*adjustment taken from standard include LCMS_MAPPERF04
*(see where-used-list for BAPI_SLSTRANSACT_CREATEMULTI, program LCMS_MAPPERU11)
delete lt_input_fields where fieldname = 'HANDLE'
                                OR
                             fieldname = 'HEADER_HANDLE'.
append ls_salesorder_item to lt_salesorder_item.
  // fill schedule line for item
perform get_guid changing lv_guid_sl.
add 1 to lv_handle_sl.
clear ls_input_fields.
ls_input_fields-ref_guid   = lv_guid_i.
ls_input_fields-ref_handle  = lv_handle_i.
ls_input_fields-ref_kind   = gc_object_ref_kind-orderadm_i.
ls_input_fields-objectname = gc_object_name-schedlin.
setfield ls_scheduleline ITEM_GUID lv_guid_i.
setfield ls_scheduleline GUID lv_guid_sl.
setfield ls_scheduleline HANDLE lv_handle_sl.
setfield ls_scheduleline ITEM_HANDLE lv_handle_i.
setfield ls_scheduleline QUANTITY '1.000'.
append ls_scheduleline to lt_scheduleline.
  // fill partner line
*perform get_guid changing lv_guid_p.
*the partner use the logical key as well
ls_logical_key-ref_partner_handle = '0001'.
clear ls_input_fields.
ls_input_fields-ref_guid   = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind   = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0001'.
setfield ls_partner KIND_OF_ENTRY 'C'.
setfield ls_partner PARTNER_FCT '00000001'.
setfield ls_partner PARTNER_NO bpNumber(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
//  example of a second partner function (custom) with data
    override
ls_logical_key-ref_partner_handle = '0002'.
clear ls_input_fields.
ls_input_fields-ref_guid   = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind   = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0002'.
setfield ls_partner KIND_OF_ENTRY 'B'.            "manual entry...
setfield ls_partner PARTNER_FCT customFct(input).
setfield ls_partner PARTNER_NO bpNumber(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
setfield ls_partner TITLE 'Mr.'.
setfield ls_partner FIRSTNAME 'John'.
setfield ls_partner LASTNAME 'Smith'.
setfield ls_partner STR_SUPPL1 'John Smith and Co'.
setfield ls_partner STREET 'Street1'.
setfield ls_partner STR_SUPPL3 'Street4'.
setfield ls_partner HOUSE_NO '42'.
setfield ls_partner CITY 'Townville'.
setfield ls_partner DISTRICT 'Districtshire'.
setfield ls_partner POSTL_COD1 'AA1 2BB'.
note now ...
*adjustment taken from standard include LCMS_MAPPERF04
*(see where-used-list for BAPI_SLSTRANSACT_CREATEMULTI, program LCMS_MAPPERU11)
I don't use macro because name of the field in input_table is different
*_set_field ls_partner COUNTRYISO 'GB'.
*instead
ls_partner-COUNTRYISO = 'GB'.
ls_input_fields-fieldname = 'COUNTRY'.
append ls_input_fields to lt_input_fields.
*_set_field ls_partner LANGU_ISO 'EN'.
ls_partner-LANGU_ISO = 'EN'.
ls_input_fields-fieldname = 'LANGU'.
append ls_input_fields to lt_input_fields.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
Create sales orders                                                  *
call function 'BAPI_SLSTRANSACT_CREATEMULTI'
  EXPORTING
    testrun       = false
  TABLES
    header        = lt_salesorder_header[]
    item          = lt_salesorder_item[]
    partner       = lt_partner[]
    organisation  = lt_organisation[]
    input_fields  = lt_input_fields[]
    scheduleline  = lt_scheduleline[]
    saved_process = lt_saved_process[]
    return        = lt_return[].
// get the GUID of the created object
call function 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    wait = 'X'.
INCLUDE ZZGVBAPISALESORDER_GET_GUIDF01.
The include contains only this:
***INCLUDE ZZGVBAPISALESORDER_GET_GUIDF01 .
*&      Form  get_guid
      text
     <--guid  text
FORM get_guid  CHANGING GUID.
  CALL FUNCTION 'SYSTEM_UUID_C_CREATE'
      IMPORTING
           UUID    = GUID.
ENDFORM.                    " get_guid

Similar Messages

  • Create Service Contract using BAPI_SLSTRANSACT_CREATEMULTI

    Hi,
    In my requirement, I have to create a Service Contract from flat file by using BAPI - BAPI_SLSTRANSACT_CREATEMULTI and data which are comming from flat files are, <b>Serial number, Sold-to party, Ship-to party, Installation date, Contract start date, Contract end date, Service profile, Response profile.</b>
    Please suggest me what are the Import parameters should I pass in this BAPI to create Service Contract?
    Thanks in Advance,
    Deepesh

    Hi Deepesh ,
    Please use BAPI_BUSPROCESSND_CREATEMULTI for creating the service contract.This is better in terms of functionality and usage , though very similar to BAPI_SLSTRANSACT_CREATEMULTI in terms of its interface.
    You need to call :
    1. BAPI_BUSPROCESSND_CREATEMULTI
    2. BAPI_BUSPROCESSND_SAVE
    3. BAPI_TRANSACTION_COMMIT 
    in succession.
    As far as filling the import parameters is concerned,
    1.All your dates would go to APPOINTMENT_H or APPOINTMENT_I ( Header or Item)
    2.Sold-to Party, Ship-to Party would go to PARTNER.
    Regards,
    Rishi.

  • 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 multiple Contracts using BAPI_BUSPROCESSND_CREATEMULTI?

    Hi Experts,
    I m trying to create multiple service contracts using BAPI_BUSPROCESSND_CREATEMULTI. I can create single transaction in one go but program is failing to create multiple service contracts in one go. It does create the multiple contracts but messes up with products and product related information. As when there is same product in two different contracts, the record in item internal table has same values for both contracts as we are not passing header guid to the intem related internal table 'ITEM', 'SCHEDULELINE' etc.
    How to use this BAPI to create mulitple service contracts in one go?
    Thanks and Regards.

    Any guideline?
    Thanks and Regards,

  • How to create Service Contract-Urgent

    Hii All,
    Can anyone tell me what all the requirements needed to create a service contract?
    I shall be thankful to anyone who could please please send me the step by step procedure to create the service contract.
    Thanks
    Gopi.

    Hi Gopal ,
    Use following steps for creating service contract.
    1] Use t-code <b>ME31K</b>
    2] Enter details like Vendor , Agreement type (MK) , Purch Orgn Purch.group.In the same , enter Item Category as "<b>D</b>" and respective account assignment category (K,F etc.)
    3]In second screen enter Validity period , then short text for the desired services.In next screen , enter Service details and proper account assnmnt
    Save the contract
    Regards
    Nilesh

  • I need your help how to create service plan using programm

    Hello everybody
    I met some difficulities when writing a programm which is used to create service plan.
    I used the function module 'crm_order_maintain'.
    Can you tell me how to set the parameters:
       IT_SERVICEPLAN_I
       IT_SERVICEPLAN_IE
    The two parameters is used as cycle data.
    I'm waiting for your help.
    If you have any idea,please apply to my message .Thank you very much. ^ ^

    Hi,
    I think there is standard way of creating service plans using actions..
    The standard method used is CREATE_ORDER_SRVPLAN.
    Regards,
    PePe

  • How to create Service Order using bapi BAPI_ALM_ORDER_MAINTAIN

    Hi,
    I want to create the Service Order with multiple Operations & Components.
    I am using this bapi BAPI_ALM_ORDER_MAINTAIN.
    But this BAPI creates the service order with only one Operation at a time. Can multiple operations be created using this bapi.
    If not could any one please guide to use this or other BAPI to create Service Order with multiple Operations & Components?
    Thank's in advance,
    Chetan

    Read the Documentation of the BAPI.
    Operations and Components are table parameters, you can pass multiple data. did you check that....

  • How to update  Service Contract using BAPI/FM for ME31K

    Hi ,
    I am using BAPI BAPI_CONTRACT_CREATE to create contracts.
    It works fine, the only problem i am facing is while updating line item with item category "D' its simply skips the item category and create a item. The item category is blank when i see in transaction ME33K.
    When i create it using ME31K transaction with line item item category type  "D' its ask me to fill the services also for that line item.
    My question is is there any BAPI which i can use to update the Services for item line with item category  D.
    Thanks
    Amar

    Hi Amar,
    Not sure if this would help you but you can consider writing different logic (probably a BDC) for item category 'D', and use BAPI for all other cases (if 'D' is the only exception).
    BAPI documentaion says:
    *External services (planned and unplanned services) are not supported.
    Creation of configurations is not supported*
    Regards,
    Shyam

  • IDOC type CRMXIF_ORDER_SAVE_M in CRM thru LSMW to create Service Contracts.

    Hi All,
    I am trying to create Service contracts using IDOC type CRMXIF_ORDER_SAVE_M in CRM thru LSMW.
    I have a mapping issue of the file fields to the segment fields;
    I have 5 files, Contract Header, Items, Dates, Partners, Objects(Serial numbers);
    I Appreciate if you send me the mapping details for me if some one has already done this please;
    or any otherhelp on the notes/documents are highly appreciated
    Thanks
    Iver

    hi, do you mean the problem is in the file resource file, and you want to use it in LSMW?
    If so, I have meet the similar problem,  two source file inbound into LSMW. one header , one item
    And I solve it in this way,
    combine the 2 file before lsmw read it, like this
    Header data 1 /   item1
    header data 1 /   item2
    header data 2 /   item1
    header data 3 /   item1
    header data 3 /   item2
    for each line, the header data is exist, if item is mutiple, the header line can be repeat.
    Then the 2 file combine to one file, lsmw read the combined file
    You need to do some additional logic in data mapping,  mapping the different item  in each loop, but header data once if they are same.

  • 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

  • How to create  Service Order  and then Invoice    using   IW31

    I  have  problem  to create   Service Order  and  then Billing,
                   could  anyone tel me ,what is process  flow.
    Thanksa in Advance.

    Hi Suniel,
    PLease take a look at:
    Re: Problem  to create  Service Order  using   IW31 and  then Invoice  for that
    Best regards,
    demas

  • Problem in Creating Service contract Quote

    Hi,
    I have a problem while creating Service Contract Quote. The Problem is "No Items being created in Service Contract Quote."
    I am copying these line items from the Package Quote(Programatically). I am reading the Package Quote Lines Items using CRM_ORDER_READ and I am looping these one by one, and copying into one Item Table. Passed this table, to MAINTAIN_ORDERADM_I function module. And Then I am calling SAVE function module.
    But, for me service contract Quote is being created with no line items.
    Can you please let me know, how can I solve this problem.
    And let me know what are the necessary steps to be taken progrmtically,  for creating Service Contract Quote from a Package Quote.
    Thanks,
    Sandeep

    A standard way of doing this would be to create an action in service contract with method call processing type, and method COPY_DOCUMENT. For this you need to do the following:
    1) Create a new action called "SRV_CNTRCT_QUOTE_CREATE" in action pofile already attached to Package Quote. Use
        CRMC_ACTION_DEF Tcode for this.
    2) Choose processing type as method call and method as COPY_DOCUMENT.
    3) Choose parameter CRMD_ORDERADM_H, PROCESS_TYPE with initial value as transaction type of Serv Contract Quote.
    4) Institute start and scheduled conditions if required in CRMC_ACTION_CONF.
    Note: For this copying controls at transaction level, item category level and itemcat determination while copying should have been determined.
    Regds,
    Raghu

  • How to create Service and response profiles

    Hello Gurus
              I have configured the IC Web Client in solution manager 4.0 system. But in sservice ticket i am not able to see the SLA info. Please tell me
      where to give these SLA parameters ?
      How to create service and response profiles?
      Shuold i use SLF1 instead of  SLFN to maintain SLA ?
    Please tell me how to do these it will be very helpful....

    Hi Naveen
    The Service and Response Profiles can be created in the easy access menu using the path
    SAP Menu> Service> Service Contracts and Service Plans--> Maintain availability and Response Time
    Availability time is also know as service profile
    And then assign these service and response profiles to your Servie Product Master which will be used in the service ticket.
    For the field to be available to enter teh service and response profile in the product master, assign the set types COMM_PR_SRV to the category in which the product will be created
    Hope this would help.
    Regards,
    Rekha Dadwal
    <b>
    You gain a point for every point that you reward. So reward helpful answers generously</b>

  • How to create a  contract? ( Types: volume,time,quality contracts)

    Hi Gurus,
    How to create a  contract? ( Types: volume,time,quality contracts)
    Give the procedure to create above mentioned types of contract.
    Bye
    Narasimha Rao Gunda

    1.Access the transaction choosing one of the following navigation options:
    SAP ECC menu     Logistics  Materials Management  Purchasing   Outline Agreement  Contract  Create
    Transaction code     ME31K
    2.On the Create Contract: Initial Screen, enter the following values and choose Enter:
         Vendor               xxxx          
         Agreement type          MK          
         Agreement date          Todayu2019s date          
         Purchasing Organization          
         Purchasing Group          xxx          
         Plant               xxx     
    3.On the Create Contract: Header Data screen, in Validity End field, enter end date (e.g. two years in the future) of the contract and choose Enter.
    4.On the Create Contract: Item Overview  screen, enter the following values:
         Material                              
         Target Quantity      10000               
         Net price          xxxx usd per 100 PC          
         Plant          1000
    5.Remark: Delete any entry in the field storage location.
    6.Additional step:
    If you want to use the information of an existing info record mark the line of the agreement item (item 10) and go to Environment  Info record. On the Info record: General Data screen choose Conditions. On the screen Display Gross Price Condition (PB00): Condition Supplements you can see the value of the gross price (here: 1282.5 per 100 pieces.).
    7.Choose Save (Check if the automatic print function of the contract works).

  • How to create purchase order using VA01 for BAPI?

    how to create purchase order using VA01 for BAPI?

    Hi Arun,
    Please check this link
    Example Program for BAPI_PO_CREATE1
    Re: BAPI_PO_CREATE1
    Questions in BAPI_PO_CREATE1
    Problem with BAPI_PO_CREATE1
    *& Report BAPI_PO_CREATE *
    REPORT bapi_po_create.
    Input File Declaration
    TYPES: BEGIN OF ty_input_file,
    column1 TYPE char50,
    column2 TYPE char50,
    column3 TYPE char50,
    column4 TYPE char50,
    column5 TYPE char50,
    column6 TYPE char50,
    column7 TYPE char50,
    column8 TYPE char50,
    column9 TYPE char50,
    column10 TYPE char50,
    column11 TYPE char50,
    column12 TYPE char50,
    column13 TYPE char50,
    column14 TYPE char50,
    column15 TYPE char50,
    column16 TYPE char50,
    column17 TYPE char50,
    column18 TYPE char50,
    END OF ty_input_file.
    DATA: i_input_file TYPE STANDARD TABLE OF ty_input_file,
    wa_input_file TYPE ty_input_file.
    CONSTANTS: c_path TYPE char20 VALUE 'C:\',
    c_mask TYPE char9 VALUE ',.,..',
    c_mode TYPE char1 VALUE 'O',
    c_filetype TYPE char10 VALUE 'ASC',
    c_x TYPE char01 VALUE 'X'.
    PARAMETERS : p_fname LIKE rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
    Browse Presentation Server
    PERFORM f4_presentation_file.
    START-OF-SELECTION..
    Read presentation server file
    PERFORM f1003_upload_file.
    IF NOT i_input_file[] IS INITIAL.
    PERFORM split_data.
    ENDIF.
    *& Form f4_presentation_file
    *& F4 Help for presentation server
    FORM f4_presentation_file .
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
    def_path = c_path
    mask = c_mask
    mode = c_mode
    title = text-001
    IMPORTING
    filename = p_fname
    EXCEPTIONS
    inv_winsys = 1
    no_batch = 2
    selection_cancel = 3
    selection_error = 4
    OTHERS = 5.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " f4_presentation_file
    *& Form f1003_upload_file
    *& Upload File
    FORM f1003_upload_file .
    DATA: lcl_filename TYPE string.
    lcl_filename = p_fname.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = lcl_filename
    filetype = c_filetype
    has_field_separator = c_x
    TABLES
    data_tab = i_input_file
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
    ENDIF.
    ENDFORM. " f1003_upload_file
    *& Form split_data
    Collect data for creating Purchase Order
    FORM split_data .
    DATA: i_poitem TYPE STANDARD TABLE OF bapimepoitem,
    i_poitemx TYPE STANDARD TABLE OF bapimepoitemx,
    i_poitem_sch TYPE STANDARD TABLE OF bapimeposchedule,
    i_poitem_schx TYPE STANDARD TABLE OF bapimeposchedulx,
    i_acct_*** TYPE STANDARD TABLE OF bapimepoaccount,
    i_acct_assx TYPE STANDARD TABLE OF bapimepoaccountx,
    i_services TYPE STANDARD TABLE OF bapiesllc ,
    i_srvacc TYPE STANDARD TABLE OF bapiesklc,
    i_return TYPE STANDARD TABLE OF bapiret2,
    wa_header TYPE bapimepoheader,
    wa_headerx TYPE bapimepoheaderx,
    wa_poitem TYPE bapimepoitem,
    wa_poitemx TYPE bapimepoitemx,
    wa_poitem_sch TYPE bapimeposchedule,
    wa_poitem_schx TYPE bapimeposchedulx,
    wa_acct_*** TYPE bapimepoaccount,
    wa_acct_assx TYPE bapimepoaccountx,
    wa_services TYPE bapiesllc,
    wa_srvacc TYPE bapiesklc,
    wa_return TYPE bapiret2,
    ws_po TYPE bapimepoheader-po_number.
    break gbpra8.
    wa_services-pckg_no = 10.
    wa_services-line_no = 1.
    wa_services-outl_no = '0'.
    wa_services-outl_ind = c_x.
    wa_services-subpckg_no = 20.
    APPEND wa_services TO i_services.
    wa_srvacc-pckg_no = 10.
    wa_srvacc-line_no = 1.
    wa_srvacc-serno_line = 01.
    wa_srvacc-serial_no = 01.
    wa_srvacc-percentage = 100.
    APPEND wa_srvacc TO i_srvacc.
    LOOP AT i_input_file INTO wa_input_file.
    IF wa_input_file-column2 EQ 'HD'.
    wa_header-doc_type = wa_input_file-column3.
    wa_header-creat_date = sy-datum.
    wa_header-created_by = sy-uname.
    wa_header-vendor = wa_input_file-column4.
    PERFORM conversion_output USING wa_header-vendor
    CHANGING wa_header-vendor.
    wa_header-comp_code = 'DE03'.
    wa_header-purch_org = 'DE03'.
    wa_header-pur_group = 'DE1'.
    wa_header-vper_start = wa_input_file-column9.
    wa_header-vper_end = wa_input_file-column10.
    wa_headerx-comp_code = c_x.
    wa_headerx-doc_type = c_x.
    wa_headerx-creat_date = c_x.
    wa_headerx-created_by = c_x.
    wa_headerx-vendor = c_x.
    wa_headerx-purch_org = c_x.
    wa_headerx-pur_group = c_x.
    wa_headerx-vper_start = c_x.
    wa_headerx-vper_end = c_x.
    ENDIF.
    IF wa_input_file-column2 EQ 'IT'.
    wa_poitem-po_item = wa_input_file-column3.
    wa_poitem-short_text = wa_input_file-column6.
    wa_poitem-plant = wa_input_file-column8.
    wa_poitem-quantity = '1'.
    wa_poitem-tax_code = 'V0'.
    wa_poitem-item_cat = 'D'.
    wa_poitem-acctasscat = 'K'.
    wa_poitem-matl_group = wa_input_file-column7.
    wa_poitem-pckg_no = '10'.
    APPEND wa_poitem TO i_poitem .
    wa_poitemx-po_item = wa_input_file-column3.
    wa_poitemx-po_itemx = c_x.
    wa_poitemx-short_text = c_x.
    wa_poitemx-plant = c_x.
    wa_poitemx-quantity = c_x.
    wa_poitemx-tax_code = c_x.
    wa_poitemx-item_cat = c_x.
    wa_poitemx-acctasscat = c_x.
    wa_poitemx-matl_group = c_x.
    wa_poitemx-pckg_no = c_x.
    APPEND wa_poitemx TO i_poitemx.
    wa_poitem_sch-po_item = wa_input_file-column3.
    wa_poitem_sch-delivery_date = sy-datum.
    APPEND wa_poitem_sch TO i_poitem_sch.
    wa_poitem_schx-po_item = wa_input_file-column3.
    wa_poitem_schx-po_itemx = c_x.
    wa_poitem_schx-delivery_date = c_x.
    APPEND wa_poitem_schx TO i_poitem_schx.
    wa_acct_***-po_item = 10.
    wa_acct_***-serial_no = 01.
    wa_acct_***-gl_account = '0006360100'.
    wa_acct_***-co_area = '1000'.
    wa_acct_***-costcenter = 'KC010000'.
    APPEND wa_acct_*** TO i_acct_***.
    wa_acct_***-po_item = 10.
    wa_acct_***-serial_no = 02.
    wa_acct_***-gl_account = '0006360100'.
    wa_acct_***-co_area = '1000'.
    wa_acct_***-costcenter = 'KC010000'.
    APPEND wa_acct_*** TO i_acct_***.
    wa_acct_assx-po_item = 10.
    wa_acct_assx-serial_no = 01.
    wa_acct_assx-po_itemx = c_x.
    wa_acct_assx-serial_nox = c_x.
    wa_acct_assx-gl_account = c_x.
    wa_acct_assx-co_area = c_x.
    wa_acct_assx-costcenter = c_x.
    APPEND wa_acct_assx TO i_acct_assx.
    wa_acct_assx-po_item = 10.
    wa_acct_assx-serial_no = 02.
    wa_acct_assx-po_itemx = c_x.
    wa_acct_assx-serial_nox = c_x.
    wa_acct_assx-gl_account = c_x.
    wa_acct_assx-co_area = c_x.
    wa_acct_assx-costcenter = c_x.
    APPEND wa_acct_assx TO i_acct_assx.
    wa_services-pckg_no = 20.
    wa_services-line_no = 2.
    wa_services-service = wa_input_file-column9.
    wa_services-quantity = '100'.
    wa_services-gr_price = '100'.
    wa_services-userf1_txt = wa_input_file-column13.
    APPEND wa_services TO i_services.
    wa_srvacc-pckg_no = 20.
    wa_srvacc-line_no = 1.
    wa_srvacc-serno_line = 02.
    wa_srvacc-serial_no = 02.
    wa_srvacc-percentage = 100.
    APPEND wa_srvacc TO i_srvacc.
    ENDIF.
    ENDLOOP.
    CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
    poheader = wa_header
    poheaderx = wa_headerx
    POADDRVENDOR =
    TESTRUN =
    MEMORY_UNCOMPLETE =
    MEMORY_COMPLETE =
    POEXPIMPHEADER =
    POEXPIMPHEADERX =
    VERSIONS =
    NO_MESSAGING =
    NO_MESSAGE_REQ =
    NO_AUTHORITY =
    NO_PRICE_FROM_PO =
    IMPORTING
    exppurchaseorder = ws_po
    EXPHEADER =
    EXPPOEXPIMPHEADER =
    TABLES
    return = i_return
    poitem = i_poitem
    poitemx = i_poitemx
    POADDRDELIVERY =
    poschedule = i_poitem_sch
    poschedulex = i_poitem_schx
    poaccount = i_acct_***
    POACCOUNTPROFITSEGMENT =
    poaccountx = i_acct_assx
    POCONDHEADER =
    POCONDHEADERX =
    POCOND =
    POCONDX =
    POLIMITS =
    POCONTRACTLIMITS =
    poservices = i_services
    posrvaccessvalues = i_srvacc
    POSERVICESTEXT =
    EXTENSIONIN =
    EXTENSIONOUT =
    POEXPIMPITEM =
    POEXPIMPITEMX =
    POTEXTHEADER =
    POTEXTITEM =
    ALLVERSIONS =
    POPARTNER =
    break gbpra8.
    LOOP AT i_return INTO wa_return.
    ENDLOOP.
    ENDFORM. " split_data
    *& Form conversion_output
    Conversion exit input
    FORM conversion_output USING p_ip
    CHANGING p_op.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = p_ip
    IMPORTING
    output = p_op.
    ENDFORM. " conversion_output
    Best regards,
    raam

Maybe you are looking for