Skip to Content
0
Former Member
Sep 30, 2010 at 06:39 AM

data not showing when not defining PARAMETER

62 Views

hi all,

i have created a report in which i have define two Parametres i-e S_ANLKL FOR ANLA-ANLKL DEFAULT '1100' to '2790' and

  • S_ZUJHR LIKE ANLA-ZUJHR*.When i execute it by giving year 2005, 2006,2007 or 2010, it gives me data but when i execute it without defining any year it does'nt show me any data.Eventhough i have check in the table that there data when execute at table level.Could anybody identified my mistake.Following are the code for report:

include zalsd_alv_incl.

*Define Tables
TABLES:ANEP,ANLA,ANLC.


SELECT-OPTIONS:
    S_ANLKL FOR ANLA-ANLKL DEFAULT '1100' to '2790'.

PARAMETER:
    S_ZUJHR LIKE ANLA-ZUJHR.

DATA:BEGIN OF gi_anla OCCURS 0,
     bukrs  LIKE anla-bukrs,
     ANLN1  LIKE anla-ANLN1,
     ANLN2  LIKE anla-ANLN2,
     ZUJHR  LIKE anla-ZUJHR,"Fiscal Year
     AKTIV  LIKE ANLA-AKTIV,"Asset capitalization date
     ANLKL  LIKE ANLA-ANLKL,"Asset Class
     END OF gi_anla,


     BEGIN OF GI_ANLC OCCURS 0,
      bukrs  LIKE anlc-bukrs,
      NAFAP  LIKE anlc-nafag,"Posted Depreciation
      kansw  LIKE anlc-kansw,"Asset Acquisation Value
      ANLN2  LIKE anlc-anln2,"Asset Subnumber
      ANLN1  LIKE anlc-ANLN1,"Main Asset Number
      AFABE  LIKE ANLC-AFABE,"Real depreciation area
      ANSWL  LIKE ANLC-ANSWL,"Transactions for the year
     END OF GI_ANLC,

    BEGIN OF gi_main OCCURS 0,
     sno    type   i,       "S.No
     bukrs  LIKE anla-bukrs,"Company code
     ANLN1  LIKE anlc-ANLN1,"Main Asset Number
     anln2  LIKE anlc-anln2,"Asset Subnumber
     AKTIV  LIKE ANLA-AKTIV,"Asset capitalization date
     ANLKL  LIKE ANLA-ANLKL,"Asset Class
     ZUJHR  LIKE anla-ZUJHR,"Fiscal Year
     NAFAG  LIKE anlc-nafag,"Ordinary Depreciation Posted
     kansw  LIKE anlc-kansw,"Asset Acquisation Value
     PSTEND LIKE anlc-PSTEND,"Posting depreciation up to period
     AFABE  LIKE ANLC-AFABE,"Real depreciation area
     ANSWL  LIKE ANLC-ANSWL,"Transactions for the year
       END OF gi_main.

DATA: date_from TYPE d,
      date_to   TYPE d.

START-OF-SELECTION.
     PERFORM get_data.
     PERFORM organize_data.
     PERFORM f_display_report.
  END-OF-SELECTION.


form get_data.

  Data:
        lv_year(4) type n,
        lv_prvyear(4) type n,
        lv_datefrom type d,
        lv_dateto type d.

    move s_ZUJHR to lv_year.
    lv_prvyear = lv_year - 1.

    concatenate lv_prvyear '10' '01' into lv_datefrom.
    concatenate lv_year '09' '30' into lv_dateto.

  SELECT anlc~bukrs anlc~anln1 ANLC~ANLN2 ANLA~ZUJHR kansw nafaG PSTEND ANSWL ANLKL AKTIV
    INTO CORRESPONDING FIELDS OF TABLE gi_main
    FROM
    ANLC
    INNER JOIN ANLA ON
    anlc~bukrs = anla~bukrs AND
    anlc~anln1 = anla~anln1 AND
    ANLC~ANLN2 = ANLA~ANLN2
   WHERE ANLC~AFABE eq '01'
    AND ANLA~ZUJHR EQ S_ZUJHR
    AND   ANLA~ANLKL in S_ANLKL
    AND   ANLA~AKTIV between lv_datefrom and lv_dateto.

    ENDFORM.

  FORM organize_data.

  data: lv_index type sy-tabix.


  LOOP at gi_anla.
  move sy-tabix to gi_main-sno.
    READ TABLE gi_anla WITH KEY bukrs = gi_anla-bukrs
                                anln1 = gi_anla-anln1
                                anln2 = gi_anla-anln2.
    MOVE-CORRESPONDING gi_anla to gi_main.

    READ TABLE gi_anlc WITH KEY bukrs = gi_anlc-bukrs
                                anln1 = gi_anlc-anln1
                                anln2 = gi_anlc-anln2.
    IF sy-subrc = 0.
      MOVE-CORRESPONDING gi_anlc to gi_main.
    ENDIF.

    CLEAR gi_main.
 ENDLOOP.
    ENDFORM.

    form f_display_report.

  perform fill_fieldcat using 'SNO'       5    'S.No.' 'gi_main'.
  perform fill_fieldcat using 'ANLKL'     20   'Asset Class' 'gi_main'.
  perform fill_fieldcat using 'ANLN1'     20   'Asset Number' 'gi_main'.
  perform fill_fieldcat using 'ANLN2'     20   'Asset Subnumber' 'gi_main'.
  perform fill_fieldcat using 'AKTIV'     20   'Asset Capitalization Date' 'gi_main'.
  perform fill_fieldcat using 'KANSW'     20   'Asset Acquisation Value' 'gi_main'.
  perform fill_fieldcat using 'NAFAG'     20   'Posted Depreciation' 'gi_main'.
  perform fill_fieldcat using 'PSTEND'    20   'Posting depreciation up to period' 'gi_main'.
  perform fill_fieldcat using 'ANSWL'     20   'Transactions for the year' 'gi_main'.
  perform add_heading_alv using c_alv_head_header '' 'Ghulam Farooq Group'.
  perform display_alv using gi_main[].

endform.