Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

hi i would like tovalidate the quantity with the months .

Former Member
0 Kudos

i mean if for particular month what is the quantity and for that year what is the quantity like

year-2003 year-2004 year-2005

January 13 15 15

February 143 12 10

.

.

.

December . . . .

like the above. so i tried to get for the first year.ie. for every single year , but in the output i suppose to get for every year, whether the data occurs or not and that too it should display all the years as per select-options.

Message was edited by: kalyan kumar konduru

2 REPLIES 2

Manohar2u
Active Contributor
0 Kudos

1. In selection screen you can give date or period as select option.

2. Pickup all record which fall under given condition. Here it goes the logic

3. Loop at itab.

case sy-datum+4(2)

when datum+4(2) = '01'

month = sy-datum+4(2

year = sy-datum+0(4)

quantity = Quantity + itab-quantity.

when sy-datum+4(2) = '02'.

---

endcase.

append to new internal itab2.

endloop.

Regds

Manohar

andreas_mann3
Active Contributor
0 Kudos

hi,

here's a test-prg.

REPORT zforum91 .

DATA: BEGIN OF itab OCCURS 0,
      month LIKE bkpf-monat,
      year LIKE bkpf-gjahr,
      val(4) TYPE n,
      END OF itab.

DATA: BEGIN OF iy OCCURS 0,
      year LIKE bkpf-gjahr,
      END OF iy.
DATA mon TYPE t247-ktx.

SELECT-OPTIONS s_year FOR itab-year DEFAULT 2001 TO 2003.

START-OF-SELECTION.

  SELECT  jahr FROM  tfacs INTO  iy
         WHERE  jahr IN s_year.
    COLLECT iy.
  ENDSELECT.

*test-data
  APPEND '01200110' TO itab.
  APPEND '01200211' TO itab.
  APPEND '01200312' TO itab.
  APPEND '02200113' TO itab.
  APPEND '02200214' TO itab.
  APPEND '02200315' TO itab.

  SORT itab.
  LOOP AT itab.
    AT NEW month.
      NEW-LINE.
      SELECT SINGLE ktx FROM  t247 INTO mon
             WHERE  spras  = sy-langu
             AND    mnr    = itab-month.
      WRITE mon.
    ENDAT.

    WRITE   itab-val.

  ENDLOOP.

TOP-OF-PAGE.
  WRITE: / 'mth'.
  LOOP AT iy.
    WRITE: iy-year.
  ENDLOOP.
  ULINE.

pls reward points if answers are useful

thank you

Andreas