2007 Dec 04 5:16 AM
Hi,
In a table i have 16 fields like a1,a2,----a16, based on user entry on selection screen, i hvae to fetch field.
Ex. If user enters 2 on selection screen i have to fetch 2nd field of the table,if it is 5 i have to fetch 5th field etc.
Is there any solution to get fields without using case and endcase.
Thnak u.
Hi,
You can use case or if statements..
Thanks
Shyja
2007 Dec 04 5:21 AM
2007 Dec 04 5:21 AM
Try like this:
DATA: L_FLD(30).
CONCATENATE 'FIELD_' P_NO INTO L_FIELD. " < FIELD_5
SELECT (L_FLD)
INTO L_VALUE
FROM ZTAB
WHERE COND = CONDITION.Regards,
Naimesh Patel
2007 Dec 04 5:49 AM
if it is select options in your selection screen...just use "IN" in your query....
if u r entries r of parameters type.
declare it as select-options in this way
selection-options:<entry> for <reference-field> no-extension no intervals.
reward if usefull.
2007 Dec 04 6:55 AM
Hi,
Try like this:
DATA: itab TYPE STANDARD TABLE OF spfli,
wa LIKE LINE OF itab.
DATA: line(72) TYPE c,
list LIKE TABLE OF line(72).
line = ' CITYFROM CITYTO '.
APPEND line TO list.
SELECT DISTINCT (list)
INTO CORRESPONDING FIELDS OF TABLE itab
FROM spfli.
IF sy-subrc EQ 0.
LOOP AT itab INTO wa.
WRITE: / wa-cityfrom, wa-cityto.
ENDLOOP.
ENDIF.
Regards,
Bhaskar
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |