‎2007 Aug 01 7:17 AM
Hello all
I have 1 select-option and 1 parameter field. When i enter 'US' (say for ex.) then in the parameter when i press F4 for value help ,i should get all the states of US .and when i enter some other country in select-opton then i should give all the states in that country when i press F4 on parameter.
<b>NOTE :</b> i dun want to submit thos select-option to other report thats wat i found on some other threads similar to this, i think i have to use RS_REFRESH_FROM_SELECTOPTIONS F.M., i used it in my program but i im not sure wat to do after i get the TABLE in that FM ..how do i get the values entered on the in the select-option.at runtime .plz give some sample code if possible
Thanks in advance
Nilesh
‎2007 Aug 03 8:21 AM
Hello
Wats happng ? Not a single reply to this qn ? I have spent lots of time on this playing with all the possibles EVENTs but didn get it ..
Plz help...
Nilesh
‎2007 Aug 03 8:41 AM
Hi,
AT SELECTION-SCREEN ON VALUE-REQUEST FOR <PARAMETER>
SELECT * FROM <COUNTRY_TABLE> INTO ITAB
WHERE <COND>
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'ZPROJ_CODE' ==>BD TABLE FIELD
dynpprog = sy-repid
dynpnr = '1000'
dynprofield = 'PROJ_CODE' ==> PARAMETER
value_org = 'S'
TABLES
value_tab = ITAB.
i dont know what is db name.
Good Regards,
Vallamuthu.M
‎2007 Aug 03 8:44 AM
Hi Nilesh,
The requirement can possible by overwriting standard SAP F4 functionality provide by SAP.
In AT SELECTION-SCREEN ON VALUE-REQUEST FOR FIELD 'XYZ'.
here u have to use FM F4IF_INT_TABLE_VALUE_REQUEST
first select from specific DDIC table against country entry by the user.
pass it to this FM.
<b>retfield</b> parameter will be the DDIc field name for which u wanted value help.
check the return table and take the value from it usine read..index 1 and pass it to screen field.
Hope it will solve ur problem.
Regards,
Krishnendu
‎2007 Aug 03 9:22 AM
Dear Krishnendu
Thanks for ur reply But i know this procedure. But this is not the compelte scenario , hehe in F.M. F4IF_INT_TABLE_VALUE_REQUEST
u will pass some internal table of the possible values .. m i ryte ? that internal table should be filled with the values from select statement ..m iryte ? in the select statement in where <CONDITION> i want to specify the Value i entered in Select-options on thescreen..so it should be Dynamic and not static select statement ? so finally i wanted to capture the value i entered in the select -option and use it to query and popultate an intenal table so thati can pass it to the above module
waitng for ur reply
Nilesh
‎2007 Aug 03 9:25 AM
Hi
· The statement
SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE|TABLE .
allows you to define further nodes for dynamic selections. If the node has type T, you can use TABLE instead of NODE. The user can then decide at runtime the components of the node for which he or she wants to enter selections. Dynamic selections require special handling in the database program.
The statement
SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE|TABLE node.declares a node node of a logical database for dynamic selections in the selection include.
To use the dynamic selections in the SELECT statements of the subroutine PUT_node, you must use the data object DYN_SEL. The data object DYN_SEL is automatically generated in the logical database program as follows:
TYPE-POOLS RSDS.
DATA DYN_SEL TYPE RSDS_TYPE.You do not have to program these lines yourself. The data object DYN_SEL is available in the database program but not in a connected executable program.
The type RSDS_TYPE of the data object is defined in the type group RSDS as follows:
TYPE-POOL RSDS.
* WHERE-clauses ------------------------------
TYPES: RSDS_WHERE_TAB LIKE RSDSWHERE OCCURS 5.
TYPES: BEGIN OF RSDS_WHERE,
TABLENAME LIKE RSDSTABS-PRIM_TAB,
WHERE_TAB TYPE RSDS_WHERE_TAB,
END OF RSDS_WHERE.
TYPES: RSDS_TWHERE TYPE RSDS_WHERE OCCURS 5.
* Expressions Polish notation ---------------
TYPES: RSDS_EXPR_TAB LIKE RSDSEXPR OCCURS 10.
TYPES: BEGIN OF RSDS_EXPR,
TABLENAME LIKE RSDSTABS-PRIM_TAB,
EXPR_TAB TYPE RSDS_EXPR_TAB,
END OF RSDS_EXPR.
TYPES: RSDS_TEXPR TYPE RSDS_EXPR OCCURS 10.
* Selections as RANGES-tables -----------------
TYPES: RSDS_SELOPT_T LIKE RSDSSELOPT OCCURS 10.
TYPES: BEGIN OF RSDS_FRANGE,
FIELDNAME LIKE RSDSTABS-PRIM_FNAME,
SELOPT_T TYPE RSDS_SELOPT_T,
END OF RSDS_FRANGE.
TYPES: RSDS_FRANGE_T TYPE RSDS_FRANGE OCCURS 10.
TYPES: BEGIN OF RSDS_RANGE,
TABLENAME LIKE RSDSTABS-PRIM_TAB,
FRANGE_T TYPE RSDS_FRANGE_T,
END OF RSDS_RANGE.
TYPES: RSDS_TRANGE TYPE RSDS_RANGE OCCURS 10.
* Definition of RSDS_TYPE
TYPES: BEGIN OF RSDS_TYPE,
CLAUSES TYPE RSDS_TWHERE,
TEXPR TYPE RSDS_TEXPR,
TRANGE TYPE RSDS_TRANGE,
END OF RSDS_TYPE.RSDS_TYPE is a deep structure with the following components:
CLAUSES
CLAUSES contains the dynamic selections entered by the user (or possibly program-internal selection criteria) as internal tables, which you can use directly in dynamic WHERE clauses.
CLAUSES is an internal table that contains another internal table WHERE_TAB as a component. Each line of the CLAUSES-TABLENAME column contains the name of a node designated for dynamic selections. For each of these database tables, the WHERE_TAB tables contain the selection criteria of the dynamic selections. The WHERE_TAB tables have a format that allows you to use them directly in dynamic WHERE clauses.
To use WHERE_TAB in the logical database, you must program the dynamic WHERE clause for each node node designated for dynamic selection in the corresponding subroutine PUT_node. For this, the corresponding internal table WHERE_TAB for node must be read from the data object DYN_SEL.
The following example shows how you can use a local data object in the subroutine for this purpose:
Suppose the database table SCARR is the root node of the logical database ZHK and that SPFLI is its only subordinate node.
The selection Include DBZHKSEL contains the following lines:
SELECT-OPTIONS S_CARRID FOR SCARR-CARRID.
SELECT-OPTIONS S_CONNID FOR SPFLI-CONNID.
SELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE SCARR.
The subroutine PUT_SCARR of the database program SAPDBZHK uses the dynamic selection as follows:
FORM PUT_SCARR.
STATICS: DYNAMIC_SELECTIONS TYPE RSDS_WHERE,
FLAG_READ.
IF FLAG_READ = SPACE.
DYNAMIC_SELECTIONS-TABLENAME = 'SCARR'.
READ TABLE DYN_SEL-CLAUSES
WITH KEY DYNAMIC_SELECTIONS-TABLENAME
INTO DYNAMIC_SELECTIONS.
FLAG_READ = 'X'.
ENDIF.
SELECT * FROM SCARR
WHERE CARRID IN S_CARRID
AND (DYNAMIC_SELECTIONS-WHERE_TAB).
PUT SCARR.
ENDSELECT.
ENDFORM.The line of the internal table DYN_SEL-CLAUSES that contains the value SCARR in column DYN_SEL-CLAUSES-TABLENAME is read into the local structure DYNAMIC_SELECTIONS. The STATICSstatements and the FLAG_READ field assure that the table DYN_SEL is read only once each time the executable program is run. The table DYNAMIC_SELECTIONS-WHERE_TAB is used in the dynamic WHERE clause.
Each executable program that uses ZHK as its logical database and contains a NODES or TABLES statement for SCARR or SPFLI now offers dynamic selections for the fields in table SCARR on its selection screen. The dynamic WHERE clause means that the logical database only reads those lines that satisfy the selection conditions on the selection screen and in the dynamic selections.
TEXPR
TRANGE
TRANGE contains the selections from the dynamic selection as RANGES tables that you can use with the IN operator in a WHERE clause or logical expression.
TRANGE is an internal table that contains another internal table FRANGE_T as a component. Each line in the column TRANGE-TABLENAME contains the name of a node that is designated for dynamic selections. For each of these nodes, the FRANGE_T tables contain the selection criteria of the dynamic selections in the format of RANGES tables. FRANGE_T contains a FIELDNAME column that contains the fields of the node for which the RANGES tables are defined. The other component of FRANGE_T, SELOPT_T, contains the actual RANGES tables.
With TRANGE, you can access the selections of individual database columns directly . Furthermore, it is easier to modify selection criteria stored in the RANGES format than those stored in the WHERE clause format. The following example shows how you can use local data objects of the corresponding subroutine PUT_node.
Suppose the database table SCARR is the root node of the logical database ZHK and that SPFLI is its only subordinate node.
The selection Include DBZHKSEL contains the following lines:
SELECT-OPTIONS S_CARRID FOR SCARR-CARRID.
SELECT-OPTIONS S_CONNID FOR SPFLI-CONNID.
SELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE SCARR.
The subroutine PUT_SCARR of the database program SAPDBZHK uses the dynamic selection as follows:
FORM PUT_SCARR.
STATICS: DYNAMIC_RANGES TYPE RSDS_RANGE,
DYNAMIC_RANGE1 TYPE RSDS_FRANGE,
DYNAMIC_RANGE2 TYPE RSDS_FRANGE,
FLAG_READ.
IF FLAG_READ = SPACE.
DYNAMIC_RANGES-TABLENAME = 'SCARR'.
READ TABLE DYN_SEL-TRANGE
WITH KEY DYNAMIC_RANGES-TABLENAME
INTO DYNAMIC_RANGES.
DYNAMIC_RANGE1-FIELDNAME = 'CARRNAME'.
READ TABLE DYNAMIC_RANGES-FRANGE_T
WITH KEY DYNAMIC_RANGE1-FIELDNAME
INTO DYNAMIC_RANGE1.
DYNAMIC_RANGE2-FIELDNAME = 'CURRCODE'.
READ TABLE DYNAMIC_RANGES-FRANGE_T
WITH KEY DYNAMIC_RANGE2-FIELDNAME
INTO DYNAMIC_RANGE2.
FLAG_READ = 'X'.
ENDIF.
SELECT * FROM SCARR
WHERE CARRID IN S_CARRID
AND CARRNAME IN DYNAMIC_RANGE1-SELOPT_T
AND CURRCODE IN DYNAMIC_RANGE2-SELOPT_T.
PUT SCARR.
ENDSELECT.
ENDFORM.The line of the internal table DYN_SEL-TRANGE that contains the value 'SCARR' in column DYN_SEL-CLAUSES-TABLENAME is read into the local table DYNAMIC_RANGES. The nested tables DYNAMIC_RANGES-FRANGE_T are read into the local tables DYNAMIC-RANGE1 and DYNAMIC-RANGE2 according to the contents of DYNAMIC_RANGES-FIELDNAME. The STATICS statements and the FLAG_READ field assure that the tables are read only once each time the executable program is executed. After the READ statements, the nested tables SELOPT_T of the local tables contain the RANGES tables for the columns CARRNAME and CURRCODE of the database table SCARR.
The SELOPT_T tables are used in the SELECT statement directly as selection tables. Besides CARRNAME, CURRCODE and the primary key, there are no further columns in the database table SCARR. Therefore, this logical database has the same function as the logical database in the above example using the CLAUSES component.
Reward all helpfull answers
Regards
Pavan
‎2007 Dec 06 2:00 AM
Hey Laha
This is Sameer, was with u at hcl rembr?
whr r u these days buddy?
drop me ur no at sameer.sameerahmed@gmail.com and I will call u.
Take care
Sameer
‎2007 Aug 03 8:54 AM
Did you try searching the forum for a solution first? A search with 'Dynamic search help' seems to return quite a few solutions. Maybe you would like to try that.
Sudha
‎2007 Aug 03 9:27 AM
‎2007 Aug 03 9:47 AM
Hi
Thanks but not yet solved..but Mr.pavan praveen has given me other direction to think abt it but still i m confused with the use of thefollowing FM
watever i knwo till now is
(1)DYNP_VALUES_READ
this module is used to capture the values entered in parameters on the screen at runtime(i.e. we can get the values enterd in parameters before Start-Of-Selection)
(2)RS_REFRESH_FROM_SELECTOPTIONS
and i read somewhere on forum that this moduel is used to capture vallues of select-options from the screen ( similar to previous one but for select-option ), i used it , got some internal table which contains name of my seleect-options(s1) but it doesnt cotain wat value i entered on the screen in s1-low field of that internal table so dun know wat to do ahead..dun know how to frame the query
can u help me here ?
Thanks once again
‎2007 Aug 03 9:58 AM
Hi Nilesh,
Wat you can do is,
In this event.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR <field>
You use . DYNP_VALUES_READ to read the value on screen.
afer that select that data on the basis of data you get from screen.
then call FM.F4IF_INT_TABLE_VALUE_REQUEST.
it will work then.
Hope you got it now.
Regards
Azad.
Reward if helpful.
‎2007 Aug 03 10:31 AM
Hi.
well this i tried ..but as i told u earlier this Fn moduel will read only the value of '<b>Parameters</b>' on the screen it doesnt read the value in select-option on the screen.
So i read that RS_REFRESH_FROM_SELECTOPTIONS will do the same job as DYNP_VALUES_READ did but for select-option. but till now no success ..i guess now u must have understood where i stuck.
<b>NOTE :some part of my code</b>
here is my code.there are 2 parameter fields and 1 select option , i dun have pbm with reading values from parameter ,means in thsi example if i enter value in p1 and then press F4 on p2 then i will get the value help for p2 as per value in p1 but now i want similar thing to happen with select-option S1.
DATA : BEGIN OF ITAB OCCURS 0,
CARRID LIKE SFLIGHT-CARRID,
CONNID LIKE SFLIGHT-CONNID,
CITYFROM LIKE SPFLI-CITYFROM,
CITYTO LIKE SPFLI-CITYTO,
END OF ITAB.
DATA: PROGNAME TYPE SY-REPID,
DYNNUM TYPE SY-DYNNR,
DYNPRO_VALUES TYPE TABLE OF DYNPREAD,
FIELD_VALUE LIKE LINE OF DYNPRO_VALUES,
VALUES_TAB TYPE TABLE OF ITAB.
SELECT-OPTIONS S1 FOR SPFLI-CITYFROM NO INTERVALS.
PARAMETER : P1 LIKE SFLIGHT-CARRID,
P2 LIKE SFLIGHT-CONNID.
FIELD_VALUE-FIELDNAME = 'P1'.
APPEND FIELD_VALUE TO DYNPRO_VALUES.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P2.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = PROGNAME
dynumb = DYNNUM
translate_to_upper = 'X'
TABLES
dynpfields = DYNPRO_VALUES.
READ TABLE dynpro_values INDEX 1 INTO field_value.
SELECT carrid connid CITYFROM CITYTO
FROM spfli
INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE carrid = field_value-fieldvalue.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'CONNID'
dynpprog = progname
dynpnr = dynnum
dynprofield = 'P2'
value_org = 'S'
TABLES
value_tab = ITAB.
Nilesh <b></b>
‎2007 Aug 03 10:41 AM
Hey Nilesh,
Then Call this FM RS_REFRESH_FROM_SELECTOPTIONS.
You will get the selection screen values.
accroding to that you can fetch data.
if ne prob u can chat with me, give me ur id.
Regards
Azad.
‎2007 Aug 03 10:51 AM
‎2007 Aug 03 11:05 AM
Hi
F4IF_INT_TABLE_VALUE_REQUEST is used for displaying F4 help for a parameter
SELECT-OPTIONS : s_variable for mara-matnr NO INTERVELS.
PARAMETERS : p_regtyp TYPE char1.
*
*---------------Selection Screen Help-------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_regtyp.
PERFORM f1000_show_f4help_regtyp .
*------------------Form----------------------------------------------------*
FORM f1000_show_f4help_regtyp .
DATA : Begin of Itab occurs 0,
matnr like mara-matnr,
end of itab.
Here
LOOP at s_variable.
move : s_variable-low to itab-matnr.
APPEND ITAB.
CLEAR ITAB.
ENDLOOP.
* Function Module to Call F4 Help
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = lc_reg_type
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = lc_pregtyp
value_org = 'S'
TABLES
value_tab = itab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " f1000_show_f4help_regtyp
RS_REFRESH_FROM_SELECTOPTIONSStores the selection screen data in an internal table
Reward all helpfull answers
Regards
Pavan
‎2007 Aug 03 11:25 AM
Hi praveen
i tried ur pgm but the loop which u specified doesnt contain any values when i debug it
LOOP at s_variable.
move : s_variable-low to itab-matnr.
APPEND ITAB.
CLEAR ITAB.
ENDLOOP.
so ultimately the ITAB doesnt contain any value
try debugging it ..it will not contain the values of s_variable-low ..rather it will get the values only after Start-of-selection event starts..
I hope u got my point .
Nilesh
‎2007 Aug 03 11:21 AM
Try something like this :
TABLES: t005, t005s.
PARAMETERS: land1 LIKE t005-land1,
bland LIKE t005s-bland.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR bland.
DATA: t_t005u TYPE TABLE OF t005u WITH HEADER LINE,
t_dynpread TYPE TABLE OF dynpread WITH HEADER LINE,
t_dselc TYPE TABLE OF dselc WITH HEADER LINE.
* Read current value of country (we are BEFORE PAI)
REFRESH t_dynpread.
t_dynpread-fieldname = 'LAND1'.
t_dynpread-fieldvalue = land1.
APPEND t_dynpread.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = t_dynpread
EXCEPTIONS
OTHERS = 1.
CHECK sy-subrc = 0.
READ TABLE t_dynpread INDEX 1.
CHECK sy-subrc = 0.
land1 = t_dynpread-fieldvalue.
* Fill an internal table
IF land1 IS INITIAL.
SELECT * FROM t005u INTO TABLE t_t005u.
ELSE.
SELECT * FROM t005u INTO TABLE t_t005u
WHERE land1 = land1.
ENDIF.
CHECK sy-subrc = 0.
* Map fields to be updated between dynpro and table read
REFRESH t_dselc.
t_dselc-fldname = 'LAND1'.
t_dselc-dyfldname = 'LAND1'.
APPEND t_dselc.
t_dselc-fldname = 'BLAND'.
t_dselc-dyfldname = 'BLAND'.
APPEND t_dselc.
* Call F4*
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'T005U'
retfield = 'BLAND'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'BLAND'
value_org = 'S'
TABLES
value_tab = t_t005u
dynpfld_mapping = t_dselc.Regards
‎2007 Aug 03 11:41 AM
HI raymond
as i said earlier i dun have requirement for parametere but i want value of select-option to be read at screen.So depeneding upon the value i will change the F4 help values for parameter.
i hope u got me
NIlesh
‎2007 Aug 07 8:28 AM
Hello all
it was a nice response from all of u who replied me but the my pbm is not yet solved.. ? anybody got any solution for this ? let me once again frame the qn in short
i have 1 select-option (s1) and 1 parameter (p1)
while running when i enter some country name in s1 and then when i press F4 in paramenter p1 ,i should get the value help conataing cities from that country i entered in s1. ..so its dynamic..the F4 help will be dependent on the value entereed in the sleect-option.
plz help
Nilesh
‎2007 Aug 30 11:32 AM
Hello
anybody there who can answer my question..its not been solved yet .!!!!!!!!
any pointers in this area are highly appreciated .. plz help
Thanks in advance
Nilesh