web dynpro abap _ scn3

Download Web Dynpro Abap _ Scn3

Post on 28-Dec-2015

118 views

Category:

Documents

14 download

Embed Size (px)

DESCRIPTION

web dynpro abap

TRANSCRIPT

  • Getting Started Newsletters Store

    Products Services & Support About SCN Downloads

    Industries Training & Education Partnership Developer Center

    Lines of Business University Alliances Events & Webinars Innovation

    Login RegisterWelcome, Guest Search the Community

    Activity Communications Actions

    Brow se

    Web Dynpro ABAP 116 Posts 1 2 3 4 5 8

    PreviousNext

    This post is part of a series on code snippets. The complete list of posts in the series is availab le in the document

    Code Snippets: A Blog Series.

    Two steps are needed to pass parameters into a Web Dynpro ABAP application from the SAPgui. First, the SAPgui

    must construct the URL of the Web Dynpro application and open the URL in a web browser. This step may be done in

    any ABAP routine.

    Second, the Web Dynpro application must read the parameters from its URL query string. This is accomplished in

    one of two ways. Dynamic parameters must be handled by programmatically reading the parameter name/value pairs

    from the URL query string in the HANDLEDEFAULT event handler method of the Web Dynpro application's interface

    view, i.e., its window.

    Internal table LT_PARAMETERS may now be read and the parameter name/value pairs processed as needed by the

    application. Static parameters may also be handled in this way or may be defined at design time as importing

    Code Snippet Series: Passing Parameters to WebDynpro from SAPgui

    Posted by Amy King Aug 28, 2013

    01. DATA lv_absolute_url TYPE string.

    02. DATA lv_url TYPE char255.

    03. DATA ls_parameter TYPE ihttpnvp.

    04. DATA lt_parameters TYPE tihttpnvp.

    05.

    06. * Assemble the parameter name/value pairs as needed

    07. ls_parameter-name = 'param1_name'.

    08. ls_parameter-value = 'param1_value'.

    09. APPEND ls_parameter TO lt_parameters.

    10.

    11. ls_parameter-name = 'param2_name'.

    12. ls_parameter-value = 'param2_value'.

    13. APPEND ls_parameter TO lt_parameters.

    14.

    15. * Construct the URL with parameters

    16. cl_wd_utilities=>construct_wd_url(

    17. EXPORTING

    18. application_name = 'WEB_DYNPRO_APPLICATION_NAME'

    19. in_parameters = lt_parameters

    20. IMPORTING

    21. out_absolute_ur l = lv_absolute_url

    22. ).

    23.

    24. lv_url = lv_absolute_url. " cast data type

    25.

    26. CALL FUNCTION 'CALL_BROWSER'

    27. EXPORTING

    28. url = lv_url

    29. window_name = 'Example: Passing Parameters'

    30. new_window = abap_true

    31. EXCEPTIONS

    32. OTHERS = 0.

    01. DATA lt_parameters TYPE tihttpnvp.

    02.

    03. * Read URL parameters from the query string

    04. wdevent->get_data(

    05. EXPORTING

    06. name = if_wd_application=>all_url_parameters

    07. IMPORTING

    08. value = lt_parameters

    09. ).

  • parameters in the HANDLEDEFAULT method signature.

    1024 View s 6 Comments

    Tags: w da, w eb_dynpro, w ebdynpro, query_string, url, parameter, w eb_dynpro_abap, parameters, w ebdynpro_abap,

    w ebdynproabap, url_parameters, w ebdynpro_for_abap, abap_w d, query_url, querystring

    This post is part of a series on code snippets. The complete list of posts in the series is availab le in the document

    Code Snippets: A Blog Series.

    In a view's layout, individual MenuItems may be added as child elements to a Menu, ButtonChoice or LinkChoice

    parent element, but what if the list of menu options is not known at design time? An example is needing to present

    the user with a ButtonChoice that lists employees who report directly to the user. This list will be different for each

    user and must be read from a database table, so these menu options cannot be created at design time.

    The Menu, ButtonChoice or LinkChoice element may be created in the view's layout at design time and its child

    elements created dynamically at runtime, for example in the view's WDDOINIT hook method. The example below

    creates MenuActionItems for a ButtonChoice. The same approach may be used to dynamically create menu items for

    a Menu or LinkChoice UI element.

    695 View s 0 Comments

    Tags: w da, menu, w eb_dynpro, w ebdynpro, dynamic, w eb_dynpro_abap, w ebdynpro_abap, w ebdynproabap,

    w ebdynpro_for_abap, abap_w d, code_snippet, code_snippet_series, buttonchoice, button_choice, linkchoice, link_choice

    Code Snippet Series: Creating Menu ItemsDynamically

    Posted by Amy King Aug 21, 2013

    01. DATA lo_view TYPE REF TO if_wd_view.

    02. DATA lo_buttonchoice TYPE REF TO cl_wd_button_choice.

    03. DATA lo_menuactionitem TYPE REF TO cl_wd_menu_action_item.

    04.

    05. * Get a reference to the ButtonChoice view object

    06. lo_view ?= wd_this->wd_get_api( ).

    07. lo_buttonchoice ?= lo_view->get_element( 'BUTTONCHOICE_ID' ).

    08.

    09. * Add a MenuActionItem to the ButtonChoice for each record in the source data table

    10. LOOP AT lt_data ASSIGNING .

    11.

    12. CALL METHOD cl_wd_menu_action_item=>new_menu_action_item

    13. EXPORTING

    14. id = -id

    15. on_action = 'VIEW_ACTION' " action to be executed upon selection of the menu item

    16. text = -text

    17. RECEIVING

    18. control = lo_menuactionitem.

    19.

    20. CALL METHOD lo_buttonchoice->add_choice

    21. EXPORTING

    22. the_choice = lo_menuactionitem.

    23.

    24. ENDLOOP. "

    This post is part of a series on code snippets. The complete list of posts in the series is availab le in the document

    Code Snippets: A Blog Series.

    Knowing the environment in which a Web Dynpro ABAP application is running is necessary if you want to branch logic

    or show or hide content depending on the client environment. An example is showing the user's logon name in a

    header or a copyright notice in a footer when the application is running standalone but hiding these view elements

    when the application is running in the NetWeaver portal.

    Code Snippet Series: Determining the ClientEnvironment

    Posted by Amy King Aug 20, 2013

    01. DATA lo_wd_component TYPE REF TO if_wd_component.

    02. DATA lo_wd_application TYPE REF TO if_wd_application.

    03. DATA lv_client_environment TYPE i.

    04.

  • 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 the object references.

    390 View s 0 Comments

    Tags: w eb_dynpro, environment, w ebdynpro, w eb_dynpro_abap, w ebdynpro_abap, client, w ebdynproabap,

    w ebdynpro_for_abap, abap_w d, client_environment, code_snippet, code_snippet_series

    05. lo_wd_component ?= wd_this->wd_get_api( ).

    06. lo_wd_application = lo_wd_component->get_application( ).

    07. lv_client_environment = lo_wd_application->get_client_environment( ).

    08. CASE lv_client_environment.

    09.

    10. WHEN if_wd_application=>co_client_environment-nwbc.

    11. * NetWeaver Business Client

    12.

    13. WHEN if_wd_application=>co_client_environment-portal.

    14. * NetWeaver Portal

    15.

    16. WHEN if_wd_application=>co_client_environment-sapgui.

    17. * SAPgui

    18.

    19. WHEN if_wd_application=>co_client_environment-standalone.

    20. * Standalone

    21.

    22. WHEN if_wd_application=>co_client_environment-unknown.

    23. * Unknown client environment

    24.

    25. ENDCASE.

    01. CASE wd_this->wd_get_api( )->get_application( )->get_client_environment( ).

    02. ...

    03. ENDCASE.

    If you want to debug into what is happening in the ABAP application server when you access an HTTP URL on it with

    your browser, there are several places to set an external breakpoint which will bring up the ABAP debugger for this

    web request.

    Function module HTTP_DISPATCH_REQUEST line 982 seems to be the first point from where a breakpoint will bring

    you into the debugger.

    At this point, the http handler list is already populated. This is done by call function module

    HTTP_GET_HANDLER_LIST from line 606 and gives you all the handlers into question for the URL.

    Debugging into a HTTP request on AS ABAP

    Posted by Christian Buckowitz Aug 11, 2013

  • For this example, there exist 2 handlers for /sab/bc/ui5_ui5.

    If you look at the nested handlertbl, you can see the handler implementation classes and the order in which they will

    be executed to handle the http request.

    The next point of interest is where the actual call of the http handler is done. This is in class method

    CL_HTTP_SERVER=>EXECUTE_REQUEST line 627.

    A bit up in the code, an object instance was created from the http handler class and now the interface method

    if_http_extension->handle_request is called. From here it is up to the http handler object to proceed with the

    processing. This may be completely different from one handler to the n