cancel
Showing results for 
Search instead for 
Did you mean: 

internal table values in a popup window

Former Member
0 Kudos

Hi All,

i'm new to WD..

i have a dynamic internal table(only one field) in my WDA. i want to show all the values as POPUP on the screen after user press the button. please let me know how can i procced for this? also after selecting the rows from Popup table, i want the fields selected to be placed into another internal table.

please let me know how can i do this..

Thanks in advance

Shekhar

Accepted Solutions (1)

Accepted Solutions (1)

pranav_nagpal2
Contributor
0 Kudos

hi shekhar,

i have seen this while working on tables that your internal table fields should be of same name as that of your context attribute name only thn it will display the values.

eg.. say your context node(with which you have binded the table) is X and context attribute name is Y(with this you have to bind your table fileld)

now in internal table name of the field of internal table must be Y. i.e. you can declare your internal table as

types: begin of itab,

y type c,

endof itab.

regards,

Pranav

Former Member
0 Kudos

It's working Pranav.. Thanks a lot!!!

Thanks Vivek,Uday and Suman for your valuable inputs!!!!!

Regards

Shekhar

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Shekar,

you have to create another view ( Say V2) for pop up and embed this view to a new window ( say 2) .

Create a node for table at component controller and map is your view V2 . Create a table conrol and bind it to the node . I hope that you know how to create table control .

Now on the action handler of the button write the following code

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.

lo_api_component = wd_comp_controller->wd_get_api( ).

lo_window_manager = lo_api_component->get_window_manager( ).

lo_window = lo_window_manager->create_window(

window_name = 'W2' "window where you have embed your pop up view

  • title =

  • close_in_any_case = abap_true

message_display_mode = if_wd_window=>co_msg_display_mode_selected

  • close_button = abap_true

button_kind = if_wd_window=>co_buttons_ok

message_type = if_wd_window=>co_msg_type_none

default_button = if_wd_window=>co_button_ok

).

lo_window->open( ).

later you close the window with the same reference by storing it as a component controller attribute .

To move the data from one table to another table ..:

1.get the lead selection of first table ...

2. copy the record to another table .

3 remove the record from first table . " table means node here which is assiciated with the table .

I hope this will help you .

Regards

Vivek

PS: Please provide the points if answer is helpful

Former Member
0 Kudos

Hi Vivek,

Thanks for the reply..

i'm able to display the table structure. But its not displaying the records. Its giving me the blank table.

i've binded my internal table containing the records to the node (table).

Don't know where i have gone wrong

Regards

Shekhar

uday_gubbala2
Active Contributor
0 Kudos

Hi Shekhar,

Try go through this [example |http://saptechnical.com/Tutorials/WebDynproABAP/Popup/page1.htm]where the user enters his customer number & presses on a pushbutton. The corresponding sales orders are displayed in a popup window. When the user selects 1 of the orders the popup gets closed and the corresponding sales item details are displayed in the main window. The example explains along with step-by-step snapshots so you can get to understand the whole process & compare with the way you have followed in your application.

Regards,

Uday

Former Member
0 Kudos

Hi Shekar,

You are getting empty table means,you are not assigning the data to context node.Check in debug mode whether the data is binding properly to node or not.

To get the selected row and send back to other screen

Create a contrller context node with attributes which you want to be in internal table.

Declare one internal table in the attributes of component controller and fill this internal table in the event handler method of Lead selection of pop up window.

declare your internal table like..

eg:gt_table type IF_COMPONENTCONTROLLER=>elements_flights in contrller attributes

Former Member
0 Kudos

Hi,

i have used the following code in my prog:

the internal table I_TAB contains only one field.

LO_ND_TABLE is the context node which i have binded to the table control

DATA LO_ND_TABLE TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_TABLE TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA LS_TABLE TYPE WD_THIS->ELEMENT_TABLE.

  • navigate from <CONTEXT> to <TABLE> via lead selection

LO_ND_TABLE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_TABLE

).

LO_ND_TABLE->BIND_TABLE( I_TAB ).

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.

LO_API_COMPONENT = WD_COMP_CONTROLLER->WD_GET_API( ).

LO_WINDOW_MANAGER = LO_API_COMPONENT->GET_WINDOW_MANAGER( ).

LO_WINDOW = LO_WINDOW_MANAGER->CREATE_WINDOW(

WINDOW_NAME = 'POPUP_TABLE'

title = 'Select the fields'

close_in_any_case = abap_true

MESSAGE_DISPLAY_MODE =

IF_WD_WINDOW=>CO_MSG_DISPLAY_mode_selected

close_button = abap_true

BUTTON_KIND = IF_WD_WINDOW=>CO_BUTTONS_OK

MESSAGE_TYPE =

IF_WD_WINDOW=>CO_MSG_TYPE_NOne

DEFAULT_BUTTON = IF_WD_WINDOW=>CO_BUTTON_OK

).

LO_WINDOW->OPEN( ).

Regards

Shekhar

Former Member
0 Kudos

Just want to add one more thing here..

Suppose if i got 10 records in my internal table, the pop up is displaying 10 records. But the records are getting displayed blank. I mean to say, its taking the number of records exactly but its not displaying the values..

Regards

Shekhar

uday_gubbala2
Active Contributor
0 Kudos

Hi Shekhar,

Have you actually populated your internal table I_TAB with any data? Am asking so coz I dont find anything related to that in here. You have just obtained your context node's reference & have written a bind_table to that. Have you actually filled this internal table by using WDDOINIT method or a supply function?

Regards,

Uday

Am sorry I had earlier given you a link to invalid tutorial. Plz find the correct link for the task I had explained earlier in [here|http://saptechnical.com/Tutorials/WebDynproABAP/Modalbox/page1.htm].

Below is the code that I have in my push button.I read the KUNNR value entered by the user & fetch the corresponding sales order information & bind it to my context node. I then map this context node to the view embedded within my popup view.

METHOD onactiondisplay_popup .
  DATA: lv_node  TYPE REF TO if_wd_context_node,
        lv_kunnr TYPE ig_componentcontroller=>element_kna1-kunnr,
        lt_vbak  TYPE ig_componentcontroller=>elements_vbak.


*   get message manager
  DATA lo_api_controller     TYPE REF TO if_wd_controller.
  DATA lo_message_manager    TYPE REF TO if_wd_message_manager.

  lo_api_controller ?= wd_this->wd_get_api( ).

  CALL METHOD lo_api_controller->get_message_manager
    RECEIVING
      message_manager = lo_message_manager.


  lv_node = wd_context->get_child_node( name = 'KNA1' ).

  CALL METHOD lv_node->get_attribute
    EXPORTING
      name  = 'KUNNR'
    IMPORTING
      value = lv_kunnr.

  SELECT * FROM vbak INTO TABLE lt_vbak WHERE kunnr = lv_kunnr.

  IF sy-subrc NE 0.

*   report message
    CALL METHOD lo_message_manager->report_error_message
      EXPORTING
        message_text = 'No sales orders exist for this customer!'.
  ELSE.
    lv_node = wd_context->get_child_node( name = 'VBAK' ).
    lv_node->bind_table( new_items = lt_vbak ).

    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.

    lo_api_component  = wd_comp_controller->wd_get_api( ).
    lo_window_manager = lo_api_component->get_window_manager( ).
    lo_window         = lo_window_manager->create_window(
                        window_name            = 'POPUP_WINDOW'
                        title                  = 'Working with modal windows in webdynpro!'
                        close_in_any_case      = abap_true ).

    lv_node = wd_context->get_child_node( name = 'WINDOW_REFERENCE' ).

    lo_window->open( ).

  ENDIF.
ENDMETHOD.                    "onactiondisplay_popup

Former Member
0 Kudos

Hi Shekar,

navigate from <CONTEXT> to <TABLE> via lead selection 
LO_ND_TABLE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_TABLE
).

LO_ND_TABLE->BIND_TABLE( I_TAB ).

Why are you binding in the called form.You have to write this logic in pop up window.Thats the reason you are getting empty table.What did you bind to the table in pop up window.

My suggestion is.

Create a context node in controller as well as in view1 and map them,populate view context node in view1 when you press button in view1.Now the values are available in controller's context.

Go to view2 create a context node of same type and map with controllers context then bind the node with table ui element in view2.Now you will get the values into table when you press button in view1.

in similar way to capture selected row in pop up.

Create a structure/internal table in controller attribute and populate this in action handler method.

First go through the article which Uday posted.