‎2008 Apr 02 12:30 PM
Hi!
On selection screen I have two parameters (s_egrid and s_empid). If user enter something in first (but not in second) one, second one should be filled from database.
The problem is that I don't know how to fill the empty parameter.
Let's say that i have an internal table i_zemployee with list of all necessary employee Id's (stored in field empid)
if I Ioop like this
loop at i_zemployee into wa_zemployee.
insert wa_zemployee-empid into s_empid.
endloop.... I did something stupid but i hope that you understand what i need:
s_emipd[1] = 'u1'.
s_emipd[2] = 'u7'.
s_emipd[3] = 'u9'.... like array of user id's.
and this s_empid I need in my next SELECT statement like
SELECT * FROM ...
....
WHERE empid in s_empid.if someone knows the solution thanks in advance!
T.
‎2008 Apr 02 9:55 PM
All the select-options, e.g. s_empid, are range tables so to fill any of them, I'd suggest something like (not syntax checked):
start-of-selection.
perform fill_gaps.
form fill_gaps.
*" Provide defaults if empty default
if s_empid[] is initial. "not filled
loop at i_zemployee into wa_zemployee.
clear: s_empid. "clear header line each loop
s_empid-option = 'EQ'. "equals
s_empid-sign = 'I'. "include
s_empid-low = wa_zemployee-empid. "set a value
s_empid-high = space. "only used for between-type options
append s_empid.
endloop.
endif.
endform.
Jonathan
‎2008 Apr 02 1:25 PM
Hello,
To fill the second when the first one is selected you can use the event AT SELECTION-SCREEN ON <field>.
See this, extracted from SAP BC-ABA material.
REPORT EVENT_DEMO.
NODES SPFLI.
AT SELECTION-SCREEN ON CITY_FR.
IF CARRID-LOW EQ 'AA' AND CITY_FR NE 'NEW YORK'.
MESSAGE E010(HB).
ENDIF.
There are some helpfull samples in transaction ABAPDOCU.
Regards,
‎2008 Apr 02 9:55 PM
All the select-options, e.g. s_empid, are range tables so to fill any of them, I'd suggest something like (not syntax checked):
start-of-selection.
perform fill_gaps.
form fill_gaps.
*" Provide defaults if empty default
if s_empid[] is initial. "not filled
loop at i_zemployee into wa_zemployee.
clear: s_empid. "clear header line each loop
s_empid-option = 'EQ'. "equals
s_empid-sign = 'I'. "include
s_empid-low = wa_zemployee-empid. "set a value
s_empid-high = space. "only used for between-type options
append s_empid.
endloop.
endif.
endform.
Jonathan
‎2008 Apr 02 10:21 PM
HI try something like this...
tables: mara, makt.
data: begin of itab occurs 0,
matnr like mara-matnr,
end of itab.
data : begin of btab occurs 0,
maktx like makt-maktx,
end of btab.
ata mak like makt-maktx.
DATA : return like ddshretval occurs 0 with header line.
data: begin of dynpfields occurs 3.
include structure dynpread.
data: end of dynpfields.
select-options: p_matnr for mara-matnr.
select matnr from mara into table itab where matnr IN p_matnr.
loop at itab.
write: / itab-matnr.
endloop.
Initialization.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
REFRESH ITAB.
SELECT matnr FROM mara INTO TABLE ITAB.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR '
dynprofield = 'P_MATNR '
dynpprog = sy-REPID
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = ITAB
return_tab = return.
select single maktx from makt into mak where matnr = return-fieldval.
p_matnr = return-fieldval.
refresh return.
clear return.
move 'P_MAKTX' to dynpfields-fieldname.
move mak to dynpfields-fieldvalue.
append dynpfields.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = 'SY-REPID'
dynumb = '1000'
tables
dynpfields = dynpfields
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
refresh return.
clear return.
validate according to ur requirement.
Regards
Syed A
‎2008 Apr 03 3:50 AM
Hi,
First you have to observe here is, if you want to fill second parameter
by entering first one it is not possible,because when you enter some value in first one some event has to trigger ,under that event we can write code.Simply enter the values,will not trigger.
‎2008 Apr 03 9:34 AM
Jonathan provided me a correct answer! Problem solved 100% Thanks man! Your reward: 10 points