07-18-2007 12:28 AM
I want to give the user a flexibility to filter the data using select-options.
But, I want to give it in a Dialog/screen. Not in a Selection-screen!!
Please understand the difference between selection-screen(automatically generated screen) and screens/dialog(manually generated dialogs) in programming.
Ideas with Function Modules/Classes would be helpful.
Experts dont worry about points, right.
07-18-2007 12:34 AM
This is easier than you may think. First create your select-options by defining them using the same statements that you would for a selection screen, but define as a subscreen.
* Custom Selection Screen 1010
selection-screen begin of screen 1010 as subscreen.
selection-screen begin of block b1 with frame title text-001.
select-options: s_matnr for mara-matnr,
s_matkl for mara-matkl,
s_mtart for mara-mtart.
selection-screen end of block b1.
selection-screen end of screen 1010.
So now that you have a subscreen defined, you can simply embed this into a subscreen container within your dynpro.
Here is the full program. Here you need to create screen 100, and put a subscreen container inside it and name this container as subscreen_1010.
report zrich_0006 .
tables: mara.
* Custom Selection Screen 1010
selection-screen begin of screen 1010 as subscreen.
selection-screen begin of block b1 with frame title text-001.
select-options: s_matnr for mara-matnr,
s_matkl for mara-matkl,
s_mtart for mara-mtart.
selection-screen end of block b1.
selection-screen end of screen 1010.
start-of-selection.
call screen 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
module status_0100 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
endmodule.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
module user_command_0100 input.
endmodule.
* Screen screen 100 with a subscreen area called "subscreen_1010"
* Screen Flow Logic follows
*process before output.
*
* module status_0100.
*
* call subscreen subscreen_1010 including sy-repid '1010'.
*
*process after input.
*
* call subscreen subscreen_1010 .
*
* module user_command_0100.
Hope this helps.
Regards,
Rich Heilman
07-18-2007 12:32 AM
REPORT ZTEST_SCREEN .
DATA : BEGIN OF IT_DYNPFIELDS OCCURS 3.
INCLUDE STRUCTURE DYNPREAD.
DATA : END OF IT_DYNPFIELDS.
DATA: TEST(10) TYPE C.
RANGES: R_UNAME FOR SY-UNAME.
DATA: V_USERNAME LIKE SY-UNAME.
DATA : V_PROG LIKE D020S-PROG VALUE 'ZTEST_SCREEN',
V_DNUM LIKE D020S-DNUM VALUE '0100'.
CALL SCREEN 100.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'TEST'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
&----
*& Module GET_CURSOR_USERNAME INPUT
&----
text
----
MODULE GET_CURSOR_USERNAME INPUT.
REFRESH IT_DYNPFIELDS.
CLEAR IT_DYNPFIELDS.
MOVE 'V_USERNAME' TO IT_DYNPFIELDS-FIELDNAME.
APPEND IT_DYNPFIELDS.
CLEAR IT_DYNPFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = V_PROG
DYNUMB = V_DNUM
TRANSLATE_TO_UPPER = 'X'
TABLES
DYNPFIELDS = IT_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 IT_DYNPFIELDS WITH KEY FIELDNAME = 'V_USERNAME'.
IF SY-SUBRC = 0.
V_USERNAME = IT_DYNPFIELDS-FIELDVALUE.
ENDIF.
ENDIF.
PERFORM GET_MULTIPLE.
ENDMODULE. " GET_CURSOR_USERNAME INPUT
&----
*& Form GET_MULTIPLE
&----
text
----
--> p1 text
<-- p2 text
----
FORM GET_MULTIPLE .
Dynamically holding Field name
FIELD-SYMBOLS: <FST> TYPE STANDARD TABLE.
IF R_UNAME[] IS INITIAL.
IF NOT V_USERNAME IS INITIAL.
R_UNAME-SIGN = 'I'.
R_UNAME-OPTION = 'EQ'.
R_UNAME-LOW = V_USERNAME.
APPEND R_UNAME.
CLEAR R_UNAME.
ENDIF.
ENDIF.
ASSIGN R_UNAME[] TO <FST>.
CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
EXPORTING
TITLE = 'Select Multiple Value'(059)
TEXT = 'Finish Group'(058)
SIGNED = 'X'
LOWER_CASE = ' '
NO_INTERVAL_CHECK = 'X'
JUST_DISPLAY = ' '
JUST_INCL = 'X'
TABLES
RANGE = <FST>
EXCEPTIONS
NO_RANGE_TAB = 1
CANCELLED = 2
INTERNAL_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
READ TABLE R_UNAME INDEX 1.
IF SY-SUBRC = 0.
V_USERNAME = R_UNAME-LOW.
ENDIF.
ENDIF.
ENDFORM. " GET_MULTIPLE
07-18-2007 1:36 AM
Thanks for the reply man, but the Rich gave the perfect solution which was much easier to implement.
And also I had to look at the effort for each select-option.
Anyway, keep it up dude.
07-18-2007 12:34 AM
This is easier than you may think. First create your select-options by defining them using the same statements that you would for a selection screen, but define as a subscreen.
* Custom Selection Screen 1010
selection-screen begin of screen 1010 as subscreen.
selection-screen begin of block b1 with frame title text-001.
select-options: s_matnr for mara-matnr,
s_matkl for mara-matkl,
s_mtart for mara-mtart.
selection-screen end of block b1.
selection-screen end of screen 1010.
So now that you have a subscreen defined, you can simply embed this into a subscreen container within your dynpro.
Here is the full program. Here you need to create screen 100, and put a subscreen container inside it and name this container as subscreen_1010.
report zrich_0006 .
tables: mara.
* Custom Selection Screen 1010
selection-screen begin of screen 1010 as subscreen.
selection-screen begin of block b1 with frame title text-001.
select-options: s_matnr for mara-matnr,
s_matkl for mara-matkl,
s_mtart for mara-mtart.
selection-screen end of block b1.
selection-screen end of screen 1010.
start-of-selection.
call screen 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
module status_0100 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
endmodule.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
module user_command_0100 input.
endmodule.
* Screen screen 100 with a subscreen area called "subscreen_1010"
* Screen Flow Logic follows
*process before output.
*
* module status_0100.
*
* call subscreen subscreen_1010 including sy-repid '1010'.
*
*process after input.
*
* call subscreen subscreen_1010 .
*
* module user_command_0100.
Hope this helps.
Regards,
Rich Heilman