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

Similar Messages

  • 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

  • Not able to update a contract using BAPI

    Hi All,
    I am tryin to use a BAPI to update the contract and for this I have coded the following:
    v_ponumber = 'abc-123' .
       MOVE v_ponumber  TO poheader2-number.
        MOVE 'X'  TO poheaderx-number.
        MOVE '00001' TO po_item2-ITEM_NO.
        MOVE 'test text' TO po_item2-SHORT_TEXT.
        APPEND po_item2.
        MOVE '00001' TO po_item2_x-ITEM_NO.
        MOVE 'X' TO po_item2_x-ITEM_NOX.
        MOVE 'X' TO po_item2_x-SHORT_TEXT.
        APPEND po_item2_x.
    CALL FUNCTION 'BAPI_CONTRACT_CHANGE'
      EXPORTING
        PURCHASINGDOCUMENT          = v_ponumber
       HEADER                      = poheader2
       HEADERX                     = poheaderx
    TABLES
       ITEM                        = po_item2
       ITEMX                       = po_item2_x
       RETURN                      = return2
    if sy-subrc = 0.
    commit work.
    endif.
    in the return table I am getting the message which says that the contract has been updated but I went to see the contract was actually not updated.... any advise where I am missing?
    Thanks,
    Rajat

    I am not sure why it is not working??  Try for any other alternate function modules.
    But i see one issue with your coding, always check the return table message type and use commit work, instead of sy-subrc check. This fails for BAPI's

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

  • Help-urgent - how to update service pack and apply patches for ADS

    Dear all,
       I've just download the sp 11 and the patch ,how should i update my ADS? I've try to search the forum but to no avail. Pls advise,thanks.
    Regards,
    Joan

    Hi Joan,
    To deploy an SCA or SDA, proceed as follows:
          1. Make sure you have downloaded the SCA or SDA from SAP Service Marketplace.
          2. Start the SDM GUI. To do this, execute the following file:
                a) Windows: RemoteGui.bat in folder \usr\sap\<SID>\<instance>\SDM\program
                b) Unix: RemoteGui.sh in folder /usr/sap/<SID>/<instance>/SDM/program
          3. The SDM GUI screen appears.
          Note: With SAP Web Application Server 6.30 the SDM server is started whenever you start the SAP system. To check whether the SDM server is running, use the tools SAP Management Console (Windows) or jcmon (UNIX).
          4. Choose "SDM Gui -> Login" or the icon "Connect to SDM Server". The dialog box "Enter Login Information for SDM Server" appears.
          5. Enter the following information:
                a) Password
                The initial password is "sdm" (without quotes).
                b) User description (optional)
                c) Hostname
                d) Port
                With instance number 00, the default port number is 50018. If your instance number is different from 00, the port number changes to
                Port = 50018 + 100 x <instance number>.
                You have to calculate the new port number and enter it manually.
          6. Choose "Login". The SDM GUI appears.
          7. Choose tab "Deployment".
          8. Choose "Add SCA/SDA to Deployment List (Local File Browser)". A file selection screen appears.
          9. Select the SCA or SDA file you would like to deploy and choose "Next" to read the information on the following screens.
          10. Choose "Next" until the "Start" button appears.
          11. Choose "Start". After the SCA or SDA has been completely deployed, a success message appears.
          12. Choose "Confirm" to return to the SDM GUI.
          13. When you have finished work, log out from the SDM server. Choose "Deployment -> Logout" or the icon "Disconnect from SDM server" for this.
    If this answers your question, please mark the question accordingly and do award points if helpful.
    Regards,
    Arafat

  • Planner group is not updated in service notification using BAPI

    Hi,
    Planner group is not updated in service notification using BAPI BAPI_ALM_ORDER_MAINTAIN.
    I have written the below code, but planner group is not updated in the service notification.
    Please advice which parameters do i need to pass to update planner group in the service notification.
              wa_methods-refnumber      = '000001'.
              wa_methods-objecttype     = 'PARTNER'.
              wa_methods-method         = 'CREATE'.
              wa_methods-objectkey      = wa_subscr1-aufnr.
              APPEND wa_methods TO i_methods.
              wa_methods-refnumber      = '000002'.
              wa_methods-objecttype     = 'HEADER'.
              wa_methods-method         = 'CREATE'.
              wa_methods-objectkey      = wa_subscr1-aufnr.
              APPEND wa_methods TO i_methods.
              wa_methods-refnumber      = '000000'.
              wa_methods-objecttype     = ' '.
              wa_methods-method         = 'SAVE'.
              APPEND wa_methods TO i_methods.
              REFRESH i_partner.
              CLEAR wa_partner.
              wa_partner-orderid        = wa_subscr1-aufnr.
              wa_partner-partn_role     = 'VW'.
              wa_partner-partn_role_old = ''.
              wa_partner-partner        = wa_subscr1-parnr.
              wa_partner-partner_old    = ''.
              APPEND wa_partner TO i_partner.
              REFRESH i_planrgrp.
              CLEAR wa_planrgrp.
              wa_planrgrp-orderid        = wa_subscr1-aufnr.
              wa_planrgrp-plangroup      = wa_subscr1-ingpr.
              APPEND wa_planrgrp TO i_planrgrp.
              REFRESH i_planrgrp_up.
              CLEAR wa_planrgrp_up.
              wa_planrgrp_up-orderid     = wa_subscr1-aufnr.
              wa_planrgrp_up-plangroup   = 'X'.
              APPEND wa_planrgrp_up TO i_planrgrp_up.
    *----Change order details with Technician name
              CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
                TABLES
                  it_methods   = i_methods
                  it_header    = i_planrgrp
                it_header_up = i_planrgrp_up
                  it_partner   = i_partner
                  return       = i_return.
    Thanks & regards,
    Krishna

    Try this way
    CALL FUNCTION 'BAPI_SERVNOT_CREATE'
    EXPORTING
    * EXTERNAL_NUMBER =
    notif_type = 'S3'
    notifheader = ls_notif_h
    * TASK_DETERMINATION = ' '
    * SENDER =
    * ORDERID =
    IMPORTING
    NOTIFHEADER_EXPORT = ls_notif_e
    TABLES
    * NOTITEM =
    * NOTIFCAUS =
    * NOTIFACTV =
    * NOTIFTASK =
    * NOTIFPARTNR =
    * LONGTEXTS =
    * KEY_RELATIONSHIPS =
    return = lt_return
    * IF lt_return IS INITIAL.                                               " <<< Comment this lie
    read table  lt_return into ls_return with key type = 'E'. " << Change
    if sy-subrc ne 0.                                                             " << Change
    COMMIT WORK AND WAIT.
    write: / ls_notif_e-NOTIF_NO.
    ELSE.
    LOOP AT lt_return INTO ls_return.
    WRITE:/ 'errors'.
    * ls_return.
    ENDLOOP.
    endif.

  • How to add new line item using BAPI BAPI_CONTRACT_CHANGE for contract-ME32K

    HI Experts,
    how to add new line item using BAPI: BAPI_CONTRACT_CHANGE for existing contract.
    Requirement:
    Already the contract having two line items using ME31K.
    Custom program has to add new line items in existing contract.
    Thanks,
    Sendil

    I got the solution:
    We can do like this:
    1. Get all details using details, BAPI_CONTRACT_GETDETAIL.
    2. After getting results, append new line item. Then use your BAPI.
    Check this posting program.. where this bapi is used, use the same coding technique.
    IDOC_INPUT_PURCONTRACT_CHANGE

  • 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 CRUD application using bapi in webdynpro java

    Hi All,
          I have implemented the CRUD application using bapi  Now i want to create, retrieve , update and delete the existing table by click on Insert, delete, retrieve ,and update button dynamically. i get null values from database,  Please let me know the logic and procedure for how to create CRUD application using bapi  Please any one help me..
    Thanks in advance

    Hi,
    Hey tell me one thing your BAPI having CURD methods. See you are getting data from BAPI and pull the data in Table in WDJ. So if u can do any action it will comes trough BAPI.
    If your BAPI having CURD methods. You can implement CURD methods in WDJAVA also.
    @ You said you are getting null values from the database. Please let me know what code you have to wrote for CURD. Please tell me.
    Hope this is help full for u
    Best Regards
    Vijay K

  • 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 material doc using bapi

    hi all,
    pls tell me how to create material doc using bapi ,
    if i give po no , it will create material doc no .
    advance thanks ,

    Hi venu,
    Please go thru this example, it will help u.
    REPORT ZBAPIMM01 LINE-SIZE 255 NO STANDARD PAGE HEADING
    LINE-COUNT 065(001).
    TABLES: T001L, "Storage Locations
    MARA, "General Material Data
    MAKT, "Material Descriptions
    MBEW, "Material Valuation
    MARC. "Plant Data for Material
    DATA: BAPI_HEAD LIKE BAPIMATHEAD,
    BAPI_MAKT LIKE BAPI_MAKT, "Material Description
    BAPI_MARA1 LIKE BAPI_MARA, "Client Data
    BAPI_MARAX LIKE BAPI_MARAX,
    BAPI_MARC1 LIKE BAPI_MARC, "Plant View
    BAPI_MARCX LIKE BAPI_MARCX,
    BAPI_MBEW1 LIKE BAPI_MBEW, "Accounting View
    BAPI_MBEWX LIKE BAPI_MBEWX,
    BAPI_RETURN LIKE BAPIRET2.
    DATA: BEGIN OF INT_MAKT OCCURS 100.
    INCLUDE STRUCTURE BAPI_MAKT.
    DATA: END OF INT_MAKT.
    DATA: BEGIN OF INT_MAT OCCURS 100,
    WERKS(4), "Plant
    MTART(4), "Material type
    MATNR(18), "Material number
    MATKL(9) , "Material group
    MBRSH(1), "Industry sector
    MEINS(3), "Base unit of measure
    GEWEI(3), "Weight Unit
    SPART(2), "Division
    EKGRP(3), "Purchasing group
    VPRSV(1), "Price control indicator
    STPRS(12), "Standard price
    PEINH(3), "Price unit
    SPRAS(2), "Language key
    MAKTX(40), "Material description
    END OF INT_MAT.
    SELECT-OPTIONS:
    PLANT FOR MARC-WERKS OBLIGATORY MEMORY ID PLT,
    MATERIAL FOR MARA-MATNR MEMORY ID MAT,
    MATLTYPE FOR MARA-MTART MEMORY ID MTY,
    DIVISION FOR MARA-SPART MEMORY ID DIV.
    PARAMETERS: F_FILE LIKE RLGRAP-FILENAME
    DEFAULT 'C:\DATA\ZMATERIAL.XLS' MEMORY ID F_FILE,
    GETDATA AS CHECKBOX, "Tick to download materials data to local harddisk
    UPDDATA AS CHECKBOX. "Tick to update date to Materials Master
    IF GETDATA = 'X'.
    PERFORM DOWNLOAD_DATA.
    PERFORM DOWNLOAD_FILE.
    ENDIF.
    IF UPDDATA = 'X'.
    PERFORM UPLOAD_FILE.
    PERFORM UPDATE_MM.
    ENDIF.
    FORM DOWNLOAD_DATA.
    SELECT * FROM MARC WHERE LVORM EQ ' '
    AND WERKS IN PLANT
    AND MATNR IN MATERIAL.
    CLEAR MARA.
    SELECT SINGLE * FROM MARA WHERE MATNR = MARC-MATNR.
    CHECK MATLTYPE.
    CHECK DIVISION.
    CLEAR MBEW.
    SELECT SINGLE * FROM MBEW WHERE MATNR = MARC-MATNR
    AND BWKEY = MARC-WERKS.
    CLEAR MAKT.
    SELECT SINGLE * FROM MAKT WHERE SPRAS = 'EN'
    AND MATNR = MARC-MATNR.
    WRITE:/ MARC-WERKS, "Plant
    MARA-MTART, "Material type
    MARA-MATNR, "Material number
    MARA-MATKL, "Material group
    MARA-MBRSH, "Industry sector
    MARA-MEINS, "Base unit of measure
    MARA-GEWEI, "Weight Unit
    MARA-SPART, "Division
    MARC-EKGRP, "Purchasing group
    MBEW-VPRSV, "Price control indicator
    MBEW-STPRS, "Standard price
    MBEW-PEINH, "Price unit
    MAKT-SPRAS, "Language key
    MAKT-MAKTX. "Material description
    INT_MAT-WERKS = MARC-WERKS. "Plant
    INT_MAT-MTART = MARA-MTART. "Material type
    INT_MAT-MATNR = MARA-MATNR. "Material number
    INT_MAT-MATKL = MARA-MATKL. "Material group
    INT_MAT-MBRSH = MARA-MBRSH. "Industry sector
    INT_MAT-MEINS = MARA-MEINS. "Base unit of measure
    INT_MAT-GEWEI = MARA-GEWEI. "Weight Unit
    INT_MAT-SPART = MARA-SPART. "Division
    INT_MAT-EKGRP = MARC-EKGRP. "Purchasing group
    INT_MAT-VPRSV = MBEW-VPRSV. "Price control indicator
    INT_MAT-STPRS = MBEW-STPRS. "Standard price
    INT_MAT-PEINH = MBEW-PEINH. "Price unit
    INT_MAT-SPRAS = MAKT-SPRAS. "Language key
    INT_MAT-MAKTX = MAKT-MAKTX. "Material description
    APPEND INT_MAT.
    CLEAR INT_MAT.
    ENDSELECT.
    ENDFORM.
    FORM DOWNLOAD_FILE.
    call function 'WS_DOWNLOAD'
    EXPORTING
    FILENAME = F_FILE
    FILETYPE = 'DAT'
    FILETYPE = 'WK1'
    tables
    data_tab = INT_MAT
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_WRITE_ERROR = 2
    INVALID_FILESIZE = 3
    INVALID_TYPE = 4
    NO_BATCH = 5
    UNKNOWN_ERROR = 6
    INVALID_TABLE_WIDTH = 7
    GUI_REFUSE_FILETRANSFER = 8
    CUSTOMER_ERROR = 9
    OTHERS = 10.
    IF SY-SUBRC = 0.
    FORMAT COLOR COL_GROUP.
    WRITE:/ 'Data Download Successfully to your local harddisk'.
    SKIP.
    ENDIF.
    ENDFORM.
    FORM UPLOAD_FILE.
    call function 'WS_UPLOAD'
    EXPORTING
    FILENAME = F_FILE
    FILETYPE = 'DAT'
    FILETYPE = 'WK1'
    tables
    data_tab = INT_MAT
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_WRITE_ERROR = 2
    INVALID_FILESIZE = 3
    INVALID_TYPE = 4
    NO_BATCH = 5
    UNKNOWN_ERROR = 6
    INVALID_TABLE_WIDTH = 7
    GUI_REFUSE_FILETRANSFER = 8
    CUSTOMER_ERROR = 9
    OTHERS = 10.
    IF SY-SUBRC = 0.
    FORMAT COLOR COL_GROUP.
    WRITE:/ 'Data Upload Successfully from your local harddisk'.
    SKIP.
    ENDIF.
    ENDFORM.
    FORM UPDATE_MM.
    LOOP AT INT_MAT.
    Header
    BAPI_HEAD-MATERIAL = INT_MAT-MATNR.
    BAPI_HEAD-IND_SECTOR = INT_MAT-MBRSH.
    BAPI_HEAD-MATL_TYPE = INT_MAT-MTART.
    BAPI_HEAD-BASIC_VIEW = 'X'.
    BAPI_HEAD-PURCHASE_VIEW = 'X'.
    BAPI_HEAD-ACCOUNT_VIEW = 'X'.
    Material Description
    REFRESH INT_MAKT.
    INT_MAKT-LANGU = INT_MAT-SPRAS.
    INT_MAKT-MATL_DESC = INT_MAT-MAKTX.
    APPEND INT_MAKT.
    Client Data - Basic
    BAPI_MARA1-MATL_GROUP = INT_MAT-MATKL.
    BAPI_MARA1-BASE_UOM = INT_MAT-MEINS.
    BAPI_MARA1-UNIT_OF_WT = INT_MAT-GEWEI.
    BAPI_MARA1-DIVISION = INT_MAT-SPART.
    BAPI_MARAX-MATL_GROUP = 'X'.
    BAPI_MARAX-BASE_UOM = 'X'.
    BAPI_MARAX-UNIT_OF_WT = 'X'.
    BAPI_MARAX-DIVISION = 'X'.
    Plant - Purchasing
    BAPI_MARC1-PLANT = INT_MAT-WERKS.
    BAPI_MARC1-PUR_GROUP = INT_MAT-EKGRP.
    BAPI_MARCX-PLANT = INT_MAT-WERKS.
    BAPI_MARCX-PUR_GROUP = 'X'.
    Accounting
    BAPI_MBEW1-VAL_AREA = INT_MAT-WERKS.
    BAPI_MBEW1-PRICE_CTRL = INT_MAT-VPRSV.
    BAPI_MBEW1-STD_PRICE = INT_MAT-STPRS.
    BAPI_MBEW1-PRICE_UNIT = INT_MAT-PEINH.
    BAPI_MBEWX-VAL_AREA = INT_MAT-WERKS.
    BAPI_MBEWX-PRICE_CTRL = 'X'.
    BAPI_MBEWX-STD_PRICE = 'X'.
    BAPI_MBEWX-PRICE_UNIT = 'X'.
    WRITE:/ BAPI_HEAD, BAPI_MARC1.
    call function 'BAPI_MATERIAL_SAVEDATA'
    exporting
    HEADDATA = BAPI_HEAD
    CLIENTDATA = BAPI_MARA1
    CLIENTDATAX = BAPI_MARAX
    PLANTDATA = BAPI_MARC1
    PLANTDATAX = BAPI_MARCX
    FORECASTPARAMETERS =
    FORECASTPARAMETERSX =
    PLANNINGDATA =
    PLANNINGDATAX =
    STORAGELOCATIONDATA =
    STORAGELOCATIONDATAX =
    VALUATIONDATA = BAPI_MBEW1
    VALUATIONDATAX = BAPI_MBEWX
    WAREHOUSENUMBERDATA =
    WAREHOUSENUMBERDATAX =
    SALESDATA = BAPI_MVKE1
    SALESDATAX = BAPI_MVKEX
    STORAGETYPEDATA =
    STORAGETYPEDATAX =
    IMPORTING
    RETURN = BAPI_RETURN
    TABLES
    MATERIALDESCRIPTION = INT_MAKT
    UNITSOFMEASURE =
    UNITSOFMEASUREX =
    INTERNATIONALARTNOS =
    MATERIALLONGTEXT =
    TAXCLASSIFICATIONS =
    RETURNMESSAGES =
    PRTDATA =
    PRTDATAX =
    EXTENSIONIN =
    EXTENSIONINX =
    IF BAPI_RETURN-TYPE = 'E'.
    WRITE:/ 'Error Message ', BAPI_RETURN.
    ENDIF.
    ENDLOOP.
    ENDFORM.
    *---End of Program
    Reagrds,
    Kumar

  • Updating service contract line item's end date

    Hi,
    I am trying to extend the end date on a line item in a service contract via the DI and it is giving me the following error:  'Item's end date cannot be greater than contract's end date' and I don't understand why.
    I retrieve the service contract object, change the header end date then find the line item  I need, update it with the same end date and then issue call the SC update method.  Here's my code:
        Try
                 SC.Lines.SetCurrentLine(SerialNbrLineNumber)
                 NewStartDate = LineEndDate
                 'calculate new end date & extend service contract
                 NewEndDate = NewStartDate.AddYears(Warranty_Duration)
                'never make the contract end date earlier than it had been
                SC.EndDate = IIf(NewEndDate > SC.EndDate, _
                                                             NewEndDate, _
                                                             SC.EndDate)
                'update service contract detail with new end date
                 If NewEndDate > LineEndDate Then
                     SC.Lines.EndDate = NewEndDate
                 End If
                 If SC.Update() <> 0 Then
                    rs.RtnCode = -1
                    rs.RtnMessage = B1Comp.GetLastErrorDescription()
                 End If
    I did see something in the di help that mentions that B1 calcs an end date based on the "duration of coverage" field but I don't think I could use that because I might only change the end date for one line item. 
    BTW I can do this in the application with no problem.
    Thanks in advance for any assistance.

    Known B1 bug.  Should have checked support first.  More info on note # 1026540

  • How to Update a Row using ADF

    Hi every one
    Can any one help me out, How to Update a Row using ADF.
    Thanks in advance

    In addition to Clear to my question
    By Using ADF BC How can I update a record in a database.
    I have VO and EO associated with a table.
    How can I update a record using ADF BC
    Message was edited by:
    user616296

  • How to update flex to use air 1.5.1

    How to update Flex to use air 1.5.1?
    The last Nightly Build (3.4.0.5042) release today has the
    "old" 1.5 version of air sdk.
    Thanks

    Currently, you have to overlay the AIR 1.5.1 SDK on top of
    your Flex SDK. There are instructions in the AIR 1.5.1 release
    notes:
    http://www.adobe.com/support/documentation/en/air/1_5_1/releasenotes_developers.html#sdk
    The AIR 1.5.1 SDK is available here:
    http://www.adobe.com/products/air/tools/sdk/

  • How to map service contract data from ecc to crm

    Hi Experts,
    Please help me,how to map service contract data from ecc to crm system.
    is there any perticular process.please let me know.
    thanks in advance..

    Hi Srinivasulu,
    Create the service contract type of ECC and also item categories under it in ECC in CRM. Map the number ranges.
    Check the Partners mapping from R/3 to CRM and that will be all.
    I tried but in CRM in the transaction type internal number range is mandatory. So, if you create service contract in ECC with one number it will replicate to CRM but with different number. But you can see ECC number under the transaction history in CRM.
    Good Luck.
    Sharath.

Maybe you are looking for

  • SOAP adapter or file adapter

    Hi Gurus, Non-SAP system B ->PI->Non-SAP system A. The request is sent from non-SAP application  A to Pi and this is routed to another non SAP system sap example SYSTEM B. Then B sends the response in the form of XML file to Application A via PI. Thi

  • HPE-400Y Soundcard ASIO compliant?

    Is the  HP Pavilion Elite HPE-440y factory installed soundcard  ASIO  compatable?

  • How to hard reset MSI windpad enjoy 7 plus?

    The screen bullet password has been locked after several attempts and it requests me to provide email address & password. The wifi cannot be on currently, and I have forgotten the password for my email. I have tried to hard reset, by pressing power &

  • HT4623 i have a 3g,when will be a new update of the ios

    when will there be an upgrade ios for iphone 3g

  • Backup-GPO -All, can this be filtered?

    Hi guys, I'm using the following to backup all the GPO's in the domain: $Backups = Backup-GPO -All -Path $SubBackupFolder -Domain $DomainFQDN -Comment "Add comment here" However, I do not want to backup all the GPO's. I want to backup only about 20 G