2009 May 26 11:35 AM
hi,
I have a requirement that through In the table control i have two columns . in first column there is F4 help if i select a particular value from first column first row then according to that i want to display list of values in the second column for first record and this list should be changed for different value in first column.
pls help.
2009 May 26 11:46 AM
Hi,
Try this way in this am bringing the project based upon the customer
MODULE fill_customer INPUT.
*Checking the customer is initial
IF t_customer[] IS INITIAL.
SELECT pspid FROM proj
INTO t_customer-pspid.
APPEND t_customer.
ENDSELECT.
Function module for appending the customer in the customer listbox
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'WA_CUSTOMER'
value_org = 'S'
TABLES
value_tab = t_customer
return_tab = return2.
IF sy-subrc = 0.
t_customer-pspid = return2-fieldval.
ENDIF.
ENDIF.
IF NOT wa_customer IS INITIAL.
v_cus = wa_customer.
ENDIF.
ENDMODULE. " FILL_CUSTOMER INPUT
&----
*& Module FILL_PROJECT INPUT
&----
Filling the project details in the listbox
----
MODULE fill_project INPUT.
*Filling the Project Details Based on the Customer
DATA : v1_pspnr TYPE prps-pspnr.
Refreshing the t_project to get the project details based on the customer
REFRESH : t_project.
IF t_project[] IS INITIAL.
SELECT SINGLE pspnr FROM proj
INTO v1_pspnr WHERE pspid = wa_customer.
IF sy-subrc = 0.
SELECT psphi FROM prps
INTO t_prps-psphi
WHERE psphi = v1_pspnr.
APPEND t_prps.
ENDSELECT.
ENDIF.
SELECT posid FROM prps INTO
t_project-posid
WHERE psphi = t_prps-psphi.
APPEND t_project.
ENDSELECT.
*Inserting all to the project listbox
t_project-posid = 'ALL'.
INSERT t_project INTO t_project INDEX 1.
Function module for appending the project in the project listbox
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'WA_PROJECT'
value_org = 'S'
TABLES
value_tab = t_project
return_tab = return3.
IF sy-subrc = 0.
t_project-posid = return3-fieldval.
ENDIF.
to get the WBS element
IF NOT wa_project IS INITIAL.
SELECT SINGLE pspnr FROM prps INTO prps-pspnr
WHERE posid = wa_project.
IF sy-subrc = 0.
wa_project = prps-pspnr.
v_pro = prps-pspnr.
ENDIF.
ENDIF.
ENDIF.
ENDMODULE. " FILL_PROJECT INPUT
2009 May 27 7:15 AM
Hi Sudhir,
To dispaly the values in a listbox in one column depending on the values of another column , You need to read the values of the first colum. For that reason you can use the the fm "DYNP_VALUES_READ". After reading the values populate the internal table and put it in th list box.
One more thing as you are using table control you have to pass the row no of the table control to the FM. To get the row number you can use the FM "DYNP_GET_STEPL".
Below i have attached some sample code.
data: begin of dynpfields occurs 3.
include structure dynpread.
data : end of dynpfields.
data v_setpl type SY-STEPL.
data v_setpl_temp type SY-STEPL.
clear v_setpl.
CALL FUNCTION 'DYNP_GET_STEPL' "This is to get the column Number.
IMPORTING
POVSTEPL = v_setpl
EXCEPTIONS
STEPL_NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
move <first field name> to dynpfields-fieldname.
move v_setpl to dynpfields-stepl.
append dynpfields.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = '<prog-name>'
DYNUMB = '<screen-number>'
TRANSLATE_TO_UPPER = ' '
TABLES
DYNPFIELDS = dynpfields
EXCEPTIONS
INVALID_ABAPWORKAREA = 1
INVALID_DYNPROFIELD = 2
INVALID_DYNPRONAME = 3
INVALID_DYNPRONUMMER = 4
INVALID_REQUEST = 5
NO_FIELDDESCRIPTION = 6
INVALID_PARAMETER = 7
UNDEFIND_ERROR = 8
DOUBLE_CONVERSION = 9
STEPL_NOT_FOUND = 10
OTHERS = 11
.
if sy-subrc = 0.
read table dynpfields index sy-index.
V_TEMP = dynpfields-FIELDVALUE
endif.
Then by the help of V_temp write the select query and populate the internal table.
and dispaly it in the list box.
if any problem then please come back.
regards
Amarendra
2009 May 27 11:35 AM
Hi,
until and unless the PAI is triggered u can't get the value that was selected in the F4 value into the program to populate the value for the adjacent column. user interaction should be there after the F4 value selection. a way, but a tedious one, is to write the F4 event(Process on value-request) for the 1st value manually. so when the user selects a value from the F4 help, to assign the value back into the screen field the control will come back to the code. during which u can populate the adjacent column value.
next suggestion will be to make the first column also a drop down list and from the screen field attributes assign a fcode to the drop down list column. so when user selects a value in the drop list the control will come to PAI where u can write code to populate the adjacent field.
Regards,
Prabhu.
2009 May 27 5:07 PM
Hi Prabhu,
You are ver much right that we can't get the value untill we trigger the PAI. BUt by the help of the FM "DYNP_VLUES_READ" we can read the contents of a field without triggering the PAI. I had already done it for one of my requirment.
so if you caal this FM after the f4if_int_table_value_request function module you can get the value. I am very much sure about it.
Sudhir : request you to try with it and come back if any problem.
regards
Amarendra
Edited by: AmarendraSahoo on May 27, 2009 6:08 PM