‎2009 Jul 18 7:47 AM
Hi all,
I have problem to run this code for getting select option values in runtime. Is there any function, methods or structure to know this? I didnot get DB values when I click select-option button.
I would like to display DB field values when i click select-option pushbutton. select-option values while programs working in runtime.
Example Code:
REPORT ZBAPUSHBUTTON.
data: lryrctno type ZLRYRCT-ZEBELN,
LDRIVER_FN type ZLRYRCT-DRIVER_FN,
LZDELDT TYPE ZLRYRCT-ZDELDT,
LZLRYNO TYPE ZLRYRCT-ZLRYNO,
LZDRIVERID type zlryrct-ZDRIVERID.
DATA: LRYRCT TYPE ZLRYRCT.
SELECTION-SCREEN PUSHBUTTON 10(10) LB1 USER-COMMAND PB1.
SELECTION-SCREEN PUSHBUTTON 25(10) LB2 USER-COMMAND PB2.
SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE T1.
PARAMETERS: PLRYCTNO like lryrctno,
PDR_FN LIKE LDRIVER_FN,
PZDELDT LIKE LZDELDT,
PZLRYNO LIKE LZLRYNO.
SELECTION-SCREEN END OF SCREEN 100.
SELECTION-SCREEN BEGIN OF SCREEN 200 TITLE T2.
select-options: slryctno for lryrctno,
sdr_fn for ldriver_fn,
szdeldt for lzdeldt,
szlryno for lzlryno,
pzdrid for lzdriverid no intervals.
SELECTION-SCREEN END OF SCREEN 200.
INITIALIZATION.
T1 = 'SELECT CHECK BOX AND RADIO BUTTON'.
T2 = 'SELECT PARAMETERS'.
LB1 = 'PARAMETER'.
LB2 = 'SELECT-OPTION'.
AT SELECTION-SCREEN.
CASE SY-UCOMM.
WHEN 'PB1'.
CALL SELECTION-SCREEN 100.
select single * from zlryrct into lryrct where zebeln = plryctno.
if sy-subrc = 0.
message 'primary key already exists. enter different lorry rect. no.' type 'W'.
endif.
LRYRCT-ZEBELN = PLRYCTNO.
LRYRCT-DRIVER_FN = PDR_FN .
LRYRCT-ZDELDT = PZDELDT.
LRYRCT-ZLRYNO = PZLRYNO.
INSERT INTO ZLRYRCT VALUES LRYRCT.
if not sy-subrc = 0.
MESSAGE 'Insert not possible' TYPE 'W' .
endif.
WHEN 'PB2'.
CALL SELECTION-SCREEN 200.
select * from zlryrct into lryrct where
zebeln in slryctno and
driver_fn in sdr_fn and
zdeldt in szdeldt and
zlryno in szlryno.
write: / lryrct-zebeln, LRYRCT-DRIVER_FN, LRYRCT-ZDELDT, LRYRCT-ZDELDT, LRYRCT-ZLRYNO .
endselect.
ENDCASE.
‎2009 Jul 18 11:12 PM
What you are looking for is called "search help" (SE11 transaction), you may reuse an existing one (it must be attached to data element, or structure component as foreign key, etc.) Please look at SAP documentation and forums. You may also program it yourself by using AT SELECTION-SCREEN ON VALUE-REQUEST FOR ...