cancel
Showing results for 
Search instead for 
Did you mean: 

multiple ALVs in a single page

Former Member
0 Kudos

hi

thanks for the reply.

the requirement is like this. once i enter the details in the selection screen and execute i need to see the results in an ALV. once the results are displyed in the ALV i need to have a checkbox at the left side of each entry. i will select some of the entries and click on some button on the ALV table, this should create another ALV table below the first ALV table. in this table also we will have checkboxes before each entry. once user selects some entries and click on some buttom n the second ALV table , another ALV should be displyed below the second ALV table.

is there any blog or thread where i can get some coding or guidance for this kind of requirement?

thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi experts,

Any suggestions/ help on this?

thanks

Former Member
0 Kudos

Hi,

Now totally there are 4 ALV right as per your requirement.

First create the compoent usages for these ALVs. Refer to basic tutorials for ALV.

Now, design the nodes for the respective nodes in the component controller and map them to the respective views.

Create 3 views, for Input, Main, Detail views. Under each Transparant container create view container UI elemnet.

Create compoenent usage for the Main table in MAIN view, 3 other ALVs for the DETAIL view.

Also map the respective DATA nodes of the ALV to the respective nodes.

For each node create a CHKBOX type char1.

Now,

Get the data based on the inout fields and fill the table & bind this to the MAIN node of the ALV.

Now for creating checkboxes an for ALV refer this link.

Implement the ONCLICK action for all those ALVs.

Get the tbale entires based on the CHECKED(X) records.

Create the 2 context attributes for the visibility (wdui_visibility) and bind the VISIBILE propety of the TCO to the last 2 ALVs.

Hope it is clear till now. Please let me know once you are done till this.

Regards,

Lekha.

Former Member
0 Kudos

hi lekha,

thank you so much.

actually there is one selection screen and 3 ALVs. i will your steps and create the application. i will come back to you if there is any issue.

thanks

Former Member
0 Kudos

hi Lekha,

i developed the program as u suggested. i need some help here. i have added the checkboxes at each line. now lets i have added some button in the tool bar of ALV and i select some 3 entries in teh alv and click on the button. i need to read those entries which are selected by me in the action handler method of the button. how do i do this?

thanks

Former Member
0 Kudos

Hi,

Please refer this link for my reply's -

How to read those entries. You can write the code in that button handler(create a method for this).

Create a event handler for button for that ALV under methods tab (FUNCTIONS).

Get the function Id(button Id) and call the respective method.

In the methods tab of that view - create

ON_FUNCTION	Event Handler  ON_FUNCTION	INTERFACECONTROLLER  ALV1

Now in this handler -

if r_param->id eq 'SAVE'.  "if buttn id is SAVE
 wd_this->check_data( ).   "Create a method and write the code in this method
endif.

Also, hope you have bound the visible proerpty of the TCO(transparent container) based on the

entries in 1st table, get the table data for 2nd table. If entries found for 2nd table set the visibility of the 2nd TCO.

Is this clear.

Regards,

Lekha.

Edited by: Lekha on Oct 13, 2009 11:41 AM

Former Member
0 Kudos

hi lekha,

thanks for the reply.

i am using the viewcontainer element for inserting the ALV. what do u mean by TCO? and can u give me more details on how do i bind the visible property and control that in the program?

thanks

Former Member
0 Kudos

Hi,

Transparant container(TCO).....If you have VCU*view container element) under the TCO then the alignment/layout will be good.

If you have used the VCU, then bind the visiblt property of that to the respective context attributes.

Former Member
0 Kudos

hi lekha,

thank you very much for ur help. i am almost done with the development. in the selection screen i have buttons cancel, reset, check, copy. how do i remove them and also can i create a variant for the selection screen like we do for normal abap reports?

thanks

Former Member
0 Kudos

Hi,

Use this code -

DATA lv_r_helper_class TYPE REF TO if_wd_select_options.
  lv_r_helper_class = lo_interfacecontroller->init_selection_screen(
  ).

  lv_r_helper_class->SET_GLOBAL_OPTIONS(
                              I_DISPLAY_BTN_CANCEL  = ABAP_FALSE
                              I_DISPLAY_BTN_CHECK   = ABAP_FALSE
                              I_DISPLAY_BTN_RESET   = ABAP_FALSE
                              I_DISPLAY_BTN_EXECUTE = ABAP_FALSE ).

Refer these links for variants -

Regards,

Lekha.

Edited by: Lekha on Oct 18, 2009 9:31 AM

Former Member
0 Kudos

hi Lekha,

I need to your expertise again.

in the selection screen i have sales order fied ( VBELN ). i want to add a F4 help to this field. if you go to va03 and press F1 on the sales order field -> go to technical information, u will find that VMVA collective search help assigned to the field. I want to assign this searh help to my field on the selection screen. i tried exploring the method "add_selection_field" and its various parameters but to no avail.

thanks

Former Member
0 Kudos

Hi,

Please paste your code .

Have you used

IF_WD_SELECT_OPTIONS=>ADD_SELECTION_FIELD
I_VALUE_HELP_TYPE = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_SEARCHHELP
I_VALUE_HELP_ID = 'VMVA'
 I_VALUE_HELP_MODE = '0'

Regards,

Lekha.

Former Member
0 Kudos

hi

sorry i had missed the value help mode parameter. its working fine now. thank you. you are awesome as usual

Former Member
0 Kudos

Hi Lekha,

I am back again.

i am displaying some results in ALV with a check box on left side for each entry. i will select some entries and click on some button. i want to change the color of the rows to red/green ( any color ) once i clicked the button. how can i do this?

thanks

Former Member
0 Kudos

Hi,

Do you want to color a row that is checked Is that so.

Refer this wiki -

http://wiki.sdn.sap.com/wiki/display/Snippets/ABAPWebDynproALV-ChangeCellColourbasedonContent

This wiki will color for single cell, you can apply the same for all columns.

Regards,

Lekha.

Edited by: Lekha on Oct 23, 2009 12:07 PM

Former Member
0 Kudos

hi lekha,

regarding the variant creation for ABAP webdynpro reports, i came across a blog series where the variant cration functionality was built.

http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3414900)ID1781063050DB10667346866181706031End...

in this blog series author had explained for a simple scenario with two fields on the selection screen. what i would like to know from you is, is it possible to make this functionality generic. i mean develop a component which will be used by other WD components to achieve the variant creation functionality. if so, can you give me some guidance on how to start this?

thanks

Former Member
0 Kudos

Hi,

You mean to say, you want to have this new functionality as a component usage in others so that other applications can also

use the same.

I guess, you can do.

But, you need to have a clear understanding on the current functionality then you need to deisgn the tables to

store the component names, variant Id etc....as the scope is wide.

The new component should have all the inputs that are required to ahcieve the functionality so that the calling component

passes the required information/data.

design a custom class and have all the methods with the respective coding and call this method in the new component.

Regards,

Lekha.

Former Member
0 Kudos

hi Lekha,

I will definitely work on this. one of the thing i am worried about is how to call the views from used component in the current component. my scenario would some thing like this

component A will have a selection screen with some fields and will have two buttons "save variant" and "get variant".

component B ( which will be the generic component) will have two views one for "saving variants" and another one for "searching the variants". the first view will have two buttons "OK" and "CANCEL". the second view contains "search" and "apply" button.

when i click on "save variant" button in component A, it shud call view "save variant of component B ( as a pop up / in a new window), if the user clicks on "OK" or "CANCEL" it shud go back to view of component A. similarly if user clicks on "get variant" button, it shud call " searching the variant" view in a new pop up / window and user searches for variant and clicks on "apply" , those values should come back to component A view.

how do i call the views in pop up window and also the fields in the selection screen might vary from component to component so my method for saving variants in component B shud have a generic type as import parameter ( i am not able to put it in correct words, hopu u understand what i am trying to say).

thanks

Former Member
0 Kudos

Hi,

Please refer these threads for calling view of a component usage -

In the current component, create 2 alv usages and create 2 windows(Sub) inaddtion to current component window(MAIN).

In this case, Sub1 will have the 1st view of the comp B, Sub2 will have the 2nd view of CompB ie embed the view in view container.

For Popup -

When you have a used component, in the code wizard there is a option to open a popup for component usage.Try to use that option.

SAVE variant button, using the popup for component usage option call the SUB1, similarly with other button also.

Hope this is clear till this part.

I guess you need to have some custom tables for this to save variant so that it is easy for you to get the same.

how do i call the views in pop up window and also the fields in the selection screen might vary from component to component so my method for saving variants in component B shud have a generic type as import parameter ( i am not able to put it in correct words, hopu u understand what i am trying to say).

One thing you do, In the comp B create parameters for that Window so that you can use the same for Application parameters

when you call this CompB then you can pass these values to these parameters which are used in CompB.

In this case, you have to use the URL of application(of comp B) and pass the parameters to this application and open a window

in popup...

Regards,

Lekha.

Edited by: Lekha on Oct 26, 2009 1:38 PM

Former Member
0 Kudos

Hi Lekha,

I am in the process of developing the generic comp for saving variants. i had stuck up at one point. lets say i have comp A with some 10 fields on the selection screen. now i will have a method in comp B

( which is generic comp) which is a interface method, which will have input parameters for component name ( which is using comp B, in this case it is comp A) and view name and also the ids of sel screen fields. once i give these details

to the method of comp B, can i access the values entered on the sel screen of comp A inside this method?

by the way i do not want to define the comp usage of comp A in comp B, as comp B is a generic comp. i have defined the comp usage for comp B in comp A.

thanks

Edited by: sudhakar murthy on Nov 1, 2009 11:52 AM

Former Member
0 Kudos

hi,

What you can do for this is :

Use the concept of Assitance Classes :

Create an common Assistance Class for both the components(C1, C2 ).

Create Attributes/Tables in the assistance class' Attributes Tab and pass the values from C1 into these attributes using :

wd_assist->Att1 = <Value to be passed>

Finally in Component C2, access those attributes and you will have all the relevant values in C2.

For more help on Assistance Class , Refer this SAP online help :

http://help.sap.com/saphelp_nw04s/helpdata/en/43/1f6442a3d9e72ce10000000a1550b0/frameset.htm

Standard Component for Assistance Classes : DEMO_COMMON_ASSISTANCE1

See if it helps you.

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

You can refer follwoing links for assisigning colours.

[http://help.sap.com/saphelp_nw2004s/helpdata/en/b6/b7bc68306049bd8500362ce52b6def/content.htm]

[http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393?overridelayout=true]

Regards,

Priya

Former Member
0 Kudos

hi lekha,

i am having a context node in component controller which i have mapped to a view controller. in one of view method based on some logic i am getting the values in an internal table1.

i am taking the values into itab2 and doing some adjustments. now i am binding the itab2 to the context node. now i want to access the itab1 and itab2 in another method of the view.

how can i do that. can i declare some attributes in the view and pass the itab1 itab2 there?

thanks

Former Member
0 Kudos

hi,

-For passing Values from one View to Another, declare an Attribute of type <TableType> in your component controller.

- Pass the values of itab1 to this Attribute using :

wd_comp_controller->Att = itab1.

-Now in second view you can access the same values of itab1 via this Attribute.

Former Member
0 Kudos

hi

in component controller i have defined an attribute Att with ref to DATA

in one of the views method i am using

wd_comp_controller->Att = itab1.

i am getting an error saying Att is not defined by any DATA statement.

Former Member
0 Kudos

hi,

The type of ATT and itab should be same.

suppose itab is of type sflight.

Then Att will be of type TableType of Sflight.

Att type FlightTab.

Att when defining as a Table should be of TableType.

You can define Tabletype in SE11 .

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

declare the attribute Att in comp controller which is the type itab.

Regards,

Priya

Former Member
0 Kudos

Have you checked both TYPE REF TO and PUBLIC under the attributes tab.

Former Member
0 Kudos

hi lekha,

you are right, public solved the issue. i have defined itab1 within the view by declaring the types declaration. but "att" attribute in comp controller ref to DATA( it is treated as field symbol right). how do i assign itab1 values to Att attribute?

Former Member
0 Kudos

FIELD-SYMBOLS:

<fs_t_discr_table> TYPE STANDARD TABLE.

Is ITAB1 a static or dynamic structure....

assign wd_comp_controller->attr->* to <fs_t_discr_table>.

Edited by: Lekha on Nov 5, 2009 3:12 PM

Former Member
0 Kudos

hi

itab1 is a static internal table. lets say it contains feild1, field2 and feild3 as columns. i want to store the values in this itab1 in the attribute of the comp comtroller and retrieve the values in another view method

Former Member
0 Kudos

Hi,

DATA

lt_table TYPE REF TO data,

ls_table TYPE REF TO data.

FIELD-SYMBOLS:

<fs_t_discr_table> TYPE STANDARD TABLE of itab1 structure.

wd_comp_controller->attr = lt_table. "I have data inthis lt_table

assign wd_comp_controller->attr->* to <fs_t_discr_table>.

CREATE DATA ls_table LIKE LINE OF <lv_table>.

Regards,

Lekha.

Edited by: Lekha on Nov 5, 2009 3:28 PM

Former Member
0 Kudos

hi lekha,

FIELD-SYMBOLS:

<fs_t_discr_table> TYPE STANDARD TABLE of itab1 structure.

assign wd_comp_controller->attr->* to <fs_t_discr_table>.

in the above statement ur assining attr to <fs_t_discr_table> right? will that store the data of <fs_t_discr_table> in attr? how do i access attr in antoher view mehotd?

Former Member
0 Kudos

Hi,

DATA
 lt_table       TYPE REF TO data,
 ls_table       TYPE REF TO data.
FIELD-SYMBOLS:
<fs_t_discr_table> TYPE STANDARD TABLE of itab1 structure.

wd_comp_controller->attr = lt_table.  "I have data inthis lt_table

assign wd_comp_controller->attr->* to <fs_t_discr_table>.

CREATE DATA ls_table LIKE LINE OF <lv_table>.


To read the same global in 2nd view - 
DATA
lt_table    TYPE REF TO data
  FIELD-SYMBOLS :
    <lv_table1> TYPE STANDARD TABLE.( you can give the static structure name)      

  IF wd_comp_controller->attr IS NOT INITIAL.
    ASSIGN wd_comp_controller->attr->* TO <lv_table1>.
  ENDIF.                                "if wd_comp_controller->gt_table is not initial.
 IF NOT <lv_table1> IS INITIAL.
   GET REFERENCE OF <lv_table1> INTO lt_table1.

ENDIF.

READ TABLE <lv_table1> ASSIGNING <fs_table> INDEX lv_index.
 IF <fs_table> IS ASSIGNED.
      ASSIGN COMPONENT 'UOM'  OF STRUCTURE <fs_table> TO <fs_value>.
      IF sy-subrc = 0.
        lv_old_uom = <fs_value>.
        CLEAR <fs_value>.
      ENDIF.
endif.

Regards,

Lekha.

Former Member
0 Kudos

hi

i think i did not explain this properly.

types : begin of t_data,

field1

field2

field3

end of t_data.

data: itab1 type table of t_data

i will fill the itab1 with some values. my itab1 does not refer to DATA.

Former Member
0 Kudos

Then why you want to assign the data to fieldsymbol...

What you wanted to do withthis data.

Former Member
0 Kudos

hi,

I would again suggest you to make a Structure in SE11 of type t_data.

Also create Table type in SE11 and assign this structure to this.

Finally Declare Attribute in Comp Controller of table type which you have just made and assign values to this attribute using :

wd_comp_controller->Att = itab1.

Similary you can fetch values in view2 using :

itab2 = wd_comp_controller->Att.

Former Member
0 Kudos

hi

i am trying to access an internal table in two methods of the same view. i have declared a attribute in the view attributes. in the second method i am using

itab2 = wd_this->att1

but i am not getting anything into itab2

by the way the second method is a event handler method triggered on "ON_FUNCTION" event of ALV compopnent. does it make any difference

Former Member
0 Kudos

i have declared a attribute in the view attributes.

To Access Atribute in more than one view, you have to declare the same in Component Controller because component controller is accessible to all the views.

So Create Att in Comp Controller so as to access the same in other views.

Wd_comp_controller->Att = itab1. This will set the value of itab1 in attribute Att.

Similarly itab2 = wd_comp_controller->Att will fetch the value

Former Member
0 Kudos

hi

there is only one view in my component. and i want to access the atribute defined for this view in multiple methods of the view.

Former Member
0 Kudos

Hi,

You can have this in component controller or view's contoller attributes.

If this variable is in view'controller attribute then it can be accessed any where in any methods in that view,

if it is in component controller then it can be accesses accorss viiews of that component.

Then if it in view's attributes then (you can follow same apprach of declaration as in component controller)

but

WD_THIS is used instead of WD_COMP_CONTROLLER.

Hope this is clear...

Regards,

Lekha.

Former Member
0 Kudos

hi lekha,

i did the same thing. using wd_this, but some how i am not able ti get access the values stored in the view attribute, in the second method

the second method is a event handler method triggered on "ON_FUNCTION" event of ALV compopnent. does it make any difference?

Former Member
0 Kudos

Hi,

What is the error you are getting....It should be accessible in any method/event handler of the view...

Paste your code.

Regards,

Lekha.

Edited by: Lekha on Nov 6, 2009 2:11 PM

Former Member
0 Kudos

hi

i have added a buttons on top of ALV using the below code

DATA : lr_buttonui1 type REF TO CL_SALV_WD_FE_BUTTON,

DATA : button2 TYPE REF TO CL_SALV_WD_FUNCTION,

CREATE OBJECT lr_buttonui1.

lr_buttonui1->SET_TEXT( 'show' ).

button2 = l_VALUE->IF_SALV_WD_FUNCTION_SETTINGS~create_function( id

= 'show' ).

button2->SET_EDITOR( lr_buttonui1 ).

button is added to the ALV, but it is not looking like a button . its look like just some text pasted on the top ( i can click that )

i want to look it like normal button that we add in the layout using "button" element. how do i do this.

Former Member
0 Kudos

Hi,

It will appear as normal buttons itself..

In the EVENTs of the ALV (ON_FUCNTOINS) wiil be there...have you atatched any code to this button or not yet.

if you have seen the above links for custom buttons, then you can see their apperance...

Edited by: Lekha on Dec 10, 2009 10:18 AM

Former Member
0 Kudos

hi,

i did create a event handler method and assigned it to on_function event of the ALV table and everything is working fine, except the appearance of button. am i referring to classes probably. i am not sure?

thanks

Former Member
0 Kudos

How does they appear...try to run any standard compoent or alv in your system and test it out...

Former Member
0 Kudos

hi lekha,

i have two view and one window in WD application. I have created navigation links to call the view2 from view1 when user clicks on a button. when i do this second view is appearing on the same window. i want to open the second view as a modal pop up in new window. is this possible to do ?

thanks

Former Member
0 Kudos

Hi,

yes, you can do that...you ahve to create differt window for this and you need to embed the 2nvd view in this window..

You need to create one more application for this new window..

Using the IF_WD_WINDOW_MANAGER you need to use the method create_external_window by passing the URL as second Application name...in teh button handler of the 1st view..

This is the way you can do it..

Do you want these 2views to be as independent sessions..

Regards,

Lekha.

Former Member
0 Kudos

hi lekha,

i have managed to open the views in a new window, without creating application by using the below code

data: l_cmp_api type ref to if_wd_component,

l_window_manager type ref to if_wd_window_manager.

l_cmp_api = wd_comp_controller->wd_get_api( ).

l_window_manager = l_cmp_api->get_window_manager( ).

if wd_this->r_popup_win is initial.

wd_this->r_popup_win = l_window_manager->create_window(

window_name = 'get_var' ).

  • button_kind = if_wd_window=>co_buttons_yesnocancel

  • message_type = if_wd_window=>co_msg_type_question ).

endif.

wd_this->r_popup_win->open( ).

wd_this->r_popup_win->set_close_in_any_case( abap_false ).

i have embeded a view a in the window "get_var". the view will have some input fields and one button. when i enter the vlaues in the input fields and click on the button , i want to go to the main view and access the values entered in the "get_var" window in the main view methods. how do i do this.

thanks

Former Member
0 Kudos

Hi,

For these Input fields, you might have bound them to some attributes right..

Create a node i component controller and place these atttibutes under this node..amp teh same to the other views where ever you want to access the data of that attribute..

Now, In the MAIN view also you have this node rgiht..Just try to read this node for that particular attribute..

As this attribute is already bound to the Input fields created in other view...

This is simpler....

Former Member
0 Kudos

hi lekha,

I am almost done with this, but stuck with little problem. i got the values in the main wdmodify method. the values are stored in

rt_field1 field. this if defined as

rt_fileld1 type range of trg_char10.

i am using the below code to set the values of the selection screen field "field1".

data: lr_data type REF TO data.

get REFERENCE OF rt_field1 INTO lr_data.

wd_this->r_HANDLER->SET_RANGE_TABLE_OF_SEL_FIELD(

exporting I_ID = 'field1'

IT_RANGE_TABLE = lr_data ).

i am getting dump Field symbol has not yet been assigned in the method "ADD_RANGE_TABLE_TO_NODE". am i doing something wrong. how do we populate the selection screen field, once we have the values in range tables.

thanks

Answers (0)