<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: multiple alv problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-alv-problem/m-p/2954529#M696873</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is the whole code, also include pnp logical database in program attributes.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
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 &amp;lt;&amp;gt; 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 &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_fieldcat
*&amp;amp;---------------------------------------------------------------------*
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 '&amp;amp;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 '&amp;amp;F03' OR '&amp;amp;F15' OR '&amp;amp;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.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Oct 2007 11:58:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-16T11:58:32Z</dc:date>
    <item>
      <title>multiple alv problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-alv-problem/m-p/2954526#M696870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have declare internal table like below&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
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.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used REUSE_ALV_BLOCK_LIST_INIT, REUSE_ALV_BLOCK_LIST_APPEND and REUSE_ALV_BLOCK_LIST_DISPLAY to achive this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have placed REUSE_ALV_BLOCK_LIST_APPEND inside the loop of int_roe internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;I am getting multiple alv displayed in screen, But my problem is it shows same data for header and every alv table display.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pl. suggest any solution to resolve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 11:32:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-alv-problem/m-p/2954526#M696870</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T11:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: multiple alv problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-alv-problem/m-p/2954527#M696871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Haresh,&lt;/P&gt;&lt;P&gt; Paste the code we will try and let u know.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Avi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 11:41:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-alv-problem/m-p/2954527#M696871</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T11:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: multiple alv problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-alv-problem/m-p/2954528#M696872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Haresh,&lt;/P&gt;&lt;P&gt; Paste the code we will try and let u know.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Avi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 11:42:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-alv-problem/m-p/2954528#M696872</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T11:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: multiple alv problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-alv-problem/m-p/2954529#M696873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is the whole code, also include pnp logical database in program attributes.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
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 &amp;lt;&amp;gt; 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 &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_fieldcat
*&amp;amp;---------------------------------------------------------------------*
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 '&amp;amp;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 '&amp;amp;F03' OR '&amp;amp;F15' OR '&amp;amp;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.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 11:58:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-alv-problem/m-p/2954529#M696873</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T11:58:32Z</dc:date>
    </item>
  </channel>
</rss>

