Skip to Content
0

Start Routine to add missing month and values of those months

Jan 12, 2017 at 09:37 PM

53

avatar image
Former Member

Hi

In the psa I have:

Material - Valuated Area - period - year - values - qty

X - 2400 - 01 - 2016 - 200 - 5

X -2400 - 02 - 2016 - 150 - 3

X-2400 - 04 - 2016 - 100 - 2

I want in start routine to add missing months then make qty = last value of previous month of missing month

like 03 will be 150 and 3

how to do this? please help

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Raf Boudewijns Jan 13, 2017 at 09:08 AM
0

this is actually a general programming question (not BW specific), but your code should look something like this:

describe table source_package lines lv_lines.
loop at source_package assigning <source_fields>.
    check sy-tabix le lv_lines. " only process original entries
    if sy-tabix gt 1 and <source_fields>-"period" gt ( lv_previous_line-"period" + 1 ).
        wa_new_line = <source_fields>.
        wa_new_line-"period" = lv_previous_line-"period" + 1.
        append wa_new_line to source_package.
    endif.
    lv_previous_line = <source_fields>.
endloop.

where "period" refers to the technical name of your period field.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 14, 2017 at 06:28 AM
0

Thanks but actually I am looking for adding the missing periods and filling the other record values with the values of its previous month

Share
10 |10000 characters needed characters left characters exceeded
Raf Boudewijns Jan 16, 2017 at 07:52 AM
0

the above will do that...

Share
10 |10000 characters needed characters left characters exceeded