Help: BAPI_SLSTRANSACT_CREATEMULTI

good morning,
sorry for my english, i try to explain, well!!!
I have a little problem with bapi
"BAPI_SLSTRANSACT_CREATEMULTI".
I call bapi in the abap program as any other function module, when i execute program, nothing happens: no message, no return code, no document (also with BAPI_TRANSACTION_COMMIT).
which kind of data is required for table INPUT_FIELDS?
which is the error? 
Help!!
Best regards.
Ale
Message was edited by: alessandra la monica

Hi Ale,
   While I try to get my main programme for you, you can check out the following function module which I have used within the earlier function module that I sent to you. Pay attention to those interface parameters for which you get an error.
function zbapi_busprocessnd_create.
""Local interface:
*"  IMPORTING
*"     VALUE(I_SERVICE_OS) TYPE  CRMT_SRV_OSSET_COMT OPTIONAL
*"  TABLES
*"      HEADER STRUCTURE  BAPIBUS20001_HEADER_INS
*"      ITEM STRUCTURE  BAPIBUS20001_ITEM OPTIONAL
*"      ACTIVITY STRUCTURE  BAPIBUS20001_ACTIVITY_INS OPTIONAL
*"      SALES STRUCTURE  BAPIBUS20001_SALES OPTIONAL
*"      PARTNER STRUCTURE  BAPIBUS20001_PARTNER_INS OPTIONAL
*"      ORGANISATION STRUCTURE  BAPIBUS20001_ORGMAN_INS OPTIONAL
*"      SHIPPING STRUCTURE  BAPIBUS20001_SHIPPING OPTIONAL
*"      APPOINTMENT STRUCTURE  BAPIBUS20001_APPOINTMENT_INS OPTIONAL
*"      TEXT STRUCTURE  BAPIBUS20001_TEXT_INS OPTIONAL
*"      STATUS STRUCTURE  BAPIBUS20001_STATUS_INS OPTIONAL
*"      INPUT_FIELDS STRUCTURE  BAPIBUS20001_INPUT_FIELDS OPTIONAL
*"      CREATED_PROCESS STRUCTURE  BAPIBUS20001_HEADER_INS OPTIONAL
*"      RETURN STRUCTURE  BAPIRET2 OPTIONAL
*"      LEAD STRUCTURE  BAPIBUS20001_LEAD OPTIONAL
*"      OPPORTUNITY STRUCTURE  BAPIBUS20001_OPPORTUNITY OPTIONAL
*"      PRODUCT STRUCTURE  BAPIBUS20001_PRODUCT OPTIONAL
*"      SCHEDULELINE STRUCTURE  BAPIBUS20001_SCHEDLIN OPTIONAL
*"      CUSTOMER_HEAD STRUCTURE  BAPIBUS20001_CUSTOMER_H OPTIONAL
*"      CUSTOMER_ITEM STRUCTURE  BAPIBUS20001_CUSTOMER_I OPTIONAL
*"      PRICING STRUCTURE  BAPIBUS20001_PRICING OPTIONAL
*"      PRICING_ITEM STRUCTURE  BAPIBUS20001_PRICING_I OPTIONAL
*"      CONDITION_CREATE STRUCTURE  BAPIBUS20001_CONDITION_CREATE
*"       OPTIONAL
*"      BILLING STRUCTURE  BAPIBUS20001_BILLING OPTIONAL
*"      CONFIG_CFG STRUCTURE  BAPIBUS20001_CONFIG_CFG OPTIONAL
*"      CONFIG_BLB STRUCTURE  BAPIBUS20001_CONFIG_BLB OPTIONAL
*"      CONFIG_INS STRUCTURE  BAPIBUS20001_CONFIG_INS OPTIONAL
*"      CONFIG_PRT STRUCTURE  BAPIBUS20001_CONFIG_PRT OPTIONAL
*"      CONFIG_VAL STRUCTURE  BAPIBUS20001_CONFIG_VAL OPTIONAL
*"      CONFIG_VK STRUCTURE  BAPIBUS20001_CONFIG_VK OPTIONAL
*"      CONFIG_REF STRUCTURE  BAPIBUS20001_CONFIG_REF OPTIONAL
*"      ADDRESS STRUCTURE  BAPIADDR3 OPTIONAL
*"      BILLPLAN STRUCTURE  BAPIBUS20001_BILLPLAN OPTIONAL
*"      BILLPLAN_DATE STRUCTURE  BAPIBUS20001_BILLPLAN_DATE OPTIONAL
*"      EXTENSIONIN STRUCTURE  BAPIPAREX OPTIONAL
*"      DOCUMENT_FLOW STRUCTURE  BAPIBUS20001_DOC_FLOW_INS OPTIONAL
*"      BATCH STRUCTURE  BAPIBUS20001_BATCH OPTIONAL
*"      PRICING_AGR_CRM STRUCTURE  BAPIBUS20001_PRICE_AGR_CRM OPTIONAL
*"      FINPROD_ITEM STRUCTURE  BAPIBUS20001_FINPROD_ITEM OPTIONAL
*"      CANCEL STRUCTURE  BAPIBUS20001_CANCEL OPTIONAL
*"      CANCEL_IR STRUCTURE  BAPIBUS20001_CANCEL_IR OPTIONAL
*"      PRODUCT_LIST STRUCTURE  BAPIBUS20001_PRODUCT_LIST OPTIONAL
*"      PRODUCTS STRUCTURE  BAPIBUS20001_PRODUCTS OPTIONAL
*"      OBJECTS STRUCTURE  BAPIBUS20001_OBJECTS OPTIONAL
*"      PAYPLAN STRUCTURE  BAPIBUS20001_PAYPLAN OPTIONAL
*"      PAYPLAN_DATE STRUCTURE  BAPIBUS20001_PAYPLAN_DATE OPTIONAL
*"      CONFIG_FILTER_CFG STRUCTURE  BAPIBUS20001_CONFIG_FILTER_CFG
*"       OPTIONAL
*"      CONFIG_FILTER_INS STRUCTURE  BAPIBUS20001_CONFIG_FILTER_INS
*"       OPTIONAL
*"      CONFIG_FILTER_PRT STRUCTURE  BAPIBUS20001_CONFIG_FILTER_PRT
*"       OPTIONAL
*"      CONFIG_FILTER_VAL STRUCTURE  BAPIBUS20001_CONFIG_FILTER_VAL
*"       OPTIONAL
*"      ACTIVITY_I STRUCTURE  BAPIBUS20001_ACTIVITY_I OPTIONAL
  data: lt_orderadm_h_com  type crmt_orderadm_h_comt,
        ls_orderadm_h_com  like line of lt_orderadm_h_com,
        lt_activity_h_com  type crmt_activity_h_comt,
        lt_activity_i_com  type crmt_activity_i_comt,
        lt_partner_com     type crmt_partner_comt,
        lt_orgman_com      type crmt_orgman_comt,
        lt_appointment_com type crmt_appointment_comt,
        lt_text_com        type crmt_text_comt,
        lt_status_com      type crmt_status_comt,
        lt_service_os_com  type crmt_srv_osset_comt,
        lt_input_fields    type crmt_input_field_tab,
        ls_created_process like line of created_process,
        lt_order_guids     type crmt_object_guid_tab.
  data: lt_opport_h_com    type crmt_opport_h_comt,
        lt_lead_h_com      type crmt_lead_h_comt,
        lt_orderadm_i_com  type crmt_orderadm_i_comt,
        ls_orderadm_i_com  like line of lt_orderadm_i_com,
        lt_product_i_com   type crmt_product_i_comt,
        lt_schedlin_i_com  type crmt_schedlin_i_comt,
        lt_sales_com       type crmt_sales_comt,
        lt_shipping_com    type crmt_shipping_comt,
        lt_customer_h_com  type crmt_customer_h_comt,
        lt_customer_i_com  type crmt_customer_i_comt,
        lt_pricing_com     type crmt_pricing_comt,
        lt_billing_com     type crmt_billing_comt,
        lt_config_com      type crmt_config_comt,
        lt_pricing_i_com   type crmt_pricing_i_comt,
        lt_pridoc_com      type crmt_pridoc_comt,
        lt_billplan_com    type crmt_billplan_comt,
        lt_doc_flow_com    type crmt_doc_flow_comt.
  data: ls_process_settings type  bapibus20001_procsettings.
dummy table to fill interface of mapping routine
  data: lt_condition_change type table of bapibus20001_condition_change,
        lt_condition_delete type table of bapibus20001_condition_delete.
// Update
  data: lt_header_save type table of bapibus20001_guid_dis,
        ls_header_save like line of lt_header_save,
        lt_saved_objects type table of bapibus20001_object_id,
        ls_saved_object  like line of lt_saved_objects.
// Container of BAPI dialog status before this function group starts
  data: lv_bapi_no_dialog type crmt_boolean.
// BAPI update
  data: lt_batch_com type crmt_batch_comt,
        lt_pricing_agr_crm_com type crmt_price_agreements_crm_comt,
        lt_finprod_i_com type crmt_finprod_i_comt,
        lt_cancel_com type crmt_cancel_comt,
        lt_cancel_ir_com type crmt_cancel_ir_comt,
        lt_ordprp_i_com type crmt_ordprp_i_comt,
        lt_ordprp_i_d_com type crmt_ordprp_i_d_comt,
        lt_ordprp_objl_i_d_com type crmt_ordprp_objl_i_d_comt,
        lt_payplan_com type crmt_payplan_comt,
        lt_payplan_d_com type crmt_payplan_d_comt,
        lt_config_filter_com type crmt_config_filter_comt.
*---- surpress dialog
  perform set_no_dialog changing lv_bapi_no_dialog.
  perform map_into_orderadm_h_com_ins tables   header
                                               return
                                      changing lt_orderadm_h_com.
Item
  perform map_into_orderadm_i_com tables   item
                                           return
                                  changing lt_orderadm_i_com.
  perform map_into_partner_com_ins tables   partner
                                   changing lt_partner_com.
  perform map_into_orgman         tables organisation input_fields
                                  changing lt_orgman_com.
  perform map_into_text_com_ins   tables   text
                                           return
                                  changing lt_text_com.
perform map_into_service_os_com_ins tables LT_service_os
                                   changing lt_service_os_com.
opportunity
  perform map_into_opport_h_com   tables   opportunity
                                           return
                                  changing lt_opport_h_com.
lead
  perform map_into_lead_h_com     tables   lead
                                           return
                                  changing lt_lead_h_com.
product
  perform map_into_product_i_com  tables   product
                                           return
                                  changing lt_product_i_com.
scheduleline
  perform map_into_schedlin_i_com tables   scheduleline
                                  changing lt_schedlin_i_com.
customer_head
  perform map_into_customer_h     tables   customer_head
                                  changing lt_customer_h_com.
customer_item
  perform map_into_customer_i     tables   customer_item
                                  changing lt_customer_i_com.
pricing
  perform map_into_pricing        tables   pricing
                                           return
                                  changing lt_pricing_com.
pricing_item
  perform map_into_pricing_i      tables   pricing_item
                                           return
                                  changing lt_pricing_i_com.
billing
  perform map_into_billing        tables   billing
                                  changing lt_billing_com.
config
  perform map_into_config         tables   config_cfg
                                           config_blb
                                           config_ins
                                           config_prt
                                           config_val
                                           config_vk
                                           config_ref
                                           return
                                  changing lt_config_com.
config filter
  perform map_into_config_filter   tables config_filter_cfg
                                          config_filter_ins
                                          config_filter_prt
                                          config_filter_val
                                          return
                                   changing lt_config_filter_com.
pricing conditions
  perform map_into_pridoc         tables   condition_create
                                           lt_condition_change
                                           lt_condition_delete
                                           return
                                  changing lt_pridoc_com.
billplan
  perform map_into_billplan       tables   billplan
                                           billplan_date
                                           return
                                  changing lt_billplan_com.
appointment
  perform map_into_appointment
          tables return appointment changing lt_appointment_com.
document flow
  perform map_into_docflow
          tables document_flow changing lt_doc_flow_com.
  inserttable activity     gs_activity_h_com  lt_activity_h_com.
  inserttable status       gs_status_com      lt_status_com.
  inserttable sales        gs_sales_com       lt_sales_com.
  inserttable shipping     gs_shipping_com    lt_shipping_com.
  perform map_into_input_fields tables input_fields
                              changing lt_input_fields.
batch
  perform map_into_batch
          tables batch
               changing lt_batch_com.
pricing agreements
  perform map_into_pricing_agr_crm
          tables pricing_agr_crm
                 return
              changing lt_pricing_agr_crm_com.
finprod item
  perform map_into_finprod_i_com
          tables finprod_item
          changing lt_finprod_i_com.
cancel
  perform map_into_cancel
          tables cancel
                 cancel_ir
          changing lt_cancel_com
                   lt_cancel_ir_com.
ordprp ( partner range product )
  perform map_into_ordprp
          tables product_list
                 products
                 objects
          changing lt_ordprp_i_com
                   lt_ordprp_i_d_com
                   lt_ordprp_objl_i_d_com.
payplan
  perform map_into_payplan
          tables payplan
                 payplan_date
          changing lt_payplan_com
                   lt_payplan_d_com.
activity i
  perform map_into_activity_i tables activity_i return extensionin
          changing lt_activity_i_com.
  call function 'CRM_ORDER_MAINTAIN'
    exporting
      it_lead_h               = lt_lead_h_com
      it_opport_h             = lt_opport_h_com
      it_activity_h           = lt_activity_h_com
      it_activity_i           = lt_activity_i_com
      it_sales                = lt_sales_com
      it_pricing              = lt_pricing_com
      it_pricing_i            = lt_pricing_i_com
      it_orgman               = lt_orgman_com
      it_shipping             = lt_shipping_com
      it_product_i            = lt_product_i_com
      it_batch                = lt_batch_com
      it_finprod_i            = lt_finprod_i_com
      it_config               = lt_config_com
      it_payplan              = lt_payplan_com
      it_payplan_d            = lt_payplan_d_com
      it_customer_h           = lt_customer_h_com
      it_customer_i           = lt_customer_i_com
      it_appointment          = lt_appointment_com
      it_text                 = lt_text_com
      it_schedlin_i           = lt_schedlin_i_com
      it_partner              = lt_partner_com
    it_service_os           = lt_service_os_com
      it_service_os           = i_service_os
      it_cancel               = lt_cancel_com
      it_cancel_ir            = lt_cancel_ir_com
      it_status               = lt_status_com
      it_billplan             = lt_billplan_com
      it_billing              = lt_billing_com
      it_ordprp_i             = lt_ordprp_i_com
      it_ordprp_i_d           = lt_ordprp_i_d_com
      it_ordprp_objl_i_d      = lt_ordprp_objl_i_d_com
      it_price_agreements_crm = lt_pricing_agr_crm_com
      it_config_filter        = lt_config_filter_com
      it_pridoc               = lt_pridoc_com
    changing
      ct_orderadm_h           = lt_orderadm_h_com
      ct_orderadm_i           = lt_orderadm_i_com
      ct_doc_flow             = lt_doc_flow_com
      ct_input_fields         = lt_input_fields
      cv_log_handle           = gv_loghandle
    exceptions
      error_occurred          = 1
      document_locked         = 2
      no_change_allowed       = 3
      no_authority            = 4
      others                  = 5.
  if sy-subrc ne 0.
    perform set_bapireturn2 tables return
      using gc_msgtype-abort syst-msgid syst-msgno
            syst-msgv1 syst-msgv2 syst-msgv3 syst-msgv4
            space 0 space space space.
  endif.
*---- get created processes
  loop at lt_orderadm_h_com into ls_orderadm_h_com
    where not guid is initial.
    move-corresponding ls_orderadm_h_com to ls_created_process.
    append ls_created_process to created_process.
    insert ls_orderadm_h_com-guid into table lt_order_guids.
  endloop.
  call function 'BAPI_BUSPROCESSND_PROCSETTINGS'
    importing
      process_settings_out = ls_process_settings.
*---- get application log
  perform get_appl_log tables return
    using  gv_loghandle ls_process_settings-msglevel lt_order_guids.
*---- Restore BAPI dialog flag
  perform set_dialog_from_flag using lv_bapi_no_dialog.
*---- Clear object buffers on event ROLLBACK
  perform busprocessnd_init on rollback.
*---- Save transaction immediately on demand
  if ls_process_settings-save eq true.
    loop at created_process into ls_created_process.
      ls_header_save-guid = ls_created_process-guid.
      append ls_header_save to lt_header_save.
    endloop.
    call function 'BAPI_BUSPROCESSND_SAVE'
      tables
        objects_to_save = lt_header_save
        saved_objects   = lt_saved_objects
        return          = return.
    loop at lt_saved_objects into ls_saved_object.
      ls_created_process-object_id = ls_saved_object-object_id.
      modify created_process from ls_created_process
             transporting object_id
             where guid eq ls_saved_object-guid.
    endloop.
  endif.
endfunction.
regards,
Madhavan

Similar Messages

  • Help needed with BAPI_SLSTRANSACT_CREATEMULTI

    Dear All,
    I need to to create a quotation as well as a sales order in CRM system using BAPI_SLSTRANSACT_CREATEMULTI from Web Dynpro
    I am not able to understand how this BAPI works.
    I need help with the minimum (mandatory) fields that are required to be set for a quotation or sales order to be created.
    I also need help in understanding how the GUIDs and Handles are to be used.
    Could anyone please help me in this regard?
    Thanks and regards,
    Mayuresh

    Hi,
    You can check the mandatory field by executing(pressing F8) that function module.
    Give the fnmodule name and press F8.Pass the parameters and execute the RFC.
    U will get some data.Passing the parameters r nothing but mandatory field.
    Same values u can pass it from ur code.
    Regards,
    LG

  • Ship to party for each material using BAPI_SLSTRANSACT_CREATEMULTI

    i am able to generate sales order for in CRM. I am inputting the sold to party, ship to party, bill to party and payer at the header level...
    CRM is currently configured in such a way that , there is a provision to assign ship to party at item level for each material.
    How can i programatically replicate this? I need to assign a diiferent ship to party for each material in the sales order.*
    how can i programatically replicate this?...
    this is  my code for cresating a sales order in CRM with sold to party, ship to party, bill to party and payer at the header level...
    *************include constants
      include crm_direct.
    ************// GUIDs
      data:         lv_guid_h type GUID_32,              "HEADER GUIDE
                    lv_guid_i type GUID_32,              "ITEM GUIDE
                    lv_guid_sl type GUID_32,             "SCHEDULE LINE GUIDE
                    lv_guid_p type GUID_32.              "PARTNER GUIDE
    ***********// Handles
      data:        lv_current_handle type crmt_handle,    "CURRENT HANDLE
                   lv_handle_h type crmt_handle,          "HEADER HANDLE
                   lv_handle_i type crmt_handle,          "ITEM HANDLE
                   lv_handle_sl type crmt_handle,         "SCHEDULE LINE HANDLE
                   lv_handle_p type crmt_handle.          "PARTNER HANDLE
    ***********// Administration header + item + etc
      data:        lt_salesorder_header type table of bapibus20001_header_ins,        "LT_SALESORDER_HEADER
                   ls_salesorder_header type bapibus20001_header_ins,                 "LS_SALESORDER_HEADER
                   lt_salesorder_item type table of bapibus20001_item,                "LT_SALESORDER_ITEM
                   ls_salesorder_item type bapibus20001_item,                         "LS_SALESORDER_ITEM
                   lt_scheduleline type table of BAPIBUS20001_SCHEDLIN,               "LT_SCHEDULELINE
                   ls_scheduleline type BAPIBUS20001_SCHEDLIN,                        "LS_SCHEDULELINE
                   lt_partner type table of BAPIBUS20001_PARTNER_INS,                 "LT_PARTNER
                   ls_partner type BAPIBUS20001_PARTNER_INS,                          "LS_PARTNER
                   ls_logical_key TYPE crmt_partner_logic_partner_key,                "LS_LOGICAL_KEY
                   lt_organisation type table of BAPIBUS20001_ORGMAN_INS,             "LT_ORGANISATION
                   ls_organisation type BAPIBUS20001_ORGMAN_INS.                      "LS_ORGANISATION
    *********// Saved sales orders
    data: lt_saved_process type table of bapibus20001_object_id,                   "LT_SAVED_PROCESS
      data:
            ls_saved_process type bapibus20001_object_id,                             "LS_SAVED_PROCESS
            ls_salesorder type CRMT_RETURN_OBJECTS_STRUC.                             "LS_SALESORDER
      data: lt_input_fields type table of bapibus20001_input_fields,                  "LT_INPUT_FIELDS
            ls_input_fields type bapibus20001_input_fields,                           "LS_INPUT_FIELDS
            ls_return type bapiret2.                                                  "LS_RETURN
    data: lt_return type table of bapiret2.                                        "LT_RETURN
    ***********// Macro definition to populate structure and input field This, called as
    *_set_field 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, Macro has not been used to show how the code should look like.
    *except for that the macro has been used 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 = 'ZWEB'.
        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 (Interface needs this, some times 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   SO_RESP .                                 "(input).
        setfield      ls_organisation    SALES_ORG        SALES_ORG.                                "(input).
        setfield      ls_organisation    DIS_CHANNEL      DIS_CHNL.                                 "(input).
        setfield      ls_organisation    DIVISION         DIVISION.                                 "(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).
      setfield      ls_salesorder_item      ITM_TYPE           'ZTAN'.
      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        quantity.                        "(input).
      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                 SOLD_TO.                                "(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.
      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              'C'.
      setfield          ls_partner           PARTNER_FCT                '00000002'.
      setfield          ls_partner           PARTNER_NO                 SHIP_TO .                                "(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.
      ls_logical_key-ref_partner_handle = '0003'.
      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 '0003'.
      setfield ls_partner KIND_OF_ENTRY 'C'.
      setfield ls_partner PARTNER_FCT '00000003'.
      setfield ls_partner PARTNER_NO BILL_TO ."(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.
      ls_logical_key-ref_partner_handle = '0004'.
      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 '0004'.
      setfield ls_partner KIND_OF_ENTRY 'C'.
      setfield ls_partner PARTNER_FCT '00000004'.
      setfield ls_partner PARTNER_NO PAYER ."(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.
    *_set_field ls_partner REF_GUID lv_guid_h.
    *_set_field ls_partner REF_HANDLE lv_handle_h.
    *_set_field ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
    *_set_field ls_partner REF_PARTNER_HANDLE '0002'.
    *_set_field ls_partner KIND_OF_ENTRY 'B'. "manual entry...
    *_set_field ls_partner PARTNER_FCT customFct(input).
    *_set_field ls_partner PARTNER_NO bpNumber(input).
    *_set_field ls_partner NO_TYPE 'BP'.
    *_set_field ls_partner DISPLAY_TYPE 'BP'.
    *_set_field ls_partner TITLE 'Mr.'.
    *_set_field ls_partner FIRSTNAME 'John'.
    *_set_field ls_partner LASTNAME 'Smith'.
    *_set_field ls_partner STR_SUPPL1 'John Smith and Co'.
    *_set_field ls_partner STREET 'Street1'.
    *_set_field ls_partner STR_SUPPL3 'Street4'.
    *_set_field ls_partner HOUSE_NO '42'.
    *_set_field ls_partner CITY 'Townville'.
    *_set_field ls_partner DISTRICT 'Districtshire'.
    *_set_field 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'
    IMPORTING
        RETURN        = lt_return1.
    INCLUDE ZZGVBAPISALESORDER_GET_GUIDF01.
    Edited by: jessica sam on Dec 22, 2008 4:25 PM
    Edited by: jessica sam on Dec 22, 2008 4:27 PM
    Edited by: jessica sam on Dec 22, 2008 7:05 PM
    Edited by: jessica sam on Dec 23, 2008 5:18 AM

    I know how to trace the Ship to party at line item. When i create an order manually on CRM then the table CRMD_PARTNER has the required entries and the Ship to party at line item is getting populated correctly. Also if i open the order in CRMD_ORDER the ship pto party are being populated correctly at line item..
    But if i am trying to replicate this programatcally using the BAPI, i see that the ship to at header is being copied to each line item and this is not what is expected.
    If i go and check in the CRMD_PARTNER the data is not filled
    correctly as I dont have any ship to party at line item
    So finally I even tried to insert the data manually in the CRMD_PARTNER table using an
    INSERT statement and even that doesnt work...
    https://www.sdn.sap.com/irj/scn/forums
    So i am unable to ficgure out what is going wrong
    Any body if they have any idea on poulating ship to party programatically in
    sales order for each line item please help
    I am unable to figure out how to fill PArtner table of this BAPI to populate ship to at line item level
    Kindly Help..
    Regards,
    Jessica Sam

  • How to create ST using BAPI_SLSTRANSACT_CREATEMULTI

    Hi Friends,
    I'm trying to create NEW SalesTransaction(ST) using fm 'BAPI_SLSTRANSACT_CREATEMULTI' in an another new RFC function module. The header is creating but not Partner,Item,product and all. I need to create ST using this BAPI.
    The input i'm passing is partner,pro`duct,product description,net price,net value,quantity,PO number,Order number,Quantity,ATP quntity,Date,Address including email and phone.
    The problem i'm facing is <b>HOW TO FILL THESE INPUT VALUES IN THE  EXACT FILEDS IN THE TABLES OF BAPI.</b>
    I'm getting these errors.
    <b>1)W CRM_ORDER            004 Referenced object type (PARTNER) not allowed       
    2)W CRM_ORDER            004 Referenced object type (SALES) not allowed         
    3)E CRM_ORDERADM_I       006 Item  was not found.                               
    4)E CRM_ORDER            005 Incomplete interface data - No reference specified 
    5)S CRM_MESSAGES         005 A log has been generated for single document       </b>
    The code i did is:
      TYPES: TYP_HEADER          TYPE BAPIBUS20001_HEADER_INS,
             TYP_ITEM            TYPE BAPIBUS20001_ITEM,
             TYP_SALES           TYPE BAPIBUS20001_SALES,
             TYP_PARTNER         TYPE BAPIBUS20001_PARTNER_INS,
             TYP_SCHEDULELINE    TYPE BAPIBUS20001_SCHEDLIN,
             TYP_CREATED_PROCESS TYPE BAPIBUS20001_HEADER_INS,
             TYP_SAVED_PROCESS   TYPE BAPIBUS20001_OBJECT_ID,
             TYP_INPUT_FIELDS    TYPE BAPIBUS20001_INPUT_FIELDS.
      DATA: IT_HEADER            TYPE TYP_HEADER OCCURS 10
                                      WITH HEADER LINE,
            IT_ITEM              TYPE TYP_ITEM OCCURS 10
                                      WITH HEADER LINE,
            IT_SALES             TYPE TYP_SALES OCCURS 10
                                      WITH HEADER LINE,
            IT_PARTNER           TYPE TYP_PARTNER OCCURS 10
                                      WITH HEADER LINE,
            IT_SCHEDULELINE      TYPE TYP_SCHEDULELINE OCCURS 10
                                      WITH HEADER LINE,
            IT_CREATED_PROCESS   TYPE TYP_CREATED_PROCESS OCCURS 10
                                      WITH HEADER LINE,
            IT_SAVED_PROCESS     TYPE TYP_SAVED_PROCESS OCCURS 10
                                      WITH HEADER LINE,
            IT_INPUT_FIELDS      TYPE TYP_INPUT_FIELDS OCCURS 10
                                      WITH HEADER LINE,
            V_ORDER_DATE(15)     TYPE C,
            V_GUID_H             TYPE BBP_GUID_32,
            V_GUID_I             TYPE BBP_GUID_32,
            V_GUID_P             TYPE BBP_GUID_32,
            V_GUID_SA            TYPE BBP_GUID_32,
            V_GUID_SC            TYPE BBP_GUID_32.
      PERFORM GET_GUID CHANGING V_GUID_H.
      PERFORM GET_GUID CHANGING V_GUID_I.
      PERFORM GET_GUID CHANGING V_GUID_P. 
      PERFORM GET_GUID CHANGING V_GUID_SA.
      PERFORM GET_GUID CHANGING V_GUID_SC.
    * Header
      IT_HEADER-GUID       = V_GUID_H.
      IT_HEADER-PROCESS_TYPE = PROCESS_TYPE(INPUT).
      IT_HEADER-DESCRIPTION  = DESCRIPTION(INPUT).
      APPEND IT_HEADER.
    * Item
      IT_ITEM-GUID = V_GUID_I.
      IT_ITEM-HEADER = V_GUID_H.
      IT_ITEM-ORDERED_PROD = PRODUCT(INPUT).
      IT_ITEM-DESCRIPTION  = PRODUCT_DESCRIPTION(INPUT).
      IT_ITEM-ITM_TYPE     = ITEM_TYPE(INPUT).
      IT_ITEM-MODE         = 'A'.
      APPEND IT_ITEM.
    * Sales
      IT_SALES-REF_GUID = V_GUID_SA.
      IT_SALES-PO_NUMBER_SOLD = PO_NUMBER(INPUT).
      APPEND IT_SALES.
    * Partner
      IT_PARTNER-REF_GUID    = V_GUID_H.
      IT_PARTNER-PARTNER_FCT = '00000001'.
      IT_PARTNER-REF_KIND    = 'A'.
      IT_PARTNER-REF_PARTNER_HANDLE = '0001'.
      IT_PARTNER-KIND_OF_ENTRY = 'A'.
      IT_PARTNER-NO_TYPE     = 'BP'.
      IT_PARTNER-DISPLAY_TYPE = 'BP'.
      IT_PARTNER-PARTNER_NO  = CUSTOMER(INPUT).
      IT_PARTNER-NAME        = NAME(INPUT).
      IT_PARTNER-HOUSE_NO    = HOUSE_NO(INPUT).
      IT_PARTNER-CITY        = CITY(INPUT).
      IT_PARTNER-STREET      = STREET(INPUT).
      IT_PARTNER-COUNTRY     = COUNTRY(INPUT).
      IT_PARTNER-E_MAIL      = EMAIL(INPUT).
      IT_PARTNER-TEL1_NUMBR  = PHONE(INPUT).
      APPEND IT_PARTNER.
    * Schedule line
      IT_SCHEDULELINE-ITEM_GUID = V_GUID_SC.
      IT_SCHEDULELINE-QUANTITY = ATP_QUANTITY(INPUT).
      APPEND IT_SCHEDULELINE.
    * Input fields
      IT_INPUT_FIELDS-REF_GUID    = V_GUID_H.
      IT_INPUT_FIELDS-OBJECTNAME  = 'ORDERADM_H'.
      IT_INPUT_FIELDS-LOGICAL_KEY = '1'.
      APPEND IT_INPUT_FIELDS.
      IT_INPUT_FIELDS-REF_GUID    = V_GUID_I.
      IT_INPUT_FIELDS-OBJECTNAME  = 'ORDERADM_I'.
      IT_INPUT_FIELDS-LOGICAL_KEY = '1'.
      APPEND IT_INPUT_FIELDS.
      IT_INPUT_FIELDS-REF_GUID    = V_GUID_H.
      IT_INPUT_FIELDS-OBJECTNAME  = 'PARTNER'.
      IT_INPUT_FIELDS-LOGICAL_KEY = '1'.
      APPEND IT_INPUT_FIELDS.
      IT_INPUT_FIELDS-REF_GUID    = V_GUID_SA.
      IT_INPUT_FIELDS-OBJECTNAME  = 'SALES'.
      IT_INPUT_FIELDS-LOGICAL_KEY = '1'.
      APPEND IT_INPUT_FIELDS.
      IT_INPUT_FIELDS-REF_GUID    = V_GUID_SC.
      IT_INPUT_FIELDS-OBJECTNAME  = 'SCHEDLIN'.
      IT_INPUT_FIELDS-LOGICAL_KEY = '1'.
      APPEND IT_INPUT_FIELDS.
      CALL FUNCTION 'BAPI_SLSTRANSACT_CREATEMULTI'
    *   EXPORTING
    *     TESTRUN                =
        TABLES
          HEADER                 = IT_HEADER
          ITEM                   = IT_ITEM
          RETURN                 = RETURN
          SALES                  = IT_SALES
          PARTNER                = IT_PARTNER
    *     ORGANISATION           =
    *     SHIPPING               =
    *     APPOINTMENT            =
    *     TEXT                   =
    *     STATUS                 =
          INPUT_FIELDS           = IT_INPUT_FIELDS
    *     PRODUCT                =
          SCHEDULELINE           = IT_SCHEDULELINE
    *     CUSTOMER_HEAD          =
    *     CUSTOMER_ITEM          =
    *     PRICING                =
    *     PRICING_ITEM           =
    *     CONDITION_CREATE       =
    *     BILLING                =
    *     CONFIG_CFG             =
    *     CONFIG_BLB             =
    *     CONFIG_INS             =
    *     CONFIG_PRT             =
    *     CONFIG_VAL             =
    *     CONFIG_VK              =
    *     CONFIG_REF             =
    *     ADDRESS                =
    *     BILLPLAN               =
    *     BILLPLAN_DATE          =
          CREATED_PROCESS        = IT_CREATED_PROCESS
          SAVED_PROCESS          = IT_SAVED_PROCESS
    *     DOC_FLOW               =
    *     PAYPLAN                =
    *     PAYPLAN_DATE           =
      COMMIT WORK.
      READ TABLE RETURN WITH KEY TYPE = 'E'.
      IF SY-SUBRC NE 0.
         DATA: V_RETURN LIKE  BAPIRET2.
         CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           IMPORTING
             RETURN        = V_RETURN.
         CHECK NOT IT_SAVED_PROCESS[] IS INITIAL.
         READ TABLE IT_SAVED_PROCESS INDEX 1.
         CHECK SY-SUBRC EQ 0.
           SALES_PROCESS = IT_SAVED_PROCESS-OBJECT_ID.
      ENDIF.
    ENDFUNCTION.
    FORM GET_GUID CHANGING P_GUID TYPE  GUID_32.
      CALL FUNCTION 'GUID_CREATE'
        IMPORTING
          EV_GUID_32       = P_GUID.
    ENDFORM.
    Can any one help me in this.

    Hey Varda,
    I generated a sales order in CRM with BAPI_SLSTRANSACT_CREATEMULTI for a single line item...that is it accepts a single product and generates a sales order...but in real time there can be any number of line items for a sales order...
    *1) Now i need to make this code generic such that it can accept any number of materials...line items?
    How can i make the code generic ....such that it works for any number of line items.*
    *2) Also the CRM is currently configured in such a way that , there is a provision to assign ship to party at item level for each material.
    How can i programatically replicate this? I need to assign a diiferent ship to party for each material in the sales order.*
    how can i programatically replicate this?...
    this is my code for cresating a sales order in CRM for a single line item or single material
    *************include constants
    include crm_direct.
    ************// GUIDs
    data: lv_guid_h type GUID_32, "HEADER GUIDE
    lv_guid_i type GUID_32, "ITEM GUIDE
    lv_guid_sl type GUID_32, "SCHEDULE LINE GUIDE
    lv_guid_p type GUID_32. "PARTNER GUIDE
    ***********// Handles
    data: lv_current_handle type crmt_handle, "CURRENT HANDLE
    lv_handle_h type crmt_handle, "HEADER HANDLE
    lv_handle_i type crmt_handle, "ITEM HANDLE
    lv_handle_sl type crmt_handle, "SCHEDULE LINE HANDLE
    lv_handle_p type crmt_handle. "PARTNER HANDLE
    ***********// Administration header + item + etc
    data: lt_salesorder_header type table of bapibus20001_header_ins, "LT_SALESORDER_HEADER
    ls_salesorder_header type bapibus20001_header_ins, "LS_SALESORDER_HEADER
    lt_salesorder_item type table of bapibus20001_item, "LT_SALESORDER_ITEM
    ls_salesorder_item type bapibus20001_item, "LS_SALESORDER_ITEM
    lt_scheduleline type table of BAPIBUS20001_SCHEDLIN, "LT_SCHEDULELINE
    ls_scheduleline type BAPIBUS20001_SCHEDLIN, "LS_SCHEDULELINE
    lt_partner type table of BAPIBUS20001_PARTNER_INS, "LT_PARTNER
    ls_partner type BAPIBUS20001_PARTNER_INS, "LS_PARTNER
    ls_logical_key TYPE crmt_partner_logic_partner_key, "LS_LOGICAL_KEY
    lt_organisation type table of BAPIBUS20001_ORGMAN_INS, "LT_ORGANISATION
    ls_organisation type BAPIBUS20001_ORGMAN_INS. "LS_ORGANISATION
    *********// Saved sales orders
    data: lt_saved_process type table of bapibus20001_object_id, "LT_SAVED_PROCESS
    data:
    ls_saved_process type bapibus20001_object_id, "LS_SAVED_PROCESS
    ls_salesorder type CRMT_RETURN_OBJECTS_STRUC. "LS_SALESORDER
    data: lt_input_fields type table of bapibus20001_input_fields, "LT_INPUT_FIELDS
    ls_input_fields type bapibus20001_input_fields, "LS_INPUT_FIELDS
    ls_return type bapiret2. "LS_RETURN
    data: lt_return type table of bapiret2. "LT_RETURN
    ***********// Macro definition to populate structure and input field This, called as
    *_set_field 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, Macro has not been used to show how the code should look like.
    *except for that the macro has been used 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 = 'ZWEB'.
    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 (Interface needs this, some times 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 SO_RESP . "(input).
    setfield ls_organisation SALES_ORG SALES_ORG. "(input).
    setfield ls_organisation DIS_CHANNEL DIS_CHNL. "(input).
    setfield ls_organisation DIVISION DIVISION. "(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).
    setfield ls_salesorder_item ITM_TYPE 'ZTAN'.
    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 quantity. "(input).
    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 SOLD_TO. "(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.
    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 'C'.
    setfield ls_partner PARTNER_FCT '00000002'.
    setfield ls_partner PARTNER_NO SHIP_TO . "(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.
    ls_logical_key-ref_partner_handle = '0003'.
    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 '0003'.
    setfield ls_partner KIND_OF_ENTRY 'C'.
    setfield ls_partner PARTNER_FCT '00000003'.
    setfield ls_partner PARTNER_NO BILL_TO ."(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.
    ls_logical_key-ref_partner_handle = '0004'.
    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 '0004'.
    setfield ls_partner KIND_OF_ENTRY 'C'.
    setfield ls_partner PARTNER_FCT '00000004'.
    setfield ls_partner PARTNER_NO PAYER ."(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.
    *_set_field ls_partner REF_GUID lv_guid_h.
    *_set_field ls_partner REF_HANDLE lv_handle_h.
    *_set_field ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
    *_set_field ls_partner REF_PARTNER_HANDLE '0002'.
    *_set_field ls_partner KIND_OF_ENTRY 'B'. "manual entry...
    *_set_field ls_partner PARTNER_FCT customFct(input).
    *_set_field ls_partner PARTNER_NO bpNumber(input).
    *_set_field ls_partner NO_TYPE 'BP'.
    *_set_field ls_partner DISPLAY_TYPE 'BP'.
    *_set_field ls_partner TITLE 'Mr.'.
    *_set_field ls_partner FIRSTNAME 'John'.
    *_set_field ls_partner LASTNAME 'Smith'.
    *_set_field ls_partner STR_SUPPL1 'John Smith and Co'.
    *_set_field ls_partner STREET 'Street1'.
    *_set_field ls_partner STR_SUPPL3 'Street4'.
    *_set_field ls_partner HOUSE_NO '42'.
    *_set_field ls_partner CITY 'Townville'.
    *_set_field ls_partner DISTRICT 'Districtshire'.
    *_set_field 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'
    IMPORTING
    RETURN = lt_return1.
    INCLUDE ZZGVBAPISALESORDER_GET_GUIDF01.

  • Customer's field using BAPI_SLSTRANSACT_CREATEMULTI

    Hi,
    Can someone tell me how to populate customer's fields using BAPI BAPI_SLSTRANSACT_CREATEMULTI'.I have used EEW and it has extended the structure 'CRMT_CUSTOMER_H_COM' but did not extend sructure'BAPIBUS20001_CUSTOMER_H'. So I cannot pass the value.
    Tried to extend 'BAPIBUS20001_CUSTOMER_H' using SE11 but its enhancement category is set to 'Can not be enhanced'.
    Thanks for any suggestion

    Hi Sudesh,
    I think you did not do the enhancement properly in EEWB.
    Just do one thing. Copy the code if you have written any in the EEWB for the enhancement somewhere. Run the EEWB wizard again and regenerate the project. Now paste the code that you had written earlier.
    Use the BAPI_BUSPROCESSND_CREATEMULTI and populate the fields as below:
    DATA: lv_header_guid   TYPE crmt_object_guid,
          lv_item_guid     TYPE crmt_object_guid,
          lit_inputfields  TYPE TABLE OF
                           bapibus20001_input_fields,
          wa_inputfields   LIKE LINE OF lit_inputfields,
          lit_customer_h   TYPE TABLE OF
                           bapibus20001_customer_h,
          wa_customer_h    LIKE LINE OF lit_customer_h,
          lit_header       TYPE TABLE OF
                           bapibus20001_header_ins,
          wa_header        LIKE LINE OF lit_header,
          lit_orderadm_i   TYPE TABLE OF bapibus20001_item,
          wa_orderadm_i    LIKE LINE OF lit_orderadm_i.
    * Fill the HEADER
    * Create Contract header guid
      CALL FUNCTION 'GUID_CREATE'
        IMPORTING
          ev_guid_16 = lv_header_guid.
    * Fill orderadm_h
      wa_header-guid         = lv_header_guid.
      wa_header-process_type = 'ZIUS'.
      APPEND wa_header TO lit_header.
    * Fill input fields
      MOVE: lv_header_guid  TO wa_inputfields-ref_guid,
            'A'             TO wa_inputfields-ref_kind,
            'ORDERADM_H'    TO wa_inputfields-objectname,
            'PROCESS_TYPE'  TO wa_inputfields-fieldname.
      APPEND wa_inputfields TO lit_inputfields.
      CLEAR wa_inputfields.
    * Customer Fields at HEADER Level 
      MOVE lv_header_guid TO wa_customer_h-ref_guid.
      MOVE 'A'            TO wa_customer_h-mode.
    MOVE: lv_terms      TO wa_customer_h-zzcustomer_h0305,
           gv_sales_ch   TO wa_customer_h-zzcustomer_h0301,
           gv_sales_type TO wa_customer_h-zzcustomer_h0302,
           gv_reference  TO wa_customer_h-zzcustomer_h0313,
           gv_creditrate TO wa_customer_h-zzcustomer_h0311.
      APPEND wa_customer_h TO lit_customer_h.
    * Fill input fields
      MOVE: lv_header_guid  TO wa_inputfields-ref_guid,
            'A'             TO wa_inputfields-ref_kind,
            'CUSTOMER_H'    TO wa_inputfields-objectname.
      MOVE 'ZZCUSTOMER_H0305' TO wa_inputfields-fieldname.
      APPEND wa_inputfields TO lit_inputfields.
      MOVE 'ZZCUSTOMER_H0301' TO wa_inputfields-fieldname.
      APPEND wa_inputfields TO lit_inputfields.
      MOVE 'ZZCUSTOMER_H0302' TO wa_inputfields-fieldname.
      APPEND wa_inputfields TO lit_inputfields.
      MOVE 'ZZCUSTOMER_H0313' TO wa_inputfields-fieldname.
      APPEND wa_inputfields TO lit_inputfields.
      MOVE 'ZZCUSTOMER_H0311' TO wa_inputfields-fieldname.
      APPEND wa_inputfields TO lit_inputfields.
      MOVE 'MODE' TO wa_inputfields-fieldname.
      APPEND wa_inputfields TO lit_inputfields.
      CLEAR wa_inputfields.
    * Fill the Item(ORDERADM_I)
      CALL FUNCTION 'GUID_CREATE'
        IMPORTING
          ev_guid_16 = lv_item_guid.
    * Fill ORDERADM_I
      MOVE: lv_item_guid   TO wa_orderadm_i-guid,
            'A'            TO wa_orderadm_i-mode,
            gv_product     TO wa_orderadm_i-ordered_prod,
            lv_header_guid TO wa_orderadm_i-header.
    * Fill input fields
      MOVE: lv_item_guid  TO wa_inputfields-ref_guid,
            'B'           TO wa_inputfields-ref_kind,
            'ORDERADM_I'  TO wa_inputfields-objectname.
      MOVE  'ORDERED_PROD' TO wa_inputfields-fieldname.
      APPEND wa_inputfields TO lit_inputfields.
      MOVE  'PRODUCT' TO wa_inputfields-fieldname.
      APPEND wa_inputfields TO lit_inputfields.
      MOVE  'MODE' TO wa_inputfields-fieldname.
      APPEND wa_inputfields TO lit_inputfields.
      CLEAR wa_inputfields.
    * Customer fields at ITEM Level
    * Similarly fill the values for enahanced fields in
    * lit_customer_i and also the respective input fields in
    * lit_inputfields
    * Fill the rest of the internal tables in the same way
    * Partner, Status, Object, Appointment etc.
    * Now call the BAPI
      CALL FUNCTION 'ZBAPI_CONTRACT_CREATEMULTI'
        TABLES
          header           = lit_header
          item             = lit_orderadm_i
          partner          = lit_partner
          organisation     = lit_organisation
          status           = lit_status
          appointment      = lit_appointment
          input_fields     = lit_inputfields
          return           = lit_ret
          product          = lit_product
          scheduleline     = lit_schline
          customer_head    = lit_customer_h
          customer_item    = lit_customer_i
          pricing          = lit_pricing
          condition_create = lit_condition
          billing          = lit_billing
          config_cfg       = lit_config_cfg
          config_ins       = lit_config_ins
          config_val       = lit_config
          OBJECTS          = lit_object.
    <b>Reward points if it helps.</b>

  • 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

  • Is it a limitation for BAPI_SLSTRANSACT_CREATEMULTI?

    Is it a limitation for BAPI_SLSTRANSACT_CREATEMULTI
    I am trying to create a Sales Order using a Zprogram. I have used BAPI_SLSTRANSACT_CREATEMULTI. If I give the input as Normal material I am able to generate a sale order. If I give the input as VC material I am able to generate a sales order. But if I give both VC and Normal material as input, I get a run time error as follows.
    Is it a limitation for BAPI_SLSTRANSACT_CREATEMULTI that we cannot create a sales order with both VC and Non-VC items or am I missing some data which I need to pass when I give both VC and Non VC items? I get this error only for my Zprogram. But if I try to create an order on screen manually I donu2019t get any error. This happens only if I create an order with my Zprogram.
    Some one please help me u2026I am just stuggling to get this doneu2026
    I dint find any posts that gives me information about this error.
    CUX1 034 u201CNo root instance found in header datau201D                                                                               
    In the source code you have the termination point in line 63                                   of the (Include)program "LCRM_CONFIG_OWF02". 
    Line
    SourceCde
    33
    LT_CUXI_CUPRT
    34
    LT_CUXI_CUVAL
    35
    LT_CUXI_CUVK
    36
    LS_CUXI_CUCFG.
    37
    38
    PERFORM CREATE_PRICING_CSTIC USING IS_CONFIG-CUCFG-CFGINFO.
    39
    40
    set config to cbase
    41
    CALL FUNCTION 'COM_CUXI_SET_SINGLE_CFG'
    42
    EXPORTING
    43
    I_CFG_HEADER          = LS_CUXI_CUCFG
    44
    I_ROOT_INSTANCE       = CV_INT_OBJ_NO
    45
    I_LOGSYS              = LV_LOGSYS
    46
    IMPORTING
    47
    E_ROOT_INSTANCE       = CV_INT_OBJ_NO
    48
    TABLES
    49
    I_TAB_INSTANCES       = LT_CUXI_CUINS
    50
    I_TAB_PART_OF         = LT_CUXI_CUPRT
    51
    I_TAB_VALUES          = LT_CUXI_CUVAL
    52
    I_TAB_VAR_KEYS        = LT_CUXI_CUVK
    53
    I_TAB_RESTRICTIONS    = LT_CUXI_CURES
    54
    EXCEPTIONS
    55
    INVALID_INSTANCE      = 1
    56
    INTERNAL_ERROR        = 2
    57
    OTHERS                = 3.
    58
    59
    IF SY-SUBRC <> 0.
    60
    if sy-msgno is initial.
    61
    MESSAGE X010 WITH 'COM_CUXI_SET_SINGLE_CFG'.
    62
    else.
    >>>>>
    MESSAGE ID SY-MSGID TYPE 'X' NUMBER SY-MSGNO
    64
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    65
    endif.
    66
    ENDIF.
    67
    68
    ENDFORM.                               " CONFIG_TO_CBASE
    Edited by: jessica sam on Jan 22, 2009 9:58 PM

    Re: Can we create saleorder for VC,Non-VC items with BAPI_SLSTRANSACT_CREATEMUL

  • Using BAPI for Quotations: BAPI_SLSTRANSACT_CREATEMULTI

    Hi everyone,
    I am working with the BAPI: BAPI_SLSTRANSACT_CREATEMULTI  to create an enquiry OR even a quotation. Using t.code SE37, in the following tables I enter:
    Header: (2 fields)
    Process_Type: ZAG (t.type for enquiry)
    Description: description of the enquiry
    Partner: (3 fields)
    Partner_Fct: (partner function) - e.g. 00000001 (SP)
    Partner_No: (partner number) - BP ID
    KIND_OF_ENTRY
    (Entered 5 partners; 1 that was entered manually (SP) and the other four which are determined auto.)
    HENCE in the INPUT FIELD I have 5 BP's
    INPUTFIELDS (1 Field)
    Fieldname : entered 5 BP's
    On execution, the return table shows three errors:
    E CRM_ORDER_CUST       004 System error: Incorrect call of read module for table CRMC_OBJECTS!
    W CRM_ORDER                003 Object type  cannot be processed
    A CRM_ORDER                 009 Program error: Incorrect values in interface parameters
    I entered handle 00000001 for header and 0000002 for the partner and specified the same in the INPUTFIELDS: REF_HANDLE, it leads to more errors
    Any solutions please? Deserving points shall be awarded.
    Best Regards,
    Jacob.
    Edited by: Jacob Raj on Mar 14, 2008 1:50 PM

    Hi,
    May be following code is useful for you.
    ******************************Header  Data***********************************
    DATA: lwa_header TYPE bapibus20001_header_ins,
                lwa_input_fields TYPE bapibus20001_input_fields.
    lwa_header-handle = '0000000001'.
      lwa_header-process_type = lwa_crmd_orderadm_h-process_type.
      APPEND lwa_header TO i_header.
      lwa_input_fields-ref_handle  = '0000000001'.
      lwa_input_fields-objectname  = 'ORDERADM_H'.
      lwa_input_fields-ref_kind    = 'A'.
      PERFORM populate_input_field_name  USING 'PROCESS_TYPE' CHANGING lwa_input_fields
    ********************************Partner Data********************************
    DATA:lwa_partner TYPE bapibus20001_partner_ins,
           lwa_input_fields TYPE bapibus20001_input_fields,
    lwa_partner-ref_handle            = '0000000001'.
      lwa_partner-ref_kind              = 'A'.
      lwa_partner-ref_partner_handle    = '0001'.
      lwa_partner-kind_of_entry         = 'C'.
      lwa_partner-partner_fct           = '00000001'.
      lwa_partner-partner_no            = <partner no>.
      lwa_partner-no_type               = 'BP'.
      lwa_partner-display_type          = 'BP'.
      APPEND lwa_partner TO i_partner.
      lwa_partner-ref_partner_handle    = '0002'.
      lwa_partner-partner_no = <partner no>..
      lwa_partner-partner_fct = '00000014'.
      APPEND lwa_partner TO i_partner.
      lwa_partner-kind_of_entry         = 'A'.
      lwa_partner-ref_partner_handle    = '0003'.
      lwa_partner-partner_no = <partner no>.
      lwa_partner-partner_fct = '00000012'.
      APPEND lwa_partner TO i_partner.
      CLEAR lwa_input_fields.
      lwa_input_fields-ref_handle    = '0000000001'.
      lwa_input_fields-objectname  = 'PARTNER'.
      lwa_input_fields-logical_key = '0001'.
      lwa_input_fields-ref_kind    = 'A'.
      PERFORM populate_input_field_name  USING 'DISPLAY_TYPE' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'KIND_OF_ENTRY' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'NO_TYPE' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'PARTNER_FCT' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'PARTNER_NO' CHANGING lwa_input_fields.
      CLEAR lwa_input_fields.
      lwa_input_fields-ref_handle    = '0000000001'.
      lwa_input_fields-objectname  = 'PARTNER'.
      lwa_input_fields-logical_key = '0002'.
      lwa_input_fields-ref_kind    = 'A'.
      PERFORM populate_input_field_name  USING 'DISPLAY_TYPE' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'KIND_OF_ENTRY' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'NO_TYPE' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'PARTNER_FCT' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'PARTNER_NO' CHANGING lwa_input_fields.
      CLEAR lwa_input_fields.
      lwa_input_fields-ref_handle    = '0000000001'.
      lwa_input_fields-objectname  = 'PARTNER'.
      lwa_input_fields-logical_key = '0003'.
      lwa_input_fields-ref_kind    = 'A'.
      PERFORM populate_input_field_name  USING 'DISPLAY_TYPE' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'KIND_OF_ENTRY' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'NO_TYPE' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'PARTNER_FCT' CHANGING lwa_input_fields.
      PERFORM populate_input_field_name  USING 'PARTNER_NO' CHANGING lwa_input_fields.
    FORM populate_input_field_name  USING lv_field_name TYPE string
                                          CHANGING lwa_input_fields TYPE bapibus20001_input_fields.
      lwa_input_fields-fieldname  = lv_field_name.
      APPEND lwa_input_fields TO i_input_fields.
    ENDFORM.
    ***************************CALL  BAPI_SLSTRANSACT_CREATEMULTI*********************************
    CALL FUNCTION 'ZBAPI_SLSTRANSACT_CREATEMULTI'
            TABLES
              header           = i_header
              return           = i_return
              sales            = i_sales
              partner          = i_partner
              input_fields     = i_input_fields
              created_process  = i_created_process
              saved_process    = i_saved_process
    COMMIT WORK.
    If helpful kindly reward me.
    Thanks & Regards,
    Anirban

  • Pricing reference material in BAPI_SLSTRANSACT_CREATEMULTI

    Hi,
    When creating sales order using the BAPI BAPI_SLSTRANSACT_CREATEMULTI I am filling the pricing reference material(PRICE_PRODUCT_ID) and batch id 'BATCH_ID' as follows in the required table.
      WA_INPUT_FIELDS-REF_GUID = V_GUID_I.
      WA_INPUT_FIELDS-OBJECTNAME = 'PRODUCT_I'.
      WA_INPUT_FIELDS-REF_KIND  = 'B'.
      WA_INPUT_FIELDS-FIELDNAME = 'PRICE_PRODUCT_ID'.
      APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS.
      WA_INPUT_FIELDS-REF_GUID = V_GUID_I.
      WA_INPUT_FIELDS-OBJECTNAME = 'PRODUCT_I'.
      WA_INPUT_FIELDS-REF_KIND  = 'B'.
      WA_INPUT_FIELDS-FIELDNAME = 'BATCH_ID'.
      APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS.
      WA_PRODUCT-REF_GUID = V_GUID_I.
      WA_PRODUCT-PRICE_PRODUCT_ID  =
    '0000000000000000000000000000000000013623'.
    WA_PRODUCT-batch_id = '060630-EN1'.
      APPEND WA_PRODUCT TO IT_PRODUCT.
    But the fileds are not getting updated.Can anyone please let me know what detail am I missing out.
    Thanks,
    Chamu

    Hi Chamu,
    You are missing the process_qty_unit in the IT_PRODUCT table. You can find the values for this from the table T006. Also, fill the input fields for the same.
    Here is the modified code :
    WA_INPUT_FIELDS-REF_GUID = V_GUID_I.
    WA_INPUT_FIELDS-OBJECTNAME = 'PRODUCT_I'.
    WA_INPUT_FIELDS-REF_KIND = 'B'.
    WA_INPUT_FIELDS-FIELDNAME = 'PRICE_PRODUCT_ID'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS.
    WA_INPUT_FIELDS-REF_GUID = V_GUID_I.
    WA_INPUT_FIELDS-OBJECTNAME = 'PRODUCT_I'.
    WA_INPUT_FIELDS-REF_KIND = 'B'.
    WA_INPUT_FIELDS-FIELDNAME = 'BATCH_ID'.
    APPEND WA_INPUT_FIELDS TO IT_INPUT_FIELDS.
    WA_PRODUCT-REF_GUID = V_GUID_I.
    <b>wa_product-process_qty_unit = 'Your product unit'.</b>
    WA_PRODUCT-PRICE_PRODUCT_ID =
    '0000000000000000000000000000000000013623'.
    WA_PRODUCT-batch_id = '060630-EN1'.
    APPEND WA_PRODUCT TO IT_PRODUCT.
    <b>Reward points if it helps.</b>
    Regards,
    Amit Mishra
    Message was edited by: Amit Mishra

  • BAPI_SLSTRANSACT_CREATEMULTI in workflow

    Hi,
    I am trying to use BAPI_SLSTRANSACT_CREATEMULTI in my workflow in a method.
    This is what i pass to header data.
    ADD 1 TO lv_current_handle .
      iv_process_type = 'ZSG1'.
      // fill order administration header
      ls_salesorder_header-handle        = lv_current_handle.
      ls_salesorder_header-process_type  = iv_process_type.
      ls_salesorder_header-created_by  = AGENT+2(12).
      APPEND ls_salesorder_header TO lt_salesorder_header.
      ls_input_fields-ref_handle = lv_current_handle.
      ls_input_fields-ref_kind   = gc_object_ref_kind-orderadm_h.
      ls_input_fields-objectname = gc_object_name-orderadm_h.
      ls_input_fields-fieldname  = 'PROCESS_TYPE'.
      APPEND ls_input_fields TO lt_input_fields.
      ls_input_fields-fieldname  = 'CREATED_BY'.
      APPEND ls_input_fields TO lt_input_fields.
      CLEAR ls_input_fields.
    What I find is that when I run the method to create an order in swo1 it creates the order with Created_by field as the user that is passed. However when I trigger it in my workflow even though the container element is having the right value it populates WF-BATCH as Created_by field.
    I donot want workflow to populate WF-BATCH. Even if I hard code AGENT+2(12) to be a particular user id and run through workflow it still populates WF-BATCH. How do I overwrite this Wf-BATCH in created_by field in CRMD_ORDERADM_H field.
    Regards,
    Vishal Bhatia

    Hi viji,
    I debugged BAPI to find that it calls CRM_ORDER_MAINTAIN which inturn calls CRM_ORDERADM_H_MERGE_OW in which on line 341 we have the code:
      CREATED_BY
       Fill created_by early, so it can be used eg. by partner determination
      if cs_orderadm_h_wrk-mode             EQ   gc_mode-create    AND
         cs_orderadm_h_wrk-created_by       is   initial.
        cs_orderadm_h_wrk-created_by = sy-uname.
      endif.
    I have no idea why is sy-uname is populated here???? If I somehow change the value in this  cs_orderadm_h_wrk-created_by field the changed value appears in the CRMD_ORDERADM_H table in created_by field..
    Request you to look in the system and provide me with some more help.
    Regards,
    Vishal Bhatia

  • BAPI_SLSTRANSACT_CREATEMULTI + Organization

    Hi,
    I need help to problem with BAPI_SLSTRANSACT_CREATEMULTI bapi.
    Situation:
    SAP CRM 5 SP 8
    I fill all the relevant fields and the document is created. But exist a role for organization determination and it don't works when bapi process.
    I fill the data in the Organization table from bapi, but the screen fields from CRMD_ORDER don't be filled with these data.
    The fields are filled with data from role for determination.
    If I cancel the role for determination, the fields don't be filled (it's null).
    So, The organization fields don't be filled whatever...
    Can anybody help me, please?
    Obs.:  I filled field from INPUT_FIELDS table correctly.
    Regards,
    Sandra

    This WOrks !!!!!
    *Organization Data
    ls_org-ref_handle = '0000000001'. (Sold to party)
    ls_org-ref_kind = 'A'. (Order header Administration)
    ls_org-mode = 'A'. (Create)
    ls_org-sales_org_resp = 'O 50000616'.
    ls_org-dis_channel = '10'.
    ls_org-division = '10'.
    ls_org-sales_org = 'O 50000616'.
    append ls_org to it_orgagization.
    MY HEADER REFERERENCE HANDLE IS '0000000001'. You shud put the handle you have used for the header.
    Input fields for Organization
    clear ls_input_fields.
    ls_input_fields-ref_handle = '0000000001'.
    ls_input_fields-objectname = 'ORGMAN'.
    ls_input_fields-fieldname = 'REF_KIND'.
    ls_input_fields-REF_KIND = 'A'.
    append ls_input_fields to it_input_fields.
    clear ls_input_fields.
    ls_input_fields-ref_handle = '0000000001'.
    ls_input_fields-objectname = 'ORGMAN'.
    ls_input_fields-fieldname = 'MODE'.
    ls_input_fields-REF_KIND = 'A'.
    append ls_input_fields to it_input_fields.
    clear ls_input_fields.
    ls_input_fields-ref_handle = '0000000001'.
    ls_input_fields-objectname = 'ORGMAN'.
    ls_input_fields-fieldname = 'SALES_ORG_RESP'.
    ls_input_fields-REF_KIND = 'A'.
    append ls_input_fields to it_input_fields.
    clear ls_input_fields.
    ls_input_fields-ref_handle = '0000000001'.
    ls_input_fields-objectname = 'ORGMAN'.
    ls_input_fields-fieldname = 'DIS_CHANNEL'.
    ls_input_fields-REF_KIND = 'A'.
    append ls_input_fields to it_input_fields.
    clear ls_input_fields.
    ls_input_fields-ref_handle = '0000000001'.
    ls_input_fields-objectname = 'ORGMAN'.
    ls_input_fields-fieldname = 'DIVISION'.
    ls_input_fields-REF_KIND = 'A'.
    append ls_input_fields to it_input_fields.
    clear ls_input_fields.
    ls_input_fields-ref_handle = '0000000001'.
    ls_input_fields-objectname = 'ORGMAN'.
    ls_input_fields-fieldname = 'SALES_ORG'.
    ls_input_fields-REF_KIND = 'A'.
    append ls_input_fields to it_input_fields.

  • Problem with threads and simulation: please help

    please help me figure this out..
    i have something like this:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DrawShapes extends JApplet{
         private JButton choices[];
         private String names[]={"line", "square", "oval"};
         private JPanel buttonPanel;
         private DrawPanel drawingArea;
         private int width=300, height=200;
         public void init(){
              drawingArea=new DrawPanel(width, height);
              choices=new JButton[names.length];
              buttonPanel=new JPanel();
              buttonPanel.setLayout(new GridLayout(1, choices.length));
              ButtonHandler handler=new ButtonHandler();
              for(int i=0; i<choices.length; i++){
                   choices=new JButton(names[i]);
                   buttonPanel.add(choices[i]);
                   choices[i].addActionListener(handler);
              Container c=getContentPane();
              c.add(buttonPanel, BorderLayout.NORTH);
              c.add(drawingArea, BorderLayout.CENTER);
         }//end init
         public void setWidth(int w){
              width=(w>=0 ? w : 300);
         public void setHeight(int h){
              height=(h>=0 ? h : 200);
         /*public static void main(String args[]){
              int width, height;
              if(args.length!=2){
                   height=200; width=300;
              else{
                        width=Integer.parseInt(args[0]);
                        height=Integer.parseInt(args[1]);
              JFrame appWindow=new JFrame("An applet running as an application");
              appWindow.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              DrawShapes appObj=new DrawShapes();
              appObj.setWidth(width);
              appObj.setHeight(height);
              appObj.init();          
              appObj.start();
              appWindow.getContentPane().add(appObj);
              appWindow.setSize(width, height);
              appWindow.show();
         }//end main*/
         private class ButtonHandler implements ActionListener{
              public void actionPerformed(ActionEvent e){
                   for(int i=0; i<choices.length; i++){
                        if(e.getSource()==choices[i]){
                             drawingArea.setCurrentChoice(i);
                             break;
    }//end class DrawShapes
    class DrawPanel extends JPanel{
         private int currentChoice=-1;
         private int width=100, height=100;
         public DrawPanel(int w, int h){
              width=(w>=0 ? w : 100);
              height=(h>=0 ? h : 100);
         public void paintComponent(Graphics g){
              super.paintComponent(g);
              switch(currentChoice){
                   case 0:     g.drawLine(randomX(), randomY(), randomX(), randomY());
                             break;
                   case 1: g.drawRect(randomX(), randomY(), randomX(), randomY());
                             break;
                   case 2: g.drawOval(randomX(), randomY(), randomX(), randomY());
                             break;
         public void setCurrentChoice(int c){
              currentChoice=c;
              repaint();          
         private int randomX(){
              return (int) (Math.random()*width);
         private int randomY(){
              return (int) (Math.random()*height);
    }//end class drawPanel
    That one's from a book. I used that code to start with my applet. Mine calls different merthod from the switch cases. Say I have:
    case 0: drawStart(g); break;
    public void drawStart(Graphics g){
      /* something here */
    drawMain(g);
    public void drawMain(graphics g){
    g.drawString("test", x, y);
    //here's where i'm trying to pause
    //i've tried placing Thread.sleep between these lines
    g.drawLine(x, y, a, b);
    //Thread.sleep here
    g.drawRect(x, y, 50, 70);
    }I also need to put delays between method calls but I need to synchronize them. Am I doing it all wrong? The application pauses or sleeps but afterwards, it still drew everything all at once. Thanks a lot!

    It is. Sorry about that. Just answer any if you want to. I'd appreciate your help. Sorry again if it caused you anything or whatever. .n_n.

  • Query Help

    Table1:
    ou store point
    LS LIB1 50
    LS LIB1 200
    LS LIB1 100
    LS LIB1 79
    I have to insert table1 to table2 by splitting into every 143point and assing serial number for every 143 from parameter.
    in aboce example we can split 3 time 143 like below table2 sample.
    Table2
    ou store point serial_number
    LS LIB1 50 101
    LS LIB1 93 101
    LS LIB1 107 102
    LS LIB1 36 102
    LS LIB1 64 103
    LS LIB1 79 103
    i tried below procedure its not working.
    table may have any order like below.
    Table1:
    ou store point
    LS LIB1 200
    LS LIB1 50
    LS LIB1 100
    LS LIB1 79
    then table2
    ou store point serial_number
    LS LIB1 143 101
    LS LIB1 57 102
    LS LIB1 50 102
    LS LIB1 36 102
    LS LIB1 64 103
    LS LIB1 79 103
    create or replace procedure assign_serial(from_num number,to_num number) is
    bal number(10);
    begin
    bal := 0;
    for c1 in(select * from table1)
    loop
    if c1.point <=143 then
    if bal=0 then
    bal=143-used;
    insert int0 table2 values(c1.ou,c1.store,used);
    elsif used > 0 then
    used=used-bal;
    insert int0 table2 values(c1.ou,c1.store,bal);
    bal=0;
    if used > 0 then
    insert int0 table2 values(c1.ou,c1.store,used);
    end if;
    bal:=143-used;
    end if;
    end loop;
    end;
    How to split and assign serial number,please hELP.

    .after giving serial num i have to change points in table1 to 0.The problem for SUm and split for every 143 is ,different OU and store is there.we have to know for which store points we earned serial number.
    i hope this below logic little satisfy except assign cardnum,please........ check and currect the logic
    LS LIB1 50
    LS LIB1 200
    LS LIB1 100
    LS LIB1 79
    --variable used and bal
    for c1 in(select * from table1)
    loop
    used := c1.points;
    if c1.point <=143 then
    if bal=0 then
    bal=143-used;
    insert int0 table2 values(c1.ou,c1.store,used);
    elsif used > 0 then
    used=used-bal;
    insert int0 table2 values(c1.ou,c1.store,bal);
    bal=0;
    if used > 0 then
    insert int0 table2 values(c1.ou,c1.store,used);
    end if;
    bal:=143-used;
    end if;
    end loop;

  • Help my safari doesnt open and gives me a crash report

    help my safari doesn't open and gives me a crash report ever since i downloaded a file from the internet. I have a macbook air (early 2014) with running os x yosemite version 10.10.1

    There is no need to download anything to solve this problem.
    You may have installed the "Genieo" or "InstallMac" ad-injection malware. Follow the instructions on this Apple Support page to remove it.
    Back up all data before making any changes.
    Besides the files listed in the linked support article, you may also need to remove this file in the same way:
    ~/Library/LaunchAgents/com.genieo.completer.ltvbit.plist
    If there are other items with a name that includes "Genieo" or "genieo" alongside any of those you find, remove them as well.
    One of the steps in the article is to remove malicious Safari extensions. Do the equivalent in the Chrome and Firefox browsers, if you use either of those. If Safari crashes on launch, skip that step and come back to it after you've done everything else.
    If you don't find any of the files or extensions listed, or if removing them doesn't stop the ad injection, then you may have one of the other kinds of adware covered by the support article. Follow the rest of the instructions in the article.
    Make sure you don't repeat the mistake that led you to install the malware. Chances are you got it from an Internet cesspit such as "Softonic" or "CNET Download." Never visit either of those sites again. You might also have downloaded it from an ad in a page on some other site. The ad would probably have included a large green button labeled "Download" or "Download Now" in white letters. The button is designed to confuse people who intend to download something else on the same page. If you ever download a file that isn't obviously what you expected, delete it immediately.
    In the Security & Privacy pane of System Preferences, select the General tab. The radio button marked Anywhere  should not be selected. If it is, click the lock icon to unlock the settings, then select one of the other buttons. After that, don't ignore a warning that you are about to run or install an application from an unknown developer.
    Still in System Preferences, open the App Store or Software Update pane and check the box marked
              Install system data files and security updates
    if it's not already checked.

  • Apple Mini DVI to Video Adapter is not working. Please Help...

    I bought an Apple Mini DVI to Video Adapter to connect my Macbook to a TV using normal video cable. When I connect the cable, my Laptop DIsplay gives a flickr once and then it shows nothing. I checked Display in the system preference where I don't get a secondary monitor option. My TV is panasonic and it's an old one. I work on Final Cut Pro and it's very very important to see my videos on a TV. What am I doing wrong with the connection? Anyone Please Please help...

    Your probably not doing anything wrong. There are thousands of users with Similar issues and it seems to be with many different adapters.
    We have Mini DP to VGA (3 different brands) and they all fail most of the time. This seems more prevalent with LCD Projectors. I've tested some (50+) with VGA Monitor (HP) and they all worked, LCD Projector (Epson, Hitachi, and Sanyo) and they all fail, DLP Projector (Sanyo) and one worked.
    My Apple Mini DP to DVi works most of the time. My Mini DP to HDMI (Generic non Apple) works every time.
    The general consensus is that Apple broke something in the OS around 10.6.4 or 10.6.5 and its not yet fixed. As we are a school we have logged a case with the EDU Support group so will see what happens.
    Dicko

Maybe you are looking for

  • Invoiceposting

    Hi all, actually i have created "terms of payments" as below- 2 days - 3%discount 4 days - 2% discount 5 days no discount. so i have posted one invoice with RS 1000/- using this payment terms on the date of "05.02.2010". but when i am posting the inv

  • PO Form attahcment Name in Email

    Hello, we have a requirement whe PO get saved it will sent out an email attahcment with PDF format. we have an outputdevice as Email and Device type is PDF.This will send an attchment as PRINT DATA.PDF.Our Requirement to change the name of the attach

  • Confused: the difference between ExtractStruct., and table in datasource?

    Run RSA6 on R3, locate any datasource and display it, then we can see a ExtractStruct. field at the top, and many table fields at bottom.   What's the difference between the ExtractStruct. and the below table in the datasource?   All the entries are

  • Folio Builder Installer Damaged

    I recently launched my Folio Builder panel and signed it. I told me that I need to install an update. I followed the link and downloaded the update. When I opened the installer, I got this message: "Installer.app" is damaged and can't be opened. You

  • ABAP webdynpro CO not showing input parameters

    Folks, I know this is strange. But might be that I'm missing something in the ABAP webdynpro creation/configuration. Here it is./. I have created an ABAP webdynpro application in SE80 with the context declared in COMPONENTCONTROLLER and a view with t