on 07-16-2011 11:20 AM
Hi all,
I have create a select-options with 5 fields and alv and a button(get list) in webdynpro, i have to retrieve the values into alv from table through select-options by clicking on button.
and i have written a function module for select options. so based on input, the values are fetched from table in function module.
i am getting confused with the coding part, so can anybody tel me the coding part for alv by calling function module nd how to pass the values to function module(i,e select-option fields.)
( written code for select-options in wddoinit)
Thanks all in advance
Hi VANI,
I hope you have declared the component usage for select option properly.
Now do as follows:-
1. Add 2 attributes in the tab 'Attribute' to implement select option for a particular field.
Like i want to implement select option in PO_NO ( EKPO-EBELN) & ITEM_NO( EKPO-EBELP).
Declare usage in properties in particular view:-
Declare attributes :- M_HANDLER_Report - Type ref to - IF_WD_SELECT_OPTIONS
M_WD_SELECT_OPTIONS_Report - Type ref to - IWCI_WDR_SELECT_OPTIONS
In WDDOINIT :-
create instantiate component usage from code wizard.
then set normal properties for display:-
WD_THIS->M_WD_SELECT_OPTIONS_REPORT = WD_THIS->WD_CPIFC_SELECT_OPTION_REPORT( ).
init the select screen
WD_THIS->M_HANDLER_REPORT = WD_THIS->M_WD_SELECT_OPTIONS_REPORT->INIT_SELECTION_SCREEN( ).
WD_THIS->M_HANDLER_REPORT->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 ).
To assign a field in select option code like below:-
create a range table that consists of this new data element
LT_RANGE_TABLE = WD_THIS->M_HANDLER_REPORT->CREATE_RANGE_TABLE( I_TYPENAME = 'EBELN' ). " enter the data element of the field
add a . field to the selection
WD_THIS->M_HANDLER_REPORT->ADD_SELECTION_FIELD( I_ID = 'EBELN' "field name
IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY ).
to add more field proceed as above again with different field.
create a range table that consists of this new data element
LT_RANGE_TABLE = WD_THIS->M_HANDLER_REPORT->CREATE_RANGE_TABLE( I_TYPENAME = 'EBELP' ). " enter the data element of the field
add a . field to the selection
WD_THIS->M_HANDLER_REPORT->ADD_SELECTION_FIELD( I_ID = 'EBELP' "field name
IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY ).
Now in particular action by which you want to get values bind to your alv table:-
Declare variable and field symbol to hold values from selection
DATA: RT_PO_NO TYPE REF TO DATA.
DATA: RT_ITEM_NO TYPE REF TO DATA.
FIELD-SYMBOLS: <FS_PO_NO> TYPE TABLE,
<FS_ITEM_NO> TYPE TABLE,
Retrieve the data from the select option
RT_PO_NO = WD_THIS->M_HANDLER_REPORT->GET_RANGE_TABLE_OF_SEL_FIELD(
I_ID = 'EBELN' ).
Assign it to a field symbol
ASSIGN RT_PO_NO->* TO <FS_PO_NO>.
Retrieve the data from the select option
RT_ITEM_NO = WD_THIS->M_HANDLER_REPORT->GET_RANGE_TABLE_OF_SEL_FIELD(
I_ID = 'EBELP' ).
Now use select statement to get data from table
Select < field name > FROM < table name > INTO CORRESPONDING FIELDS OF TABLE < internal table to hold data > WHERE
PO_NO IN <FS_PO_NO> AND
ITEM_NO IN <FS_ITEM_NO> .
Regards,
Monishankar C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i am getting all values in the alv but now the problem is i have created a custom rfc with ranges for 5 input fields and in output there are 10 fields.
i am calling this rfc in the code of alv therefore i am not using any select statements here. i am calling the node and passing the structure with field name to the import parameters and local table(itab type table of structure) name to the table parameters.
i am not getting the proper values based on input. its displaying all the values from the table..
let me know if there is any other methods to be used in alv?
if you want to write the select query using selectoption values, you can write select query code in wddoinit method.
Because first you have to select the vaues using select option, it means already wddoinit executed, so you have write code in getlist button.
where first read the select option values, based on the values write the select query.
After that bind the resulted values to one node. and maintain context mapping between that node and data node of alv interface controller.
Regards
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.