cancel
Showing results for 
Search instead for 
Did you mean: 

how to find out name of web dynpro abap application at runtime

martin_svik2
Participant
0 Kudos

hi,

does anybody know how i can read out the currently used web dynpro application name at runtime ? is there any function module/method

for that ?

I have a user exit in travel management which is used by backend transaction and many web dynpro applications. i only want to run trough the coding of the user exit when the calling web dynpro application is a specific one, and NOT call the exit when it is called from backend/ or other web dynpro applications.

there is nothing like sy-tcode for name of current web dynpro application ?!?

somebody told me to use this:

data lv_name type string.

lv_name = cl_wdr_task=>application->name.

but when using this coding i get dump in ST22 with runtime error "OBJECTS_OBJREF_NOT_ASSIGNED".

br Martin

Accepted Solutions (0)

Answers (3)

Answers (3)

DiegoValdivia
Participant

For anyone reaching this post in 2023 or onwards. Shortdump OBJECTS_OBJREF_NOT_ASSIGNED is triggered because following code is executed from SAP GUI Tcode IW32:

data lv_name type string.

lv_name = cl_wdr_task=>application->name.

The explanation behind that error is that cl_wdr_task=>application is an Object Reference which is never created when the exit is called from Tcode IW32. Such object reference is only created when the exit is called from a Web Dynpro.

So the solution I found was the following:

DATA: lv_wd_app_name type string.

IF sy-tcode IS INITIAL.
IF cl_wdr_task=>application IS BOUND.
lv_wd_app_name = cl_wdr_task=>application->name.
ENDIF.

ENDIF.

I hope this helps.

Former Member

Hi,

Try below code.This might help you.


DATA:

     lr_ctrl_api                    TYPE REF TO if_wd_controller,

     lr_comp_api                    TYPE REF TO if_wd_component,

     lr_appl_api                    TYPE REF TO if_wd_application,

     lr_appl_info                   TYPE REF TO if_wd_rr_application,

     l_appl_name                    TYPE string.

* get app name

   lr_ctrl_api  = wd_this->wd_get_api( ).

   lr_comp_api  = lr_ctrl_api->get_component( ).

   lr_appl_api  = lr_comp_api->get_application( ).

   lr_appl_info = lr_appl_api->get_application_info( ).

   l_appl_name  = lr_appl_info->get_name( ).

Thanks

KH

martin_svik2
Participant
0 Kudos

Hi,

this is not working, it says that field "wd_this" is not known. what is this "wd_this" ????

when i comment this one line with the "wd_this" and leave the rest of the code i again get the runtime error.

We are outside the web dynpro application with my user exit, i don't think this can be used here !

br Martin

Former Member
0 Kudos

Hi,

Alternatively you can also fetch WDP application from  database table WDY_APPLICATION where you can pass the WDP Component name to get Application name.

Thanks

KH

martin_svik2
Participant
0 Kudos

hi,

well, ok, BUT: thats the same problem: how should i know the WDP component name ?

br Martin

martin_svik2
Participant
0 Kudos

has anybody an idea ?

prince_jain4
Explorer
0 Kudos

Getting Error: Field "WD_THIS" is unknown.

Former Member
0 Kudos

Hi Martin,

Rather than finding out the application/component, can you not use SET PARAMETER and GET PARAMETER? I mean, you set a TPARA parameter(New parameter) from the calling application and read its value in the EXIT, if the value is set then the called application is yours.

I hope this works.

Regards

Mohit

martin_svik2
Participant
0 Kudos

Hi Mohit,

nice approach, but the problem is: the calling application is sap-standard with no possibility to change it without modification. and modification is not allowed

br Martin

Former Member
0 Kudos

Hey,

Can't we do enhancement? enhance the standard webdynpro component by writing POST/PRE EXIT to the method from where the exit is called.

We oftenly do enhancements in standard webdynpro components in SRM, not too sure about your application.

Another alternative-

Read system call stack where you will have to focus on classes with format /1BCWDY/0O2TIFC6GG2TO5CG1RT8==CP (here /1BCWDY/0O2TIFC6GG2TO5CG1RT8 will be the class name)

Then you need to check database table  WDY_WB_GENINFO with GUID = CLASSNAME+8 (Class name leaving first 8 charcaters). in this case we should be passing 0O2TIFC6GG2TO5CG1RT8 in the GUID field and controller name must be SPACE. The query will give COMPONENT_NAME and then you can find application(which may not really be needed I guess).

Former Member
0 Kudos

Please check this document too, let me know if this helps.