Performance of BAPI's to create Leads and Activities

Hi,
I'm using the BAPI's BAPI_LEAD_CREATEMULTI and BAPI_ACTIVITYCRM_CREATEMULTI to create Leads and Activities.
The scenario is:
1) The input file has 3 types of records coming in
   (a) Leads only
   (b) Activities only (Prospect Lead activities)
   (c) LEad + Activity (rescheduled activities)
2) Depending on the type of record, I'm required to create the relevant order and if required link the lead and activity (scenario - C)(using the FM CRM_DOC_FLOW_MAINTAIN_OW).
3) In addition to this, I'm also required to link campaign elements to both Leads and Activities (done within the BAPI's BAPI_LEAD_CREATEMULTI and BAPI_ACTIVITYCRM_CREATEMULTI in the doc_flow structure).
ISSUE:
The issue that I am facing is that it is taking a lot of time to create these. I'm basically running a custom conversion program for LEads and Activities. The rate is almost 6-8 secs for each record, and we have about 500,000 records to be converted.
Also, I'm having to use the following function modules after the creation of Leads and Activities:
1) CRM_MA_ACT_SAVE - to set the status of the activity to OPEN or IN PROGRESS. This is being done after the creation of an activity because the BAPI BAPI_ACTIVITYCRM_CREATEMULTI seems to always default the status to OPEN.
2) CRM_ORDER_CHANGE_STATUS - to set the status of the LEad to OPEN or IN PROGRESS. This is being done after the creation of an activity because the BAPI BAPI_LEAD_CREATEMULTI seems to always default the status to OPEN.
3) BAPI_LEAD_ATT_CHANGE - to set the STATUS SINCE field for a Lead. This is being done because I'm unable to set the STATUS_SINCE field using the BAPI BAPI_LEAD_CREATEMULTI.
The logic being used within the code is to process a batch of records (500/1000 records - value is an input selection parameter) from the input file in one go, and then commit all of them after their creation. After this, the next batch of records is again processed and committed.
We've also tried to create LEads and Activities record by record and not in batches... but the performance still remains the same.
I'm not sure what is slowing down the process. If whether it is all the commits, or if it is the additional use of the FM's to change the 'status' and 'Stauts-since' values after having committed the leads and activities.
When we look at the LEads and Activities that are created, everything looks fine. It is only that the performance is really slow.
Thanks for all your patience and suggestions,
- Akarsh

In order to improve the performance you could use several processes. Just start you conversion-program with several variants at the same time.
Last time I converted 80.000 contracts it took me 6 hours with 5 processes.
Hopes this helps.

Similar Messages

  • Performance of BAPI's to create Leads and Activities in CRM

    Hi,
    I'm using the BAPI's BAPI_LEAD_CREATEMULTI and BAPI_ACTIVITYCRM_CREATEMULTI to create Leads and Activities.
    The scenario is:
    1) The input file has 3 types of records coming in
    (a) Leads only
    (b) Activities only (Prospect Lead activities)
    (c) LEad + Activity (rescheduled activities)
    2) Depending on the type of record, I'm required to create the relevant order and if required link the lead and activity (scenario - C)(using the FM CRM_DOC_FLOW_MAINTAIN_OW).
    3) In addition to this, I'm also required to link campaign elements to both Leads and Activities (done within the BAPI's BAPI_LEAD_CREATEMULTI and BAPI_ACTIVITYCRM_CREATEMULTI in the doc_flow structure).
    ISSUE:
    The issue that I am facing is that it is taking a lot of time to create these. I'm basically running a custom conversion program for LEads and Activities. The rate is almost 6-8 secs for each record, and we have about 500,000 records to be converted.
    Also, I'm having to use the following function modules after the creation of Leads and Activities:
    1) CRM_MA_ACT_SAVE - to set the status of the activity to OPEN or IN PROGRESS. This is being done after the creation of an activity because the BAPI BAPI_ACTIVITYCRM_CREATEMULTI seems to always default the status to OPEN.
    2) CRM_ORDER_CHANGE_STATUS - to set the status of the LEad to OPEN or IN PROGRESS. This is being done after the creation of an activity because the BAPI BAPI_LEAD_CREATEMULTI seems to always default the status to OPEN.
    3) BAPI_LEAD_ATT_CHANGE - to set the STATUS SINCE field for a Lead. This is being done because I'm unable to set the STATUS_SINCE field using the BAPI BAPI_LEAD_CREATEMULTI.
    The logic being used within the code is to process a batch of records (500/1000 records - value is an input selection parameter) from the input file in one go, and then commit all of them after their creation. After this, the next batch of records is again processed and committed.
    We've also tried to create LEads and Activities record by record and not in batches... but the performance still remains the same.
    I'm not sure what is slowing down the process. If whether it is all the commits, or if it is the additional use of the FM's to change the 'status' and 'Stauts-since' values after having committed the leads and activities.
    When we look at the LEads and Activities that are created, everything looks fine. It is only that the performance is really slow.
    Thanks for all your patience and suggestions,
    - Akarsh

    In order to improve the performance you could use several processes. Just start you conversion-program with several variants at the same time.
    Last time I converted 80.000 contracts it took me 6 hours with 5 processes.
    Hopes this helps.

  • BAPI needed to create invoice and creditmemo

    Hi all,
          Is there any BAPI available to create invoice and creditmemo when material no is not given.
          My requirement is to create credit memo and  invoice through FB75 or FB70 transaction. I am able to achieve the same through BDC. Is there any BAPI availabe for the same to create credit memo or invoice to avoid BDC.
          Input given to the program is a excel file in which i have the following fields
          Transaction -- which separates credit memo or
                         invoice
          Company code, purchase order number, GL account
          number, cost center, profit center, amount etc...
    Please let me know some pointers.
    Regards,
    Karthik.

    GN_INVOICE_CREATE or BAPI_BILLINGDOC_CREATEMULTIPLE
    Please find the sample code for Billing document BAPI.
    t_billing-salesorg = vbak-vkorg.
    t_billing-DISTR_CHAN = vbak-vtweg.
    t_billing-DIVISION = vbak-spart.
    t_billing-DOC_TYPE = vbak-auart.
    t_billing-ref_doc = vbak-vbeln.
    t_billing-ref_item = vbap-posnr.
    t_billing-doc_number = vbak-vbeln.
    t_billing-ITM_NUMBER = vbap-posnr.
    t_billing-ordbilltyp = 'BILLING TYPE'.
    t_billing-price_date = sy-datum.
    t_billing-ref_doc_ca = vbak-vbtyp.
    t_billing-sold_to = vbak-kunnr.
    t_billing-material = vbap-matnr.
    t_billing-plant = vbap-werks.
    APPEND t_billing.
    CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
    TABLES
    billingdatain = t_billing
    return = t_return
    success = t_success.
    commit work.
    Regards

  • Is there any BAPI/FM to create a trasnport request and add objects into it?

    Hi Experts,
    Could anyone please assist me in finding a BAPI/FM to create a transport request and add objects to it.
    I could find a BAPI BAPI_REQUEST_CREATE, it creates trasnport request but doesn't have option to add objects.
    Thanks
    Yogesh Gupta

    Create a custom Function Module , in that write a BDC to create a transport request and add objects to it.
    Thats it.

  • How to create a Sales Lead and Sales Lead Contact using Web Services

    Hi,
    I am working on integration of sales lead with third party application. I want to create a sales lead and sales lead contact using web services.
    The question is What WSDLs should I use to create Sales Lead and sales lead Contact? And What are the required parameters to pass to that WSDL?
    Please let me know if any information required.
    Thanks and Regards,
    Jason

    Hi,
      Sample soap messages for creating Sales Lead ::
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/marketing/leadMgmt/leads/leadService/types/" xmlns:lead="http://xmlns.oracle.com/oracle/apps/marketing/leadMgmt/leads/leadService/" xmlns:lead1="http://xmlns.oracle.com/apps/marketing/leadMgmt/leads/leadService/" xmlns:not="http://xmlns.oracle.com/apps/crmCommon/notes/noteService" xmlns:not1="http://xmlns.oracle.com/apps/crmCommon/notes/flex/noteDff/">
       <soapenv:Header/>
       <soapenv:Body>
          <typ:createSalesLead>
             <typ:salesLead>
                <lead:Name>Lead Created For Migrration Test4</lead:Name>
                <lead:Rating_c>A</lead:Rating_c>
             </typ:salesLead>
          </typ:createSalesLead>
       </soapenv:Body>
    </soapenv:Envelope>
      Sample soap messages for creating Opportunity ::
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/sales/opptyMgmt/opportunities/opportunityService/types/" xmlns:opp="http://xmlns.oracle.com/apps/sales/opptyMgmt/opportunities/opportunityService/" xmlns:rev="http://xmlns.oracle.com/apps/sales/opptyMgmt/revenues/revenueService/" xmlns:not="http://xmlns.oracle.com/apps/crmCommon/notes/noteService" xmlns:not1="http://xmlns.oracle.com/apps/crmCommon/notes/flex/noteDff/" xmlns:rev1="http://xmlns.oracle.com/oracle/apps/sales/opptyMgmt/revenues/revenueService/" xmlns:act="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/">
       <soapenv:Header/>
       <soapenv:Body>
          <typ:createOpportunity>
             <typ:opportunity>
                <opp:Name>Test Opportunity</opp:Name>
             </typ:opportunity>
          </typ:createOpportunity>
       </soapenv:Body>
    </soapenv:Envelope>
    Please revert if you have any clarifications.
    Best Regards,
    Mohd Sabeer

  • No template found creating Tabs and Processes in HR Flexible Performance UI

    Dear Experts
    We will be using EHP4 Flexible Performance UI.
    I have created the sample performance template in PHAP_CATALOG and have transported this to our DEV playpen client.
    Within the config Master client I want to configure the u201CDefine Tabs and Process Configuration for Templateu2019 IMG node and after I log in it takes me to the web dynpro screen u201CWeb dynpro ABAP configuration for Appraisalsu201D, I get the error u201CNo template foundu201D.
    When I check the Help it says 1) to check the template has been created and 2) that the template has been released
    I checked and the template does exist in PHAP_CATALOG and has been released.
    Has anyone encountered this problem and has a way to fix this?
    Thanks
    Oliver

    Hi Maurice,
    Thanks for your quick reply.
    Yes the template has been definitely released.
    Yes Iu2019m using the same user to create the template and trying to do the process tabs u2013 I have SAP ALL Access.
    Also, when I transport this template from the DEV master client - to a DEV unit test client I can actual run the process template setupu2026u2026u2026u2026.
    Developer has checked the code and DEV Master client is the same as DEV Unit test clientu2026u2026u2026.interesting.
    Have you ever come across the issue where the source client where template has been created and released that you could not create the process tabs?
    Any other ideas how I could solve this?
    Many thanks
    Oliver

  • BAPI to create PO and GR

    Hi,
    Can anybody send me some sample code to handle multiple files in application server. My requirement is to create an interface to create PO and GR from the file residing in Application server. Multiple files will be in application server. No selection screens are there. BAPI used are BAPI_PO_CREATE1 and BAPI_GOODSMVT_CREATE. And If anyone has already created this interface, please give me some idea of how to read multiple files and if possible send some sample code.
    Any help will be greatly appreciated.
    Regards,
    Naveen

    Hi Naveen,
        Go through this link.
    BAPI_PO_CREATE1
    Re: Proble in Creating Multiple Item PO using BAPI_PO_CREATE1
    BAPI_GOODSMVT_CREATE
    http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm
    http://www.4ap.de/abap/bapi_goodsmvt_create.php
    Reward Points For the Helpful.
    Regards,
    Harini.S

  • BAPI for create VIP and Group_d for BP

    Hey
    Do you know BAPI for filling fields VIP and Group_d from table BP001 for BP?
    Regards
    Radek

    Hey, thank you, with this BAPI I found bapi BAPI_BUPA_FS_TREASURY_ADD that suit my needs.
    BAPI FS_API_BP001_change is only for changing records, BAPI FS_API_BP001_ADD has some problems (short dump).
    Regards
    Radek

  • Function or bapi to upload the lead questionnaire to lead partner portal

    hi all,
    Is there any function or bapi to upload the lead questionnaire that exists in the marketing leads-lead partner portal . The survey should get attached to the lead . I am able to create the lead though with the LDPO process by a function module .Any help on this will be very useful.
    Thanks in advance.
    Mithun

    Hi Bharani,
    I can answer two of your questions:
    2. No, with a BAPI you cannot see the screens during processing.  After it is called you can display the BOM and check that the data is loaded correctly.
    3. You can see the error messages of the BAPI by looking in the RETURN structure.  This will contain details of any error, warning, information, and success messages generated during the creation of the BOM.
    Cheers,
    Brad

  • Creating IT00 and retrieving pernr

    Hi Guys,
              Generally when we do hiring in R/3, after creating IT0000 we get the pernr (internal). How to achieve this through BAPI? I know we cannot perform action thru BAPI. But what I am doing is I am creating each infotype (00, 01, 02, 06, 07, 19) with HR_MAINTAIN_MASTERDATA. So after creating IT00, I need to capture the created pernr and update other infotypes for that pernr. Is it right way? Please help me asap.

    use GET parameter ID PER as posted previously, that definitely works.  The HR_RETURN parameter does not work, that only contains PERNR when you are maintaining data on a pre-existing records.
    Be careful using HR_MAINTAIN_MASTERDATA for Hiring actions, in 4.6 it does not create the CP object and CP-->P relationship in OM.  Maybe it does in later releases, not sure.

  • Query on creating "Lead" from the Flat file

    Hi Group,
    I was trying to use the BAPI "BAPI_LEAD_CREATEMULTI" to create the lead.
    I have a requirement for creating the Lead... and I have a few questions on creating the Lead like:
    1)Does this Lead creation happen with the Business Partners or it has no
    in no way connection with the Business Partners?
    2)My requirement is that, I need to create leads for the records of the input file
    which I get from the User and this looks like this with the fields as:
    Sales prospect; Lead group; status; Qualification level; Origin; Priority; contact person; Lead group; status; Qualification level; Origin; and Priority.
    (ie., 12 different input fields starting with Sales Prospect to Priority ).
    In Sales Prospect, I will give the Business Partner # and also in the Contact Person.
    Could you pls let me know how my requriement can be fulfilled( probably with some other code ).
    Please give me your valuable suggestions on this to move further. And also, please give me some sample code to build this requirement.
    thanks in advance.
    Regards,
    Vishnu.

    Check the return structure in the BAPI if it contains only success message, then try giving <b>CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'</b> passing essential parameters immediately after the create bapi call.

  • BAPI Sales order create with reference

    Hi
    I need to use BAPI to create sales order with reference to Quantity Contract. The line item material quantity would be less than or equal to quantity contract quantity.
    Sales order needs to be created with new quantity.
    Quantity contract quantity change needs to be maintained.
    Document flow needs to be maintained.
    Is any one aware if this is possible using BAPI_SALESORDER_CREATEFROMDAT2. If yes, how?
    Any insights would be highly appreciated.

    Hi Maninder,
    The BAPI does not allow the Pricing Conditions to be sourced from the Contract. I debugged the BAPI and it uses a piece of code (don't recall which subroutine though) from SAPMV45A which is relevant for dialog processing where it reads from the VBAP and *VBAP structures. Well this structure is only populated when you are using the Front End transaction (VA41, VA42, etc). Because this structure is empty, pricing conditions do not flow across.
    Here is a little prototype program I whipped up to test my method of creating a Sales order and then changing the Sales Order:
    REPORT  ypat_salesorder_create LINE-SIZE 256.
    * This program will create a ZOC Sales Order with Reference to Contract
    * 20000720 / 10. This will be done via BAPI. There are 2 BAPi calls,
    * BAPI_SALESORDER_CREATEFROMDAT2 and BAPI_SALESORDER_CHANGE. We need to
    * perform 2 BAPI calls as the BAPI to create the Sales Order does not
    * bring across the Pricing Conditions properly. To get around this we
    * create the Order with reference to the Contract, then we get the
    * related Pricing Conditions from the COntract and then update the newly
    * created Order.
    * Constants
    CONSTANTS: c_contract  LIKE vbak-vbeln VALUE '0020000720',
               c_item      LIKE vbap-posnr VALUE '000010'.
    * Structures
    * Structure to hold BAPI Header
    DATA: st_bapisdhd1   LIKE bapisdhd1.
    * Internal Tables
    * Sales Order Create BAPI Return Messages
    DATA: tbl_return     TYPE STANDARD TABLE OF bapiret2
                         WITH HEADER LINE.
    * Sales Order BAPI Line Item
    DATA: tbl_bapisditm  TYPE STANDARD TABLE OF bapisditm
                         WITH HEADER LINE.
    * Sales Order BAPI Line Item
    DATA: tbl_bapisditmx  TYPE STANDARD TABLE OF bapisditmx
                         WITH HEADER LINE.
    * Sales Order BAPI Pricing Conditions
    DATA: tbl_bapicond   TYPE STANDARD TABLE OF bapicond
                         WITH HEADER LINE.
    * Sales Order BAPI Partner Functions
    DATA: tbl_bapiparnr  TYPE STANDARD TABLE OF bapiparnr
                         WITH HEADER LINE.
    * Sales Order BAPI Schedule Lines
    DATA: tbl_bapischdl  TYPE STANDARD TABLE OF bapischdl
                         WITH HEADER LINE.
    * Sales Order BAPI Schedule Lines
    DATA: tbl_bapischdlx TYPE STANDARD TABLE OF bapischdlx
                         WITH HEADER LINE.
    * Sales Order BAPI Pricing Conditions
    DATA: tbl_bapicondx    TYPE STANDARD TABLE OF bapicondx
                           WITH HEADER LINE.
    * Customer Enhancement for VBAK, VBAP, VBEP
    DATA: tbl_bapiparex    TYPE STANDARD TABLE OF bapiparex
                           WITH HEADER LINE.
    * Table to hold BAPI Detail Conditions
    DATA: tbl_bapisdcond   TYPE STANDARD TABLE OF bapisdcond
                           WITH HEADER LINE.
    * Table to hold Return Messages from Sales Order Change BAPI
    DATA: tbl_return_chg  TYPE STANDARD TABLE OF bapiret2
                          WITH HEADER LINE.
    * Variables
    DATA: g_vbeln_created   LIKE vbak-vbeln,
          g_valid_contract  TYPE c,
          g_cont_price_date TYPE d.
    * Start of Selection
    START-OF-SELECTION.
      PERFORM validate_contract.
      PERFORM create_sales_ord.
      PERFORM update_sales_ord.
    * End of Selection
    END-OF-SELECTION.
      PERFORM write_output_report.
    * Subroutines
    *&      Form  create_sales_ord
    *       Create the Sales Order
    FORM create_sales_ord .
      PERFORM populate_bapi_tables.
      PERFORM call_create_sales_ord_bapi.
    ENDFORM.                    " create_sales_ord
    *&      Form  populate_bapi_tables
    *       Fill up the BAPI Tables
    FORM populate_bapi_tables .
      PERFORM populate_bapi_header.
      PERFORM build_bapi_partners.
      PERFORM build_bapi_items.
      PERFORM build_bapi_sched_lines.
    ENDFORM.                    " populate_bapi_tables
    *&      Form  populate_bapi_header
    *       Build BAPI Header Details
    FORM populate_bapi_header .
      CLEAR st_bapisdhd1.
      st_bapisdhd1-doc_type     = 'ZOC'.         "Order type
      st_bapisdhd1-sales_org    = '026'.         "Sales Org
      st_bapisdhd1-distr_chan   = '00'.          "Dist Channel
      st_bapisdhd1-division     = '00'.          "Division
      st_bapisdhd1-purch_no_c   = 'Cust Po No'.  "Cust PO No
      st_bapisdhd1-name         = 'Orderer'.     "Name of Orderer
      st_bapisdhd1-ord_reason   = ''.            "Order Reason
      st_bapisdhd1-sales_off    = '3001'.        "Sales Office
      st_bapisdhd1-sales_grp    = '301'.         "Market Area
      IF g_valid_contract = 'X'.
        st_bapisdhd1-price_date = g_cont_price_date.
      ENDIF.
    ENDFORM.                    " populate_bapi_header
    *&      Form  build_bapi_partners
    *       Build BAPI Partner Functions
    FORM build_bapi_partners .
      CLEAR tbl_bapiparnr.
      tbl_bapiparnr-partn_role   = 'AG'.
      tbl_bapiparnr-partn_numb   = '0000100750'.
      APPEND tbl_bapiparnr.
      CLEAR tbl_bapiparnr.
      tbl_bapiparnr-partn_role   = 'WE'.
      tbl_bapiparnr-partn_numb   = '0000504472'.
      APPEND tbl_bapiparnr.
    ENDFORM.                    " build_bapi_partners
    *&      Form  build_bapi_items
    *       Build The BAPI Line Items
    FORM build_bapi_items .
      DATA: l_matnr LIKE mara-matnr.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = '10000072'
        IMPORTING
          output = l_matnr.
      CLEAR tbl_bapisditm.
      tbl_bapisditm-itm_number  = c_item.
      IF g_valid_contract = 'X'.
        tbl_bapisditm-ref_doc     = c_contract.
        tbl_bapisditm-ref_doc_it  = c_item.
        tbl_bapisditm-ref_doc_ca  = 'G'.       "Contract
      ENDIF.
      tbl_bapisditm-material    = l_matnr.
      tbl_bapisditm-plant       = '3012'.
      tbl_bapisditm-target_qty  = '5.000'.
      tbl_bapisditm-target_qu   = 'M3'.
      tbl_bapisditm-item_categ  = 'ZZOC'.
      tbl_bapisditm-sales_dist  = '301'.
      tbl_bapisditm-dlv_prio    = '02'.
      tbl_bapisditm-prc_group5  = '080'.
      tbl_bapisditm-cust_mat35  = 'kdmat'.
      tbl_bapisditm-route       = 'TESYS'.
      tbl_bapisditm-usage_ind   = 'CIV'.
      APPEND tbl_bapisditm.
      CLEAR tbl_bapisditmx.
      tbl_bapisditmx-itm_number = c_item.
      tbl_bapisditmx-ref_doc    = 'X'.
      tbl_bapisditmx-ref_doc_it = 'X'.
      tbl_bapisditmx-ref_doc_ca = 'X'.
      tbl_bapisditmx-material   = 'X'.
      tbl_bapisditmx-updateflag = 'I'.
      tbl_bapisditmx-plant      = 'X'.
      tbl_bapisditmx-target_qty = 'X'.
      tbl_bapisditmx-target_qu  = 'X'.
      tbl_bapisditmx-item_categ = 'X'.
      tbl_bapisditmx-sales_dist = 'X'.
      tbl_bapisditmx-dlv_prio   = 'X'.
      tbl_bapisditmx-prc_group5 = 'X'.
      tbl_bapisditmx-cust_mat35 = 'X'.
      tbl_bapisditmx-usage_ind  = 'X'.
      tbl_bapisditmx-route      = 'X'.
      APPEND tbl_bapisditmx.
    ENDFORM.                    " build_bapi_items
    *&      Form  build_bapi_sched_lines
    *       Build the BAPI Schedule Lines
    FORM build_bapi_sched_lines .
      CLEAR tbl_bapischdl.
      tbl_bapischdl-itm_number  = c_item.
      tbl_bapischdl-req_qty     = '1'.
      tbl_bapischdl-req_date    = sy-datum.
      APPEND tbl_bapischdl.
    ENDFORM.                    " build_bapi_sched_lines
    *&      Form  build_bapi_conditions
    *       Pull the BAPI Pricing Conditions from the Contract
    FORM build_bapi_conditions .
      LOOP AT tbl_bapisdcond.
        CLEAR tbl_bapicond.
        MOVE-CORRESPONDING tbl_bapisdcond TO tbl_bapicond.
        APPEND tbl_bapicond.
        CLEAR tbl_bapicondx.
        tbl_bapicondx-itm_number = tbl_bapicond-itm_number.
        tbl_bapicondx-cond_st_no = tbl_bapicond-cond_st_no.
        tbl_bapicondx-cond_count = tbl_bapicond-cond_count.
        tbl_bapicondx-cond_type  = tbl_bapicond-cond_type.
        tbl_bapicondx-updateflag = 'I'.
        tbl_bapicondx-cond_value = 'X'.
        tbl_bapicondx-currency   = 'X'.
        tbl_bapicondx-cond_unit  = 'X'.
        tbl_bapicondx-cond_p_unt = 'X'.
        tbl_bapicondx-varcond    = tbl_bapicond-varcond.
        APPEND tbl_bapicondx.
      ENDLOOP.
    ENDFORM.                    " build_bapi_conditions
    *&      Form  call_create_sales_ord_bapi
    *       Call the Sales Order Create BAPI
    FORM call_create_sales_ord_bapi .
      CLEAR g_vbeln_created.
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
          order_header_in    = st_bapisdhd1
        IMPORTING
          salesdocument      = g_vbeln_created
        TABLES
          return             = tbl_return
          order_items_in     = tbl_bapisditm
          order_items_inx    = tbl_bapisditmx
          order_partners     = tbl_bapiparnr
          order_schedules_in = tbl_bapischdl.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDFORM.                    " call_create_sales_ord_bapi
    *&      Form  update_sales_ord
    *       Update the newly created Sales Order with the Pricing Conditions
    *       from the Contract
    FORM update_sales_ord .
      CHECK g_valid_contract EQ 'X'.
      PERFORM get_contract_details.
      PERFORM build_bapi_conditions.
      PERFORM call_change_sales_ord_bapi.
    ENDFORM.                    " update_sales_ord
    *&      Form  get_contract_details
    *       Get Contract Details
    FORM get_contract_details .
    * Need to manually get the relevant Pricing Conditions as the BAPI
    * BAPISDORDER_GETDETAILEDLIST causes problems when we call the BAPI
    * BAPI_SALESORDER_CREATEFROMDAT2 and BAPI_SALESORDER_CHANGE (I think
    * this is due to the fact that these BAPIs belong to the same Function
    * Group and there must be some common structures that are not cleared
    * causing us all sorts of grief when we try and call the next BAPI)
      DATA: tbl_konv TYPE STANDARD TABLE OF konv WITH HEADER LINE.
      DATA: tbl_komv TYPE STANDARD TABLE OF komv WITH HEADER LINE.
      DATA: tbl_vbak TYPE STANDARD TABLE OF vbak WITH HEADER LINE.
    * Pricing Condition Master
      DATA: BEGIN OF tbl_t685a OCCURS 0,
              kschl     LIKE t685a-kschl,
              kaend_wrt LIKE t685a-kaend_wrt,
            END OF tbl_t685a.
      SELECT *
             INTO TABLE tbl_vbak
             FROM vbak
             WHERE vbeln = c_contract.
      READ TABLE tbl_vbak INDEX 1.
      SELECT *
             INTO TABLE tbl_konv
             FROM konv
             WHERE knumv = tbl_vbak-knumv AND
                   kposn = c_item.
      CHECK sy-subrc EQ 0.
    * We now need to make sure we only bring across the Condition Types that
    * are EDITABLE. If we bring across non editable conditions (such as
    * 'ZPR1') the Change Sales Order BAPI will fail
      SELECT kschl kaend_wrt
             INTO TABLE tbl_t685a
             FROM t685a
             FOR ALL ENTRIES IN tbl_konv
             WHERE kappl     EQ 'V'             AND  "Sales
                   kschl     EQ tbl_konv-kschl  AND
                   kaend_wrt EQ 'X'             AND  "Value is Editable
                   kmanu     NE 'D'.                 "Process manually
    * Prepare for Binary Search
      SORT tbl_t685a BY kschl.
      LOOP AT tbl_konv.
        READ TABLE tbl_t685a WITH KEY kschl = tbl_konv-kschl BINARY SEARCH.
        IF sy-subrc EQ 0.
          MOVE-CORRESPONDING tbl_konv TO tbl_komv.
          APPEND tbl_komv.
        ENDIF.
      ENDLOOP.
      CHECK NOT tbl_komv[] IS INITIAL.
    * Map KOMV into the more BAPI friendly BAPISDCOND structure
      CALL FUNCTION 'MAP_INT_TO_EXT_STRUCTURE'
        TABLES
          fxvbak        = tbl_vbak
          fxkomv        = tbl_komv
          fxbapikomv    = tbl_bapisdcond
        EXCEPTIONS
          entry_missing = 1
          OTHERS        = 2.
    ENDFORM.                    " get_contract_details
    *&      Form  call_change_sales_ord_bapi
    *       Call the Change Sales Order BAPI
    FORM call_change_sales_ord_bapi .
      DATA: st_head_chg      LIKE bapisdh1x,
            st_logic_switch  TYPE bapisdls.
      CHECK NOT g_vbeln_created IS INITIAL.
      CHECK g_valid_contract EQ 'X'.
      st_head_chg-updateflag     = 'U'.
      st_logic_switch-cond_handl = 'X'.
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument    = g_vbeln_created
          order_header_inx = st_head_chg
          logic_switch     = st_logic_switch
        TABLES
          return           = tbl_return_chg
          conditions_in    = tbl_bapicond
          conditions_inx   = tbl_bapicondx.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDFORM.                    " call_change_sales_ord_bapi
    *&      Form  write_output_report
    *       Produce Output Report
    FORM write_output_report .
      IF NOT g_vbeln_created IS INITIAL.
        WRITE:/ 'Success! Sales Order', g_vbeln_created, 'was created!'.
      ELSE.
        WRITE:/ 'Failure! Sales Order was not created!'.
      ENDIF.
      SKIP.
      WRITE:/ 'Sales Order Create Log'.
      LOOP AT tbl_return.
        WRITE:/ tbl_return-type, tbl_return-id, tbl_return-number,
                tbl_return-message.
      ENDLOOP.
      SKIP.
      WRITE:/ 'Sales Order Change Log'.
      LOOP AT tbl_return_chg.
        WRITE:/ tbl_return_chg-type, tbl_return_chg-id,
                tbl_return_chg-number, tbl_return_chg-message.
      ENDLOOP.
    ENDFORM.                    " write_output_report
    *&      Form  validate_contract
    *       Make sure that the Contract is Valid
    FORM validate_contract .
      DATA: l_gueen  LIKE vbak-gueen,
            l_prsdt  LIKE vbkd-prsdt.
      SELECT SINGLE  vbak~gueen vbkd~prsdt
             INTO (l_gueen, l_prsdt)
             FROM vbak
             INNER JOIN vbkd
             ON vbak~vbeln = vbkd~vbeln
             WHERE vbak~vbeln = c_contract AND
                   vbkd~posnr = '000000'.
      IF sy-datum LE l_gueen.
    * Contract is valid! Set Order Price Date
        g_valid_contract  = 'X'.
        g_cont_price_date = l_prsdt.
      ENDIF.
    ENDFORM.                    " validate_contract
    Hope this helps.
    Cheers,
    Pat.

  • How to create lead follow up opportunity....

    Hello,
    How to create lead follow up opportunity automatically... Also my clients need is when we change the status of Lead from Open or In-Process or Won to Completed then an automatic email should go to the employee responsible in the lead.
    Please help me in this.... I tried doing this by creating Action profile & assigning that action profile to transaction type but didn't get the expected result.
    I would really appreciate some one help on this.... Please describe it in steps for automatic Opportunity creation & also for email.
    Thanks,
    Ajeet

    Using action is correct approach. You just have to configure action properly. For follow-up use in action 'method call' and use method 'copy_document' and as parameter specify transaction type that you want to be created as follow-up.
    For mail, you can use in action trigger_alert method.

  • How to add custom field in delivery address/performance location tab in SRM shopping cart and Ship to address Pop-up in SRM PO?

    Hi Experts
    i have a reuirement where i have to add custom field in delivery address/performance location tab in SRM shopping cart and Ship to address Pop-up in SRM PO
    i am doing below steps for this.
    1. Adding custom field ZZfield in structure INCL_EEW_PD_PARTNER_CSF by  using  append structure.
    2. Spro ->Supplier Relationship Management -> SRM Server -> Cross application basic settings -> Extensions and field controls (personalization) -> Configure field control ->Configure Control for Fields of Substructures
    then click on  "Metadata for Fields of Substructures and Table-Like Enhancements"  
    add the below entry
    Bus. Object Set Type  : I am trying 7 and 29
    Structure Field Name  : ZZfield
    Bus. Object Type       : BUS2121/BUS2201
    Set Level                    : Item
    Field Visible :  Check box should be checked
    Field Enable :  check box should be checked
    Can anyone has the idea of this?
    Thanks
    Rohit

    Hello Rohit,
    Please create a enchancement for component  /SAPSRM/WDC_UI_DO_SHIPTO.
    Add new input field and label in view V_DODC_SHIPTO.
    Bind the input field value with field ZZfield from structure  /SAPSRM/WDC_UI_DO_SHIPTO in the context node SHIP_TO .
    Regards,
    Neelima

  • BAPIs fpr T-Codes FV70 and FV-75 for creation of Customer Invoices

    Hi all,
    Can any1 tell me Validation BAPIs for T-Codes FV70 and FV75.
    Please bear the following points
    1. The BAPI should NOT create Parked Customer Invoices, they should just validate that the data to create the customer invoice.
    2. The Transaction are used for CUSTOMER invoices NOt Vendor.
    3. I've searched SDN and I got the follwing BAPIs 
                  a. BAPI_INCOMINGINVOICE_PARK
                  b. MRM_INVOICE_PARK
                  c. MRM_PARKED_INVOICE_ACCDATA
    But they are all for Vendor Invoices and CREATE parking invoices, Both the things I do not want.
    If someone knows the name of the BAPI please forward to me at the earliest.
    Cheers
    Abhishek

    Hi Eric,
    Many thanks, I'll check the BAPI out, meanwhile can u also tell me whether there is a BAPI for creating Parking documents, i.e. BAPIs for T-Codes for FV70 and FV75.
    I've tried to find a lot about this, but they say that BAPIs are there for only posting, not parking the Customer Invoices.
    Cheers
    Abhishek

Maybe you are looking for

  • How to compare two schemas in Oracle sql developer

    Hello, I need to compare both the data and schemas details (columns etc) between two schemas on different databases (connections). What is the easiest and most efficient way to do this? Hopefully in Oracle Sql Developer or Sql Plus? Thanks.

  • Ports not appearing in the command prompt

    Hi all, I have enabled the following ports in my windows 8 system using firewall. I opened the firewall.cpl and created rules both for inbound ports & outbound ports. The Opened ports are as below:- 443, 25, 587, 143, 993, 995, 80, 3478,5061,5223. Al

  • How to play all?

    I'm trying to make a dvd with two movies and I was wondering how would I be able to make the dvd play all the contents at once rather than going back to the main menu after every movie.

  • Wireless direct configuration source manual

    I have a Photosmart 5520 printer and we changed router and Ithe P address schem.  On the first page of the Network configuration page the IP address is correct at10.0.1.10 (DHCP).  On the second page under "Wireless Direct" the IP address is 192.168.

  • From OU to sub-suffix

    At the beginning of setting up a server (MS Windows Server 2003) i mistakenly created a single suffix and added all my data to a single OU within that suffix - as it turns out I need to have that data in it's own sub-suffix since I need to separate t