2007 Nov 26 1:54 PM
Hi,
i have a RANGES in my ABAP code and i want to generate a table from it.
For exemple, i have the following code :
SELECT-OPTIONS P_BUKRS FOR PERNR-BUKRS.
Ok, now, this ranges is filled by this data :
1 I |EQ |0400| |
2 I |BT |0600|0620 |
I want to create an internal table which lists all data like this :
0400
0600
0601
0602
..
0620
Thanks for help.
2007 Nov 26 1:58 PM
1) create an itab with field number
and fill it in a do-loop with 1 to 1000 or more
loop that table:
loop at itab where number in p_bukrs.
append itab-number to outrec.
endloop.2)
alternative:
(why not immediately)
select bukrs from t001 into table outrec
where bukrs in p_bukrs.
endloop.A.
Message was edited by:
Andreas Mann
Hi,
i have a RANGES in my ABAP code and i want to generate a table from it.
For exemple, i have the following code :
SELECT-OPTIONS P_BUKRS FOR PERNR-BUKRS.
Ok, now, this ranges is filled by this data :
1 I |EQ |0400| |
2 I |BT |0600|0620 |
I want to create an internal table which lists all data like this :
0400
0600
0601
0602
..
0620
Thanks for help.
2007 Nov 26 1:56 PM
2007 Nov 26 1:58 PM
1) create an itab with field number
and fill it in a do-loop with 1 to 1000 or more
loop that table:
loop at itab where number in p_bukrs.
append itab-number to outrec.
endloop.2)
alternative:
(why not immediately)
select bukrs from t001 into table outrec
where bukrs in p_bukrs.
endloop.A.
Message was edited by:
Andreas Mann
2007 Nov 26 1:59 PM
DATA : BEGIN OF itab OCCURS 0,
BUKRS LIKE PERNR-BUKRS,
END OF itab.
SELECT BUKRS INTO CORRESPONDING FIELDS OF TABLE itab FROM PERNR WHERE BUKRS IN P_BUKRS.
2007 Nov 26 2:02 PM
2007 Nov 26 2:05 PM
Then change PERNR with actual table name which stroring BUKRS data.
2007 Nov 26 1:59 PM
select bukrs from t001 into table it_bukrs where bukrs in s_bukrs.
if sy-subrc = 0.
*--u will get all valid bukrs into table it_bukrs
endif.
this is because....t001 is check table for company code...and all valid company codes will be available here.....so u can use this table....
Regards
Vasu
2007 Nov 26 2:02 PM
SELECT bukrs
FROM t001
INTO TABLE i_bukrs
WHERE bukrs IN p_bukrs.