‎2008 Jul 06 3:42 PM
Hi,
i can do this select i one time?
except to itab1 and itab2
move it to string and do it once.
Regards
SELECT (sel)
FROM /bic/0cz
INTO table itab1
FOR ALL ENTRIES IN les_t
WHERE dim0costcenter = les_t-dim0costcenter
AND dim0calmonth IN g_m.
SELECT (sel)
FROM /bic/0cz
INTO table itab2
FOR ALL ENTRIES IN les_t
WHERE dim0costcenter = les_t-dim0costcenter
AND dim0calmonth IN g_m.
‎2008 Jul 06 3:57 PM
If i am not mistaking u r selecting diff. diff. fields in these 2 selects.
I think u can do it with one select without using dynamic one.
Just create an internal table with structure that contains all the fields of both of ur selects. And then select all the fields at once
SELECT fld1
fld2
....
fldnj
FROM /bic/0cz
INTO table i_final
FOR ALL ENTRIES IN les_t
WHERE dim0costcenter = les_t-dim0costcenter
AND dim0calmonth IN g_m.
Also u can use dynamic select here. For that define an internal table of 72 char length. And store all the fields in it. Then use it in the select statement.
like:
data: i_tab type standard table of char72 .
data: w_tab type char72.
w_tab = 'FLD1'.
append w_tab to i_tab.
w_tab = 'FLD2'.
append w_tab to i_tab.
.........
w_tab = 'FLDn'.
append w_tab to i_tab.
SELECT (i_tab)
FROM /bic/0cz
INTO table i_final
FOR ALL ENTRIES IN les_t
WHERE dim0costcenter = les_t-dim0costcenter
AND dim0calmonth IN g_m.
Regards,
Joy.
‎2008 Jul 06 3:57 PM
If i am not mistaking u r selecting diff. diff. fields in these 2 selects.
I think u can do it with one select without using dynamic one.
Just create an internal table with structure that contains all the fields of both of ur selects. And then select all the fields at once
SELECT fld1
fld2
....
fldnj
FROM /bic/0cz
INTO table i_final
FOR ALL ENTRIES IN les_t
WHERE dim0costcenter = les_t-dim0costcenter
AND dim0calmonth IN g_m.
Also u can use dynamic select here. For that define an internal table of 72 char length. And store all the fields in it. Then use it in the select statement.
like:
data: i_tab type standard table of char72 .
data: w_tab type char72.
w_tab = 'FLD1'.
append w_tab to i_tab.
w_tab = 'FLD2'.
append w_tab to i_tab.
.........
w_tab = 'FLDn'.
append w_tab to i_tab.
SELECT (i_tab)
FROM /bic/0cz
INTO table i_final
FOR ALL ENTRIES IN les_t
WHERE dim0costcenter = les_t-dim0costcenter
AND dim0calmonth IN g_m.
Regards,
Joy.
‎2008 Jul 06 4:07 PM
Hi Joyjit,
thanks but i use dynamic select (sel) one for 3 fields
and i wont the next select be with 5 to diff table (diff structure).
i can do that?
Regards
‎2008 Jul 06 4:41 PM
Hi,
Not able to get you. Can pl. tell ur requirement in detail?
Regards,
Joy.
‎2008 Jul 06 5:16 PM
Hi Joyjit ,
my program is running in loops and what i wont is
first time to select 3(i do it in sel) fields to internal tables with 3 fields
and next select is to internal table with 5 fields.
and i wont to do it in one select .
like in the example
when x.
move 'itab1' to t_tab
SELECT (sel)
FROM /bic/0cz
INTO table t_tab
FOR ALL ENTRIES IN les_t
WHERE dim0costcenter = les_t-dim0costcenter
AND dim0calmonth IN g_m.
when y .
move 'itab2' to t_tab
SELECT (sel)
FROM /bic/0cz
INTO table t_tab
FOR ALL ENTRIES IN les_t
WHERE dim0costcenter = les_t-dim0costcenter
AND dim0calmonth IN g_m.Regards
‎2008 Jul 06 5:35 PM
Yes..that is possible...pl. see this code:
DATA:dy_table TYPE REF TO data,
dy_line TYPE REF TO data.
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa> TYPE ANY.
UNASSIGN : <dyn_table>,
<dyn_wa>.
when x.
Create internal table dynamically with the stucture of table name
entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF ty_itab1.<<Structure of i_tab1
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc = 0.
SELECT (sel)
FROM /bic/0cz
INTO table <dyn_table>
FOR ALL ENTRIES IN les_t
WHERE dim0costcenter = les_t-dim0costcenter
AND dim0calmonth IN g_m.
ENDIF.
Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
when y.
Create internal table dynamically with the stucture of table name
entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF ty_itab2.<<Structure of i_tab2
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc = 0.
SELECT (sel)
FROM /bic/0cz
INTO table <dyn_table>
FOR ALL ENTRIES IN les_t
WHERE dim0costcenter = les_t-dim0costcenter
AND dim0calmonth IN g_m.
ENDIF.
Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
Regards,
Joy.
‎2008 Jul 06 7:04 PM