Skip to Content
avatar image
Former Member

Start Routine to add missing month and values of those months

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 13, 2017 at 09:08 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 14, 2017 at 06:28 AM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 16, 2017 at 07:52 AM

    the above will do that...

    Add comment
    10|10000 characters needed characters exceeded