Hi,
Look at this example...
*****************************
*----
at selection-screen on value-request for s_pernr-low.
*----
perform get_values changing s_pernr-low.
*----
at selection-screen on value-request for s_pernr-high.
*----
perform get_values changing s_pernr-high.
**********
&----
*& Form get_values
&----
text
----
-->P_S_PERNR_LOW text
----
FORM get_values CHANGING P_S_PERNR.
refresh t_itab.
clear t_return.
select pernr from zfdmr_records into table t_itab.
delete adjacent duplicates from t_itab.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'PERNR'
PVALKEY = ' '
DYNPPROG = sy-cprog
DYNPNR = sy-dynnr
DYNPROFIELD = 'ZFDMR_RECORDS-PERNR'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = 'F'
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
TABLES
VALUE_TAB = t_itab
FIELD_TAB =
RETURN_TAB = t_return
DYNPFLD_MAPPING =
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.
READ TABLE t_return INDEX 1.
p_s_pernr = t_return-fieldval.
ENDFORM. " get_values
I hope it will help you.
Thanks.
If your doubt is solved award points.
Hi,
Here is the sample.Execute it and you will observe.Kindly reward points if it helps.
REPORT ZGK_TEST message-id zsd line-count 16(1) no standard page heading . *----------------------------------------------------------------------* * Tables Declaration *----------------------------------------------------------------------* tables : vbap. " Sales Document: Item Data *----------------------------------------------------------------------* * Constant Declaration * *----------------------------------------------------------------------* CONSTANTS: C_X TYPE C VALUE 'X'. " Translate to Uppercase *----------------------------------------------------------------------* * Variable Declaration * *----------------------------------------------------------------------* * Variable for Table index data v_sytabix like sy-tabix. * Variable for Program name data L_NAME LIKE SYST-REPID. *----------------------------------------------------------------------* * Ranges Declaration * *----------------------------------------------------------------------* * Range for getting values form selection screen DATA: BEGIN OF range1 OCCURS 0, SIGN(1), OPTION(2), LOW LIKE vbap-vbeln, high like vbap-vbeln, END OF range1. *----------------------------------------------------------------------* * Structure Declaration * *----------------------------------------------------------------------* *----------------------------------------------------------------------* * Internal table Declaration * *----------------------------------------------------------------------* * Internal table for Report output data: begin of i_vbap occurs 0, vbeln like vbap-vbeln, " Sales Document posnr like vbap-posnr, " Sales Document item end of i_vbap. * Internal table for output to the F4 help data: begin of I_DISPLAY occurs 0, vbeln like vbap-vbeln, " Sales Document posnr like vbap-posnr, " Sales Document item end of I_DISPLAY. * Internal table for return value form function module DATA: BEGIN OF I_RETURNVAL OCCURS 0. INCLUDE STRUCTURE DDSHRETVAL. " Interface Structure Search DATA: END OF I_RETURNVAL. * Internal table for F4 help field heading DATA: I_FIELDTAB LIKE DFIES OCCURS 0 WITH HEADER LINE. * Internal table for getting screen values from selection screen data L_SCR_FIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE. *----------------------------------------------------------------------* * Field-Symbols * *----------------------------------------------------------------------* *----------------------------------------------------------------------* * Selection-screen * *----------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME title text-001. select-options: S_VBELN for vbap-vbeln no intervals, S_POSNR for vbap-posnr no intervals. SELECTION-SCREEN end OF BLOCK B1. *----------------------------------------------------------------------* * AT SELECTION-SCREEN ON VALUE-REQUEST * *----------------------------------------------------------------------* at selection-screen on value-request for s_posnr-low. clear: L_SCR_FIELDS, I_FIELDTAB, i_display, I_RETURNVAL. refresh: L_SCR_FIELDS, I_FIELDTAB, i_display, I_RETURNVAL. L_NAME = SYST-REPID. MOVE 'S_VBELN-LOW' TO L_SCR_FIELDS-FIELDNAME. APPEND L_SCR_FIELDS. * Call the Function module DYNP_VALUES_READ to get the values form * selection screen CALL FUNCTION 'DYNP_VALUES_READ' EXPORTING DYNAME = L_NAME DYNUMB = SYST-DYNNR TRANSLATE_TO_UPPER = C_X " X TABLES DYNPFIELDS = L_SCR_FIELDS 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 eq 0. LOOP AT L_SCR_FIELDS. range1-sign = 'I'. range1-option = 'EQ'. range1-low = L_SCR_FIELDS-FIELDVALUE. range1-high = space. append range1. ENDLOOP. ENDIF. * F4 help Field headings I_FIELDTAB-TABNAME = 'I_DISPLAY'. I_FIELDTAB-FIELDNAME = 'VBELN'. I_FIELDTAB-POSITION = '1'. I_FIELDTAB-OUTPUTLEN = '10'. I_FIELDTAB-INTTYPE = 'C'. I_FIELDTAB-INTLEN = '10'. APPEND I_FIELDTAB. I_FIELDTAB-FIELDNAME = 'POSNR'. I_FIELDTAB-POSITION = '2'. I_FIELDTAB-OFFSET = '10'. I_FIELDTAB-OUTPUTLEN = '6'. I_FIELDTAB-INTTYPE = 'N'. I_FIELDTAB-INTLEN = '6'. APPEND I_FIELDTAB. * Retrieve sales document, Sales document item from table Sales * Document: Item Data(VBAP). * Primary keys used for selection: VBELN select vbeln posnr from vbap into table i_display where vbeln in range1. * Call the function module F4IF_INT_TABLE_VALUE_REQUEST for F4 values CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING RETFIELD = 'POSNR' WINDOW_TITLE = 'Line Item' VALUE_ORG = 'S' MULTIPLE_CHOICE = C_X " (for muliple selection) TABLES VALUE_TAB = I_DISPLAY FIELD_TAB = I_FIELDTAB RETURN_TAB = I_RETURNVAL 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. ELSE. * Star for For single values * READ TABLE I_RETURNVAL INDEX 1. * S_POSNR-LOW = I_RETURNVAL-FIELDVAL. * End for the single values * Start For multiple selection loop at i_returnval. s_posnr-sign = 'I'. s_posnr-option = 'EQ'. s_posnr-low = I_RETURNVAL-FIELDVAL. append s_posnr. endloop. sort s_posnr. read table s_posnr index 1. * End for multiple selection ENDIF. *----------------------------------------------------------------------* * Start-of-selection * *----------------------------------------------------------------------* start-of-selection. * Retrieve sales document, Sales document item from table Sales * Document: Item Data(VBAP). * Primary keys used for selection: VBELN select vbeln posnr from vbap into table i_vbap where vbeln in s_vbeln and posnr in s_posnr. * if the above selection is successful continue the process else exit * * form the report if sy-subrc ne 0. * message e002 with 'No data to display'. endif. *----------------------------------------------------------------------* * End-of-selection * *----------------------------------------------------------------------* end-of-selection. if not i_vbap[] is initial. loop at i_vbap. write:/ i_vbap-vbeln, i_vbap-posnr. endloop. endif.
Hi senthilkumar,
Have a look at url
http://help.sap.com/saphelp_47x200/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_47x200/helpdata/en/9f/dbaac935c111d1829f0000e829fbfe/frameset.htm
Thanks
Lakshman
Add a comment