‎2009 Jun 08 5:37 AM
Dear Friends,
I have developed one Dialog program. In that i have to select profit center like from and to option. Apart from i want to select more profit ceneter also. Now my problem s i designed form,to and more fielsd also. If i enter more filds it s not coming in to from to option.
Tell any gud function modulr for selectiong from,to and more fields.
Thanks & regards
Prabu K
‎2009 Jun 08 6:05 AM
Hi,
In you dialog screen just create 2 input fields.
1. <from field> 2. <to field>
Declare a range for that field type. eg. RANGES: R_RANGE for <field type>.
After the values are entered to the input fields. Have this code.
If from and to fields are not initial.
R_RANGE-SIGN = 'I'.
R_RANGE-OPTION = 'BT'.
R_RANGE-LOW = <from field low value>.
R_RANGE-HIGH = <from field high value>.
APPEND R_RANGE.
If from value only given.
R_RANGE-SIGN = 'I'.
R_RANGE-OPTION = 'EQ'.
R_RANGE-LOW = <from field low value>.
R_RANGE-HIGH = SPACE.
APPEND R_RANGE.
If to value only given.
R_RANGE-SIGN = 'I'.
R_RANGE-OPTION = 'BT'.
R_RANGE-LOW = SPACE
R_RANGE-HIGH = <from field high value>.
APPEND.
Hope this will help you.
Regards,
Smart Varghese
‎2009 Jun 08 6:12 AM
Hi ...
From -- to --- and more filds ..if i click that arrow (More fields) i need put more profit center that case which function module going to use..
‎2009 Jun 08 7:40 AM
Hi,
See below report it might help you.
REPORT selectoptionsrestrict.
Include type pool SSCR
TYPE-POOLS sscr.
TABLES :
marc.
defining the selection-screen
select-options :
s_matnr for marc-matnr,
s_werks for marc-werks.
Define the object to be passed to the RESTRICTION parameter
DATA restrict TYPE sscr_restrict.
Auxiliary objects for filling RESTRICT
DATA : optlist TYPE sscr_opt_list,
ass type sscr_ass.
INITIALIZATION.
Restricting the MATNR selection to only EQ and 'BT'.
optlist-name = 'OBJECTKEY1'.
optlist-options-eq = 'X'.
optlist-options-bt = 'X'.
APPEND optlist TO restrict-opt_list_tab.
ass-kind = 'S'.
ass-name = 'S_MATNR'.
ass-sg_main = 'I'.
ass-sg_addy = space.
ass-op_main = 'OBJECTKEY1'.
APPEND ass TO restrict-ass_tab.
Restricting the WERKS selection to CP, GE, LT, NE.
optlist-name = 'OBJECTKEY2'.
optlist-options-cp = 'X'.
optlist-options-ge = 'X'.
optlist-options-lt = 'X'.
optlist-options-ne = 'X'.
APPEND optlist TO restrict-opt_list_tab.
ass-kind = 'S'.
ass-name = 'S_WERKS'.
ass-sg_main = 'I'.
ass-sg_addy = space.
ass-op_main = 'OBJECTKEY2'.
APPEND ass TO restrict-ass_tab.
CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
restriction = restrict
EXCEPTIONS
TOO_LATE = 1
REPEATED = 2
SELOPT_WITHOUT_OPTIONS = 3
SELOPT_WITHOUT_SIGNS = 4
INVALID_SIGN = 5
EMPTY_OPTION_LIST = 6
INVALID_KIND = 7
REPEATED_KIND_A = 8
OTHERS = 9
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks
Mohit
‎2009 Jun 08 8:45 AM
Hi Prabu,
It is possible to achieve what you are looking for in dialog programming.
Steps to get SELECT-OPTIONS in module pool programs.
1. Start one dialog program with SAPZ_TEST.
2. Place the below code in the TOP include of the dialog program.
3. Create one screen 2000 .
4. Go to Layout of the screen and Define subscreen area on the screen and Name it as g_subscreen.
5. Place the below code in the Flow logic of the screen.
TABLES mara.
SELECTION-SCREEN BEGIN OF SCREEN 2100 AS SUBSCREEN.
SELECT-OPTIONS: matnr FOR mara-matnr.
SELECTION-SCREEN END OF SCREEN 2100.
.
6. Activate all.
7. Create Transaction code for the dialog program SAPZ_TEST.
8. Execute the transaction code. You will see the select-option like we see on Selection-screen.
I hope that you can understand.
Let me know if you have any problem.
Thanks
Venkat.O
PROCESS BEFORE OUTPUT.
CALL SUBSCREEN g_subscreen INCLUDING 'SAPMZ_TEST' '2100'.
PROCESS AFTER INPUT.
CALL SUBSCREEN g_subscreen.
‎2010 Dec 01 1:29 PM