1
votes

I am a fresher. Just 2 months of experience in SAP ABAP.

I am asked to get the quotation date for list of contracts. For that I need to get the crm business transaction number from everh table.

Now I need to use this transaction number in the program crm_order_read and get the export parameter et_orderadm_i in which GUID will be available and also the creation date and time(quotation date).

Now I am not able to understand that how to pass the transaction number(object_id) in the program crm_order_read? There is also a function module crm_order_id available, but there is no import parameter which is a transaction number.

Again, how the export parameter et_orderadm_i will contain the quotation date? I am not able to find a way to write the piece of code.

1

1 Answers

2
votes

Usually you don't pass IDs to CRM_ORDER_READ, but GUIDs.

If you have anyhow only IDs available, you first might want to change the approach. Or make a select on table CRMD_ORDERADM_H.

Which object has which guid can be seen in SE16 => CRMD_ORDERADM_H => F8.

However you can test the function module CRM_ORDER_READ in the program SE38=>CRM_ORDER_READ also with IDs.

Here's some basic coding that you can use as template.

        INCLUDE crm_object_names_con.

        data:
                lv_guid                TYPE crmt_object_guid,
                lt_guid                TYPE crmt_object_guid_tab,
                lt_req_obj             TYPE crmt_object_name_tab,
                lt_orderadm_i          TYPE crmt_orderadm_i_wrkt,
                ls_orderadm_i          TYPE crmt_orderadm_i_wrk,
                lt_orderadm_h          TYPE crmt_orderadm_h_wrkt,
                ls_orderadm_h          TYPE crmt_orderadm_h_wrk.

        CLEAR lt_guid.
        INSERT lv_guid INTO TABLE lt_guid.
        INSERT gc_object_name-orderadm_h   INTO TABLE lt_req_obj.
        INSERT gc_object_name-orderadm_i INTO TABLE lt_req_obj.
        CALL FUNCTION 'CRM_ORDER_READ'
          EXPORTING
            it_header_guid       = lt_guid
            it_requested_objects = lt_req_obj
          IMPORTING  
            et_orderadm_h        = lt_orderadm_h. 
            et_orderadm_i        = lt_orderadm_i. 


        READ TABLE lt_orderadm_i INTO ls_orderadm_i INDEX 1.


        LOOP AT lt_orderadm_i INTO ls_orderadm_i .

        ENDLOOP.

Tipps:

Double-click on CRM_ORDER_READ to navigate into it and get the exported data-types from there if you need different ones.

In CRM_ORDER_READ click on the where-used-list to see how it is implemented at other locations.

The date can be found in ORDERADM_H-POSTING_DATE.