Skip to Content
Technical Articles
Author's profile photo Amy King

Code Snippet Series: Determine the Application Name

This post is part of a series on code snippets. The complete list of posts in the series is available in the document Code Snippets: A Blog Series.

Knowing the name of a Web Dynpro ABAP application can be useful if you want to branch logic or show or hide content depending on the variant of an application. An example is including on-screen hints and help content when the application is a normal end-user variant of the application but omitting such content when the application is an “expert” variant.

DATA lo_controller TYPE REF TO if_wd_controller.
DATA lo_component TYPE REF TO if_wd_component.
DATA lo_application TYPE REF TO if_wd_application.
DATA lo_application_info TYPE REF TO if_wd_rr_application.
DATA lv_name TYPE string.

lo_controller = wd_this->wd_get_api( ).
lo_component = lo_controller->get_component( ).
lo_application = lo_component->get_application( ).
lo_application_info = lo_application->get_application_info( ).
lv_name = lo_application_info->get_name( ).

CASE to_lower( lv_name ).
    WHEN 'expert'.
     
    WHEN OTHERS.         
     
ENDCASE.

 

If you are on a version of NetWeaver that supports chaining method calls (NW 7.0 EhP 2 or higher), you may skip declaration of some or all of the object references.

 


DATA lo_application TYPE REF TO if_wd_application.
DATA lv_name TYPE string.

lo_application = wd_this->wd_get_api( )->get_component( )->get_application( ).
lv_name = lo_application->get_application_info( )->get_name( ).

CASE to_lower( lv_name ).
    WHEN 'expert'.

    WHEN OTHERS.       

ENDCASE.


 

CASE to_lower( wd_this->wd_get_api( )->get_component( )->get_application( )->get_application_info( )->get_name( ) ).
    WHEN 'expert'.
     
    WHEN OTHERS.
ENDCASE. 

 

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      wdr_task=>application_name