08-27-2009 4:01 PM
Hi Dear friends
In my report i have two input flds at selection screen i.e. sales order no and date description.Now based on sales order no the F4 help in the fld date description should change dynamically.eg. if there are two sales document number 001 and 002 and the corresponding date description for 001 are 123 and 234 and for 002 are 987 and 876 .Then if i select 001 the F4 help in date description should contain 123,234 and for 002 it should contain 987,876 before pressing the execute button.How to achieve this. Plz help me. i tried to use AT-SELECTION SCREEN ON VALUE REQUEST event but its not giving any out put as in the SELECT query i putted a WHERE condition where sales document of the database table equals to the sales order inserted in the selection screen. But when i debugg the input sales order parameter shows blank.
08-27-2009 4:07 PM
Try this way
Thanks
Venkat.OREPORT ZVENKAT_F4_FOR_PARAMETERS MESSAGE-ID zmsg .
TYPES:
BEGIN OF t_t001w,
werks TYPE t001w-werks,
name1 TYPE t001w-name1,
END OF t_t001w,
t_return_tab TYPE ddshretval.
DATA:
w_t001w TYPE t_t001w,
w_return_tab TYPE t_return_tab.
DATA:
i_t001w TYPE STANDARD TABLE OF t_t001w,
i_return_tab TYPE STANDARD TABLE OF t_return_tab.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS :p_werks TYPE t001w-werks,
p_name1 TYPE t001w-name1.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.
PERFORM f4_help_for_palant.
*&---------------------------------------------------------------------*
*& Form f4_help_for_palant
*&---------------------------------------------------------------------*
FORM f4_help_for_palant.
DATA:
w_dynpfields TYPE dynpread,
i_dynpfields LIKE STANDARD TABLE OF dynpread.
IF i_t001w[] IS INITIAL.
SELECT werks name1
FROM t001w
INTO TABLE i_t001w.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'WERKS'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_WERKS'
value_org = 'S'
TABLES
value_tab = i_t001w
return_tab = i_return_tab.
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 i_return_tab INTO w_return_tab INDEX 1.
p_werks = w_return_tab-fieldval.
READ TABLE i_t001w INTO w_t001w WITH KEY werks = p_werks.
IF sy-subrc = 0.
w_dynpfields-fieldname = 'P_NAME1'.
w_dynpfields-fieldvalue = w_t001w-name1.
APPEND w_dynpfields TO i_dynpfields.
CLEAR w_dynpfields.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = i_dynpfields.
ENDIF.
ENDFORM. " f4_help_for_palant
08-27-2009 4:29 PM
Hi,
The values would be avaliable if you first hit enter on the selection screen for the parameter for sales order # sales order no
well, you ahve to first read the screen values using FM 'DYNP_values_read' then based on that value you can write the logic to get the F4 help for the second parameter. You can search SCN on how to use the FM 'DYNP_VALUES_READ'.
which is some what like below
data begin of dynpfields occurs 1.
include structure dynpread.
data end of dynpfields.
dynpfields-fieldname = 'PNAME'.
append dynpfields.
repid = sy-repid.
call function 'DYNP_VALUES_READ'
exporting
dyname = sy-cprog
dynumb = sy-dynnr
tables
dynpfields = dynpfields
exceptions
others.
read table dynpfields index 1.
pname = dynpfields-fieldvalue.
Regards,
Himanshu