Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

issue in interactive report

Hi All,

in my report i am using interactive concept. for example i am giving personal number range in selection screen as 12900 13600 . In basic list it is displaying the output. when i click on personal number it will show the details in secondary list ut in my report in basic list when i click on 12900 it is considering last pernr i.e. 13600 and it is showing the 13600 details in the secondary list anybody can help i am sending my code below.

REPORT zmaheedhar.

TABLES : pa0001.

DATA : BEGIN OF itab OCCURS 0,

pernr TYPE pa0001-pernr,

begda TYPE pa0001-begda,

END OF itab.

DATA : BEGIN OF lt_pa2001 OCCURS 0,

pernr TYPE pa0001-pernr,

awart TYPE pa2001-awart,

begda TYPE pa2001-begda,

END OF lt_pa2001.

DATA : v_field(30) TYPE c.

SELECT-OPTIONS : s_pernr FOR pa0001-pernr.

SELECT pernr

begda

FROM pa0001

INTO TABLE itab

WHERE pernr IN s_pernr AND

begda LE sy-datum AND

endda GE sy-datum.

IF NOT itab[] IS INITIAL.

SORT itab BY pernr.

ENDIF.

LOOP AT itab.

WRITE: /2 itab-pernr HOTSPOT ON,

itab-begda.

ENDLOOP.

AT LINE-SELECTION.

GET CURSOR FIELD v_field.

CASE v_field.

WHEN 'ITAB-PERNR'.

PERFORM get_data USING itab-pernr.

ENDCASE.

&----


*& Form GET_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM get_data USING lv_pernr.

CLEAR : lt_pa2001.refresh lt_pa2001.

SELECT pernr awart begda

FROM pa2001 INTO TABLE lt_pa2001

WHERE pernr = lv_pernr.

IF NOT LT_PA2001[] IS INITIAL.

SORT LT_PA2001 BY PERNR.

ENDIF.

LOOP AT LT_PA2001.

WRITE :/2 LT_PA2001-PERNR,

LT_PA2001-AWART,

LT_PA2001-BEGDA.

ENDLOOP.

ENDFORM. " GET_DATA

thanks,

maheedhar

Tags:
replied

Here is the corrected code:


*&---------------------------------------------------------------------*
*& Report  Z0310_TEST1
*&
*&---------------------------------------------------------------------*

REPORT  z0310_test1.
TABLES : pa0001.

DATA : BEGIN OF itab OCCURS 0,
pernr TYPE pa0001-pernr,
begda TYPE pa0001-begda,
END OF itab.

DATA : BEGIN OF lt_pa2001 OCCURS 0,
pernr TYPE pa0001-pernr,
awart TYPE pa2001-awart,
begda TYPE pa2001-begda,
END OF lt_pa2001.
DATA : v_field(30) TYPE c.
SELECT-OPTIONS : s_pernr FOR pa0001-pernr.

SELECT pernr
begda
FROM pa0001
INTO TABLE itab
WHERE pernr IN s_pernr AND
begda LE sy-datum AND
endda GE sy-datum.

IF NOT itab[] IS INITIAL.
  SORT itab BY pernr.
ENDIF.

LOOP AT itab.
  WRITE: /2 itab-pernr HOTSPOT ON,
  itab-begda.
  HIDE itab-pernr.
ENDLOOP.

AT LINE-SELECTION.
  GET CURSOR FIELD v_field.
  CASE v_field.
    WHEN 'ITAB-PERNR'.
      PERFORM get_data USING itab-pernr.
  ENDCASE.
*&---------------------------------------------------------------------
*& Form GET_DATA
*&---------------------------------------------------------------------
FORM get_data USING lv_pernr.

  CLEAR : lt_pa2001.REFRESH lt_pa2001.
  SELECT pernr awart begda
  FROM pa2001 INTO TABLE lt_pa2001
  WHERE pernr = lv_pernr.


  IF NOT lt_pa2001[] IS INITIAL.
    SORT lt_pa2001 BY pernr.

    LOOP AT lt_pa2001.

      WRITE :/2 lt_pa2001-pernr,
      lt_pa2001-awart,
      lt_pa2001-begda.
    ENDLOOP.

  ENDIF.
ENDFORM. " GET_DATA

Hope That Helps

Anirban M.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question