cancel
Showing results for 
Search instead for 
Did you mean: 

Beginneru00B4s questions on WDA ALV

OttoGold
Active Contributor
0 Kudos

Dear sirs,

first let me apologize for a question about the basics, but I didn´t search any sources where I could read the answer myself (in fact few basic ABAP WD sources are repeated 10 times, but no "advanced" concepts can be found:((.

My questions are about the WDA ALV:

- how can I "bind"/connect an adobe form to the ALV print button? Can anybody provide a tutorial link or a short explanation? Is that right that the printing program will then be called with the complete dataset I see in the ALV or I could use the button to print the form for a single ALV row (or multiple, based on the user selection)

- how can I add a button to redirect the user to another view into the ALV column? I wonder if that could work this way - to have a column where there is a button for each row for the redirect. Or should I add a button and on this button click trigger the action where I first find what ALV row is selected and use it as input for the redirect operation?

- how can I create a variant for my ALV? I understand how to hide columns, but I expect there is a "variant" mechanism like for SAPGUI ALV.

Thank you for for your time and effort,

regards Otto

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hello Sir,

Nice to see Mr Adobe in the WDA forum for a change! Let me try to get your requirement. You are displaying some data within an ALV. You want the user to be able to select a row(s) within this ALV & when he clicks on a button he should be able to see the data for the selected rows within a PDF? Is this the requirement?

Regards,

Uday

OttoGold
Active Contributor
0 Kudos

Hello Uday! Nice to meet you again! And what a fun to be called Mr. Adobe:))))

The requirement is:

- display the ERP ALV report in WD, so I need WD ALV + variants (maintained by the user, what I don´t know...yet)

- For any row (one at a time) I need a way to trigger the Adobe form preview (it is some SD form, already finished in last phase)

That should be all:))

Thank you for your time and effort,

regards Otto

uday_gubbala2
Active Contributor
0 Kudos

Hi Otto,

I will try to help you with the coding but guess you will have to go through a bit of creating ALV through the tutorials...

Say suppose I have a WDA component which displays data from SFLIGHT table within an ALV. Now I have 1 column within the ALV which contains a button upon pressing which I would like the corresponding data of this row to be displayed within an Adobe form in a new window.

Say am having 2 context nodes SFLIGHT & ADOBE. The 1st one is bound to the ALV & the 2nd one would be bound to my Adobe form. So when I click upon a button within the ALV, I would read the corresponding row information (as a structure) and bind the structure to the node ADOBE. This would result in the rows information to be displayed within the Adobe form.

Below is the code within WDDOINIT for filling up the ALV with data from SFLIGHT:

method WDDOINIT .
  data: lob_node type REF TO if_wd_context_node,
        ltb_data type wd_this->elements_sflight.

  select carrid
         connid
         fldate
         price from sflight Into CORRESPONDING FIELDS OF TABLE ltb_data.

  lob_node = wd_context->get_child_node( name = wd_this->wdctx_sflight ).
  lob_node->bind_table( new_items = ltb_data ).
endmethod.

uday_gubbala2
Active Contributor
0 Kudos

Below is the code within my WDDOMODIFYVIEW method for embedding a button within my ALV:

METHOD wddomodifyview .
  CHECK first_time = abap_true.

  DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.

  lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
  IF lo_cmp_usage->has_active_component( ) IS INITIAL.
    lo_cmp_usage->create_component( ).
  ENDIF.

  DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
  lo_interfacecontroller =   wd_this->wd_cpifc_alv( ).

  DATA lo_value TYPE REF TO cl_salv_wd_config_table.
  lo_value = lo_interfacecontroller->get_model( ).

  lo_value->if_salv_wd_table_settings~set_read_only( abap_false ).

  DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
        lt_columns         TYPE        salv_wd_t_column_ref,
        lr_button TYPE REF TO cl_salv_wd_uie_button.

  FIELD-SYMBOLS <fs_column> LIKE LINE OF lt_columns.

  lr_column_settings ?= lo_value.
  lt_columns = lr_column_settings->get_columns( ).

  LOOP AT lt_columns ASSIGNING <fs_column> WHERE id = 'BUTTON'.
    CREATE OBJECT lr_button.
    lr_button->set_text( value = 'Display Adobe Form' ).

    <fs_column>-r_column->set_cell_editor( lr_button ).
  ENDLOOP.
ENDMETHOD.

uday_gubbala2
Active Contributor
0 Kudos

Now I would need to create an event handler method for the button within the ALV. In other words I would need to create a method which contains the logic to be performed when the user clicks on a button within the ALV. So i create a method of type event handler for the event ON_CLICK of ALV.

method CLICK_IN_ALV .
DATA: lob_node TYPE REF TO if_wd_context_node,
      lwa_sflight type wd_this->element_sflight,
        lv_string TYPE string.

  lob_node = wd_context->get_child_node( name = wd_this->wdctx_sflight ).

  CALL METHOD lob_node->get_static_attributes
    EXPORTING
      index             = r_param->index
    IMPORTING
      static_attributes = lwa_sflight.

  lob_node = wd_context->get_child_node( name = wd_this->wdctx_adobe ).
  lob_node->bind_structure( new_item = lwa_sflight ).

  wd_this->show_adobe_form( ).
endmethod.

uday_gubbala2
Active Contributor
0 Kudos

When the user clicks on the button within ALV the earlier event handler method CLICK_IN_ALV gets executed. It would fetch the information of the row in which the user clicked upon, bind it to the Adobe form's node & then call the method SHOW_ADOBE_FORM. This method would just display a new window for the user. I have placed the InteractiveForm UI element within a 2nd view by name ADOBE & embedded it within a new window W_ADOBE. So when the user clicks on the button i would basically display this window as a popup & hence have displayed the Adobe form as a popup to the user...

method SHOW_ADOBE_FORM .
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            = 'W_ADOBE'
                   message_display_mode   = if_wd_window=>co_msg_display_mode_selected
                   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( ).
endmethod.

OttoGold
Active Contributor
0 Kudos

Now I have 1 column within the ALV which contains a button upon pressing which I would like the corresponding data of this row to be displayed within an Adobe form in a new window.

This is what I don´t understand. If I use the ALV pre-delivered component, how can I add a column with buttons? I thought I only can display the data from context (like the mentioned SFLIGHT data).

Do not flood the thread with coding, would be better to talk about the concept, at least in my opinion. And then we could exchange the code in private. Hopefully I will not need the coding itself. I have started with the development and have copied your code here and there. I only lack the details, like the button and the variants.

Thank you very much, Otto

p.s.: I am thinking: If we have Mr. Jung as Mr. ABAP, then if you call me Mr. Adobe I am like 1% of Mr. Jung? GREAT!:))))

uday_gubbala2
Active Contributor
0 Kudos

Hi Otto,

I had actually recreated an example for the exact functionality that you had asked for after seeing your thread so that you have an exact working model.... That was the reason I was pasting my code in here. Thats the complete code that you would need to get things working.

Ok coming to what you asked for regarding how to display a column with buttons:

First of all there are 2 approaches for designing ALV in WDA. the first one is the simple straightforward one in which you just need to supply data to the standard SAP ALV component & it would display an ALV for you. But if you intend to achieve additional functionality like changing the ALV cells to buttons then you need to go for an approach call the configuration model approach. Just go through this [article |https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9]for the basics of this approach....

Regards,

Uday

ChrisPaine
Active Contributor
0 Kudos

>Otto wrote:

>Do not flood the thread with coding, would be better to talk about the concept, at least in my opinion. And then we could exchange the code in private

Otto - were this to happen, both of you would be flooded with email requests from the thousands of others attempting to do the same thing.

Your questions - and Uday's responses cover an awful lot of ground that this forum covers week-in week-out!

Perhaps we should instead consider using this code as examples that we could move into a Wiki for future reference? Would you both be interested in helping with this? Otto to provide a little bit around creating an Adobe form to display data and Uday with the code to show the data in an ALV table? Perhaps then we could wrap the application in the FPM for ABAP as a final example,

Cheers,

Chris

uday_gubbala2
Active Contributor
0 Kudos

Hi Chris,

I had actually prepared & sent across a PDF version of the development along with snapshots to Otto yesterday itself. But I had even posted my explanation & coding in here keeping in mind the forum rules & the possibility of another user searching for a similar functionality. I would be making it available as an article soon.

Regards,

Uday

Answers (1)

Answers (1)

former_member196023
Active Participant
0 Kudos

Hi,

Please go through following links, most probably those will serve your purpose.

[SAP List Viewer in Web Dynpro - Simple Example for Using ALV|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3439404a-0801-0010-dda5-8c14514d690d]

[SAP List Viewer in Web Dynpro - Programming the ALV Configuration Model|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9]

[Generating Self-Defined Functions for ALV in Web Dynpro for ABAP|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110?quicklink=index&overridelayout=true]

-Haresh