Alv and excel sheet out put.

hi friends,
now i am working on sales and purchase order report. For this i have created three radio button on selection screen one for sales 2nd for purchase and 3rd for both. when i click sales radio button it is going to display only sales data in ALV out put list as well as in EXCEL sheet.
problem:-
Some layout fileds (out put fields) i am storing in VARIENT and when i have passed this VARIANT in a SELECTION-SCREEN so here the output is ok for me, and i am unable to display these same fields in EXCEL sheet for this Please could u tell that how we do this. please send the logic for this.
thands and regards.
sagi.

Hi Amol,
you are not getting me ...
see your itab will have all the fields irrespective of variant used. so you can directly use itab to download.
i guess you are using alv tool bar option to download.
but i am telling to use your own button to download the report using your own button with GUI_DOWNLOAD Fm.
for this you pass your ITAB and and then give the file name then this will save all the fields to excel file.
Regards
vijay

Similar Messages

  • SSRS/Powerview to compare SQL table and excel sheet

    I have a SQL table and an excel sheet with some data...
    I want to be able to compare the two and find out which Excel rows are missing in the SQL table...
    Would it be easier to do this report in SSRS or would it be better to do it in Excel PowerView?
    If so how do I go about it?
    Thanks in advance for your help...
    Dhananjay Rele

    Hi Dhananjay,
    According to your description, you want to compare the data of a SQL table and an excel sheet. To achieve this goal, we can create two tables in Reporting Services report, one for SQL table with SQL Server connection type, another for excel sheet with ODBC
    connection type.
    For more details about how to create the report, please see the following steps:
    Create a report server project with SQL Server Data Tools (SSDT) Business Intelligence Templates list.
    Create a new report definition file in Solution Explorer.
    Create a Data Source named DataSource1 with Microsoft SQL Server Type, then select the SQL table database from the corresponding server.
    Create a Data Source named DataSource2 with ODBC Type, then select the excel file.
    Create two datasets which returns the SQL data and Excel sheet data based on the two data source, one for DataSource1, another for DataSource2.
    Create two table next to each other based on the datasets on the design surface.
    References:
    Create a Basic Table Report (SSRS Tutorial)
    Create SSRS report using Excel Data Source Step by Step
    If there are any other questions, please feel free to ask.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Download from ALV to excel sheet.

    When i am downloading the Alv to excel sheet. I want to get the field descritption also in the excel sheet.

    Refer:
    https://forums.sdn.sap.com/click.jspa?searchID=14433981&messageID=3603627

  • What is the difference between on new focus and do prepare out put methods

    Hi,
    what is the difference between on new focus and do prepare out put methods.

    Hi Divya,
    DO_PREPARE_OUTPUT method is triggered each time the view is prepared after each event. Normally we redefine this method in order default the initial values based upon the parameter iv_first_time = 'X'. There can be certain other scenarios like putting data validations where this method can be helpful.
    For details on ON_NEW_FOCUS, refer to this [thread|on_new_focus event;
    Thanks
    Vishal

  • 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

  • ALV to excel sheet

    Hello Gurus,
    After ALV output I have to click on the button local file and select spredsheet and transfer the whole data to Excel sheet.
    I am able to do that, but the problem is for an tracking number in the excel sheet is getting displayed as 2.09952E+13 instead of 20995150196137.
    Please do tell me how to left justify this in the sheet.
    <REMOVED BY MODERATOR>
    Regards
    Mac
    Edited by: Alvaro Tejada Galindo on Apr 16, 2008 12:13 PM

    You can also change the Format of the column to Number with 0 Decimal positions.  I tested this and it works.
    I also put your value in Cell A1 and did this in A2
    =CONCATENATE(A1)
    and it showed up fine
    Concatenate works because it converts the number to a string.
    Edited by: Paul Chapman on Apr 16, 2008 6:22 PM

  • Download greater than 255 characters from alv into excel sheet

    Hi,
    I have an ALV grid display report where the last field contains close to 600 characters of text.
    When I use the Export -> Local File -> Spreadsheet option and save it in an excel sheet, only first 255 characters are getting downloaded into excelsheet and rest is not gettting downloaded.
    Solution I have is: Keep a button on the screen. If that button is clicked, use GUI_DOWNLOAD FM  and the entire text (all 600 chars) gets downloaded.
    Is there any other solution to the above problem?
    I tried downloading the alv report into XML format and opened as an excel document, but even then only first 255 characters are apearing in excel cell.
    The domain has length 2048 chars for the final internal table in alv, so there is no problem with data element or domain.
    OIn debugging mode, I am able to see all the 600 chars in the final internal table before alv display.
    It looks like there is a constraint in alv that is can display only 255 characters in a cell.
    ALso, I tried converting the grid display to list display and then download into excel , but the result is same.
    Please help.

    please search first:
    http://www.sdn.sap.com/irj/scn/advancedsearch;jsessionid=%28J2EE3417400%29ID0634234250DB10563517489488469157End?query=downloadmorethan255char

  • Download Alv into excel sheet according to variant fields

    Hi All,
    I have more than 100 fields in the ALV report, now i want to download the report according to the fields are choosen in the variant. I am getting all the fields in excel sheet but i need some fileds that is selected in the variant.
    Thanks in advance.
    Rudhir

    use your own excel button and program this steps:

    * Get the frontend fieldcatalog
    CALL METHOD go_grid->get_frontend_fieldcatalog
    IMPORTING
    et_fieldcatalog = lt_fieldcat.
    DELETE lt_fieldcat WHERE no_out EQ 'X'.

    *create dynamic table with the frontend fieldcatalog
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = lt_fieldcat
    IMPORTING
    ep_table = lt_data
    EXCEPTIONS
    generate_subpool_dir_full = 1
    OTHERS = 2.
    IF sy-subrc EQ 0.
    ASSIGN lt_data->* TO <lt_table>.
    ENDIF.
    3° Fill the dynamic table
    4° export to excel using
    CALL FUNCTION 'XXL_SIMPLE_API'
    TABLES
    col_text = xmplt_v1
    data = <lt_table>
    online_text = xmplt_o1
    print_text = xmplt_p1
    EXCEPTIONS
    dim_mismatch_data = 1
    file_open_error       =2
    file_write_error      = 3
    inv_winsys            =4
    inv_xxl                   =5
    OTHERS                = 6.
    Check the complete example here

  • Down loading ALV to excel sheet

    Hello guys,
    Im facing problem with ALV. The data which displayed in ALV report is not displaying in excel sheet. Normally the data is displaying but i have given one cond. in selection screen, if check box is not initial 4 more fields are adding to final structure. So after adding these fields data is not displaying in excel sheet.
    I hope u understood the problem can any one suggest me..
    regards
    vijay

    Hi,
    Include 4 more fields with final internal table and that final internal table pass it to the function module
    WS_EXCEL
    likt the below.
    call function 'WS_EXCEL'
            exporting
                 filename = p_file
            tables
                 data     = i_excel.
    after reuse function module write this logic
    Regards,
    Nandha

  • Alv and excel

    hi
    i use CL_SALV_TABLE the show alv.
    when i want to spreadssheet to excel the order of the field is diffrent from the alv and the text(the names of the field) is diffrent too.
    maybe you know how to fix it
    thanks

    Hi,
    When you display data in Excel from ALV, what SAP does is that put all the CHAR fields in the front and the NUMBER fields at the END.
    Regards,
    Ravi
    Note : Please mark the helpful answers

  • ALV functinality - Excel sheet

    hi,
    when i use ALV to display the output, we get in the top i.e kind of menu bar where we can see moving into excel sheet , word etc..
    i am not able to move into Excel. i am getting all blank.
    please let me know.

    Hi,
    there are many options with which u can take the data into excel like:
    You can use these function modules also:
    SAP_CONVERT_TO_XLS_FORMAT
    -> MS_EXCEL_OLE_STANDARD_DAT
    -> RSPO_DOWNLOAD_SPOOLJOB
    RH_START_EXCEL_WITH_DATA
    Or on top of the ALV header there are many ways...just try out..
    Reward points if useful.
    tHanks
    nishant

  • Issue with downloaing from ALV to Excel sheet

    Hi All,
    When we download the ALV Report to excel sheet, the first line/first column (A11) of excel sheet will have today's date.
    Since my customer uses the excel sheet for further processing into a non-SAP system, we need to provide the excel sheet with the cell A11 (First line's firls column) as blank.
    How can we deliver this requirement?
    Your help will be sincerely appreciated....
    Regards
    Pavan

    One option is there
    Give him 1 push button on toolbar other wise you can write below function module in
    start of selection code also.
    1 ) modify u r internal table according to requirement.
    2) after that call WS_DOWNLOAD function module.
    Check below code for u r reff.
    *Modify itab according to u r requirement.
         Loop at IST_DWN.
            IST_DWN-KUNNR2_DESC = SPACE.
            IST_DWN-KUNNR3_DESC = W_ZPPCSR-KUNNR3_DESC .
            APPEND IST_DWN.
            CLEAR DATE.
          ENDLOOP.
    *F4 Help for file menu
    CALL FUNCTION 'F4_FILENAME'
            IMPORTING
              FILE_NAME = PATH.
          RLGRAP-FILETYPE = 'DAT'.
    Download fm
          CALL FUNCTION 'WS_DOWNLOAD'
            EXPORTING
              FILENAME         = PATH
              FILETYPE         = RLGRAP-FILETYPE
              MODE             = XMODE
            IMPORTING
              FILELENGTH       = L_FILELENGTH
            TABLES
              DATA_TAB         = IST_DWN
            EXCEPTIONS
              FILE_OPEN_ERROR  = 1
              FILE_WRITE_ERROR = 2
              OTHERS           = 3.
    Salil ...

  • Changes in the Dimensions not reflected in the Current View and Excel Sheet

    Hi Experts,
    We're using BPC MS Platform Version 7.0.112 and we're having problems. When we make changes in the dimension members like adding members or making changes in the hierarchy or groupings, it takes time for the changes to reflect in current view or in the excel sheet. After full processing of the dimension we can see the changes we've made when we reopen the dimension member but when we try to use the member we've added in the template, it's not yet in the current view. I've already tried, full processing of all the dimensions, processing application and reassigning aql index, refresh dimension members and yet the changes we've made doesnt appear in the current view. And what's odd is that sometimes the changes we've made would appear after a day or two or nothing at all.
    What could be possibly causing this issue?
    Thanks,
    Marvin

    Hi Dzmitry,
    Thanks for your response, I'm just wondering whats causing this? We never had this issue on older versions of BPC though, so it would really help if we would know the cause of this. Basicaly when do changes in a dimension, after processing (Full Process, System Offline and Process through member sheet), we just had to set the AppSet status to available and refresh the dimension members in Excel and all the changes would already be visible.
    Thanks,
    Marvin

  • Run Clear Case command from java and save the out put in to a file.

    Can any one help me out ...
    I want to execute Clear case command from a java and want to save the out put of this command to a file.
    I am naot able to find out how to start..
    Message was edited by:
    chandra_verma

    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Webi and Excel sheet universe

    Hi gurus,
    I created an universe based on Ms Excel sheet.
    I have created a webi report , but when iI run the report, it does not work ==> DataBase eroor : [Microsoft][ODBC driver manager] Data source name does not found and no default driver specified. (WIW 10901)
    However, this data source name exist , I cretaed it via odbc.
    So i don't understand the matter. Am I missing some settings ?
    Thanks for your help

    Hi Firmin
    Are you able to browse the data from Universe Designer?
    Suggest you to try the below:
    1. Open the Excel spreadsheet
    2. Select all the data values, make sure the remaining blank cells donu2019t get selected
    3. Click on Insert>>Name>>Define to give a name to the table
    4. Save the Excel
    5. Go to Start>>Control Panel>>Administrative tools>Data Sources(ODBC)
    6. Select System DSN>>Add>>Microsoft excel Driver(*.xls)
    7. Give a new data source name and click on Select workbook and point the saved excel sheet and 8. click on OK
    Note: Make sure the parameter <Parameter Name="Transactional Available">No</Parameter> is set to Yes under the Generic ODBC datasource in below location
    C:\Program Files\Business Objects\BusinessObjects Enterprise 11.5\win32_x86\dataAccess\connectionServer\odbc\odbc.sbo
    1. Create a new connection in Universe designer by using the Generic ODBC connection
    2. Create a new universe and insert the table which we have defined in the Excel sheet.
    3. Save and export this universe to the repository.
    4.Now create a webi report based on this Universe.
    Hope this helps!!
    Regards
    Sourashree

Maybe you are looking for

  • Also got an issue with MSI command center, maybe windows is to blame?

    MSI Command Center crashes every time after it's been running a little while, googling it I've noticed there have been a lot of topics about it crashing. I think someone here on this forum suggested reinstalling windows might help :/ Not too keen on

  • Final Cut Express HD 3.5 Quits unexpectedly while opening

    Hi all. I have Final Cut Express HD 3.5. I bought it several years ago and used it on my Mac Book Pro (2006 model). I bought an iMac a few years later (December 2009). I can't remember what OS the iMac came with, but it's currently running 10.6.8. I

  • How to make slicer to remember selected values while moving from report to another

    I have Power View on SharePoint 2013 and OLAP Cube on SQL Server 2014 solution. 1) I select slicer values and graphs are updated 2) I move to next page on same Power View file and use slicers. 3) I come back to original reports. My slicer valuers are

  • Custom Shapes, Dimensions

    I have just signed up to Adobe CC and got a lot to learn.   Using Illustrator, when I drag a custom shape across an art board, I would like to see dimensions  as I draw.   Can I set a preference for thisand where do I find it? Thank you in advance

  • Itunes locks up on startup

    Have had itunes 10.5 (the latest and greatest) and it worked fine.  today it has decided to lock up on start up.  No new programs added.  No viruses found.  I tried to do a repair install but have the same problem.  I then removed itunes completely a