12-02-2009 4:10 AM
Dear Guru,
I have encountered an issue which i am trying to resolve . The issue is as below -->
I have defined my selection screen like below:
SELECTION-SCREEN : BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
PARAMETERS : p_table TYPE dd03l-tabname OBLIGATORY. "Table name
SELECTION-SCREEN : END OF BLOCK block1.
SELECTION-SCREEN : BEGIN OF BLOCK block2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_field FOR dd03l-fieldname NO INTERVALS OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK block2.
In block1 i am providing provision to enter single table name.
where as in block2 i want select all those table fields for the table present in block1.
When i am seeking f4 help for block2 --> It is providing me lists of all data elements
in a popup window (Field Name(1)) present in sap.
In this Field Name(1) pop up we can able to minimise the list of field entries after providing
the table name manually in the restriction tab after clicking down triangle tab on the top.
My requirment is like this as soon as we will seek for f4 help of block2 it should show the
corresponding table fields of table present in block1 automatically rather than providing the
table name manually in the restriction option and find out lists of fields present in that table.
Please give some guideline to resolve this issue
Thanks & Regards
Saifur Rahaman
12-02-2009 4:26 AM
Hi,
In the selection-screen value request event,
use fm: DYNP_VALUES_READ to read the selection values and use that in a select query to retrieve values from DD03L and then pass it to FM: F4IF_INT_TABLE_VALUE_REQUEST to populate as a F4 help.
Regards,
Subramanian
12-02-2009 4:26 AM
Hi,
In the selection-screen value request event,
use fm: DYNP_VALUES_READ to read the selection values and use that in a select query to retrieve values from DD03L and then pass it to FM: F4IF_INT_TABLE_VALUE_REQUEST to populate as a F4 help.
Regards,
Subramanian
12-02-2009 4:33 AM
Dear Sir i didnot get your point exactly.... can you please elaborate it little ...
12-02-2009 4:48 AM
Hi,
Go through this sample code for
DATA: BEGIN OF T_MATNR OCCURS 0,
MATNR TYPE VBAP-MATNR,
END OF T_MATNR,
BEGIN OF T_MAKTX OCCURS 0,
MAKTX TYPE MAKT-MAKTX,
END OF T_MAKTX.
DATA: T_DYNPRO TYPE TABLE OF DYNPREAD,
WA_DYNPRO LIKE LINE OF T_DYNPRO,
TEMP TYPE MARA-MATNR.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01.
PARAMETERS: P_MATNR TYPE MARA-MATNR,
P_MAKTX TYPE MAKT-MAKTX.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.
SELECT MATNR
FROM MARA
INTO TABLE T_MATNR
UP TO 10 ROWS.
IF SY-SUBRC EQ 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'MATNR'
DYNPPROG = 'ZTRIAL'
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MATNR'
TABLES
VALUE_TAB = T_MATNR
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MAKTX.
WA_DYNPRO-FIELDNAME = 'P_MATNR'.
APPEND WA_DYNPRO TO T_DYNPRO.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-REPID
DYNUMB = SY-DYNNR
TRANSLATE_TO_UPPER = 'X'
TABLES
DYNPFIELDS = T_DYNPRO
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE T_DYNPRO INTO WA_DYNPRO WITH KEY FIELDNAME = 'P_MATNR'.
TEMP = WA_DYNPRO-FIELDVALUE.
SELECT MAKTX
FROM MAKT
INTO TABLE T_MAKTX
WHERE MATNR EQ TEMP.
"Call F4 help on MAKTX again.
12-02-2009 4:28 AM
Dear Saifur,
Please check the below code.
***************************************************************************************************************
at selection-screen on value-request for < your field>.
select fieldname from dd03l into table ptab where tabname = < your table name>.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'FIELD' " name of the parameter for field
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'FIELD' " name of the parameter for field
value_org = 'S'
tables
value_tab = ptab.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.*
endif.
***************************************************************************
Hope this will help you.
Regards,
Smart Varghese
12-02-2009 4:43 AM
Hi:
you can do like this
at selection screen of field1, call a function module DDIF_FIELDINFO_GET which gives the list of the fields.
Now use AT SELECTION-SCREEN ON VALUE-REQUEST FOR fileld2
Call a function module F4IF_INT_TABLE_VALUE_REQUEST where you have to pass the values retrieved from fm DDIF_FIELDINFO_GET . Then the list of fields would come as you press F4
Regards
Shashi
12-02-2009 5:00 AM
Hi SAIFUR,<br />
<br />
Just make use of the below code . < cut and paste ><br />
<br />
tables:dd03l.<br />
data : begin of ptab occurs 0,<br />
field like dd03l-fieldname,<br />
end of ptab.<br />
DATA : BEGIN OF DYNPFIELDS OCCURS 0.<br />
INCLUDE STRUCTURE DYNPREAD.<br />
DATA : END OF DYNPFIELDS.<br />
SELECTION-SCREEN : BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.<br />
PARAMETERS : p_table TYPE dd03l-tabname OBLIGATORY. "Table name<br />
SELECTION-SCREEN : END OF BLOCK block1.<br />
<br />
SELECTION-SCREEN : BEGIN OF BLOCK block2 WITH FRAME TITLE text-002.<br />
SELECT-OPTIONS: s_field FOR dd03l-fieldname NO INTERVALS OBLIGATORY.<br />
SELECTION-SCREEN : END OF BLOCK block2.<br />
at selection-screen on value-request for s_field-low.<br />
MOVE 'P_TABLE' TO DYNPFIELDS-FIELDNAME.<br />
APPEND DYNPFIELDS.<br />
CALL FUNCTION 'DYNP_VALUES_READ'<br />
EXPORTING<br />
dyname = sy-cprog<br />
dynumb = sy-dynnr<br />
TRANSLATE_TO_UPPER = 'X'<br />
tables<br />
dynpfields = dynpfields<br />
EXCEPTIONS<br />
INVALID_ABAPWORKAREA = 1<br />
INVALID_DYNPROFIELD = 2<br />
INVALID_DYNPRONAME = 3<br />
INVALID_DYNPRONUMMER = 4<br />
INVALID_REQUEST = 5<br />
NO_FIELDDESCRIPTION = 6<br />
INVALID_PARAMETER = 7<br />
UNDEFIND_ERROR = 8<br />
DOUBLE_CONVERSION = 9<br />
STEPL_NOT_FOUND = 10<br />
OTHERS = 11.<br />
IF sy-subrc 0.<br />
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO<br />
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.<br />
ENDIF.<br />
READ TABLE DYNPFIELDS INDEX 1 TRANSPORTING FIELDVALUE.<br />
MOVE DYNPFIELDS-FIELDVALUE TO P_TABLE.<br />
select fieldname from dd03l into table ptab where tabname = p_table.<br />
call function 'F4IF_INT_TABLE_VALUE_REQUEST'<br />
exporting<br />
retfield = 'S_FIELD-LOW'
dynpprog = sy-cprog<br />
dynpnr = sy-dynnr<br />
dynprofield = 'S_FIELD-LOW'
value_org = 'S'<br />
tables<br />
value_tab = ptab.<br />
if sy-subrc 0.<br />
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO<br />
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.<br />
endif.<br />
<p />
This will sole your issue.<br />
<p />
Regards,<br />
Smart Varghese
12-02-2009 5:39 AM
Dear smartvarghese
It is working fine for the single field selection of block2 .
but when i am going for the multiple selection and trying to select multiple field it is raising a dump.
how to resolve this
12-02-2009 5:49 AM
12-02-2009 6:18 AM
Hi Saifur,
I think you are getting the dump because of the statements between sy-subrc check
If you havenot defined any msg ids and types then comment out that part and check now.
tables:dd03l.
data : begin of ptab occurs 0,
field like dd03l-fieldname,
end of ptab.
DATA : BEGIN OF DYNPFIELDS OCCURS 0.
INCLUDE STRUCTURE DYNPREAD.
DATA : END OF DYNPFIELDS.
SELECTION-SCREEN : BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
PARAMETERS : p_table TYPE dd03l-tabname OBLIGATORY. "Table name
SELECTION-SCREEN : END OF BLOCK block1.
SELECTION-SCREEN : BEGIN OF BLOCK block2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_field FOR dd03l-fieldname NO INTERVALS OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK block2.
at selection-screen on value-request for s_field-low.
MOVE 'P_TABLE' TO DYNPFIELDS-FIELDNAME.
APPEND DYNPFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TRANSLATE_TO_UPPER = 'X'
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.
*MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO "comment thiese two lines and execute now
*WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE DYNPFIELDS INDEX 1 TRANSPORTING FIELDVALUE.
MOVE DYNPFIELDS-FIELDVALUE TO P_TABLE.
select fieldname from dd03l into table ptab where tabname = p_table.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'S_FIELD-LOW' dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'S_FIELD-LOW' value_org = 'S'
tables
value_tab = ptab.
if sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Regards,
Swarna Munukoti
12-02-2009 9:12 AM
Dear Swarna Munukoti
I have worked out in the suggestion you have provided this have resolved the issue partially.....
Now the place where i am getting stuck ... which i am trying to resolve ..
The issue is Your custom code helped me to select the desired field of a particular table one by one if we click on the "Multiple Selection" button(the yellow button) in the selection screen. But the requirment is like i want to select a multiple numbers of field at a time in the popup (Multiple Selection For S_field) .
Initially(before you have suggested your custom coding ) in this pop up (Multiple Selection For S_field) a button i was able to find "Multiple Selection" . (where after using your custom code i am not able to find that "Multiple Selection" button in the popup)
we can able to select lists of desired fields after clicking on button "Miltiple Selection" .
"Miltiple Selection" provides a popup with list of field with addition a check box for selection of multiple fields.
we can able to minimise the list of field entries after providing
the table name manually in the restriction tab after clicking down triangle tab on the top
and select all those table fields for the table present in block1
My requirment is like this your custom code should not hide "Multiple Selection" button in the popup (Multiple Selection For S_field) and as soon as we will click "Miltiple Selection" button in the
"Multiple Selection For Field Name" pop up of block2 it should show the
corresponding table fields of table present in block1 automatically with check box rather than providing the
table name manually in the restriction option and find out lists of fields present in that table.
Please give some guideline to resolve this issue
Thanks & Regards
Saifur Rahaman
12-02-2009 9:27 AM
Hello Saifur,
Did you try passing the MULTIPLE_CHOICE = 'X' to the FM & check?
BR,
Suhas
12-02-2009 9:46 AM
Saha da,
yes i tried with MULTIPLE_CHOICE = 'X' in the FM 'F4IF_INT_TABLE_VALUE_REQUEST'
It is showing lists of fields with checbox as soon as i am pressing F4
But after selecting the desired fields .. neither a single field appearing in the selection screen nor in the popup (Multiple Selection For S_field --> which gets popped up after clicking on the yellow arrow button ) and in this pop up i am not able to find the button "Multiple selection"
My requirment either the lists of field have to flow using after pressing f4 help or after clicking on the yellow arrow button and then using "Multiple selection" button which provides lists of fields with checkbox.
12-02-2009 9:48 AM
Hello,
This is because the code provided by Swarna is incomplete
Try this:
DATA: it_ret TYPE STANDARD TABLE OF ddshretval,
wa_ret TYPE ddshretval.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'S_FIELD-LOW'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'S_FIELD-LOW'
value_org = 'S'
multiple_choice = 'X'
TABLES
value_tab = ptab[]
return_tab = it_ret.
IF sy-subrc = 0.
s_field-sign = 'I'.
s_field-option = 'EQ'.
LOOP AT it_ret INTO wa_ret.
s_field-low = wa_ret-fieldval.
APPEND s_field.
ENDLOOP.
ENDIF.
BR,
Suhas
12-02-2009 9:57 AM
12-02-2009 10:03 AM
Saha da i tried with your custom code ... it worked out... thanks a lot.
My issue have been completely resolved
12-03-2009 6:31 AM
Dear Saha Da,
The custom code you have provided its working fine but
One issue have been foundout during extensive testing ..
the issue is when i am pressing f4 it is giving me provision to select multiple field at a time.
For the first field selection it working ok .
But i am trying to select the multiple field then the system is behaving like below :
Table name i gave == KNA1
Then pressed f4 --> popup came i make selection of 3 fields
ABRVW
ADRNR
ALC then pressed green tick
In the selection screen the field which is appearing == ALC
Now when i am trying to watch the multiple field using "Multiple selection " button there in the popup "Multiple selection for s_field" showing only values in following sequence
ALC
ADRNR
ALC
instead of showing
ABRVW
ADRNR
ALC
Please give me some guideline how to resolve this
Saifur
12-02-2009 5:04 AM
Hi Saifur Rahaman,
TABLES : DD03L.
DATA : BEGIN OF WA_FIELD ,
FIELDNAME LIKE DD03L-FIELDNAME,
END OF WA_FIELD.
DATA : IT_FIELD LIKE STANDARD TABLE OF WA_FIELD.
SELECTION-SCREEN : BEGIN OF BLOCK BLOCK1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_TABLE LIKE DD03L-TABNAME OBLIGATORY. "Table name
SELECTION-SCREEN : END OF BLOCK BLOCK1.
SELECTION-SCREEN : BEGIN OF BLOCK BLOCK2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: S_FIELD FOR DD03L-FIELDNAME NO INTERVALS." OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK BLOCK2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_FIELD-LOW.
SELECT FIELDNAME FROM DD03L INTO TABLE IT_FIELD WHERE TABNAME = P_TABLE.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'S_FIELD-LOW' " name of the parameter for field
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'S_FIELD-LOW' " name of the parameter for field
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_FIELD.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Copy above code and paste in your program.
execute
enter TABLENAME eg. MARA
press Enter
Now Do F4 for the Field...
Modify logic as per your requirement.. Do other minor changes by some efforts..
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
ilesh Nandaniya
12-02-2009 5:09 AM
Try this
TABLES dd03l.
DATA: itab TYPE TABLE OF dd03l,
itab1 TYPE TABLE OF dynpread,
wa LIKE LINE OF itab1.
SELECTION-SCREEN : BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
PARAMETERS : p_table TYPE dd03l-tabname OBLIGATORY . "Table name
SELECTION-SCREEN : END OF BLOCK block1.
SELECTION-SCREEN : BEGIN OF BLOCK block2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_field FOR dd03l-fieldname NO INTERVALS OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK block2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_field-low.
REFRESH itab1 .
wa-fieldname = 'P_TABLE'.
APPEND wa TO itab1.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = 'ZSAT_TEST000' "Your pgm name
dynumb = '1000'
translate_to_upper = 'X'
TABLES
dynpfields = itab1.
READ TABLE itab1 INTO wa INDEX 1.
REFRESH itab.
SELECT * FROM dd03l INTO TABLE itab WHERE tabname = wa-fieldvalue.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'FIELDNAME'
dynpprog = 'ZSAT_TEST000' "Your pgm name
dynpnr = '1000'
dynprofield = 'S_FIELD-LOW'
value_org = 'S'
TABLES
value_tab = itab.
12-03-2009 7:21 AM
The Correct solution is as below
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'S_FIELD-LOW'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'S_FIELD-LOW'
value_org = 'S'
multiple_choice = 'X'
TABLES
value_tab = ptab[]
return_tab = it_ret.
IF sy-subrc = 0.
CLEAR: read_table.
IF s_field[] IS INITIAL.
read_table = 'S_FIELD'.
ELSE.
read_table = 'IT_RET'.
ENDIF.
LOOP AT it_ret INTO wa_ret.
s_field-sign = 'I'.
s_field-option = 'EQ'.
s_field-low = wa_ret-fieldval.
APPEND s_field.
ENDLOOP.
IF read_table = 'S_FIELD'.
READ TABLE s_field INDEX 1.
ELSEIF read_table = 'IT_RET'.
CLEAR: s_field.
READ TABLE it_ret INTO wa_ret INDEX 1.
ENDIF.
ENDIF.