Skip to Content
-2

ABAP finding first and last day of the fiscal year WITHOUT FM

Aug 09, 2017 at 07:06 AM

60

avatar image
Former Member

I am working on a project based on the t009b fiscal data table. Using the last date of every fiscal month (as provided in the table) , I need to find every single calendar day of the year from 2000-2030 in fiscal variant v8 and corresponding fiscal and calendar data. My final output should include all of the columns depicted below in a custom table.

I have completed most of the columns and have shown my current output in an internal table lt_zfiscal except

My results for the last and first days of each date's respective fiscal year are incorrect. My values for these fields only change when the calendar year changes, not the fiscal year. The t009B table only has a value for the calendar year (bdatj) so my AT NEW statement only switches the last & first dates of fiscal year values when a new calendar year record has been fetched from t009B. How can I tweak my code to change dates at a new fiscal year? I am not allowed to use a function module for any calculations on the table.

 AT NEW bdatj.

*     AT EVERY NEW YEAR

        READ TABLE lt_t009b INTO wa_t009b WITH KEY poper = 12 bdatj = year .

        fys_month = wa_t009b-bumon.

        fys_day = wa_t009b-butag.

        fys_year = wa_t009b-bdatj.

        CONCATENATE fys_year fys_month fys_day INTO fiscalyr_end1_c.

        fiscalyr_end1 = fiscalyr_end1_c.

        fiscalyr_end1 = fiscalyr_end1 + 1.

        fiscalyr_start1_c = fiscalyr_end1.

        fys_year_int = fys_year.

        fys_year_int = fys_year_int + 1 .


        READ TABLE lt_t009b INTO wa_t009b WITH KEY poper = 12 bdatj = fys_year_int.

        fys_month1 = wa_t009b-bumon.

        fys_day1 = wa_t009b-butag.

        fys_year1 = wa_t009b-bdatj.

        CONCATENATE fys_year1 fys_month1 fys_day1 INTO fiscalyr_end2_c.

        fiscalyr_end2 = fiscalyr_end2_c.


      ENDAT.
exceloutput.png (99.9 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Richard Harper Aug 09, 2017 at 07:59 AM
1

"I am not allowed to use a function module for any calculations on the table."

Who says ??

Share
10 |10000 characters needed characters left characters exceeded
Bertrand DELVALLEE Aug 09, 2017 at 08:14 AM
0

Hello,

Some logic are missing in your post.

  • What is the loop containing 'AT NEW'?
  • What is the parameter 'year' in your third line?
  • What is the T009 entry for your PERIV?
  • What are the entries of T009B from 12 2016 to 01 2018 for your PERIV?

You know that you can have several lines for "BUMON = 12" (one with RELJR = '+1')?

You may not be allowed to use FM but you can still copy the logic inside. That's weird.

Best regards

Bertrand

Share
10 |10000 characters needed characters left characters exceeded