‎2008 Jun 26 2:32 PM
Hi,
I have an internal table with data column.
I want to insert empty row with data for every day not present for a certain range (select-options: s_budat.).
How can I do it?
example.
I have:
s_budat-low = 01.01.2008 and s_budat-high = 31.01.2008
it_table:
01.01.2008 xxxx xxxx xxxx
04.01.2008 xxxx xxxx xxxx
10.01.2008 xxxx xxxx xxxx
Now I want this result:
01.01.2008 xxxx xxxx xxxx
02.01.2008
03.01.2008
04.01.2008 xxxx xxxx xxxx
05.01.2008
06.01.2008
07.01.2008
08.01.2008
09.01.2008
10.01.2008 xxxx xxxx xxxx
11.01.2008
..
..
..
31.01.2008
Many Thanks!!!
‎2008 Jun 26 2:38 PM
Hi,
You can Use
APPEND INITIAL LINE TO ITAB
This Statement append an inital line if the condition is false.
Thanks.
‎2008 Jun 26 2:52 PM
First, Retrieve data depending on S_BUDAT into an internal table
Then, read the internal table with dates in S_BUDAT
if data found then populate a work area with date and data
and append to the required internal table.
else populate the work area only with date and append to the
required internal table.
I hope this will eork
‎2008 Jun 26 3:26 PM
Hi Alfonso,
Select-options:
S_budat for u2026u2026..
Data :
W_date like sy-datum.
Start-of-selection.
<select stmt>
W_date = s_budat-low.
Loop at <itab>.
W_date = w_date + 1.
Read table <itab> with key <date-field> = w_date.
If sy-subrc ne 0.
Write 😕 w_date.
Else.
Write 😕 <ur table fields names>.
Endif.
Endloop.
Try this I think it works.
Regards,
Swapna.
‎2008 Jun 26 3:34 PM
Hi Alphoso,
I have written a code for u. Just try this i think u will get ur issue resolved.
tables :
sflight.
select-options :
s_date for sflight-fldate.
data :
t_sflight type table of sflight.
Data :
W_date like sy-datum.
Start-of-selection.
select *
from sflight
into table t_sflight
where fldate in s_date.
W_date = s_date-low.
Loop at t_sflight into sflight.
W_date = w_date + 1.
Read table t_sflight into sflight with key fldate = w_date.
If sy-subrc ne 0.
Write :/10 w_date.
Else.
Write :/5 sflight-carrid color 5 intensified off,
10 sflight-fldate.
Endif.
Endloop.
Reward points if useful,
Regards,
Swapna.
‎2008 Jun 26 3:40 PM
Hi Alfanso,
For any internal table if you want to append a blank line then use the statement APPEND INITIAL LINE TO ITAB.
I hope this will help you.
Help children of U.N World Food Program by rewarding points and encourage others to answer your queries.
‎2008 Jun 26 3:46 PM
Hi Alfonso,
first populate the internal table.
and then
loop at it_final.
if the next field is not the consecutve date then
append row into the internal table.
endloop.