Application Development and Automation 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: 
Read only

multiple alv problem

Former Member
0 Likes
593

I have declare internal table like below


TYPES:
  BEGIN OF ty_roe,
    pernr TYPE persno,
    seqnr TYPE cdseq,
    roedata TYPE hrpayca_pc298_t,
  END OF ty_roe.

DATA:
  wa_roe TYPE ty_roe,
  int_roe TYPE TABLE OF ty_roe.

I have filled data in int_roe for various pernr and seqnr. So ultimately for each combination of pernr and seqnr there may be no. of lines in roedata field.

my purpose is to display pernr and seqnr in head of alv display and alv display will contain data which is there in roedata of int_roe internal table.

I have used REUSE_ALV_BLOCK_LIST_INIT, REUSE_ALV_BLOCK_LIST_APPEND and REUSE_ALV_BLOCK_LIST_DISPLAY to achive this.

i have placed REUSE_ALV_BLOCK_LIST_APPEND inside the loop of int_roe internal table.

<b>I am getting multiple alv displayed in screen, But my problem is it shows same data for header and every alv table display.</b>

pl. suggest any solution to resolve this.

Thanks

3 REPLIES 3
Read only

Former Member
0 Likes
564

Hi Haresh,

Paste the code we will try and let u know.

Regards

Avi

Read only

0 Likes
564

here is the whole code, also include pnp logical database in program attributes.


REPORT zpayrollroe_adj LINE-SIZE 255
                 NO STANDARD PAGE HEADING .

TYPE-POOLS:
  slis.

************************************************************************
*  TABLES
************************************************************************
TABLES:pernr,          "STANDARD SELECTIONS FOR HR MASTER DATA REPORTING
       pcl1,           "HR CLUSTER 1
       pcl2.           "HR CLUSTER 2

INCLUDE rpc2cd09.  "Cluster CD data definition
INCLUDE rpc2ca00.  "Cluster CA Data-Definition
INCLUDE rpppxd00.  "Data Definition buffer PCL1/PCL2 Buffer
INCLUDE rpppxd10.  "Common part buffer PCL1/PCL2
INCLUDE rpppxm00.  "Buffer Handling routine
INCLUDE rpc2rkk0.  "Cluster IN data definition
INCLUDE rpc2rx09.

TYPES:
  BEGIN OF ty_roe,
    pernr TYPE persno,
    seqnr TYPE cdseq,
    roedata TYPE hrpayca_pc298_t,
  END OF ty_roe.

DATA:
  wa_roe TYPE ty_roe,
  int_roe TYPE TABLE OF ty_roe.

DATA:
  wa_events TYPE slis_alv_event,
  int_events TYPE slis_t_event,
  wa_fcat TYPE slis_fieldcat_alv,
  int_fcat TYPE slis_t_fieldcat_alv,
  wa_layout TYPE slis_layout_alv,
  w_repid TYPE syrepid,
  tabname TYPE slis_tabname,
  wa_print TYPE slis_print_alv.


START-OF-SELECTION.
  IF pnptimra = 'X'.
    MESSAGE e888(bctrain) WITH 'Choose current period only'.
    EXIT.
  ENDIF.

GET pernr.

  CLEAR rgdir.
  REFRESH rgdir.
  cd-key-pernr = pernr-pernr.
  rp-imp-c2-cu.

  SORT rgdir BY seqnr DESCENDING.
  READ TABLE rgdir INDEX 1.

  IF rgdir-srtza = 'A' AND rgdir-payty = ' '.
    rx-key-seqno = rgdir-seqnr.
    rx-key-pernr = pernr-pernr.
    rp-imp-c2-rk.

    IF rp-imp-rk-subrc = 0.
      wa_roe-pernr = rx-key-pernr.
      wa_roe-seqnr = rx-key-seqno.
      wa_roe-roedata[] = roe[].
      APPEND wa_roe TO int_roe.
      clear wa_roe.
    ENDIF.
  ENDIF.

END-OF-SELECTION.
  PERFORM build_fieldcat.

  w_repid = sy-repid.

  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
      i_callback_program             = w_repid
*     I_CALLBACK_PF_STATUS_SET       = ' '
*     I_CALLBACK_USER_COMMAND        = ' '
*     IT_EXCLUDING                   =
            .
  CLEAR wa_events.
  REFRESH int_events.

  wa_events-name = 'TOP_OF_PAGE'.
  wa_events-form = 'FC_TOP_OF_PAGE'.

  APPEND wa_events TO int_events.

  LOOP AT int_roe INTO wa_roe.


    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        is_layout                        = wa_layout
        it_fieldcat                      = int_fcat
        i_tabname                        = 'WA_ROE-ROEDATA'
        it_events                        = int_events
      TABLES
        t_outtab                         = wa_roe-roedata
     EXCEPTIONS
       program_error                    = 1
       maximum_of_appends_reached       = 2
       OTHERS                           = 3
              .
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

  ENDLOOP.

  wa_print-reserve_lines = 2.

  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK             = ' '
     is_print                      = wa_print
*   I_SCREEN_START_COLUMN         = 0
*   I_SCREEN_START_LINE           = 0
*   I_SCREEN_END_COLUMN           = 0
*   I_SCREEN_END_LINE             = 0
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER       =
*   ES_EXIT_CAUSED_BY_USER        =
   EXCEPTIONS
     program_error                 = 1
     OTHERS                        = 2
            .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.


*&---------------------------------------------------------------------*
*&      Form  build_fieldcat
*&---------------------------------------------------------------------*
FORM build_fieldcat.
  CLEAR: wa_fcat.
  REFRESH: int_fcat.

  wa_fcat-fieldname = 'BEGDA'.
  wa_fcat-ref_tabname = 'PC298'.
  APPEND wa_fcat TO int_fcat.
  CLEAR wa_fcat.

  wa_fcat-fieldname = 'ENDDA'.
  wa_fcat-ref_tabname = 'PC298'.
  APPEND wa_fcat TO int_fcat.
  CLEAR wa_fcat.

  wa_fcat-fieldname = 'PERMO'.
  wa_fcat-ref_tabname = 'PC298'.
  APPEND wa_fcat TO int_fcat.
  CLEAR wa_fcat.

  wa_fcat-fieldname = 'ANZHL'.
  wa_fcat-ref_tabname = 'PC298'.
*  wa_fcat-edit = 'X'.
  wa_fcat-input = 'X'.
  APPEND wa_fcat TO int_fcat.
  CLEAR wa_fcat.

  wa_fcat-fieldname = 'BETRG'.
  wa_fcat-ref_tabname = 'PC298'.
*  wa_fcat-edit = 'X'.
  wa_fcat-input = 'X'.
  APPEND wa_fcat TO int_fcat.
  CLEAR wa_fcat.

ENDFORM.                    " build_fieldcat

*---------------------------------------------------------------------*
*       FORM PFSTATUS                                                 *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM pfstatus USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'PSTAT'.
ENDFORM.

*---------------------------------------------------------------------*
*       FORM user_command                                             *
*---------------------------------------------------------------------*
FORM user_command USING r_ucomm TYPE syucomm
                        rs_selfield TYPE slis_selfield.
  CASE r_ucomm.
    WHEN '&DATA_SAVE'.
*      roe[] = int_roe_new[].
**      rp-exp-c2-rk.
*      EXPORT
*       rk-version
*       versc
*       wpbp
*       abc
*       rt
*       crt
*       bt
*       c0
*       c1
*       v0
*       vcp
*       alp
*       dft
*       grt
*       ls
*       status
*       arrrs
*       ddntk
*       accr
*       bentab
*       ab
*       fund
*       average
*       modif
*       name
*       adr
*       perm
*       tax1
*       taxo
*       tax2
*       taxi
*       tcrt
*       tcrti
*       roe
*       vc1
*       vc2
*       cust
*       grord
*       grdbt
*       grrec
*       grcum
*       dowp
*       doc0
*       wcb1
*       wtdt
*      TO DATABASE pcl2(rk) ID rx-key.

    WHEN '&F03' OR '&F15' OR '&F12'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDFORM.

*---------------------------------------------------------------------*
*       FORM fc_top_of_page                                           *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM fc_top_of_page.
  WRITE:/ 'Personnel Number', wa_roe-pernr,
        / 'Seq. Number', wa_roe-seqnr.
ENDFORM.

Read only

Former Member
0 Likes
564

Hi Haresh,

Paste the code we will try and let u know.

Regards

Avi