cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Data to Webdynpro from normal module pool screen

Former Member
0 Kudos

Hi,

I am working on a requireent, where I have a normal screen with some fields and a button. When I click on the button I want to navigate to the webdynpro screen and also pass the data from the screen to web dynpro.

Any suggestion is really appriciated.

Thanks

Sanjaya

Accepted Solutions (0)

Answers (2)

Answers (2)

ChrisPaine
Active Contributor
0 Kudos

In order to pass the data from the screen to the WD you'll need to pass some parameters.

Now this hasn't anything to do with the FPM! So I suggest you visit the WDA forum and have a little search on passing parameters via URL. Have a look especially at those posts that don't suggest passing all your values in the URL but discuss other means.

The only FPM implication here is how to get at these parameters! As normally you'd get them in the window of the application called. But in the FPM that is not something you have access to!

However there is an attribute of the FPM - IF_FPM->MO_APP_PARAMETER on which you can call the method GET_VALUE to retrive any URL parameters passed to the application.

Hope that helps,

Chris

Former Member
0 Kudos

Thanks experts..

Let me put my question in a different way..

I have one variable and one internal table in my normal module pool screen and also I have the same in my web dynpro application.

So my requirement is when I navigate from my normal screen to webdynpro, i want those values to be defulted to the webdynpro screen.

I am able to do that, by using export and import to database..

But is there any other way.. I mean can we instantiate the interface fo rth web dynpro application and pass the values before calling it in the module pool..

Any example will be appricated..

@Arvind: you can use the FM WDY_EXECUTE_IN_PLACE to call the webdynpro application without much coding..

I don't understand what you are trying to explain through that code...

in this FM also we have a tables parameter to pass the values.. but that does not work.. and moreover i beleive it will accpet the paramteres only not internal tables...

ChrisPaine
Active Contributor
0 Kudos

Hello Sanjaya,

as I previously posted - you would be much better off looking in the normal Web Dynpro ABAP forum for this information, rather than in the FPM ABAP forum.

Each Web Dynpro runs in its own memory instance - you cannot directly pass values to it.

The easiest way (if you have a single application server) is to use the shared memory constructs. But if you go to the Web Dynpro ABAP forum, and do a little search you will find plenty of information about this. You pass a key (GUID) as a parameter and use that GUID to read all the data that you want.

Here's some code I've used to pass some tables into an application

data: lo_area         type ref to cl_powl_easy_area,
        lo_data         type ref to cl_powl_easy_sharedobj,
        l_uuid32        type guid_32,
        l_data          type xstring,
        l_instance_name type shm_inst_name.

  field-symbols:    <lt_jobs>     type standard table,
                    <lt_jobf>     type standard table,
                    <lt_quals>     type standard table.

*         Shared object (created with SHMA) is used to transport the data to WD application
*         Create own ID
  call function 'GUID_CREATE'
    importing              
      ev_guid_32 = l_uuid32.
  concatenate p_url '&SELPARAMS=' l_uuid32 into p_url.

*         Create shared object
  l_instance_name = l_uuid32.
  lo_area = cl_powl_easy_area=>attach_for_write( inst_name = l_instance_name ).
  create object lo_data area handle lo_area.
  lo_area->set_root( lo_data ).
*         Fill helper class
  clear l_data.

  assign: pt_job to <lt_jobs>,
          pt_quals to <lt_quals>,
          pt_jobf to <lt_jobf>.


  export jobs = <lt_jobs>
         job_family = <lt_jobf>
         quals = <lt_quals>
      to data buffer l_data compression on.

  lo_data->gt_data = l_data.
*         Release write lock
  lo_area->detach_commit( ).

ChrisPaine
Active Contributor
0 Kudos

and then read the same data in the launch application

in the default window

METHOD handledefault .

  DATA lo_componentcontroller TYPE REF TO ig_componentcontroller.
  lo_componentcontroller = wd_this->get_componentcontroller_ctr( ).

    CALL METHOD lo_componentcontroller->convert_string_to_context(
    selparams ).

ENDMETHOD.

and then

method convert_string_to_context .

  data: main_node  type ref to if_wd_context_node,
        child_node type ref to if_wd_context_node,
        lt_quals   type zpd_hrobjid_tt,
        lt_job     type zpd_hrobjid_tt,
        lt_jobf    type zpd_hrobjid_tt,

        lo_area         type ref to cl_powl_easy_area,
        lo_data         type ref to cl_powl_easy_sharedobj,
        l_data          type xstring,
        l_instance_name type shm_inst_name.

************************************
* Convert string to internal table
************************************
  main_node = wd_context->get_child_node( name = wd_this->wdctx_selection ).

  l_instance_name = selparams.

  try.

      call method cl_powl_easy_area=>attach_for_read
        exporting
*    client    =
          inst_name = l_instance_name
        receiving
          handle    = lo_area.



      lo_data ?= lo_area->get_root( ).

      l_data = lo_data->gt_data.

      import jobs = lt_job
             job_family = lt_jobf
             quals = lt_quals
          from data buffer l_data.


      lo_area->detach_area( ).

      lo_area->free_instance( inst_name = l_instance_name ).


    catch cx_shm_error.
* nothing to read - has already been read and data is now lost.
  endtry.

* Qualification

  child_node = main_node->get_child_node( name = wd_this->wdctx_quals ).
  child_node->bind_table( lt_quals ).

* Job
  child_node = main_node->get_child_node( name = wd_this->wdctx_jobs ).
  child_node->bind_table( lt_job ).

* Job Family
  child_node = main_node->get_child_node( name = wd_this->wdctx_jobf ).
  child_node->bind_table( lt_jobf ).

endmethod.

NB - This is NOT an FPM application!

to read the URL parameters for an FPM app use the method I mentioned earlier.

Former Member
0 Kudos

Hi Sanjaya,

DATA lv_app TYPE swfvtv-vval.

DATA lv_url TYPE string.

DATA lv_url_pre TYPE string.

DATA lv_url_suff TYPE string.

DATA lv_task TYPE swfvtv-task.

DATA lv_memid TYPE string.

DATA lt_param TYPE tihttpnvp.

DATA ls_param TYPE LINE OF tihttpnvp.

DATA lo_window_manager TYPE REF TO if_wd_window_manager.

DATA lo_api_component TYPE REF TO if_wd_component.

DATA lo_window TYPE REF TO if_wd_window.

----


  • Get Application Name.

----


lv_task = sworklist-external_type.

DATA lt_swfvtv TYPE TABLE OF swfvtv.

DATA ls_swfvtv TYPE swfvtv.

  • Get WD parameters

SELECT *

FROM swfvtv

INTO CORRESPONDING FIELDS OF TABLE lt_swfvtv

WHERE task EQ lv_task

AND vtyp EQ 'WD_ABAP'.

IF sy-subrc NE 0.

RAISE not_found.

ENDIF.

  • Create application name in PAPPL

    • Get namespace

READ TABLE lt_swfvtv INTO ls_swfvtv WITH KEY vpar = 'NAMESPACE' .

IF sy-subrc EQ 0.

CONCATENATE pappl ls_swfvtv-vval INTO pappl SEPARATED BY '/'.

ENDIF.

    • Get application name

READ TABLE lt_swfvtv INTO ls_swfvtv WITH KEY vpar = 'APPLICATION' .

IF sy-subrc EQ 0.

CONCATENATE pappl ls_swfvtv-vval INTO pappl SEPARATED BY '/'.

ENDIF.

----


  • Construct URL for application name.

----


lv_url = pappl.

CALL METHOD cl_wd_utilities=>construct_wd_url

EXPORTING

application_name = lv_url

in_parameters = lt_param

IMPORTING

out_absolute_url = lv_url.

SPLIT lv_url AT '?' INTO lv_url_pre lv_url_suff.

IF lv_url_suff IS NOT INITIAL.

CONCATENATE '&' lv_url_suff INTO lv_url_suff.

ENDIF.

CONCATENATE lv_url_pre '?sap-client=' sy-mandt '&sap-language=' sy-langu lv_url_suff '&WI_ID=' sworklist-external_id

INTO lv_url.

----


  • Create window for application.

----


lo_api_component = wd_this->wd_get_api( ).

lo_window_manager = lo_api_component->get_window_manager( ).

lo_window = lo_window_manager->create_external_window(

url = lv_url

has_menubar = abap_false

has_toolbar = abap_false

has_location = abap_false ).

lo_window->set_window_size( width = '700' height = '500' ).

lo_window->open( ).

This is the code to generate the URL for a Web Dynpro Application.

modify the code according to need.

Hope this will help you.

Thanks &Regards,

Arvind

Hey i dont know why is this coming like this when posted.

Copy-paste this in modify in editor.

Edited by: Arvind Patel on Jun 16, 2010 2:35 PM

ChrisPaine
Active Contributor
0 Kudos

Arvind Patel wrote

> Hi Sanjaya,

>

> DATA lv_app TYPE swfvtv-vval.

> DATA lv_url TYPE string.

> DATA lv_url_pre TYPE string.

> DATA lv_url_suff TYPE string.

> DATA lv_task TYPE swfvtv-task.

> DATA lv_memid TYPE string.

> DATA lt_param TYPE tihttpnvp.

> DATA ls_param TYPE LINE OF tihttpnvp.

>

>

> DATA lo_window_manager TYPE REF TO if_wd_window_manager.

> DATA lo_api_component TYPE REF TO if_wd_component.

> DATA lo_window TYPE REF TO if_wd_window.

>

> ----


> * Get Application Name.

> ----


> lv_task = sworklist-external_type.

>

> DATA lt_swfvtv TYPE TABLE OF swfvtv.

> DATA ls_swfvtv TYPE swfvtv.

>

> * Get WD parameters

> SELECT *

> FROM swfvtv

> INTO CORRESPONDING FIELDS OF TABLE lt_swfvtv

> WHERE task EQ lv_task

> AND vtyp EQ 'WD_ABAP'.

> IF sy-subrc NE 0.

> RAISE not_found.

> ENDIF.

>

> * Create application name in PAPPL

> ** Get namespace

> READ TABLE lt_swfvtv INTO ls_swfvtv WITH KEY vpar = 'NAMESPACE' .

> IF sy-subrc EQ 0.

> CONCATENATE pappl ls_swfvtv-vval INTO pappl SEPARATED BY '/'.

> ENDIF.

>

> ** Get application name

> READ TABLE lt_swfvtv INTO ls_swfvtv WITH KEY vpar = 'APPLICATION' .

> IF sy-subrc EQ 0.

> CONCATENATE pappl ls_swfvtv-vval INTO pappl SEPARATED BY '/'.

> ENDIF.

ChrisPaine
Active Contributor
0 Kudos

>

>

> ----


> * Construct URL for application name.

> ----


> lv_url = pappl.

> CALL METHOD cl_wd_utilities=>construct_wd_url

> EXPORTING

> application_name = lv_url

> in_parameters = lt_param

> IMPORTING

> out_absolute_url = lv_url.

>

> SPLIT lv_url AT '?' INTO lv_url_pre lv_url_suff.

>

> IF lv_url_suff IS NOT INITIAL.

> CONCATENATE '&' lv_url_suff INTO lv_url_suff.

> ENDIF.

>

> CONCATENATE lv_url_pre '?sap-client=' sy-mandt '&sap-language=' sy-langu lv_url_suff '&WI_ID=' sworklist-external_id

> INTO lv_url.

>

> ----


> * Create window for application.

> ----


> lo_api_component = wd_this->wd_get_api( ).

> lo_window_manager = lo_api_component->get_window_manager( ).

> lo_window = lo_window_manager->create_external_window(

> url = lv_url

> has_menubar = abap_false

> has_toolbar = abap_false

> has_location = abap_false ).

>

> lo_window->set_window_size( width = '700' height = '500' ).

>

> lo_window->open( ).

>

> This is the code to generate the URL for a Web Dynpro Application.

>

> modify the code according to need.

>

> Hope this will help you.

>

> Thanks &Regards,

> Arvind

>

>

Silly bug in forums stops formatting working on long posts - just split them in future...