cancel
Showing results for 
Search instead for 
Did you mean: 

Pass value in Popup Window

former_member219737
Participant
0 Kudos

Hi Experts,

I have made the Custom Pop-up with label,text field and OK button.

If I place the new value in text field of Pop-up Window, I need to pass that value to the Main screen of specific field

I have attached the screen shot for reference .

1.

2. New Value is 8.00 ..which i need to place in column Sat ...Can i get an idea for the same..

On Press of OK button...I need to place 8.00 in column Sat

Regards,

Karthik S

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Karthik,

How are you calling popup window? i.e. using a button outside table / a button withing a table cell

To get required row number of table, either you need to select row and then trigger popup window or you should have button in each row ( Change_Value ), on click of button, you would get the row number and you can use that row to set value to required column.

Regards,

Rama

former_member219737
Participant
0 Kudos

Hi Rama,

I am using the Link To Action inside the Cell of a table ....

When the user clicks the Cell of Link to Action , i need to capture the row index and i need to bind it to the element .

Can u suggest an idea on it .

Regards,

Karthik S

rajeshkothamasu
Active Participant
0 Kudos

Hi Karthik,

When click on OK Action  inside the OK Action method get the table data in to temporary internal table and index of the row selected and modify the table entries using the index

validate the table entries(Refresh the table data) and bind the internal table data to table.

Regards,

Rajesh K

ramakrishnappa
Active Contributor
0 Kudos

Hi Karthik,

Inside the event handler of LINK TO ACTION, you need to read the context_element on which the action happened.

You can try either of the below option

Approach 1:


Option1:

          Add a parameter CONTEXT_ELEMENT of type ref to IF_WD_CONTEXT_ELEMENT

  Now, write the below logic

          data lv_row_index type i.

               lo_row_index = context_element->get_index( )

Option 2: You can get context element from WDEVENT parameter as well

          data lo_element type ref to if_wd_context_element.

          data lo_row_index type i.

          wdevent->get_data(

                    EXPORTING id = 'CONTEXT_ELEMENT'

                    IMPORTING value = lo_element ).

          lo_row_index =    lo_element->get_index( ).

The row index, you can save in view's attribute

      • Create an attribute gv_current_row_index of type I

               wd_this->gv_current_row_index = lv_row_index.

Now, use the index in YES action, to set data to table row.

Approach 2:

you can also do by storing the reference of CONTEXT_ELEMENT in view attribute


Create an attribute GO_CURR_ELEMENT of type ref IF_WD_CONTEXT_ELEMENT in VIEW ,

on_link_to_action.

wdevent->get_data(

                    EXPORTING id = 'CONTEXT_ELEMENT'

                    IMPORTING value = wd_this->go_curr_element ).

ON_YES_BUTTON_ACTION

                   

                    " Read the changed value from popup window

                         lv_changed_value = ......... ?

                        

                    WD_THIS->GO_CURR_ELEMENT->set_attribute(

                                                  exporting

                                                            name = 'DAY3'

                                                            value = lv_changed_value )

Hope this helps you.

Regards,

Rama

former_member219737
Participant
0 Kudos

Hi Rama,

Thanks a lot for your ideas...

I have tried yr' first approach ...i can able to get the index of it.

But, my problem is ...Based on index value, iam building an tempory table of specific view...which i need to use it SAVE button of component controller .

Can u suggest me an ...of how to use the temporary table values of specific view to the Component Controller  of SAVE button ....

I have attached the screen for yr reference ...

Regards,

Karthik S

ramakrishnappa
Active Contributor
0 Kudos

Hi Karthik,

If your requirement is to use the temporary table on SAVE action.

Proceed as below

  • Create a global internal table GT_TEMP_TIMESHEET of your view type in component controller
  • on Save action,
    • If your SAVE event handler is in VIEW, 

                        You access the temp table as :  wd_comp_controller->gt_temp_timesheet.

    • If your SAVE event handler is in component controller

                         You access the temp table as:  wd_this->gt_temp_timesheet.

you need to write the logic in assistance class method for saving data into data base table

Let us say you have a class method SAVE_DATA in class zcl_assist_wd, pass the temporary internal table values on SAVE action

on_save_action...........

     Create a parameter IT_DATA of similar kind to temp table.

               WD_ASSIST->SAVE_DATA(

                              EXPORTING   IT_DATA = WD_THIS->GT_TEMP_TIMESHEET ).

Inside SAVE_DATA method of assistance class write the save logic

               modify ztable from table it_data.

Hope this helps you.

Regards,

Rama

former_member219737
Participant
0 Kudos

Hi Rama,

Thanks for your reply...

Is it necessary for me create the asistant class to store the data ..??.

In the above screen, I made linktoAction from Sat to Fri Columns...I will be having multiple line items too ...

If the user changes the value, i have planned to capture it in some internal table with the below fields..

1. row index

2. column index.

3. Change value

I will be modifing the internal table on click of field using Linktoaction via Popup window ...

On SAVE button, i have plan to manipulate the same ...

Can u just confirm that your logic will be feeded in my requirement ...

Regards,

KArthik S

ramakrishnappa
Active Contributor
0 Kudos

Hi Karthik,

To store data temporarily, you can still save in attributes of component controller / view controller.

My point was, if you have any requirement to save your data into data base table, this particular logic should be written in model ( assistance class/function module ).

On your approach:

     Yes, you can collect all changes done into an internal table and on_save action, you can manipulate the data and save into data base.

Regards,

Rama

former_member219737
Participant
0 Kudos

Hi Rama,

I am using the below code in One View...how can i make this entries available of table (lt_change) to Component controller SAVE button...

    data : lt_change type standard table of ZDB_TIMESHEET,
         ls_change like line of lt_change .

   "temp_table
ls_change-ROW_INDEX = lv_chang_index .
ls_change-col_index = 'DAY3'.
ls_change-value     = lv_changed_value .

append ls_change to lt_change .

Regards,

Karthik S

former_member219737
Participant
0 Kudos

Hi Rama,

Some how i could able to make the entries as global...

can u tell me an idea...if I click on specific Pop-up of any cell...I can able to get the row index...

can i know how to get the column name ....

Regards,

Karthik S

ramakrishnappa
Active Contributor
0 Kudos

Hi Karthik,

Use the parameter "ID" to get column name.

write the below code in on_link_to_aciton event handler.

data lv_column_name type string.

wdevent->get_data(

                    EXPORTING id = 'ID'

                    IMPORTING value = lv_column_name ).

Hope this helps you.

Regards,

Rama

former_member219737
Participant
0 Kudos

Hi Rama,

Thanks a lot for giving me different sort of ideas ...

Regards,

Karthik S

Answers (2)

Answers (2)

ramakrishnappa
Active Contributor
0 Kudos

Hi Karthik,

Hope your pop up window's input field is bound to an attribute in the context of component controller. On OK button action, read the attribute of popup window and set to the table.

Here, While calling pop up window, you might have to save the row id from which the pop up is triggered, so that you can read that row and set the value to SAT column.

Hope this helps you.

Regards,

Rama

former_member219737
Participant
0 Kudos

Hi Rama,

      DATA lo_el_popup TYPE REF TO if_wd_context_element.
    DATA ls_popup TYPE wd_this->Element_popup.
    DATA lv_changed_value TYPE wd_this->Element_popup-changed_value.

*   navigate from <CONTEXT> to <POPUP> via lead selection
    lo_nd_popup = wd_context->get_child_node( name = wd_this->wdctx_popup ).

*   get element via lead selection
    lo_el_popup = lo_nd_popup->get_element( ).
*   @TODO handle not set lead selection
    IF lo_el_popup IS NOT INITIAL.


*   get single attribute
    lo_el_popup->get_attribute(
      EXPORTING
        name =  `CHANGED_VALUE`
      IMPORTING
        value = lv_changed_value ).

    ENDIF.

::In "lv_changed_value" , I am getting the new value from the choesn from Popup Window...

I tried setting it to specific field of SAT column,,but it was not setting it ..

Can u tell me how to set it to the Table Entries....

Regards,

KArthik S

former_member219737
Participant
0 Kudos

Hi,

Can u tell me , how to get the row id while calling Popup Window ...

can u guide for the same .

Regards,

KArthik S

former_member219737
Participant
0 Kudos

Hi,

I am using the Standard table not the ALV table ...

Regards,

Karthik S

former_member197475
Active Contributor
0 Kudos

Hi Karthik,

You can't set the value of the column directly.

Use the below method to get the values from the structure

* get all declared attributes

   lo_el_selection->get_static_attributes(

   IMPORTING

     static_attributes = ls_selection ).


Now make the ls_selection-SAT = lv_changed_value .


Now set this using SET_STATIC_ATTRIBUTES method.



BR,

RAM.

former_member219737
Participant
0 Kudos

Hi Ram,

Thanks for your reply .

If I I have the table of 3*3 matrix....if the user clicks on 1 * 1 matrix....Is it possible to get the Row value on click of Pop-up Window ....

Regards,

KArthik S

former_member219737
Participant
0 Kudos

Hi Ram,

I have tried the below code but its not setting to it ...

can u suggest me an idea on it .

   *   get single attribute
    lo_el_popup->get_attribute(
      EXPORTING
        name =  `CHANGED_VALUE`
      IMPORTING
        value = lv_changed_value ).

  ENDIF.

  DATA lo_nd_timesheet TYPE REF TO if_wd_context_node.

  DATA : lt_timesheet TYPE wd_this->elements_timesheet,
         ls_timesheet_1 like line of lt_timesheet .
data: ld_element   type ref to if_wd_context_element.

* navigate from <CONTEXT> to <TIMESHEET> via lead selection
  lo_nd_timesheet = wd_context->get_child_node( name = wd_this->wdctx_timesheet ).

* @TODO handle non existant child
* IF lo_nd_timesheet IS INITIAL.
* ENDIF.

  ld_element = lo_nd_timesheet->get_lead_selection( ).

  if  not ld_element is INITIAL.
    ld_element->get_static_attributes( IMPORTING
                                        static_attributes = ls_timesheet_1 ).
  endif.

ls_timesheet_1-day3 = lv_changed_value .

* set all declared attributes
  ld_element->set_static_attributes(
    EXPORTING
      static_attributes = ls_timesheet_1 ).

Regards,

KArthik S

former_member219737
Participant
0 Kudos

Hi Ram,

I tried the below code too ...can u suggest me on getting the Row index in standard table ..

    DATA lo_nd_timesheet TYPE REF TO if_wd_context_node.

  DATA lo_el_timesheet TYPE REF TO if_wd_context_element.
  DATA ls_timesheet TYPE wd_this->element_timesheet.

* navigate from <CONTEXT> to <TIMESHEET> via lead selection
  lo_nd_timesheet = wd_context->get_child_node( name = wd_this->wdctx_timesheet ).

* get element via lead selection
  lo_el_timesheet = lo_nd_timesheet->get_element( ).
* alternative access  via index
* lo_el_timesheet = lo_nd_timesheet->get_element( index = 1 ).
* @TODO handle not set lead selection
  IF lo_el_timesheet IS not INITIAL.
 

* get all declared attributes
  lo_el_timesheet->get_static_attributes(
    IMPORTING
      static_attributes = ls_timesheet ).
 
  ls_timesheet-day3 = lv_changed_value .

* set all declared attributes
  ld_element->set_static_attributes(
    EXPORTING
      static_attributes = ls_timesheet ).

ENDIF.

regards,

Karthik s


former_member197475
Active Contributor
0 Kudos

Hi Karthik,

No way. It will work.

Check that the value you are going to bind is correctly binded to the timesheet node.

Also in debugging, find that the lv_changed_value is binding to the node properly or else is it changed at some other method.

BR,

RAM.

0 Kudos

Hi Karthik,

You can try the following code.

lo_nd_timesheet->BIND_ELEMENT( Exporting

                                                       NEW_ITEM= ls_timesheet

                                                       ELEMENT = ld_element

                                                        SET_INITIAL_ELEMENTS = ABAP_TRUE)

Warm regards,

Atul

former_member219737
Participant
0 Kudos

Hi Atil

Thanks for yr reply ..

I tried the below code ...

  CALL METHOD lo_nd_timesheet->bind_element
  EXPORTING
    new_item             = ls_timesheet
   set_initial_elements = ABAP_TRUE
*    index                = lv_chang_index
  RECEIVING
    element              = lo_el_timesheet
    .

But the values did not set into the specific row of the table ....

Regards,

Karthik S

former_member184578
Active Contributor
0 Kudos

Hi,

Create an attribute in Component controller and after pressing Ok in popup set the value to that attribute and then in main view read that attribute and set it to the required field.

Regards,

Kiran