sapdev logo background
sapdev logo sapdev logo
Comments

Pass portal user ID to bespoke web dynpro for ABAP





If you are creating an ABAP web dynpro which you want to insert into your SAP portal you may need retrieve the user name of the portal user currently logged in, this will allow you to retrieve or update their personal data. Below are simple steps required to perform this functionality:

What needs to be done Within your ABAP Wdp

Step 1
Within the Main Window of your ABAP Web Dynpro application, select Inbound Plugs tab. Now double click on the Startup Plug Named 'DEFAULT' (or what ever you have called it if you have changed this since window was created).

Step 2
Within the plug method HANDLEDEFAULT Add a new importing parameter below 'WDEVENT' parameter call it IV_USER of Type UNAME.

Step 3
Now within the code section of the plug method HANDLEDEFAULT you can freely assign the value of IV_User to an attribute of your component controller. i.e. wd_comp_controller->userid = IV_USER. Alternatively you could assign it to a wdp context node / attribute.

Please note this value will not be available with the WDDOINIT of your main view as WDDOINIT method of this view is called before the window HANDLEDEFAULT method. Put your code into the method WDDOMODIFYVIEW of your main view instead.

Step 4
Double click on the webdynpro Application, within the Parameters tab add a new parameter. You should just be able to use the F4 help on the param column and select the IV_USER entry.

Step 5
Save your application nad activate your web dynpro


With the 'Content Administration' tab of your portal

Step 1
Create an iview of type ABAP Web dynpro specifying the application name as that of your created wdp (must be exactly the same).

Key information for creating iView:

  • Create as iView template (select template as SAP Web Dynpro iView)

  • namespace = sap (check service name in SICF if this is not correct)

  • Application Name = ZWDA_EXAMPLE(name of your wdp created in se80)

  • Application Parameters = IV_USER=

  • Step 2
    Save and setup any other details required when creating any other iView




    comments powered by Disqus