cancel
Showing results for 
Search instead for 
Did you mean: 

How to Read the GUID of the current Transaction.

Former Member
0 Kudos

Hi

I am writing a new Function Module, which i will use in the Search Help. I need to process the data using this Function Module. For the same, i need to read the data from the current Transaction. I will be using CRM_ORDER_READ for the same. However, i need to READ the "Header_Guid" before.

Can anyone help. How to read the GUID of the current Transaction?

Thanks and Regards

Jaideep

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Use function module CRM_INTLAY_GET_HEADER_GUID

Regards,

Vinayak

Former Member
0 Kudos

Hi Jaideep,

From where you are going to call this FM ? Are you planning to Implement some BADI or from some BSP application ? If from BSP application then code will look something like this.



  DATA: current           TYPE REF TO if_bol_bo_property_access.
  DATA: dref              TYPE REF TO data.
  DATA: lv_guid           TYPE crmt_object_guid.

 FIELD-SYMBOLS: <l_data> TYPE data.
 IF iterator IS BOUND.
    current = iterator->get_current( ).
  ELSE.
    current = collection_wrapper->get_current( ).
  ENDIF.


  TRY.
      dref = current->get_property( 'GUID' ).           
    CATCH cx_sy_ref_is_initial.
      RETURN.
  ENDTRY.

  ASSIGN dref->* TO <l_data>.
  CLEAR: lv_guid.
  lv_guid = <l_data>.

and you will have the current transaction guid. Since I am not sure at what point of time you are trying to get the guid so I have given you the code at the context node BTADMINH level.

Hope this will give you some idea.

Thanks,

Vikash.