<?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: Please send the ALV code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720124#M314374</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;In your situation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'&lt;/P&gt;&lt;P&gt;     EXPORTING&lt;/P&gt;&lt;P&gt;          I_PROGRAM_NAME      = GT_REPID    &lt;/P&gt;&lt;P&gt;          I_INTERNAL_TABNAME = 'T_P0002' &lt;/P&gt;&lt;P&gt;          I_INCLNAME                  = GT_REPID&lt;/P&gt;&lt;P&gt;     CHANGING&lt;/P&gt;&lt;P&gt;          CT_FIELDCAT                = GT_FIELDCAT[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the delete all fields the users can't see.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;max_abap4@yahoo.it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Nov 2006 09:17:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-11T09:17:58Z</dc:date>
    <item>
      <title>Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720114#M314364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please send the ALV code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;requirement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the user having the role 1 I want to download all the fields&lt;/P&gt;&lt;P&gt;If the user having the role 2 I want to download the 2 or 3 fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly send the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in ad......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 07:53:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720114#M314364</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T07:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720115#M314365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the Pseudo Code&lt;/P&gt;&lt;P&gt;1. You need to have a custom button for download functionality&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Upon clicking the button do a authority check&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AUTHORITY-CHECK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  Download the entire internal table.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;  Have another table with only those fields and copy the data from main internal table and then download.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;P&gt;Note - Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 08:06:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720115#M314365</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T08:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720116#M314366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;where i have to write the Auth check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after the event_download is it correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;its very helpfull answwer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 08:10:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720116#M314366</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T08:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720117#M314367</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;U can try to use the authorizazions or check if the user belong or not belong to a certain role:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: ROLE.

* Extract the fields for ALV
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            I_PROGRAM_NAME     = GT_REPID
            I_INTERNAL_TABNAME = 'T_OUTPUT'
            I_INCLNAME         = GT_REPID
*            I_STRUCTURE_NAME   = 'LFA1'
       CHANGING
            CT_FIELDCAT        = GT_FIELDCAT[].


* Check the authorizations:
  AUTHORITY-CHECK OBJECT &amp;lt;AUTH OBJECT&amp;gt;
           ID &amp;lt;ID&amp;gt; FIELD &amp;lt;FIELD&amp;gt;.
           
  IF SY-SUBRC = 0. 
    ROLE = '1'.
  ELSE.
    ROLE = '2'.
  ENDIF.


  LOOP AT GT_FIELDCAT INTO LS_FIELDCAT.  
    CASE LS_FIELDCAT-FIELDNAME.
      WHEN &amp;lt;FIELD1&amp;gt; OR &amp;lt;FIELD2&amp;gt; ....
         IF ROLE = '2'.
           DELETE GT_FIELDCAT.
         ENDIF.
      WHEN OTHERS.
      .............. 
    ENDCASE.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 08:15:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720117#M314367</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T08:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720118#M314368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MAX,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IN WHICH TABLE  CAN I GET THE ROLES DETAILS AND USER DETAILS.&lt;/P&gt;&lt;P&gt;HOW I CAN LINK THESE DETAILS.&lt;/P&gt;&lt;P&gt;I AM DOING THE HRREPORT THE OUTPUT WILL DISPLAY IN ALV GRID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PL GUIDE ME.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 08:26:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720118#M314368</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T08:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720119#M314369</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;In table AGR_USERS you find all user roles.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code should be good for you if "Download" means you don't have to show some fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 08:32:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720119#M314369</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T08:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720120#M314370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MAX,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CAN U SEND THE FULL CODINF PL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 08:46:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720120#M314370</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T08:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720121#M314371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here I use the fm for ALV, but the concept doesn't change for OO ALV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know how you use the ALV &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPE-POOLS SLIS.

DATA: GT_FIELDCAT   TYPE SLIS_T_FIELDCAT_ALV,
      LS_FIELDCAT   TYPE SLIS_FIELDCAT_ALV,
      GT_REPID      LIKE SY-REPID.


DATA: T_ROLES LIKE STANDARD TABLE OF AGR_USERS WITH HEADER LINE.

DATA: BEGIN OF T_OUTPUT OCCURS 0,
        FIELD1,
        FIELD2,
        FIELD3,
        FIELD4,
        FIELDN,
      END   OF T_OUTPUT.

DATA: ROLE.


* Check user rules

SELECT * FROM AGR_USERS INTO TABLE T_ROLES WHERE UNAME = SY-UNAME
                                             AND FROM_DAT &amp;lt;= SY-DATUM
                                             AND TO_DAT =&amp;gt; SY-DATUM.

READ TABLE T_ROLES WITH KEY AGR_NAME = '????????'.
IF SY-SUBRC = 0.
* User can see all fields.
  ROLE = '1'.
ELSE.
  ROLE = '2'.
ENDIF.




GT_REPID = SY-REPID.

* Extract the fields for ALV
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
          I_PROGRAM_NAME     = GT_REPID
          I_INTERNAL_TABNAME = 'T_OUTPUT'
          I_INCLNAME         = GT_REPID
     CHANGING
          CT_FIELDCAT        = GT_FIELDCAT[].


* Check the authorizations:

IF ROLE = '2'.
* Delete all fields the user can't see

  DELETE GT_FIELDCAT WHERE FIELDNAME = 'FIELD1'
                        OR FIELDNAME = 'FIELD2'.

ENDIF.

* Show the output

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
          I_CALLBACK_PROGRAM = GT_REPID
          IT_FIELDCAT        = GT_FIELDCAT
     TABLES
          T_OUTTAB           = T_OUTPUT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 09:03:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720121#M314371</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T09:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720122#M314372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MAX,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS FOR UR HELP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I AM GOING TO WRITE THE CODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CAN U GIVE UR YAHOO CHAT IT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 09:10:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720122#M314372</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T09:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720123#M314373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I HAVE WRITTEN THE BELOW CODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIRST I TRY TO DISPLAY THE ALL RECORDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZSSN&lt;/P&gt;&lt;P&gt;       LINE-SIZE 140&lt;/P&gt;&lt;P&gt;       LINE-COUNT 40&lt;/P&gt;&lt;P&gt;       NO STANDARD PAGE HEADING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Program Name   : ZSSN                   Date Created : 11/13/2006    *&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Author's Name  : Satish (CN000244)                                   *&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Program Title  : SSN Banking Info                                    *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Tables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;TABLES: PERNR,&lt;/P&gt;&lt;P&gt;        T502T.  " Marital Status Designators&lt;/P&gt;&lt;P&gt;TYPE-POOLS: SLIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Info Types&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INFOTYPES: 0001,&lt;/P&gt;&lt;P&gt;           0002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Tables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*DATA: T_P0002 LIKE STANDARD TABLE OF P0002 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: T_T502T LIKE STANDARD TABLE OF T502T WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: STAT(10) TYPE C,&lt;/P&gt;&lt;P&gt;      CHECK TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF T_P0002 OCCURS 0,&lt;/P&gt;&lt;P&gt;        BEGDA LIKE P0002-BEGDA,&lt;/P&gt;&lt;P&gt;        ENDDA LIKE P0002-ENDDA,&lt;/P&gt;&lt;P&gt;        NACHN LIKE P0002-NACHN,&lt;/P&gt;&lt;P&gt;        VORNA LIKE P0002-VORNA,&lt;/P&gt;&lt;P&gt;        FAMST LIKE T502T-FAMST,&lt;/P&gt;&lt;P&gt;        FTEXT LIKE T502T-FTEXT,&lt;/P&gt;&lt;P&gt;      END OF T_P0002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: gt_fieldcat TYPE slis_t_fieldcat_alv, "ALV Catalog Table&lt;/P&gt;&lt;P&gt;      gs_fieldcat TYPE slis_fieldcat_alv.   "ALV Catalog Structure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start of selection&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GET PERNR.&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;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To get the marital status&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SELECT * FROM T502T&lt;/P&gt;&lt;P&gt;           INTO TABLE T_T502T&lt;/P&gt;&lt;P&gt;           WHERE SPRSL = 'EN'.&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC EQ 0 .&lt;/P&gt;&lt;P&gt;    SORT T_T502T BY FAMST .&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;  RP-READ-INFOTYPE P0002-PERNR 0002 P0002 PN-BEGDA PN-ENDDA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  RP-PROVIDE-FROM-LAST P0002 SPACE PN-BEGDA '31129999' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF PNP-SW-FOUND EQ '1' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    READ TABLE T_T502T WITH KEY FAMST = P0002-FAMST&lt;/P&gt;&lt;P&gt;                                        BINARY SEARCH .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    T_P0002-BEGDA = P0002-BEGDA.&lt;/P&gt;&lt;P&gt;    T_P0002-ENDDA = P0002-ENDDA.&lt;/P&gt;&lt;P&gt;    T_P0002-NACHN = P0002-NACHN.&lt;/P&gt;&lt;P&gt;    T_P0002-VORNA = P0002-VORNA.&lt;/P&gt;&lt;P&gt;    T_P0002-FAMST = P0002-FAMST.&lt;/P&gt;&lt;P&gt;    T_P0002-FTEXT = T_T502T-FTEXT.&lt;/P&gt;&lt;P&gt;    APPEND T_P0002.&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;  gs_fieldcat-col_pos      = '1'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-fieldname    = 'BEGDA'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-outputlen    = 10.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-seltext_l    = 'BEGIN DATE'.&lt;/P&gt;&lt;P&gt;  APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  gs_fieldcat-col_pos      = '2'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-fieldname    = 'ENDDA'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-outputlen    = 10.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-seltext_l    = 'END DATE'.&lt;/P&gt;&lt;P&gt;  APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR gs_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  gs_fieldcat-col_pos      = '3'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-fieldname    = 'NACHN'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-outputlen    = 15.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-seltext_l    = 'LAST NAME'.&lt;/P&gt;&lt;P&gt;  APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR gs_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  gs_fieldcat-col_pos      = '4'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-fieldname    = 'VORNA'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-outputlen    = 15.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-seltext_l    = 'FIRST NAME'.&lt;/P&gt;&lt;P&gt;  APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR gs_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  gs_fieldcat-col_pos      = '5'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-fieldname    = 'FAMST'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-outputlen    =  5.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-seltext_l    = 'MARITAL KEY'.&lt;/P&gt;&lt;P&gt;  APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  gs_fieldcat-col_pos      = '6'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-fieldname    = 'FTEXT'.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-outputlen    = 5.&lt;/P&gt;&lt;P&gt;  gs_fieldcat-seltext_l    = 'MARITAL STATUS'.&lt;/P&gt;&lt;P&gt;  APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;&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;            i_background_id  = 'ALV_BACKGROUND'&lt;/P&gt;&lt;P&gt;            i_grid_title     = 'SSN BANK INFO'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;             i_structure_name = 'veda'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            it_fieldcat      = gt_fieldcat[]&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            t_outtab         = T_P0002.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 09:11:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720123#M314373</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T09:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720124#M314374</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;In your situation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'&lt;/P&gt;&lt;P&gt;     EXPORTING&lt;/P&gt;&lt;P&gt;          I_PROGRAM_NAME      = GT_REPID    &lt;/P&gt;&lt;P&gt;          I_INTERNAL_TABNAME = 'T_P0002' &lt;/P&gt;&lt;P&gt;          I_INCLNAME                  = GT_REPID&lt;/P&gt;&lt;P&gt;     CHANGING&lt;/P&gt;&lt;P&gt;          CT_FIELDCAT                = GT_FIELDCAT[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the delete all fields the users can't see.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;max_abap4@yahoo.it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 09:17:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720124#M314374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T09:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720125#M314375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;kindly execute my program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;initially it displayed 1 record. when i click the back button it will add 1 more records ..like that it will increase the records.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 09:34:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720125#M314375</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T09:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720126#M314376</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;Insert the call of grid in END-OF-SELECTION event:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GET PERNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To get the marital status&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;SELECT * FROM T502T&lt;/P&gt;&lt;P&gt;INTO TABLE T_T502T&lt;/P&gt;&lt;P&gt;WHERE SPRSL = 'EN'.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC EQ 0 .&lt;/P&gt;&lt;P&gt;SORT T_T502T BY FAMST .&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;RP-READ-INFOTYPE P0002-PERNR 0002 P0002 PN-BEGDA PN-ENDDA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RP-PROVIDE-FROM-LAST P0002 SPACE PN-BEGDA '31129999' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF PNP-SW-FOUND EQ '1' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE T_T502T WITH KEY FAMST = P0002-FAMST&lt;/P&gt;&lt;P&gt;BINARY SEARCH .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T_P0002-BEGDA = P0002-BEGDA.&lt;/P&gt;&lt;P&gt;T_P0002-ENDDA = P0002-ENDDA.&lt;/P&gt;&lt;P&gt;T_P0002-NACHN = P0002-NACHN.&lt;/P&gt;&lt;P&gt;T_P0002-VORNA = P0002-VORNA.&lt;/P&gt;&lt;P&gt;T_P0002-FAMST = P0002-FAMST.&lt;/P&gt;&lt;P&gt;T_P0002-FTEXT = T_T502T-FTEXT.&lt;/P&gt;&lt;P&gt;APPEND T_P0002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;END-OF-SELECTION&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gs_fieldcat-col_pos = '1'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-fieldname = 'BEGDA'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-outputlen = 10.&lt;/P&gt;&lt;P&gt;gs_fieldcat-seltext_l = 'BEGIN DATE'.&lt;/P&gt;&lt;P&gt;APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gs_fieldcat-col_pos = '2'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-fieldname = 'ENDDA'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-outputlen = 10.&lt;/P&gt;&lt;P&gt;gs_fieldcat-seltext_l = 'END DATE'.&lt;/P&gt;&lt;P&gt;APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;CLEAR gs_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gs_fieldcat-col_pos = '3'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-fieldname = 'NACHN'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-outputlen = 15.&lt;/P&gt;&lt;P&gt;gs_fieldcat-seltext_l = 'LAST NAME'.&lt;/P&gt;&lt;P&gt;APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;CLEAR gs_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gs_fieldcat-col_pos = '4'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-fieldname = 'VORNA'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-outputlen = 15.&lt;/P&gt;&lt;P&gt;gs_fieldcat-seltext_l = 'FIRST NAME'.&lt;/P&gt;&lt;P&gt;APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;CLEAR gs_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gs_fieldcat-col_pos = '5'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-fieldname = 'FAMST'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-outputlen = 5.&lt;/P&gt;&lt;P&gt;gs_fieldcat-seltext_l = 'MARITAL KEY'.&lt;/P&gt;&lt;P&gt;APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gs_fieldcat-col_pos = '6'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-fieldname = 'FTEXT'.&lt;/P&gt;&lt;P&gt;gs_fieldcat-outputlen = 5.&lt;/P&gt;&lt;P&gt;gs_fieldcat-seltext_l = 'MARITAL STATUS'.&lt;/P&gt;&lt;P&gt;APPEND gs_fieldcat TO gt_fieldcat.&lt;/P&gt;&lt;P&gt;&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;i_background_id = 'ALV_BACKGROUND'&lt;/P&gt;&lt;P&gt;i_grid_title = 'SSN BANK INFO'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;i_structure_name = 'veda'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;it_fieldcat = gt_fieldcat[]&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;t_outtab = T_P0002. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 09:44:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720126#M314376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T09:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720127#M314377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MAX,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MY REQUIREMENT IS :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I WANT TO DISPLAY 7 FIELDS IN THE OUTPUT FOR BOTH ROLES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN THE ROLE 1 USER EXECUTE THE REPORT, IT  IS NOT ALLOWED TO DOWNLOAD FOR 1 FILED. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN THE ROLE 2 USER  EXECUTE THE REPORT IT DOWNLOAD THE ALL FIELDS I.E 7 FIELDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 10:23:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720127#M314377</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T10:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720128#M314378</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;Try this example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPE-POOLS SLIS.

PARAMETERS: P_ROLE TYPE N.

DATA: GT_FIELDCAT   TYPE SLIS_T_FIELDCAT_ALV,
      ET_FIELDCAT   TYPE SLIS_T_FIELDCAT_ALV,
      LS_FIELDCAT   TYPE SLIS_FIELDCAT_ALV,
      GT_REPID      LIKE SY-REPID,
      GT_EVENT_EXIT TYPE SLIS_T_EVENT_EXIT,
      LT_EVENT_EXIT TYPE SLIS_EVENT_EXIT.


DATA: T_ROLES LIKE STANDARD TABLE OF AGR_USERS WITH HEADER LINE.

DATA: BEGIN OF T_OUTPUT OCCURS 0,
        FIELD1,
        FIELD2,
        FIELD3,
        FIELD4,
      END   OF T_OUTPUT.

DATA: ROLE.


* Check user rules

*SELECT * FROM AGR_USERS INTO TABLE T_ROLES WHERE UNAME = SY-UNAME
*                                             AND FROM_DAT &amp;lt;= SY-DATUM
*                                             AND TO_DAT =&amp;gt; SY-DATUM.
*
*READ TABLE T_ROLES WITH KEY

DO 4 TIMES.
  MOVE SY-INDEX TO T_OUTPUT-FIELD1.
  T_OUTPUT-FIELD2 = T_OUTPUT-FIELD3 = T_OUTPUT-FIELD4 = T_OUTPUT-FIELD1.
  APPEND T_OUTPUT.
ENDDO.


GT_REPID = SY-REPID.

* Extract the fields for ALV
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
          I_PROGRAM_NAME     = GT_REPID
          I_INTERNAL_TABNAME = 'T_OUTPUT'
          I_INCLNAME         = GT_REPID
     CHANGING
          CT_FIELDCAT        = GT_FIELDCAT[].




LT_EVENT_EXIT-UCOMM  = '&amp;amp;XXL'.
LT_EVENT_EXIT-BEFORE = 'X'.
LT_EVENT_EXIT-AFTER  = 'X'.
APPEND LT_EVENT_EXIT TO GT_EVENT_EXIT.



* Check the authorizations:


ROLE = P_ROLE.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
          I_CALLBACK_PROGRAM      = GT_REPID
          I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
          IT_FIELDCAT             = GT_FIELDCAT
          IT_EVENT_EXIT           = GT_EVENT_EXIT
     TABLES
          T_OUTTAB                = T_OUTPUT.

*---------------------------------------------------------------------*
*       FORM user_command                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  --&amp;gt;  R_UCOMM                                                       *
*  --&amp;gt;  RS_SELFIELD                                                   *
*---------------------------------------------------------------------*
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                        RS_SELFIELD TYPE SLIS_SELFIELD.

  CHECK R_UCOMM = '&amp;amp;XXL'. "Create (excel) file

  CHECK ROLE = '1'.

  IF RS_SELFIELD-BEFORE_ACTION = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
         IMPORTING
              ET_FIELDCAT = ET_FIELDCAT.

* Save old chararcterstics
    GT_FIELDCAT[] = ET_FIELDCAT[].

    LOOP AT ET_FIELDCAT INTO LS_FIELDCAT WHERE FIELDNAME = 'FIELD2'
                                            OR FIELDNAME = 'FIELD3'
                                            OR FIELDNAME = 'FIELD4'.
      LS_FIELDCAT-NO_OUT = 'X'.
      MODIFY ET_FIELDCAT FROM LS_FIELDCAT.
    ENDLOOP.

* Set new layout
    CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_SET'
         EXPORTING
              IT_FIELDCAT = ET_FIELDCAT.

  ENDIF.




  IF RS_SELFIELD-AFTER_ACTION = 'X'.
* Set old layout
    CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_SET'
         EXPORTING
              IT_FIELDCAT = GT_FIELDCAT.
  ENDIF.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 10:55:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720128#M314378</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T10:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720129#M314379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;both r giving the same results:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want like this;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------" /&gt;&lt;P&gt;1   2    3&lt;/P&gt;&lt;P&gt;1   2    3&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if role = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if i download alv report foor role 2. the result should be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------" /&gt;&lt;P&gt;1 2&lt;/P&gt;&lt;P&gt;1 2&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 11:12:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720129#M314379</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T11:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720130#M314380</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;How are you downloading the report?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried it and if the role is 1 only first colunm is dowloaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 11:25:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720130#M314380</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T11:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720131#M314381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the selection screen i give 1 and execute the report.&lt;/P&gt;&lt;P&gt;it will display the 4 rows and 4 columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then i try to download,  using the local file and select it as  spreadsheet &lt;/P&gt;&lt;P&gt;and save it as max.xls in local disk.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i open the max.xls it will display all 4 columns and 4 rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in ad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 11:31:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720131#M314381</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T11:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720132#M314382</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;&lt;/P&gt;&lt;P&gt;You haven't read well what I wrote.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my previuos example I developed only the case to export the data to excel &amp;lt;u&amp;gt;(Spreadsheet option),&amp;lt;/u&amp;gt; in this case the &amp;lt;b&amp;gt;OK_CODE is &amp;amp;XXL'&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I've inserted all options to export the data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OK_CODE -&amp;gt; &amp;amp;XXL --&amp;gt; Spreadsheet&lt;/P&gt;&lt;P&gt;OK_CODE -&amp;gt; &amp;amp;AQW --&amp;gt; Word Processing&lt;/P&gt;&lt;P&gt;OK_CODE -&amp;gt; %PC  --&amp;gt; Local file&lt;/P&gt;&lt;P&gt;OK_CODE -&amp;gt; &amp;amp;CRTEMPL --&amp;gt; Crystal report  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPE-POOLS SLIS.

PARAMETERS: P_ROLE TYPE N.

DATA: GT_FIELDCAT   TYPE SLIS_T_FIELDCAT_ALV,
      ET_FIELDCAT   TYPE SLIS_T_FIELDCAT_ALV,
      LS_FIELDCAT   TYPE SLIS_FIELDCAT_ALV,
      GT_REPID      LIKE SY-REPID,
      GT_EVENT_EXIT TYPE SLIS_T_EVENT_EXIT,
      LT_EVENT_EXIT TYPE SLIS_EVENT_EXIT.


DATA: T_ROLES LIKE STANDARD TABLE OF AGR_USERS WITH HEADER LINE.

DATA: BEGIN OF T_OUTPUT OCCURS 0,
        FIELD1,
        FIELD2,
        FIELD3,
        FIELD4,
      END   OF T_OUTPUT.

DATA: ROLE.


* Check user rules

*SELECT * FROM AGR_USERS INTO TABLE T_ROLES WHERE UNAME = SY-UNAME
*                                             AND FROM_DAT &amp;lt;= SY-DATUM
*                                             AND TO_DAT =&amp;gt; SY-DATUM.
*
*READ TABLE T_ROLES WITH KEY

DO 4 TIMES.
  MOVE SY-INDEX TO T_OUTPUT-FIELD1.
  T_OUTPUT-FIELD2 = T_OUTPUT-FIELD3 = T_OUTPUT-FIELD4 = T_OUTPUT-FIELD1.
  APPEND T_OUTPUT.
ENDDO.


GT_REPID = SY-REPID.

* Extract the fields for ALV
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
          I_PROGRAM_NAME     = GT_REPID
          I_INTERNAL_TABNAME = 'T_OUTPUT'
          I_INCLNAME         = GT_REPID
     CHANGING
          CT_FIELDCAT        = GT_FIELDCAT[].



LT_EVENT_EXIT-BEFORE = 'X'.
LT_EVENT_EXIT-AFTER  = 'X'.
LT_EVENT_EXIT-UCOMM  = '&amp;amp;XXL'.  "&amp;lt;-- Excel
APPEND LT_EVENT_EXIT TO GT_EVENT_EXIT.
LT_EVENT_EXIT-UCOMM  = '&amp;amp;AQW'.  "&amp;lt;-- Word Processing
APPEND LT_EVENT_EXIT TO GT_EVENT_EXIT.
LT_EVENT_EXIT-UCOMM  = '%PC'.  "&amp;lt;-- Local file
APPEND LT_EVENT_EXIT TO GT_EVENT_EXIT.
LT_EVENT_EXIT-UCOMM  = '&amp;amp;CRTEMPL'. "&amp;lt;--- Crystal Report
APPEND LT_EVENT_EXIT TO GT_EVENT_EXIT.


* Check the authorizations:


ROLE = P_ROLE.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
          I_CALLBACK_PROGRAM      = GT_REPID
          I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
          IT_FIELDCAT             = GT_FIELDCAT
          IT_EVENT_EXIT           = GT_EVENT_EXIT
     TABLES
          T_OUTTAB                = T_OUTPUT.

*---------------------------------------------------------------------*
*       FORM user_command                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  --&amp;gt;  R_UCOMM                                                       *
*  --&amp;gt;  RS_SELFIELD                                                   *
*---------------------------------------------------------------------*
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                        RS_SELFIELD TYPE SLIS_SELFIELD.

  CHECK ROLE = '2'.

  IF RS_SELFIELD-BEFORE_ACTION = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
         IMPORTING
              ET_FIELDCAT = ET_FIELDCAT.

* Save old chararcterstics
    GT_FIELDCAT[] = ET_FIELDCAT[].

    LOOP AT ET_FIELDCAT INTO LS_FIELDCAT WHERE FIELDNAME = 'FIELD2'
                                            OR FIELDNAME = 'FIELD3'
                                            OR FIELDNAME = 'FIELD4'.
      LS_FIELDCAT-NO_OUT = 'X'.
      MODIFY ET_FIELDCAT FROM LS_FIELDCAT.
    ENDLOOP.

* Set new layout
    CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_SET'
         EXPORTING
              IT_FIELDCAT = ET_FIELDCAT.

  ENDIF.




  IF RS_SELFIELD-AFTER_ACTION = 'X'.
* Set old layout
    CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_SET'
         EXPORTING
              IT_FIELDCAT = GT_FIELDCAT.
  ENDIF.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 11:45:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720132#M314382</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T11:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Please send the ALV code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720133#M314383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for ur unbelivable help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank uuuuuu soooooooooooooo much MAX.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 11:55:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-send-the-alv-code/m-p/1720133#M314383</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-11T11:55:04Z</dc:date>
    </item>
  </channel>
</rss>

