<?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: ALV in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4372025#M1040311</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For passing data from two different tables you can use &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reuse_alv_fieldcatalog_merge&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer to this sample code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*"Table declarations...................................................
TABLES:
  spfli,
   sflight.

*"Type pools...................................................
TYPE-POOLS:
  slis.
*"Selection screen elements............................................
SELECT-OPTIONS:
  s_carrid FOR spfli-carrid,
  s_connid FOR spfli-connid.
*"Data declarations...................................................
DATA:
  BEGIN OF t_spfli OCCURS 0,
    carrid LIKE spfli-carrid,
    connid LIKE spfli-connid,
    cityfrom LIKE spfli-cityfrom,
    cityto LIKE spfli-cityto,
  END OF t_spfli.
*"Data declarations...................................................
DATA:
  BEGIN OF fs_sflight,
   carrid LIKE sflight-carrid,
   connid LIKE sflight-connid,
   fldate LIKE sflight-fldate,
   seatsmax LIKE sflight-seatsmax,
   seatsocc LIKE sflight-seatsocc,
  END OF fs_sflight.
*"Data declarations...................................................
DATA:
  BEGIN OF t_final OCCURS 0,
     carrid LIKE spfli-carrid,
     connid LIKE spfli-connid,
     cityfrom LIKE spfli-cityfrom,
     cityto LIKE spfli-cityto,
     fldate LIKE sflight-fldate,
     seatsmax LIKE sflight-seatsmax,
     seatsocc LIKE sflight-seatsocc,
END OF t_final.
*"--------------------------------------------------------------------*
* Internal table to hold sflight details                              *
*"--------------------------------------------------------------------*
DATA:
  t_sflight LIKE
    STANDARD TABLE OF fs_sflight.
*"--------------------------------------------------------------------*
* Internal table to hold fieldcatlog                                  *
*"--------------------------------------------------------------------*
DATA:
  t_fieldcat TYPE slis_t_fieldcat_alv,
  l_fieldcat LIKE LINE OF t_fieldcat.
*"Data declarations...................................................
DATA:
  w_layout TYPE slis_layout_alv,
  w_repid LIKE sy-repid.

*"--------------------------------------------------------------------*
*                       START-OF-SELECTION EVENT                      *
*"--------------------------------------------------------------------*
START-OF-SELECTION.
  w_repid = sy-repid.

 SELECT carrid
        connid
        cityfrom
        cityto
 FROM spfli
 INTO TABLE t_spfli
 WHERE carrid IN s_carrid
 AND connid IN s_connid.


 SELECT carrid
        connid
        fldate
        seatsmax
        seatsocc
 FROM sflight
 INTO TABLE t_sflight
 FOR ALL ENTRIES IN t_spfli
 WHERE carrid EQ t_spfli-carrid
 AND connid EQ t_spfli-connid.


  LOOP AT t_sflight INTO fs_sflight.
    READ TABLE t_spfli WITH KEY carrid = fs_sflight-carrid
                                connid = fs_sflight-connid.

    IF sy-subrc EQ 0.

      t_final-carrid = t_spfli-carrid.
      t_final-connid = t_spfli-connid.
      t_final-cityfrom = t_spfli-cityfrom.
      t_final-cityto = t_spfli-cityto.
      t_final-fldate = fs_sflight-fldate.
      t_final-seatsmax = fs_sflight-seatsmax.
      t_final-seatsocc = fs_sflight-seatsocc.
      APPEND t_final.

    ENDIF.                             " IF sy-subrc eq 0
    CLEAR t_final.

  ENDLOOP.                             " LOOP AT t_sflight....



  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
  i_program_name = w_repid
  i_internal_tabname = 'T_FINAL'
  i_inclname = w_repid
  CHANGING
  ct_fieldcat = t_fieldcat[]
  EXCEPTIONS
  inconsistent_interface = 1
  program_error = 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.


  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      is_layout     = w_layout
      it_fieldcat   = t_fieldcat
    TABLES
      t_outtab      = t_final
    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.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sravanthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Aug 2008 12:29:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-21T12:29:17Z</dc:date>
    <item>
      <title>ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4372021#M1040307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how to pass more than one table to REUSE_ALV_GRID_DISPLAY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have write following type of code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt; EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   I_GRID_TITLE                      = '                                                  PRODUCTION REPORT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   IT_FIELDCAT                       = T_FIELDCAT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    T_OUTTAB                          = it_po&lt;/P&gt;&lt;P&gt;    itab1                                   = itab1&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt; EXCEPTIONS&lt;/P&gt;&lt;P&gt;   PROGRAM_ERROR                     = 1&lt;/P&gt;&lt;P&gt;   OTHERS                            = 2&lt;/P&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i pass second table that time error is occurred.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2008 11:13:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4372021#M1040307</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-21T11:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4372022#M1040308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You Can't pass two tables in the F.M REUSE_ALV_GRID_DISPLAY's T_OUTTAB &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other wise you just merge the two tables contents into one table and pass it to the REUSE_ALV_GRID_DISPLAY's  T_OUTTAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Mallikharjuna Reddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2008 11:32:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4372022#M1040308</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-21T11:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4372023#M1040309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot pass more than one table when you are using the ALV Grid Function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can pass two tables only to Hierarchy ALV function. So if there is a realtion between two tables and you want to see the Hierarchy of the two tables then you can use Hierarchy function. Check the sample BALVHD01&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or else you have to Go for Blocked List ALV.  For this also you will pass only one table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the program BALVBT01&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you are using Block list for two tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you need to call BLOCK LIST APPEND Function two times one for each.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2008 11:36:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4372023#M1040309</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-21T11:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4372024#M1040310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it is showing error because u r passing second table in a simple report program. u cann't pass two tables&lt;/P&gt;&lt;P&gt;in REUSE_ALV_GRID_DISPLAY which is a function module for simple report. Basically using ALV&lt;/P&gt;&lt;P&gt;v can have 3 types of reports :&lt;/P&gt;&lt;P&gt;	   1. Simple Report&lt;/P&gt;&lt;P&gt;	   2. Block Report&lt;/P&gt;&lt;P&gt;	   3. Hierarchical Sequential Report&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in block and hierarchical report u can pass 2 tables not in simple report function modules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it will help in clearing ur doubt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2008 12:21:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4372024#M1040310</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-21T12:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4372025#M1040311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For passing data from two different tables you can use &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reuse_alv_fieldcatalog_merge&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer to this sample code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*"Table declarations...................................................
TABLES:
  spfli,
   sflight.

*"Type pools...................................................
TYPE-POOLS:
  slis.
*"Selection screen elements............................................
SELECT-OPTIONS:
  s_carrid FOR spfli-carrid,
  s_connid FOR spfli-connid.
*"Data declarations...................................................
DATA:
  BEGIN OF t_spfli OCCURS 0,
    carrid LIKE spfli-carrid,
    connid LIKE spfli-connid,
    cityfrom LIKE spfli-cityfrom,
    cityto LIKE spfli-cityto,
  END OF t_spfli.
*"Data declarations...................................................
DATA:
  BEGIN OF fs_sflight,
   carrid LIKE sflight-carrid,
   connid LIKE sflight-connid,
   fldate LIKE sflight-fldate,
   seatsmax LIKE sflight-seatsmax,
   seatsocc LIKE sflight-seatsocc,
  END OF fs_sflight.
*"Data declarations...................................................
DATA:
  BEGIN OF t_final OCCURS 0,
     carrid LIKE spfli-carrid,
     connid LIKE spfli-connid,
     cityfrom LIKE spfli-cityfrom,
     cityto LIKE spfli-cityto,
     fldate LIKE sflight-fldate,
     seatsmax LIKE sflight-seatsmax,
     seatsocc LIKE sflight-seatsocc,
END OF t_final.
*"--------------------------------------------------------------------*
* Internal table to hold sflight details                              *
*"--------------------------------------------------------------------*
DATA:
  t_sflight LIKE
    STANDARD TABLE OF fs_sflight.
*"--------------------------------------------------------------------*
* Internal table to hold fieldcatlog                                  *
*"--------------------------------------------------------------------*
DATA:
  t_fieldcat TYPE slis_t_fieldcat_alv,
  l_fieldcat LIKE LINE OF t_fieldcat.
*"Data declarations...................................................
DATA:
  w_layout TYPE slis_layout_alv,
  w_repid LIKE sy-repid.

*"--------------------------------------------------------------------*
*                       START-OF-SELECTION EVENT                      *
*"--------------------------------------------------------------------*
START-OF-SELECTION.
  w_repid = sy-repid.

 SELECT carrid
        connid
        cityfrom
        cityto
 FROM spfli
 INTO TABLE t_spfli
 WHERE carrid IN s_carrid
 AND connid IN s_connid.


 SELECT carrid
        connid
        fldate
        seatsmax
        seatsocc
 FROM sflight
 INTO TABLE t_sflight
 FOR ALL ENTRIES IN t_spfli
 WHERE carrid EQ t_spfli-carrid
 AND connid EQ t_spfli-connid.


  LOOP AT t_sflight INTO fs_sflight.
    READ TABLE t_spfli WITH KEY carrid = fs_sflight-carrid
                                connid = fs_sflight-connid.

    IF sy-subrc EQ 0.

      t_final-carrid = t_spfli-carrid.
      t_final-connid = t_spfli-connid.
      t_final-cityfrom = t_spfli-cityfrom.
      t_final-cityto = t_spfli-cityto.
      t_final-fldate = fs_sflight-fldate.
      t_final-seatsmax = fs_sflight-seatsmax.
      t_final-seatsocc = fs_sflight-seatsocc.
      APPEND t_final.

    ENDIF.                             " IF sy-subrc eq 0
    CLEAR t_final.

  ENDLOOP.                             " LOOP AT t_sflight....



  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
  i_program_name = w_repid
  i_internal_tabname = 'T_FINAL'
  i_inclname = w_repid
  CHANGING
  ct_fieldcat = t_fieldcat[]
  EXCEPTIONS
  inconsistent_interface = 1
  program_error = 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.


  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      is_layout     = w_layout
      it_fieldcat   = t_fieldcat
    TABLES
      t_outtab      = t_final
    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.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sravanthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2008 12:29:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4372025#M1040311</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-21T12:29:17Z</dc:date>
    </item>
  </channel>
</rss>

