How to download only some fields(dynamically) from alv grid layouts

I have ALV grid list.
I have layouts for selecting sets of fields dynamically.
If I select a particular layout, I want to download only those fields into an Excel sheet.
If I select another layout, I want to download only fields of that layout , into an Excel sheet.
Can u plz write examples.
Narendra

Hello ,
Here it is.
  FIELD-SYMBOLS <FS> TYPE ANY.
  DATA: GR_ATTACHMENT TYPE Z48S3_ATTACHMENT,
        GT_ATTACHMENT TYPE Z48S3_ATTACHMENT_TAB,
        L_F_TITLE     TYPE SO_OBJ_DES,
        L_R_FIELDCAT  LIKE LINE OF GT_FIELDCAT,
        L_F_FIELD     LIKE L_R_FIELDCAT-FIELDNAME,
        L_F_EMAILID   TYPE Z48S3_RECEIVER,
        L_F_FIRST     TYPE C.
  IF SY-SYSID EQ G_C_DEV_SYSTEM OR
     SY-SYSID EQ G_C_QUA_SYSTEM.
    CONCATENATE SY-SYSID '/' SY-MANDT ':' INTO L_F_TITLE.
    CONDENSE L_F_TITLE.
    CONCATENATE L_F_TITLE SY-TITLE INTO L_F_TITLE SEPARATED BY SPACE.
  ELSE.
    L_F_TITLE = SY-TITLE.
  ENDIF.
  G_R_VARIANT-REPORT = SY-REPID.
  G_R_VARIANT-VARIANT = P_VARIAN.
  CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
       EXPORTING
            I_DIALOG            = 'N'
            I_USER_SPECIFIC     = 'A'
            I_DEFAULT           = 'X'
            IT_DEFAULT_FIELDCAT = G_T_FIELDCAT
            I_LAYOUT            = GR_LAYOUT
       IMPORTING
            ET_FIELDCAT         = G_T_FIELDCAT
            ES_LAYOUT           = GR_LAYOUT
       CHANGING
            CS_VARIANT          = G_R_VARIANT
       EXCEPTIONS
            ERROR_MESSAGE       = 4
            OTHERS              = 4.
  SORT G_T_FIELDCAT BY COL_POS.
  PERFORM CREATE_EXCEL_ATTM_HEADING_ROW TABLES GT_ATTACHMENT
                                               G_T_FIELDCAT.
  LOOP AT G_T_ALVLIST.
    L_F_FIRST = 'X'.
    LOOP AT G_T_FIELDCAT INTO L_R_FIELDCAT WHERE NO_OUT IS INITIAL.
      CLEAR GR_ATTACHMENT-XNEWLINE.
      IF NOT L_F_FIRST IS INITIAL.
        GR_ATTACHMENT-XNEWLINE = 'X'.
        CLEAR L_F_FIRST.
      ENDIF.
      CLEAR L_F_FIELD.
      CONCATENATE 'G_T_ALVLIST-' L_R_FIELDCAT-FIELDNAME
             INTO L_F_FIELD.
      CONDENSE L_F_FIELD.
      ASSIGN (L_F_FIELD) TO <FS>.
      WRITE <FS> TO GR_ATTACHMENT-FIELDVALUE.
      UNASSIGN <FS>.
      APPEND GR_ATTACHMENT TO GT_ATTACHMENT.
    ENDLOOP.
  ENDLOOP.
Regards,
Vasanth

Similar Messages

  • How to download header and  field heading of ALV ??

    how can we download header of the alv and the field heading .?
    when we are downloading ALV report into XLS  .
    Is it possible or not .?
    thanks in advance
    Naval bhatt

    Hi Naval,
                To download Data from ALV to XLS a button os toolbar is available see
    I think it work for your work or you may use "GUI_Download "FM in your Program.
       Souman

  • Download only some selected emails from gmail

    For a 3 week period I have used a different machine with Thunderbird set up to read my mail as I normally use. When I went back to my usual machine I tried importing my mail database, however something went wrong. I only have my old emails, but nothing from what I received over the 3 weeks.
    Thunderbird continues to sync new emails with gmail via POP, but those 3 weeks are missing and not being downloaded. Is it possible to download specific emails without downloading all my emails all over again (and sorting them out in my inbox, again)?

    You already asked this question, so I'm not sure why you asked it again.
    Please keep all responses in one question so that the continuity is not lost. Hopefully the instructions I put in other question will resolve the situation,
    * https://support.mozilla.org/en-US/questions/1040412

  • How to set only one row selection  in ALV GRID DISPLAY

    How to set single row selection in grid display
    not multiselection.

    Hi,
    In the USER COMMAND, build the code to check the REFRESHED Data & then check the number of records with SEL  = 'X'.
    If more than single entry found, then raise an error message.
    Best regards,
    Prashant

  • Downloads from ALV GRID-Text conversion to dates in EXCEL

    When downloading table displays of data from ALV-GRID for excel spreadsheet, we end of with files that have a header and various line ifnromation.  IF we manually clear up the display, then we can have the individicual column headers used and force them to text but if we just call the file up as an EXCEL spreadsheet, some part numbers such 12-3465 appear in Excel as Dec-65.
    The following is an example of the record (but it is word wrapped within this display limit).  In actuality, the verbage enclosed with the <b> represent the start of the  lines that have actual display data running out about 90 characters.
    Suggestions on how to make the download immediately correct in Excel direct from SAP ALV-GRID without cleaning out the heading lines and manually forcing the affected columns to TEXT format?
    thanks
    <b>03/02/2007</b>                                                                    Dynamic List Display                                                                                1
    <b>Materials-Inforecord Details Report</b>
    <b>Purchasing Org: ILMO</b>
                        <b>Report Run Date:03/02/2007</b>                    <b>Report Time:14:31:16</b>
         <b>Plnt     Mat Grp     Vendor     Name 1     Material     Material</b> description     Vendor Cat     Mfr     MPN     PC     Item Chg.     OUn      Eq to     BUn     Net price     Per     OPUn     Inforecord     PGr     Mv Avg        per     ValCl
         <b>0042     04     106070     BURROWS COMPANY</b>     184110     Glv Exam Ltx Non Ster     02-5001     TILLOTSON     02-5001               CA     2,000     EA        93.40      1     CA     5300006999     999     93.40     2,000     6438

    there are different options to export to excel which all behave differently, if you go for the menu ->export it differs from the export button from the alv buttonbar.
    try the different export to excel options perhaps there is one that behaves the way you want
    kind regards
    arthur de smidt

  • How to copy only some coulums and rows from excel files to a Oracle Table

    Dear all,
    I have the following problems:
    How to copy only some wanted coulums ( I.e DATETIME(format:17/09/2007 00:00:01 ) and TIME (format: 00:00:01 ) from excel files to oracle table.
    HOPE TO GET HELP FROM YOU GUYS!
    SINCERELY,
    MONOJSHARMALUITEL

    How about Heterogeneous Services so that the Excel sheet is an external database:
    1- Go to Control Panel>Administrative Tools>Data Sources (ODBC)>System DSN and create a data source with appropriate driver. Name it EXCL.
    2- In %ORACLE_HOME%\Network\Admin\Tnsnames.ora fie add entry:
    EXCL =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.0.24)(PORT = 1521))
    (CONNECT_DATA =
    (SID = EXCL)
    (HS = OK)
    Here SID is the name of data source that you have just created.
    3- In %ORACLE_HOME%\Network\Admin\Listener.ora file add:
    (SID_DESC =
    (PROGRAM = hsodbc)
    (SID_NAME = <hs_sid>)
    (ORACLE_HOME = <oracle home>)
    under SID_LIST_LISTENER like:
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = d:\ORA9DB)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = ORA9DB)
    (ORACLE_HOME = d:\ORA9DB)
    (SID_NAME = ORA9DB)
    (SID_DESC =
    (PROGRAM = hsodbc)
    (SID_NAME = EXCL)
    (ORACLE_HOME = D:\ora9db)
    Dont forget to reload the listener
    c:\> lsnrctl reload
    4- In %ORACLE_HOME%\hs\admin create init<HS_SID>.ora. For our sid EXCL we create file initexcl.ora.
    In this file set following two parameters:
    HS_FDS_CONNECT_INFO = excl
    HS_FDS_TRACE_LEVEL = 0
    5- Now connect to Oracle database and create database link with following command:
    SQL> CREATE DATABASE LINK excl
    2 USING 'excl'
    3 /
    Database link created.
    Now you can perform query against this database like you would for any remote database.
    SQL> SELECT table_name FROM all_tables@excl;
    TABLE_NAME
    DEPT
    EMP

  • How to right align a read only numeric field in a panel form layout

    Hi, does anyone know how to right align a read only numeric field in a panel form layout? I am using: Style Class = AFFieldNumberMarker, but it only seems to work if the field is disabled. Disabling the field gives it a difference appearance that does not look right on our forms. These are calculated fields, which cannot be modified, so read only is necessary.
    I have looked online for some answers, and it seems that others are having similar issues.
    I have tried different combinations for the properties, but so far I cannot get it to work.
    Thanks
    Judy
    I am using JDEV 11.1.1.5

    Sorry for the delay in my response. Here is the code
    <af:inputText value="#{bindings.TotalAirlineCostEst.inputValue}"
    label="#{bindings.TotalAirlineCostEst.hints.label}"
    required="#{bindings.TotalAirlineCostEst.hints.mandatory}"
    columns="#{bindings.TotalAirlineCostEst.hints.displayWidth}"
    maximumLength="#{bindings.TotalAirlineCostEst.hints.precision}"
    shortDesc="#{bindings.TotalAirlineCostEst.hints.tooltip}"
    id="it20" readOnly="false"
    disabled="true"
    styleClass="AFFieldNumberMarker">
    <f:validator binding="#{bindings.TotalAirlineCostEst.validator}"/>
    <af:convertNumber groupingUsed="true"
    pattern="#{bindings.TotalAirlineCostEst.format}"
    type="number"
    maxFractionDigits="0"/>
    </af:inputText>
    thank you,
    Judy

  • How to download voice memos to pc from iphone 4.

    how to download voice memos to pc from iphone 4.

    Sync them as you would any other content from the computer to the device.

  • I have iphoto 6.  How do I only selecy certain photos from my camera when importing rather than all of them as show in the import page that loads

    I have iphoto 6.  How do I only selecy certain photos from my camera when importing rather than all of them as show in the import page that loads

    You use Image Capture (in your Applications Folder) for that job - or upgrade to a later iPhoto.
    Regards
    TD

  • How to download ides ecc 6.0 from  internet

    hi guru,
    it's urgent how to download ides ecc 6.0 from net.
    regards
    subhasis.

    If you have a valid license you can download it from the SAP marketplace ( http://service.sap.com/ ), otherwise it's not available.
    Peter

  • How to download only jre 1.5

    Hello I need jre 1.5 for installing tomcat I don't need JSDK. Can any one tell me how to download only jre 1.5
    Regards,

    Check this out
    http://mindprod.com/jgloss/jre.html

  • How to download hp laser jet 3050 from hp site?

    How to download hp laser jet 3050 from hp site?
    Thanks

    Make a copy of a document. Also a blank paper copy to see if it shows up then. 
    **Click the KUDOS star on the left to say 'Thanks'**
    Please mark a reply "ACCEPTED AS SOLUTION" if it solved your problem, so others can find it.

  • How to get the byte[] size dynamically from the StreamMessage object

    Hi all,
    Using JMS, I am receiving the FDF file as StreamMessage from the queue and attaching it to the PDF file which is present in the local system.
    For that, I have written the code as follows:
    {color:#0000ff} Message msg = jmsTemplate.receive();
    if(msg !=null && msg instanceof StreamMessage)
    StreamMessage message = (StreamMessage) msg;{color}
    {color:#ff6600}//hardcoded the byte array size value
    {color}{color:#0000ff} byte[] bytes = new byte[{color:#ff0000}856{color}];
    System.out.println("read msg="+message.readBytes(bytes));{color}
    {color:#0000ff}PdfReader pdfreader = new PdfReader("D:\\Managing_Workflows_No_Comment.pdf");
    PdfStamper stamp = new PdfStamper(pdfreader, new FileOutputStream("D:\\12345.pdf"));
    FdfReader fdfreader = new FdfReader(bytes);
    stamp.addComments(fdfreader);
    {color} {color:#0000ff} stamp.close();
    {color}{color:#000000}The above code is working fine except with the hardcoded of {color:#ff0000}byte array{color}{color:#ff0000} size value{color} which is given in {color:#ff0000}RED{color} in color.
    Can anybody know, {color:#000000}*how to get the byte[] size dynamically from the StreamMessage*{color} object ?
    Any help would be highly beneficial for me !!!!
    Thanks and Regards,
    Ganesh Kumar{color}

    When you create your stream message you could add an property to your message, something like streamSize that would contain the number of bytes in your stream message. Then you could get this property from the message before declaring your array.
    Tom

  • Hello. How to download to the PC photos from icloud ? please help

    Hello. How to download to the PC photos from icloud ? please help

    Hi Sebnem Turksoy,
    Thanks for visiting Apple Support Communities.
    If you would like to sync your iCloud photo stream to your PC, you can set up iCloud using these steps:
    Set up My Photo Stream
    Your new photos appear automatically on the iOS devices, computers, and Apple TV you set up with My Photo Stream, no matter which iOS device or computer you use to take or import new photos. For system requirements, see the Apple Support article iCloud: System requirements.
    On a Windows computer
    Install the iCloud Control Panel if it isn’t already installed on your computer.
    Open the iCloud Control Panel, then turn on Photos.My Photo Stream is set up by default. To turn it off, click Options, then turn off My Photo Stream.
    To change the iCloud Photos location on your computer, click Options. Click Change to choose a folder, then click OK.
    Click Apply.
    You can find these steps in the iCloud help pages:
    http://help.apple.com/icloud/#/mmf1896412ec
    Best,
    Jeremy

  • Download from ALV grid to PDF format

    hai Friends!
       plz tell me how can i download from ALV grid to PDF format..
    send me some sample codes

    check this thread
    ALV Grid to PDF
    and do use the search functionality from next time and post the question only wheb u dont find the answer
    кu03B1ятu03B9к

Maybe you are looking for