Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CRM ABAP DO_INIT_CONTEXT

Former Member
0 Likes
1,082

Hi Dear All,

I'm new to CRM develop. May I ask an easy question? How could I get the transaction type in method DO_INIT_CONTEXT? I need to check the transaction type to set the selection mode to single/muliple. Thank you.

BR

Jay

1 ACCEPTED SOLUTION
Read only

bauert
Explorer
0 Likes
884

Hi,

you probably have to get the parent.

Try something like this:

DATA lo_current TYPE REF TO if_bol_bo_property_access.

DATA lo_entity  TYPE REF TO cl_crm_bol_entity.

DATA lv_process_type TYPE CRMT_PROCESS_TYPE_DB.

lo_current = collection_wrapper->get_current( ).

lo_entity ?= lo_current. lo_entity = lo_entity->get_parent( ).

lv_process_type = lo_entity->get_property_as_string( 'PROCESS_TYPE' ).

Thx.

3 REPLIES 3
Read only

Former Member
0 Likes
884

Hi Jay,

  Can you elaborate about on which component you are working on.

  Mostle you can read it from the collection wrapper of the node in TYPED_CONTEXT of the view.

  code can look like as followed -

  data : lr_current   type ref to if_bol_bo_property_access,

           lv_ttype       type          (Transaction type field domain).

lr_current ?= me->typed_context->(node_name)->collection_wrapper->get_current( ).

  call method  lr_current->get_property_as_value(
      EXPORTING
        iv_attr_name = (Transaction type field name in character)
      IMPORTING
        ev_result = lv_ttype).

  Hope this might helps

Read only

0 Likes
884

Hi Ganguly,

I'm working on component PRD01QR/SearchHelpResult, as you could see it is for F4 help search result and I see that this view is shared by many components, our requirement is to add a button in the ALV toolbar to some special transaction types.

As you mentioned, to use lr_current ?= me->typed_context-(node_name)->collection_wrapper->get_current( ).

When we press F4 on BT116IT_SRVO/GenericItem, node BTADMINI, attribute STRUCT.ORDERED_PROD, we would trigger PRD01QR/SearchHelpResult. So I think here I should write lr_current ?= me->typed_context->btadminh->collection_wrapper->get_current( ). But sap informs me 'btadminh' does not exist.

Could you please give me any hint?   Thank you.


BR

Jay

Read only

bauert
Explorer
0 Likes
885

Hi,

you probably have to get the parent.

Try something like this:

DATA lo_current TYPE REF TO if_bol_bo_property_access.

DATA lo_entity  TYPE REF TO cl_crm_bol_entity.

DATA lv_process_type TYPE CRMT_PROCESS_TYPE_DB.

lo_current = collection_wrapper->get_current( ).

lo_entity ?= lo_current. lo_entity = lo_entity->get_parent( ).

lv_process_type = lo_entity->get_property_as_string( 'PROCESS_TYPE' ).

Thx.