Alv o/p to diff xl sheets

Hi All, 
            I have a report with subtotals at the vendor level, my requirement is when the user presses a button each vendor information with the subtotals should  go to a different XL file. The user can have his own layout; how can I know in my program which fields he had picked up for his layout? Any pointers would be great. Thanks!

Hi All, 
            I have a report with subtotals at the vendor level, my requirement is when the user presses a button each vendor information with the subtotals should  go to a different XL file. The user can have his own layout; how can I know in my program which fields he had picked up for his layout? Any pointers would be great. Thanks!

Similar Messages

  • Short dump when exporting the ALV grid report in to spread sheet

    HI,
    I am facing a problem when downloading ALV grid report in to spread sheet LIST>EXPORT>LOCAL FILE -->SPREADSHEET.
    in shotdump the cursor shows : "assign cline+cbegin(clength) to <field_cont>."
    In SAP internal table LIST,in the first record the value of the filed LENG is 0. when i have changed this value ex:10 etc it is coming properly.
    Kindly help me
    Nagendra

    Is this a standard SAP report, or your own? Can you tell what your report does, if it is a custom ALV report?

  • Truncation of Heading characters when an ALV is exported to an excel sheet

    Hi All,
    I am facing a problem while printing an ALV output on to an excel sheet. In the header the last characters are being truncated in the excel.
    Now, I have the entire data in tb_output itab. So using REUSE_ALV*, i printed the output. Here comes the problem.
    I heard about LIST_FROM_MEMORY and LIST_TO_ASCI which can solve this problem. But not much sure how to use those. Whether I need to pass my itab tb_output into any of these?
    Please help me out from this problem.
    Thanks a lot.
    Regards,
    Seenu

    Hi!
    You have 2 options:
    1. Shorten your headings so that their length is LE to the fieldlength of the data they are displaying. E.g. for PO number maximum possible is 10.
    2. Try using the parameter OUTPUTLEN in the field catalog. You can increase this to be equal to the length of your column heading.
    Hope this helps.
    Cheers!

  • Problem while alv grid display exporting to excel sheet

    Hi,
      I have done an ALV report using reuse_alv_grid _display , out put is fine , but when i click on excel view icon i could only see an excel sheet without any data ., but when i use export to local file and choose spread sheet its giving the data in excel, but the user wants to click only the excel view icon.
    Best Regards

    Hi,
    Check this link
    [Problem with Excel button in ALV Grid...URGENT;
    Regards,
    Sathish Reddy.

  • Reg alv grid display exporting to excel sheet

    hi experts,
    I have done an ALV report using reuse_alv_grid _display , out put is fine , but when i click on excel view icon i could only see an excel sheet without any data ., but when i use export to local file and choose spread sheet its giving  the data in excel, but the user wants to click only the excel view icon., please help me out.
    Note : i have already tried changing the macro security in excel to Low .

    see it will give you the   Status message  as  ...
    <b>View cannot be switched: Product is not installed or integration is not active.</b>
    it means the Excel  Integration was not  done in you  sap system .  ask basis   there  will be a Patch for it  ... once  it was applied   automatically in  all the   ALV  the excel view  will work
    in  my system it was  working 
    Girish

  • Regarding downloading from alv report o/p to excel sheet

    Hi gurus,
                       When i am trying to download the alv output to excel sheet it is downloading only titles, No data is getting displayed in it.No data is getting downloaded.
    Thnaks in advance.

    Hi,
    What are the steps you do to download ALV to excel? We need to replicate the case in order to find answer.
    Regards,
    Teddy Kurniawan

  • Need to download the ALV blocked output in to excel sheet

    I have a requirement where there is a need to download the Alv block output to excel sheet. when i click on excel button which is on output only header block data is coming in excel sheet.but i need both header block and item block data into excel.

    Hi,
    create a pushbutton on the toolbar,
    whenever user clicks the pushbutton,
    call the fm gui_download for 2 times
    for the first time,
    append = ' ',
    and for second time.
    append = 'X'.
    check this thread.
    Re: How to download multiple ALV Container data on a screen to a single Excel?
    Regards.
    R K.

  • Regarding ALV O/P download to Excel Sheet

    hi all,
         How can i download ALV o/p to Excel Sheet .
    Can anybody send the code .
    Regards
    Reddy

    Hi,
      Check the links below will help you,
    https://forums.sdn.sap.com/click.jspa?searchID=15756727&messageID=5942546
    https://forums.sdn.sap.com/click.jspa?searchID=15756727&messageID=5811905
    https://forums.sdn.sap.com/click.jspa?searchID=15756727&messageID=5986453
    https://forums.sdn.sap.com/click.jspa?searchID=15756727&messageID=5721594
    https://forums.sdn.sap.com/click.jspa?searchID=15756727&messageID=5839882
    https://forums.sdn.sap.com/click.jspa?searchID=15756727&messageID=5532797
    Have a nice day,
    Rama.

  • ALV - Mass edit grid like spread sheet

    Hi,
    Users wanted to edit ALV grid similar to spread sheet for ex: drag a column from right hand botton corner to copy values from first column etc.
    Is it possible? if atleast I could display grid in spred sheet and save it back.
    Regards
    Kasi

    Created a ALV grid event DOUBLE CLICK and maintained code for this event

  • ALV output when transporting to spread sheet

    Hi all ,
      I am finding problem when I am transporting my ALV grid output to spread sheet. Irrespective of order all integer fields are moving to right most of the spread sheet.
      Actually i need to export that as it is in the output. Hope this is  a common problem. If any one faced this previously or know solution for this please let me know.
    regards
    raghav

    Raghav,
    You will need to create some custom functionality for your needs.
    I would suggest passing your internal table in this Func Module - MS_EXCEL_OLE_STANDARD_DAT.
    You can also pass a listing of field headers will be placed above each column in the Excel output as well (if needed).
    Example:
    TYPES:  BEGIN OF t_output,
              text80(80),
              kgoal(20),
              ytd(20),
              p1(20),
              p2(20),
              p3(20),
              p4(20),
              p5(20),
              p6(20),
              p7(20),
              p8(20),
              p9(20),
              p10(20),
              p11(20),
              p12(20),
              rowcolor(4),
            END OF t_output.
    DATA: single_output_tbl TYPE TABLE OF t_output WITH HEADER LINE.
      DATA: sname LIKE rlgrap-filename.
      data: outname LIKE rlgrap-filename.
      DATA: BEGIN OF fnames OCCURS 0,
              cname(80),
            END OF fnames.
      sname = 'Output'.
      outname = 'c:\outfile'.
      PERFORM insert_headings.
       CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
        EXPORTING
          file_name                       = outname
        CREATE_PIVOT                    = 0
          data_sheet_name                 = sname
        PIVOT_SHEET_NAME                = ' '
        PASSWORD                        = ' '
        PASSWORD_OPTION                 = 0
       TABLES
        PIVOT_FIELD_TAB                 =
         data_tab                        = single_output_tbl
         fieldnames                      = fnames
       EXCEPTIONS
         file_not_exist                  = 1
         filename_expected               = 2
         communication_error             = 3
         ole_object_method_error         = 4
         ole_object_property_error       = 5
         invalid_pivot_fields            = 6
         download_problem                = 7
         OTHERS                          = 8.
      IF sy-subrc <> 0.
       MESSAGE s000(zz) WITH 'Export to Excel failed.'.
      ENDIF.
    FORM insert_headings.
      CLEAR fnames.  REFRESH fnames.
      MOVE ' ' TO fnames-cname.
      APPEND fnames.
      MOVE 'Company Goals' TO fnames-cname.
      APPEND fnames.
      MOVE 'YTD' TO fnames-cname.
      APPEND fnames.
      MOVE 'P1' TO fnames-cname.
      APPEND fnames.
      MOVE 'P2' TO fnames-cname.
      APPEND fnames.
      MOVE 'P3' TO fnames-cname.
      APPEND fnames.
      MOVE 'P4' TO fnames-cname.
      APPEND fnames.
      MOVE 'P5' TO fnames-cname.
      APPEND fnames.
      MOVE 'P6' TO fnames-cname.
      APPEND fnames.
      MOVE 'P7' TO fnames-cname.
      APPEND fnames.
      MOVE 'P8' TO fnames-cname.
      APPEND fnames.
      MOVE 'P9' TO fnames-cname.
      APPEND fnames.
      MOVE 'P10' TO fnames-cname.
      APPEND fnames.
      MOVE 'P11' TO fnames-cname.
      APPEND fnames.
      MOVE 'P12' TO fnames-cname.
      APPEND fnames.
    ENDFORM.                    " Insert_Headings
    Please points for helpful answers.

  • ALV to Excel Sheet Problem

    Hello all,
    I am transferring the ALV output from SAP to Excel sheet using the standard button i.e. To Local FIle.... but i am not getting the text of the last column in the excel sheet. the last column is being displayed empty where as its heading is being displayed....
    Regards.
    Sabah...

    Go through the code and Execute it on your system, I think this will do for you.
    In this code I used 3 radio buttons in my selection screen:
    If u selects the first radio button your out put shows into to the Excel sheet.
    If u selects the second radio button your out put shows the in the Editor screen.
    If u clicks the third radio button your output shows into the Excel as well as in the Editor.
    *& DATA DECLARATION *
    TABLES: MARA, "GENERAL MASTER DATA
    MARC, "PLANT DATA FOR MATERIAL
    MARD, "STORAGE LOCATION DATA FOR MATERIAL
    MBEW, "MATERIAL VALUATION
    MVKE, "SALES DATA FOR MATERIAL
    MAKT, "MATERIAL DESCRIPTION
    EKKO, "PURCHASING DOCUMENT HEADER
    EKPO, "PURCHASING DOCUMENT ITEM
    VBAK, "SALES DOCUMENT HEADER DATA
    VBAP. "SALES DOCUMENT ITEM DATA
    TYPE-POOLS : SLIS.
    DATA: VT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
    V_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
    V_LAYOUT TYPE SLIS_LAYOUT_ALV,
    BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
    BEGIN OF I_MARA OCCURS 0,
    MATNR LIKE MARA-MATNR, "MATERIAL NUMBER
    MBRSH LIKE MARA-MBRSH, "INDUSTRY SECTOR
    MEINS LIKE MARA-MEINS, "BASE UNIT OF MEASURE
    MATKL LIKE MARA-MATKL, "MATERIAL GROUP
    END OF I_MARA,
    BEGIN OF I_MARC OCCURS 0,
    MATNR LIKE MARC-MATNR, "MATERIAL NUMBER
    WERKS LIKE MARC-WERKS, "PLANT
    LVORM LIKE MARC-LVORM, "FLAG MATERIAL FOR DELETION AT PLANT
    "LEVEL
    DISPO LIKE MARC-DISPO, "MRP CONTROLLER
    END OF I_MARC,
    BEGIN OF I_MAKT OCCURS 0,
    MATNR LIKE MAKT-MATNR, "MATERIAL NUMBER
    MAKTX LIKE MAKT-MAKTX, "MATERIAL DESCRIPTION
    SPRAS LIKE MAKT-SPRAS, "LANGUAGE KEY
    END OF I_MAKT,
    BEGIN OF I_MVKE OCCURS 0,
    MATNR LIKE MVKE-MATNR, "MATERIAL NUMBER
    VKORG LIKE MVKE-VKORG, "SALES ORGANIZATION
    VTWEG LIKE MVKE-VTWEG, "DISTRIBUTION CHANNEL
    END OF I_MVKE,
    BEGIN OF I_MARD OCCURS 0,
    MATNR LIKE MARD-MATNR, "MATERIAL NUMBER
    LGORT LIKE MARD-LGORT, "STORAGE LOCATION
    LABST LIKE MARD-LABST, "VALUATED STOCK WITH UNRESTRICTED USE
    END OF I_MARD,
    BEGIN OF I_EKPO OCCURS 0,
    EBELN LIKE EKPO-EBELN, "PURCHASING DOCUMENT NUMBER
    EBELP LIKE EKPO-EBELP, "ITEM NUMBER OF PURCHASING DOCUMENT
    MATNR LIKE EKPO-MATNR, "MATERIAL NUMBER
    END OF I_EKPO,
    BEGIN OF I_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF I_VBAP,
    BEGIN OF I_OUT OCCURS 0,
    MATNR LIKE MARC-MATNR,
    WERKS LIKE MARC-WERKS,
    LVORM LIKE MARC-LVORM,
    DISPO LIKE MARC-DISPO,
    MBRSH LIKE MARA-MBRSH,
    MEINS LIKE MARA-MEINS,
    MATKL LIKE MARA-MATKL,
    VKORG LIKE MVKE-VKORG,
    VTWEG LIKE MVKE-VTWEG,
    SPRAS LIKE MAKT-SPRAS,
    MAKTX LIKE MAKT-MAKTX,
    LGORT LIKE MARD-LGORT,
    LABST LIKE MARD-LABST,
    EBELN LIKE EKPO-EBELN,
    EBELP LIKE EKPO-EBELP,
    VBELN LIKE VBAP-VBELN,
    POSNR LIKE VBAP-POSNR,
    END OF I_OUT,
    BEGIN OF I_HEADING OCCURS 0,
    TEXT1(20),
    TEXT2(20),
    TEXT3(20),
    TEXT4(20),
    TEXT5(20),
    TEXT6(20),
    TEXT7(20),
    TEXT8(20),
    TEXT9(20),
    TEXT10(20),
    TEXT11(40),
    TEXT12(20),
    TEXT13(20),
    TEXT14(20),
    TEXT15(20),
    TEXT16(20),
    TEXT17(20),
    END OF I_HEADING.
    *& S E L E C T I O N - S C R E E N *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR. "OBLIGATORY.
    PARAMETERS: P_WERKS LIKE MARC-WERKS. "OBLIGATORY.
    SELECT-OPTIONS: S_LGORT FOR MARD-LGORT,
    S_DISPO FOR MARC-DISPO,
    S_EBELN FOR EKPO-EBELN .
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-101.
    PARAMETERS : RB1 RADIOBUTTON GROUP G1,
    RB2 RADIOBUTTON GROUP G1,
    RB3 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK B2.
    *& S T A R T - O F - S E L E C T I O N *
    START-OF-SELECTION.
    SELECT MATNR WERKS LVORM DISPO FROM MARC
    INTO CORRESPONDING FIELDS OF TABLE I_MARC
    WHERE MATNR IN S_MATNR
    AND DISPO IN S_DISPO
    AND WERKS = P_WERKS.
    IF I_MARC[] IS INITIAL.
    WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARC'.
    EXIT.
    ENDIF.
    PERFORM PURCHASEDATA_VALIDATION.
    PERFORM SALESDATA_VALIDATION.
    SELECT MATNR LGORT LABST FROM MARD INTO TABLE I_MARD
    FOR ALL ENTRIES IN I_MARC
    WHERE MATNR = I_MARC-MATNR
    AND WERKS EQ P_WERKS
    AND LGORT IN S_LGORT.
    IF I_MARD[] IS INITIAL.
    WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARD'.
    EXIT.
    ENDIF.
    SELECT MATNR VKORG VTWEG FROM MVKE INTO TABLE I_MVKE
    FOR ALL ENTRIES IN I_MARC
    WHERE MATNR = I_MARC-MATNR.
    IF I_MVKE[] IS INITIAL.
    WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MVKE'.
    EXIT.
    ENDIF.
    LOOP AT I_MARC.
    MOVE-CORRESPONDING I_MARC TO I_OUT.
    CLEAR MARC.
    SELECT SINGLE MATNR MBRSH MEINS MATKL FROM MARA
    INTO CORRESPONDING FIELDS OF MARA
    WHERE MATNR = I_OUT-MATNR.
    IF SY-SUBRC = 0.
    MOVE: MARA-MBRSH TO I_OUT-MBRSH,
    MARA-MEINS TO I_OUT-MEINS,
    MARA-MATKL TO I_OUT-MATKL.
    ELSE.
    CONTINUE.
    ENDIF.
    SELECT SINGLE MATNR MAKTX SPRAS FROM MAKT
    INTO CORRESPONDING FIELDS OF MAKT
    WHERE MATNR = I_OUT-MATNR.
    IF SY-SUBRC = 0.
    MOVE: MAKT-MAKTX TO I_OUT-MAKTX,
    MAKT-SPRAS TO I_OUT-SPRAS.
    ELSE.
    CONTINUE.
    ENDIF.
    LOOP AT I_EKPO WHERE MATNR = I_MARC-MATNR.
    MOVE: I_EKPO-EBELN TO I_OUT-EBELN,
    I_EKPO-EBELP TO I_OUT-EBELP.
    ENDLOOP.
    LOOP AT I_VBAP WHERE MATNR = I_MARC-MATNR.
    MOVE: I_VBAP-VBELN TO I_OUT-VBELN,
    I_VBAP-POSNR TO I_OUT-POSNR.
    ENDLOOP.
    LOOP AT I_MARD WHERE MATNR = I_MARC-MATNR.
    MOVE: I_MARD-LABST TO I_OUT-LABST,
    I_MARD-LGORT TO I_OUT-LGORT.
    ENDLOOP.
    LOOP AT I_MVKE WHERE MATNR = I_MARC-MATNR.
    MOVE: I_MVKE-VKORG TO I_OUT-VKORG,
    I_MVKE-VTWEG TO I_OUT-VTWEG.
    APPEND I_OUT.
    ENDLOOP.
    CLEAR I_OUT.
    ENDLOOP.
    PERFORM OPTIONS.
    FORM OPTIONS *
    FORM OPTIONS.
    IF RB2 = 'X'.
    PERFORM FIELDCAT.
    PERFORM OUTPUT.
    ELSE.
    IF RB1 = 'X'.
    PERFORM HEADINGS.
    PERFORM DLOAD.
    ELSE.
    IF RB3 = 'X'.
    PERFORM HEADINGS.
    PERFORM DLOAD.
    PERFORM FIELDCAT.
    PERFORM OUTPUT.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDFORM. "OPTIONS
    FORM HEADINGS *
    FORM HEADINGS.
    I_HEADING-TEXT1 = 'MATNR'.
    I_HEADING-TEXT2 = 'WERKS'.
    I_HEADING-TEXT3 = 'LVORM'.
    I_HEADING-TEXT4 = 'DISPO'.
    I_HEADING-TEXT5 = 'MBRSH'.
    I_HEADING-TEXT6 = 'MEINS'.
    I_HEADING-TEXT7 = 'MATKL'.
    I_HEADING-TEXT8 = 'VKORG'.
    I_HEADING-TEXT9 = 'VTWEG'.
    I_HEADING-TEXT10 = 'SPRAS'.
    I_HEADING-TEXT11 = 'MAKTX'.
    I_HEADING-TEXT12 = 'LGORT'.
    I_HEADING-TEXT13 = 'LABST'.
    I_HEADING-TEXT14 = 'EBELN'.
    I_HEADING-TEXT15 = 'EBELP'.
    I_HEADING-TEXT16 = 'VBELN'.
    I_HEADING-TEXT17 = 'POSNR'.
    APPEND I_HEADING.
    ENDFORM. "HEADINGS
    FORM DLOAD *
    FORM DLOAD.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    FILENAME = 'C:\MATSTK.XLS'
    FILETYPE = 'DAT'
    WRITE_FIELD_SEPARATOR = 'X'
    TABLES
    DATA_TAB = I_HEADING
    EXCEPTIONS
    FILE_WRITE_ERROR = 1.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    FILENAME = 'C:\MATSTK.XLS'
    FILETYPE = 'DAT'
    APPEND = 'X'
    WRITE_FIELD_SEPARATOR = 'X'
    TABLES
    DATA_TAB = I_OUT.
    ENDFORM. "DLOAD
    FORM FIELDCAT *
    FORM FIELDCAT.
    V_FIELDCAT-COL_POS = '1'.
    V_FIELDCAT-FIELDNAME = 'MATNR'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-HOTSPOT = 'X'.
    V_FIELDCAT-REF_FIELDNAME = 'MATNR'.
    V_FIELDCAT-REF_TABNAME = 'MARC'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '2'.
    V_FIELDCAT-FIELDNAME = 'WERKS'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'WERKS'.
    V_FIELDCAT-REF_TABNAME = 'MARC'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '3'.
    V_FIELDCAT-FIELDNAME = 'LVORM'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'LVORM'.
    V_FIELDCAT-REF_TABNAME = 'MARC'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '4'.
    V_FIELDCAT-FIELDNAME = 'DISPO'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'DISPO'.
    V_FIELDCAT-REF_TABNAME = 'MARC'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '5'.
    V_FIELDCAT-FIELDNAME = 'MBRSH'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'MBRSH'.
    V_FIELDCAT-REF_TABNAME = 'MARA'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '6'.
    V_FIELDCAT-FIELDNAME = 'MEINS'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'MEINS'.
    V_FIELDCAT-REF_TABNAME = 'MARA'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '7'.
    V_FIELDCAT-FIELDNAME = 'MATKL'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'MATKL'.
    V_FIELDCAT-REF_TABNAME = 'MARA'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '8'.
    V_FIELDCAT-FIELDNAME = 'VKORG'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'VKORG'.
    V_FIELDCAT-REF_TABNAME = 'MVKE'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '9'.
    V_FIELDCAT-FIELDNAME = 'VTWEG'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'VTWEG'.
    V_FIELDCAT-REF_TABNAME = 'MVKE'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '10'.
    V_FIELDCAT-FIELDNAME = 'SPRAS'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'SPRAS'.
    V_FIELDCAT-REF_TABNAME = 'MAKT'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '11'.
    V_FIELDCAT-FIELDNAME = 'MAKTX'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'MAKTX'.
    V_FIELDCAT-REF_TABNAME = 'MAKT'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '12'.
    V_FIELDCAT-FIELDNAME = 'LGORT'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'LGORT'.
    V_FIELDCAT-REF_TABNAME = 'MARD'.
    V_FIELDCAT-SELTEXT_L = 'STRG LOCT'.
    V_FIELDCAT-OUTPUTLEN = 10.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '13'.
    V_FIELDCAT-FIELDNAME = 'LABST'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-SELTEXT_M = 'STOCK'.
    V_FIELDCAT-OUTPUTLEN = 15.
    V_FIELDCAT-REF_FIELDNAME = 'LABST'.
    V_FIELDCAT-REF_TABNAME = 'MARD'.
    V_FIELDCAT-DO_SUM = 'X'.
    V_LAYOUT-TOTALS_TEXT = 'TOTAL STOCK:'.
    V_FIELDCAT-HOTSPOT = 'X'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '14'.
    V_FIELDCAT-FIELDNAME = 'EBELN'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-HOTSPOT = 'X'.
    V_FIELDCAT-REF_FIELDNAME = 'EBELN'.
    V_FIELDCAT-REF_TABNAME = 'EKPO'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '15'.
    V_FIELDCAT-FIELDNAME = 'EBELP'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'EBELP'.
    V_FIELDCAT-REF_TABNAME = 'EKPO'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '16'.
    V_FIELDCAT-FIELDNAME = 'VBELN'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-HOTSPOT = 'X'.
    V_FIELDCAT-REF_FIELDNAME = 'VBELN'.
    V_FIELDCAT-REF_TABNAME = 'VBAP'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    V_FIELDCAT-COL_POS = '17'.
    V_FIELDCAT-FIELDNAME = 'POSNR'.
    V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'POSNR'.
    V_FIELDCAT-REF_TABNAME = 'VBAP'.
    APPEND V_FIELDCAT TO VT_FIELDCAT1.
    CLEAR V_FIELDCAT.
    ENDFORM. "FIELDCAT
    FORM OUTPUT *
    FORM OUTPUT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
    I_GRID_TITLE = 'CLICK ON MATERIAL/PURDOC/SALESDOC FOR DETAILS'
    I_CALLBACK_USER_COMMAND = 'DISPLAYDETAILS'
    IS_LAYOUT = V_LAYOUT
    IT_FIELDCAT = VT_FIELDCAT1
    TABLES
    T_OUTTAB = I_OUT.
    IF SY-SUBRC 0.
    ENDIF.
    ENDFORM. "OUTPUT
    FORM TOP-OF-PAGE *
    FORM TOP-OF-PAGE.
    DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
    WA_HEADER TYPE SLIS_LISTHEADER.
    WA_HEADER-TYP = 'H'.
    WA_HEADER-INFO = 'REPORT FOR : '.
    APPEND WA_HEADER TO T_HEADER.
    CLEAR WA_HEADER.
    WA_HEADER-TYP = 'S'.
    WA_HEADER-INFO = 'MATERIAL DETAILS'.
    APPEND WA_HEADER TO T_HEADER.
    CLEAR WA_HEADER.
    WA_HEADER-TYP = 'S'.
    WA_HEADER-INFO = 'PURCHASE ORDER DETAILS'.
    APPEND WA_HEADER TO T_HEADER.
    CLEAR WA_HEADER.
    WA_HEADER-TYP = 'S'.
    WA_HEADER-INFO = 'SALES ORDER DETAILS'.
    APPEND WA_HEADER TO T_HEADER.
    CLEAR WA_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    I_LOGO = 'GEAR'
    IT_LIST_COMMENTARY = T_HEADER.
    ENDFORM. "TOP-OF-PAGE
    *& FORM PURCHASEDATA_VALIDATION *
    FORM PURCHASEDATA_VALIDATION.
    SELECT EBELN EBELP MATNR
    FROM EKPO
    INTO TABLE I_EKPO
    FOR ALL ENTRIES IN I_MARC
    WHERE MATNR = I_MARC-MATNR
    AND EBELN IN S_EBELN
    AND WERKS EQ P_WERKS.
    IF I_EKPO[] IS INITIAL.
    WRITE:/ 'NO MATCHING DATA IS SELECTED FROM TABLE EKPO'.
    EXIT.
    ENDIF.
    DATA: T_EKPO LIKE I_EKPO OCCURS 0 WITH HEADER LINE.
    T_EKPO] = I_EKPO[.
    REFRESH I_EKPO.
    FREE I_EKPO.
    LOOP AT T_EKPO.
    SELECT SINGLE EBELN FROM EKKO INTO EKPO-EBELN
    WHERE EBELN = T_EKPO-EBELN.
    IF SY-SUBRC = 0.
    MOVE-CORRESPONDING T_EKPO TO I_EKPO.
    APPEND I_EKPO.
    CLEAR I_EKPO.
    ELSE.
    CONTINUE.
    ENDIF.
    ENDLOOP.
    SORT I_EKPO.
    ENDFORM. "PURCHASEDATA_VALIDATION
    *& FORM SALESDATA_VALIDATION *
    FORM SALESDATA_VALIDATION.
    SELECT VBELN POSNR MATNR
    FROM VBAP
    INTO CORRESPONDING FIELDS OF TABLE
    I_VBAP FOR ALL ENTRIES IN I_MARC
    WHERE MATNR = I_MARC-MATNR.
    DATA: T_VBAP LIKE I_VBAP OCCURS 0 WITH HEADER LINE.
    T_VBAP] = I_VBAP[.
    REFRESH I_VBAP.
    FREE I_VBAP.
    LOOP AT T_VBAP.
    SELECT SINGLE VBELN FROM VBAK INTO VBAK-VBELN
    WHERE VBELN = T_VBAP-VBELN.
    IF SY-SUBRC = 0.
    MOVE-CORRESPONDING T_VBAP TO I_VBAP.
    APPEND I_VBAP.
    CLEAR I_VBAP.
    ELSE.
    CONTINUE.
    ENDIF.
    ENDLOOP.
    SORT I_VBAP.
    ENDFORM. "SALESDATA_VALIDATION

  • Problem while exporting ALV column header to excel sheet.

    Hi,
    I am able to export an ALV grid details to an excel sheet. But the ALV column headers when exported to excel sheet are getting truncated.
    For eg: if my column header in ALV grid is displayed as 'Material' then the column header in excel sheet is 'Mater' only. Remaining portion is getting truncated.
    How can I view the entire column header text?
    Kindly assist.
    Thanks.

    I have the same problem with you, when user export to excel. I fixed it by using
    w_layo-colwidth_optimize = 'X'. <<<<<<<<<<<<This
    perform generate_fcat_reftab
        using 'PRUEFLOS' 'T_INPUT' '' '' 'Inspection Lot' 0.
    form generate_fcat_reftab  using    p_fieldname
                                        p_tabname
                                        p_ref_tabname
                                        p_ref_fieldname
                                        p_output_text
                                        p_output_lenght.
      clear w_fcat.
      w_fcat-fieldname = p_fieldname.
      w_fcat-tabname   = p_tabname.
      w_fcat-ref_fieldname = p_ref_fieldname.
      w_fcat-ref_tabname = p_ref_tabname.
      w_fcat-seltext_s = p_output_text.
      w_fcat-seltext_m = p_output_text.
      w_fcat-seltext_l = p_output_text.
      w_fcat-outputlen = p_output_lenght.
      w_fcat-ddictxt = 'L'. <<<<<<<<<<<<<<<<<<This
      append w_fcat to t_fcat.
    endform.

  • Alv Grid download to xl sheet: Column position mismatching

    Hi All,
    As we know that while downloading the alv grid report data into xl sheet the date cloumn and might some other column positon get shifted to extreme right.
    My problem is with five columns in my grid report  that got shifted to extreme right while downloading to the xl sheet. They have the data type CURR and DEC. As both the types are basically packed.
    I tried to convert one of them into character, but had short dumpfor this conversion.I
    Please suggest me to resolve this issue. I shall be greatful to the valuable answer.
    Note: My internal table fields order and fields order in fieldcatalog are same.
    Thnaks in advance.

    Answer is to convert it to CHAR .
    Conversion error could you post..
    Might be the size was not enough to accomodate the DEC/CURR value .
    Or the  field was not able to recognise the negative/positive signs .
    Other option is to play with excel and  manually convert all fields to Text by formatting the column in excel.

  • How to download the ALV Hierchial Tree Data to an Excel sheet.

    Hi All,
    Can any body please let me ,if there is any possibility to know How to download the ALV Hierchial Tree Data to an Excel sheet.
    If yes, please let me know how could this can b acheived.
    Regards,
    Rohini.

    Hi Rohini
    There is no such functionality provided by SAP to download ALV Tree Hierarichal Tree into excel sheet .
    If you had this kind of senario then i can propose one solution create two radio buttons one is to display in ALV Tree Format and the other is classical report which you can download it for futher process
    Regards
    Hitesh Batra

  • ALV Report to be send as a mail as an Excel sheet attachment

    Hi,
             I have designed a Report that has the mailing functionality by attaching the ALV report output in the Excel sheet.
    1. I am using SUBMITT PROGRAM....EXPORTING MEMORY ID.
              Here  I am retrieving the required ALV report.
    2. I am passing of ALV Report output to internal table, say XLS_TAB using FM LIST_TO_ASCI.
    I can see the data in the internal table. But the problem is when the report output has many columns (i.e) greater than 255 Char, the columns get truncated(data is missed).
    So, how to prevent the missing of the columns. I don't want split each record into new line. Because, when it is passed to Excel, each record should be in a single line without missing any column.
                   If you say the FM can be valid upto 255 Char, what can be the alternative solution?
    Immediate response is appreciated.
    Thanks for your help.
    Sravan.

    Hi deepan
    DESCRIBE TABLE objtxt LINES tab_lines.
      READ TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ) . <---- make it 1024 instead of 255
      CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = gv_tab_lines.
    objpack-doc_type = RAW
      APPEND objpack
    then looping contents of the final table to OBJBIN1.
    DESCRIBE TABLE objbin1 LINES tab_lines.
      objpack-doc_size = tab_lines * 255 .    <-------- make it has 1024 instead of 255
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num = 1.
      objpack-body_start = 1.
      objpack-body_num = tab_lines.
      objpack-doc_type = .XLS
      APPEND objpack.
    Regards
    vijay

Maybe you are looking for