CRM Order number return from ORMXIF_ORDER_SAVE

Hi everyone,
if i use crmxif_order_save to post sales orders into crm, how can i get the sales order number created from the post and return this?
when i use we19 the idoc created does not give me the order number that was created.  i will need to get this number and send it out of crm to the place that the order can from.
thank you for your help

Hi Zadie,
I was just asking you to check the help for the function module (CRMXIF_ORDER_SAVE). Display this FM using SE37 and press 'Function module documentation' button towards the top-right screen. There is good amount of info on IDoc interface. Please see if this helps you.
Thanks.
Ajay Kiran

Similar Messages

  • Fetch Sales Order number VBELN from Purchase requisition number BANFN

    Hi,
    I'm not able to find a suitable method to fetch the sales order number(VBELN) from the purchase requisition number(BANFN).
    I tried using VBEP table to fetch the data, but it is giving serious performance issues, as in for fetching one record it is taking approx 20 seconds!!!
    Kindly suggest a suitable method for this.
    I've used the query as folllows:
    select single vbeln banfn
    from vbep
    into (wa_vbep-vbeln, wa_vbep-banfn)
    where banfn eq wa_eban_zdd1_x-banfn.
    where: wa_vbep is the workarea having two fields vbeln and banfn, and wa_eban_zdd1_x-banfn is the reference preq number.
    Scenario in brief described below:
    Whenever a direct delivery sales order is created on a supply chain plant, a dummy purchase requisition without source of supply is created automatically at preferred supplying plant for the customer in the sales order. Direct Delivery Sales Orders which are still in Open status and for the associated dummy purchase requisitions with these sales order, the deletion flag set has to be unchecked.
    in this case, only one sales order is created corresponding to a preq..
    BAPI: BAPI_PR_GETDETAIL is not giving entries for the table as this is a special case of direct delivery from the production plant directly to the customer, bypassing the warehouse / distribution center...
    selection screen has input fields preq, matnr(product) and plant. we fetch entries depending on the data filled in selection screen and also they should be of document type(BSART in EBAN table) ZDD1 and deletion indicator is set(LOEKZ in EBAN).
    then we check if the sales order corresponding to the preq is in open status...
    for this i need to programmatically fetch the sales order number corresponding to the preq...
    this is causing a performance issue as i could find only one way -- fetching sales order number from VBEP table corresponding to BANFN... indexing for easier also didnt work...
    no other way i could find to fetch sales order number corresponding to the preq number....
    there is a bapi: BAPI_PR_GETDETAIL, but this is not fetching entries to the changing tables related to sales order...
    also EBKN table doesnt have any entries as this is a special case of direct delivery preq..
    Guess i couldnt find anyother way...
    Thanks.

    I'm not sure as to why the select query was still throwing performance issues. I could see that the index had been created on only BANFN in the DB. Prior to creating the index, it was taking approx 20 seconds per entry, but after creating the index, it took 13seconds approx.
    I used the select query as follows:
    select single vbeln banfn
    from vbep
    into (wa_vbep-vbeln, wa_vbep-banfn)
    where banfn eq wa_eban_zdd1_x-banfn.
    where: wa_vbep is the workarea having two fields vbeln and banfn, and wa_eban_zdd1_x-banfn is the reference preq number.
    I tried a few other combinations also, but  those also didnt work effectively:
    select vbeln banfn
    from vbep
    into (wa_vbep-vbeln, wa_vbep-banfn)
    where banfn eq wa_eban_zdd1_x-banfn.
    without using SINGLE in the select query as the select query would implicitly pickup only a single record,
    select vbeln banfn
    from vbep
    into wa_vbep
    where banfn eq wa_eban_zdd1_x-banfn.
    and another query where the INTO statement was directed directly to a workarea.
    But unfortunately, nothing seemed to be working.
    The index i had created was on BANFN alone in the VBEP table.

  • Finding CRM Order number from Interaction Record number

    In our scenario when a CRM Order is created, an interaction record also gets simultaneously created. If I want to find out the Order number based on the corresponding interaction record number, how will I achieve it through linking tables?

    Hi,
    Use FM CRM_ORDER_READ and check ET_DOC_FLOW.
    Hope this helps!
    Best regards,
    Caíque Escaler

  • What does the number returned from VISA Read STB represent?

    The value seems to correspond to ibsta, but I thought Read STB returned the status of the instrument, not the bus. If the former is the case, how can the instrument have a status value of 64 (REN/40 + CIC/20 + LACS/4) since it is a counter and is not capable of being the CIC. Any thoughts?
    Thanks,
    Chris

    Read STB issues a *STB? command which retrieves the contents of the instrument's status byte register. Decimal 64 corresponds to bit 6 (RQS/MSS set). The device is sending SRQ. It is not the same thing as ibsta at all. Your instrument manual should have a section on it's status byte register.
    And if it was ibsta, decimal 64 is still bit 6 only (2**6 = 64) and not bits 2, 5, and 6. REM, CIC, and LACS all being set would be decimal 100 (REM=64, CIC =32, LACS=4).

  • To get service order from sales order number and item number

    The select on AUFK takes much longer time than the transaction which is used to get the sevice order number starting from VA03. ( select one line item. goto repairs, then select the repairs column and goto SM Order). Is there any other table than AUFK from which i can get service order number.

    Hi!
    Check, if you have an entry in table VBFA for your sales order (sales order in VBELV, POSNV, AUFK in VBELN and POSNN, VBTYP_N might be 'C').
    If so, your select will be much faster by using VBFA.
    Regards,
    Christian

  • Service number from purchase order number ?

    Hi People,
    can anyone tel me how to take service / activitry  number from the corresponding purchase order
    number.... ( table flow in detail ) where these service number are stored with respect to PO ?
    thanks,
    Siva

    Hi
    Take the value of the field PACKNO from EKPO table and pass it on to the same field PACKNO in ESLL. Here you can pick up all the details:
    For Example:
    select packno from ekpo into it_packno where ebeln = "purchase order number.
    select * from esll where packno = it_packno-packno.
    If you want sub package number, it is in the field SUB_PACKNO(activity number) in ESLL table.
    Vishwa.

  • Order number, order type combination is unique.

    Dear All,
    I am getting the following error, while creating a Sales Order:
    Order number, order type combination is unique. Order number generated by the sequence for this order type already exists. Please contact your System Administrator.
    Is this a problem with the sequences.
    How can I rectify this error..?
    Please update...
    Many thanks in advance.....

    Hi santark,
    It looks like the sequence for that order type is generating a value that has already been used by another sales order of the same type. You can check what is the current value of the sequence going to Setup > Documents > Define, and search for Order Management and your order type. You can verify which is the maximum value for the sales orders of that transaction type already in the system by executing a query similar to this:
    SELECT max(order_number) FROM oe_order_headers_all WHERE order_type_id <your sales order type id>
    You should change the sequence initial value to a number higher than the max order number returned in the previous query.
    You can find the relationtship between order type names and order type ids in view oe_transaction_types_vl.
    Hope it helps.
    Regards.

  • Run time error while closing the CRM Order using BAPI

    Hi Experts,
    Need your invaluable suggestions here.Apologies for the lengthy mail, intention is to give clear idea of the issue.
    I am facing an issue while closing the CRM orders. According to our business process, when an issue is solved we will keep the order in resolved status only. We will not directly close the order from the CRM tool, instead we have created a custom program for the same purpose.
    For the custom program we will give input as the order number and execute it, this will close the order.
    Here close the order means assigning it to Close status as well assign the reason code.
    We have created some reason codes for closed status.
    So when the program is run the Order moves from resolved status to closed status along with reason code.
    But of late we are facing some problems with this program, it is giving run time error for some CRM orders.
    Run time error message : The ABAP/4 Open SQL array insert results in duplicate database records.
    The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught in procedure "CRM_SERVICE_OS_UPD_OST_DU" "(FUNCTION)", nor was it propagated by a RAISING clause.
    Please find my code which have used in the custom program
    Closing the resolved SOs in the system
        CALL FUNCTION 'CRM_STATUS_CHANGE_EXTERN_OW'
            EXPORTING
              objnr                     = iv_guid
              user_status          = lc_status_closed
           EXCEPTIONS
             object_not_found          = 1
             status_inconsistent       = 2
             status_not_allowed       = 3
             OTHERS                        = 4.
        IF sy-subrc <> 0.
          WRITE :  'Error at maintaining status'.
        ENDIF.
    Set reason code
    build lt_subject
        ls_subject-ref_guid = iv_guid.
        ls_subject-katalogart = 'A2'.
        ls_subject-codegruppe = 'ZR000003'.
        ls_subject-code       = 'ZR33'.                      " Reason code
        ls_subject-mode       = 'A'.
        APPEND ls_subject TO lt_subject.
    build lt_ossset
        ls_osset-ref_guid        = iv_guid.
        ls_osset-subject_profile = 'ZREASON03'.
        ls_osset-profile_type    = 'G'.
        ls_osset-subject         = lt_subject.
        APPEND ls_osset TO lt_osset.
    build lt_service_os
        ls_service_os-ref_guid  = iv_guid.
        ls_service_os-ref_kind  = 'A'.
        ls_service_os-osset     = lt_osset.
        APPEND ls_service_os TO lt_service_os.
    build lt_input_fields
        REFRESH: lt_input_fields, lt_field_names.
        CLEAR  : ls_input_fields, ls_field_names.
        ls_field_names-fieldname    = 'CODE'.
        APPEND ls_field_names TO lt_field_names.
        ls_field_names-fieldname    = 'CODEGRUPPE'.
        APPEND ls_field_names TO lt_field_names.
        ls_field_names-fieldname    = 'KATALOGART'.
        APPEND ls_field_names TO lt_field_names.
        ls_field_names-fieldname    = 'SERVICE_PROFILE'.
        APPEND ls_field_names TO lt_field_names.
        ls_input_fields-ref_guid    = iv_guid.
        ls_input_fields-ref_kind    = 'A'.
        ls_input_fields-objectname  = 'SERVICE_OS'.
        ls_input_fields-field_names = lt_field_names.
        APPEND ls_input_fields TO lt_input_fields.
         CALL FUNCTION 'CRM_ORDER_MAINTAIN'
          EXPORTING
            it_service_os     = lt_service_os
          CHANGING
            ct_input_fields   = lt_input_fields
          EXCEPTIONS
            error_occurred    = 1
            document_locked   = 2
            no_change_allowed = 3
            no_authority      = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
          WRITE :  'Error at maintaining reason'.
        ENDIF.
        CALL FUNCTION 'CRM_ORDER_SAVE'
          EXPORTING
            it_objects_to_save   = lt_header_guid
            iv_update_task_local = lv_update_task_local
          IMPORTING
            et_saved_objects     = lt_saved_objects
          EXCEPTIONS
            document_not_saved   = 1
            OTHERS               = 2.
        IF sy-subrc <> 0.
          WRITE : 'Error at saving'.
        ELSE.
          WRITE : 'Successfully Closed'.
          COMMIT WORK AND WAIT.
        ENDIF.
    Run time error is coming at COMMIT WORK AND WAIT statement.
    Please let me know any corrections are required in the above program.
    When I analyzed the run time error I have found that it trying to insert the record in CRMD_SRV_OSSET for that CRM order, but already one record is present in the table for the same CRM order number.
    For most of the CRM orders there is no entry in this table so they are closing successfully but for a few orders for which there is an entry we are getting the above run time error.
    There is nothing wrong with the orders which have an entry already in the table CRMD_SRV_OSSET, I need to close these kind of orders with out run time error.
    Kindly provide your feedback.

    Hi Dinakar,
    You posted this in APO PPDS forum. This question should go to PP forum where someone could answer it.
    Please close this thread and open a new thread in PP forum so that you could get help quickly from the relevant experts.
    Regards - Pawan

  • How to provide relation b/w sales order number &  purchase order number

    hi.....
    i created one report  based on sales order number and displayed by alv grid then by selecting one sales record  using bdc i created purchase order number ,then i have to display that purchase order in alv again,hoe to provide relation b/w sales order and purchase order

    This is what VA05 Does
    SELECT bstkd 
                   vbeln  "Sale order Number
                   posnr
              FROM m_vmvaa
              INTO TABLE i_m_vmvaa
              FOR ALL ENTRIES IN i_bstkd
              WHERE bstkd = i_bstkd-bstkd.   "Your PO Number

  • Purchase Order changing Sales Order Number when printing.

    Hi all,
           I have a client who is trying to print a Purchase Order and when they go to Print or do a Print Preview the Sales Order number changes from 2259 to 2264. The customer is using SAP Business 1 2005A SP01 Pl43. If anyone has heard of this or can help us out that would be greatly appreciated. Thanks!
    Jeff Haldeman
    Support One

    Hi Jeff
    That sounds strange .May be it is a bug .lets find out some of the issue before you log to sap support or patch upgrade .
    1 Are you using formatted search . check the setup - if it is automatically refresh when field altered or changes,
    --If that's the case , change it into  display saved user -defined values .
    give a shot and see what happens
    Thank you
    Bishal

  • VMI scenario: purchase order number created by supplier

    Hi,
    in a VMI scenario is there a way to let the supplier create the purchase order number which is then sent in the ORDRSP IDoc to the customer? And in the customer system the purchase order number from the ORDRSP is used when the purchase order is created from the ORDRSP IDoc.
    Is this possible? What needs to be done for it? Any ideas?
    Regards,
    Robert

    Hi Anand,
    I'm sorry but I didn't understand it.
    The vendor creates a sales order in his system and sends the order rensponse (IDoc ORDRSP) to the customer system. There a purchase order will be created out of the ORDRSP. That's the standard process. But as far as I know in the purchase order there will be no external purchase order number used from the vendor system but a purchase order number from the customer system instead. This purchase order number from the customer system could be sent to the vendor system in an ORDCHG IDoc if needed. I want to know whether or not it's possible to send an external purchase order number from the vendor system to the customer system and create a purchase order with this external purchase order number.
    Regards,
    Robert

  • BAPI or FM to get the work order number

    Hi
    Kinldy let me know if there is any BAPI or FM to get the work order number (aufnr)  from to Purchase requisition number (banfn) & Item number of the purchase requisition in the order(bnfpo).
    Thanks ,
    Arun

    Table EBKN will help you.

  • Internal Order Number For DBM order

    Hi All,
    How to get the internal order no for the SAP DBM order number,?
    from which table can we fetch ?
    Regards,
    Rangakarthick

    Hi,
    In DBM order an internal order can be created on header level and on split level.
    On split level internal order is created within event BILLING_CREATE.
    The internal order (like other documents related to the DBM order like e.g. reservation as well) are displayed in the order document flow.
    In table /DBM/ORD_DOCFLOW you can fetch internal order number from DBM order.
    But its a little bit tricky:
    In field INSTID_A you have to select business object BUS2400 representing the DBM order.
    Field INSTID_B is populated with business object BUS2075 and the internal order number.
    e.g. if you want to select all internal orders for DBM order 29926 you have to select in initial screen
    field INSTID_A:
    "BUS2400   0000029926*" (consider: there are 3 spaces after BUS2400)
    and field INSTID_B:
    "BUS2075*"
    Example from image: DBM order: 299826
    Internal order header: (no split) 121526
    Internal order split: 235320 (same for both splits 0001 and 0002)
    Regards
    Joachim

  • CRM- Find Service contract from Internal Order Number

    Hi Friends,
    I would like to know how to get service contract from internal oredr number.
    From service contract we can find internal order number by using CRM_ORDER_READ function module- table et_document_flow, but my requirement is how to find service contract from Internal order number.Any function module or BAPI available for this requierement ?
    Regards
    Vinayak Sapkal

    Hi,
      when the costs are transferred from CRM to R3, they are posted to an internal order. When a service order or incident is transferred to R3, we have to create an internal order for it, regardless of whether or not a contract has been assigned.
    This is all linked to the logic used in CO to find the appropriate internal order. It works as follows:
    The internal order is stored in the table IAOM_ASSIGNMENTS. This is accessed by a guid (the account assignment guid).
    To get this guid, there is a second table IAOM_EXT_OBJ_INF. This table links the GUIDs coming from CRM, dependent on the CO Customizing for CRM (Mass Controlling, Header level, item level controlling etc.)
    This is how we manage to link a service order to the internal order of a contract in the first place.
    When we call CO, CO first looks for an assignment for the object guid passed. If a service order has been linked to a contract, nothing will be found for the object guid. CO will then check for assignments to the reference guid and find the contract entry.
    If no contract has been assigned, CO will create an internal order based on the service order guid.
    From a CRM point of view, costs are assigned directly to an item, and so it makes no sense to have a reference guid for the costs or the possibility to change the guid via BADI.
    regards
    Waman

  • [CRM] Change sales office from within an order

    We've been trying to get the following to work... as you might guess, so far without success.
    From within a CRM order, if we change the partner number for the department a check is being done whether that partner belongs to the same sales office. If that's not the case, the sales office has to be adjusted.
    Since this might have an effect on authorization, the changing of the sales office has to be done in a separate job (action). In this job, I do the following:
    - Retrieve data on the object
    - crm_order_read for that object
    - select the correct sales office
    - prepare the crm_orgman structure with the new data
    - crm_order_maintain with the crm_orgman and inputfields tables
    - optionally commit work, bapi_transaction_commit etc.
    For as far as we can see, the data is correct. However nothing is being changed. Ideally what I'd like to do is break into the process, change the object that's being processed in memory, and let the system do its job.
    What we've also tried is (shame):
    - Retrieve data on the object
    - crm_order_read for that object
    - select the correct sales office
    - direct update the corresponding tables with the new values
    This works, but as soon as we return control to the system, the changed values (verified, if we look at the tables the values are changed) are reset to what they were.
    It's taking way too much hours for something that should be (in my eyes) a pretty simple action. Any suggestions? Thx in advance!

    Hi Egbert,
    Please take a careful look at the GUIDs you are using: if you are using the orgman structures, the REF_GUID is not the ORGMAN-GUID but instead the ORDERADM_H-GUID. Can you confirm if this has been checked and if it then still is not working? The COMMIT_WORK BAPI is also not necessary.
    Kind regards,
    Joost Janssens
    PS Please reward points if this reply helped you!

Maybe you are looking for