Kill Excel Sheet running in background

Hi all,
My requirement is to kill excel sheet running in task manager.
How to handle auto-killing the Excel spreadsheet in sap on click of back button in SAP GUI.
Kindly provide me the sample code.
Regards,
Sathish Donthula

Not kidding, try to introduce the call of FM LMBP_RESOURCE_LOGOFF for long running excel 
Cheers
Amit.

Similar Messages

  • Download data from internal table to excel sheet from the background

    Hello Experts,
    I have written a code where the data is stored in the internal table . Now when i run this code in the background i want this internal table data to get downloaded in the excel sheet. The function module GUI_DOWNLAOD is not supported in the background. So is there any other function module that can be used or is there any other way to do this
    Thanks in advance

    Hi Aditya,
    I would provide you 2 advice:
    1. save the file on the application server as text file and the fileds in it separated by TAB,you can download the file whenever you want and open it with excel.
    2.generate excel files and send it to the email address whatever you specify in the selection-screen.
    Thanks,
    Sam

  • Download to Excel while running in Background

    Hi,
    I want to download the Report Output ( in internal table) to Excel ( location selected by user on Selection Screen), and i am running the Report in Background ( F9). Execution Time of Report is huge, user will fill the selection criteria, and will give the file name and execute the Report in Background.
    Please suggest me suitable FM to achieve the same, provided there should not be any pop-up after execution begins.
    I also have to Download the contents to Excel in such way, invidual column of internal table should reflect as invidual column in Excel. Ex : 09/2004 should come in single column of Excel.
    Thanks & Regards,
    Akash

    First, if you are looking to download to a PC from background, you can't do that.  THe background has no connection to a frontend PC.  You can however,  write your program to update a custom table.  Then write another frontend program that reads this table and allows the user to download the data to excel and put it anywhere they want on there PC.  You should use the function module GUI_DOWNLOAD, or the class/method  CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD.
    Regards,
    RIch Heilman

  • Download to multiple excel sheets in the backgraoud

    Hi,
    I am trying to download data into multiple excel sheets in the background. I was able to create comma delimited csv file in the server, which can be opened as excel file. This is good when it does not have more that one worksheets.
    I have three internal table and to send these internal tables in different worksheets in the same excel file.
    Is it possible to have multiple sheets excel file from the csv file?

    Check the following thread !!
    Re: Downloading data into excel
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

  • After reports running in background job need to get automatically open in excel sheet

    Dear All,
    I have a requirement which is new to me ,
    Once the user runs the report in background  system is displaying the output in HTML format .... But the Users needs to open in Excel sheet .
    kindly  do the needful
    Regards
    Srikanth BG

    Hi Srikanth,
    Excel processing in background is currently not possible using standard ways. There exist a really good external library that allows you to handle Excel files, and even create them in background. So you could create a final, ready to use Excel file from your background run that can then be opened.
    You might have a look at the library here: http://wiki.scn.sap.com/wiki/display/ABAP/abap2xlsx
    Maybe it helps and suits your needs.
    Cheers,
    Marc

  • How to get data to excel sheet from background

    Hello Experts,
    I have be assigned a task where i have to find out all the reports and the variants containing a ' / '. I have written the code where i am able to scan through the entire list and get a set of reports and the variantsin the internal table. NOW i have to run the code in the background and the entire set of reports and the variants in the internal table to the excel sheet . So how do I do this? I am able to get the data in the excel sheet from the foreground using the FM GUI_download. But this FM does not work in the background.
    So what should be the ideal way to do this ?
    Thanks
    Aditya

    Hi,
    You can write the file into Application server.
    OPEN DATASET dataset FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      LOOP AT it_itab INTO wa_itab.
        TRANSFER wa_itab TO dataset.
      ENDLOOP.
      CLOSE DATASET dataset
    use CG3Y transaction to download file from app server to presentation server.
    Regards
    Sree

  • Download Excel when program is run in background

    Hi all,
    I need help urgently in downloading my report into an excel file automatically when my report is has completed its run in background.
    Appreciate if help can be provided.
    Many thanks in advance.

    Check out the sample program of the provided link ..
    http://www.sap-img.com/abap/download-in-background-in-excel-format.htm

  • How to download background o/p in multiple excel sheet?

    hi every body,
                                I am sandipan. I am very new in this field. My  requirement is  a report is showing total  sales report. Fields are kunag, vbeln, name1, netwr and many more fields are there   and it executing in background schdule . After  executing In background it shows the output  sm37  and i have to download this report in different excel sheet from application tool bar  in  sm37  . report will download according to kunag inr different excel sheet. for example- suppose there are 100 kunag. so there will be 100 excel sheet and the name of the  excel sheet according to customer id  means diff. customer id so different excel sheet . how is it  possible ?  please guide me with your valuable suggestion.
                                                                                    thank you.

    Hi,
    Before posting try to search in SCN next time.
    Go through below link, it may help you.
    [excel_sheets|http://www.sapdev.co.uk/ms/ms_excel.htm]

  • How to run a excel sheet macro using RH_START_EXCEL_WITH_DATA

    Hi All,
    I have found out one FM, RH_START_EXCEL_WITH_DATA,
    To run the excel sheet marco from the ABAP editor.
    DATA_FILENAME
    DATA_PATH_FLAG
    DATA_ENVIRONMENT
    DATA_TABLE
    MACRO_FILENAME
    MACRO_PATH_FLAG
    MACRO_ENVIRONMENT
    WAIT
    DELETE_FILE
    I found these parameters in the FM,
    which I need to pass,
    Any code sample...
    Any hint...
    Thanks,
    Kalyan Chandramouli

    hi
    good
    check with this report.
    REPORT Z_DISPLAY_IDOC_AND_DATA line-size 275.
    This tool reads an existing Idoc and dispays the contents in a       *
    spreadsheet format. The spreadsheet (MS-EXCEL) will be automatically *
    created if D_EXCEL = 'X'.                                            *
    data: idoc_control like EDIDC,
          NUMBER_OF_DATA_RECORDS like sy-dbcnt,
          NUMBER_OF_STATUS_RECORDS like sy-dbcnt,
          INT_EDIDS like edids occurs 0 with header line,
          INT_EDIDD like edidd occurs 0 with header line.
    TYPE-POOLS :  LEDID.
    data: STRUCT_TYPE TYPE  LEDID_STRUCT_TYPE ,
          IDOC_STRUCT TYPE  LEDID_T_IDOC_STRUCT,
          SEGMENTS TYPE  LEDID_T_SEGMENT,
          SEGMENT_STRUCT TYPE  LEDID_T_SEGMENT_STRUCT,
          excel_tab(2000) occurs 0 with header line.
    parameter: DOCNUM like edidc-docnum obligatory, ""Idoc Number
               sap_rel like SY-SAPRL default SY-SAPRL obligatory,
               pi_ver like EDI_VERREC-VERSION default '3' obligatory,
               d_excel as checkbox default 'X'. ""Download ?
    start-of-selection.
      perform read_idoc.
      perform process_idoc.
      if d_excel = 'X'.
        perform download_to_excel.
      endif.
    end-of-selection.
    FORM read_idoc.
      CALL FUNCTION 'IDOC_READ_COMPLETELY'
           EXPORTING
                DOCUMENT_NUMBER          = docnum
           IMPORTING
                IDOC_CONTROL             = idoc_control
                NUMBER_OF_DATA_RECORDS   = NUMBER_OF_DATA_RECORDS
                NUMBER_OF_STATUS_RECORDS = NUMBER_OF_STATUS_RECORDS
           TABLES
                INT_EDIDS                = INT_EDIDS
                INT_EDIDD                = INT_EDIDD
           EXCEPTIONS
                DOCUMENT_NOT_EXIST       = 1
                DOCUMENT_NUMBER_INVALID  = 2
                OTHERS                   = 3.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "" read_idoc
    FORM process_idoc.
      perform read_idoc_structure.
      perform display_data_records.
    ENDFORM.                    "" process_idoc
    FORM display_data_records.
      data: PE_seg_HEADER like EDI_SAPI01,
            segname like EDI_IAPI12-SEGMENTTYP,
            prev_segname like EDI_IAPI12-SEGMENTTYP value ' ',
            pt_fields2 like EDI_IAPI12 occurs 0 with header line,
            PT_FVALUES2 like EDI_IAPI14 occurs 0 with header line,
            byte_first type i,
            byte_last type i,
            field_val(50),
            tmp_str(15),
            tmp_str3(15),
            seg_repeats type i value 0,
            tmp_str2(15),
            tab_cr(1) type x value '09',
            tot_ctr type i value 0,
            ctr type i value 0,
            msg(40) type c.
      data: IDOC_STRUCT_wa TYPE  LEDID_IDOC_STRUCT.
      sort int_edidd by segnum.
      describe table int_edidd lines tot_ctr.
      loop at int_edidd.
        move int_edidd-segnam to segname.
        clear msg.
        concatenate 'Reading segment ' segname
                    into msg separated by space.
        if tot_ctr <> 0.
          ctr = ( 100 * sy-tabix ) / tot_ctr.
        endif.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
             EXPORTING
                  PERCENTAGE = ctr
                  TEXT       = msg.
        add 1 to seg_repeats.
        clear tmp_str2.
        if int_edidd-segnam <> prev_segname.
          seg_repeats = 1.
          clear: pe_seg_header, pt_fields2, pt_fvalues2.
          refresh: pt_fields2, pt_fvalues2.
          CALL FUNCTION 'SEGMENT_READ_COMPLETE'
               EXPORTING
                    PI_SEGTYP                 = segname
                    PI_RELEASE                = sap_rel
                    PI_VERSION                = pi_ver
               IMPORTING
                    PE_HEADER                 = pe_seg_header
               TABLES
                    PT_FIELDS                 = pt_fields2
                    PT_FVALUES                = pt_fvalues2
               EXCEPTIONS
                    SEGMENT_UNKNOWN           = 1
                    SEGMENT_STRUCTURE_UNKNOWN = 2
                    OTHERS                    = 3.
          IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE 'I' NUMBER SY-MSGNO
                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          prev_segname = int_edidd-segnam.
        endif.
        read table idoc_struct into idoc_struct_wa with key
                               segment_type = int_edidd-segnam.
        if sy-subrc = 0.
          IF IDOC_STRUCT_WA-SYNTAX_ATTRIB-MUSTFL = 'X'.
            TMP_STR = 'Mandatory'.                  ""Mandatory
          ELSE.
            TMP_STR = 'Optional'.                  ""Optional
          ENDIF.
          if IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-QUALIFIER = 'X'.
            tmp_str3 = 'Qualified'.
          else.
            tmp_str3 = 'Non-Qualified'.
          endif.
          shift IDOC_STRUCT_wa-SYNTAX_ATTRIB-OCCMAX
                                     left deleting leading '0'.
          move seg_repeats to tmp_str2.
          condense: IDOC_STRUCT_wa-SYNTAX_ATTRIB-OCCMAX, tmp_str2.
          concatenate tmp_str2 'of'  IDOC_STRUCT_wa-SYNTAX_ATTRIB-OCCMAX
              into tmp_str2 separated by space.
          write :/ IDOC_STRUCT_wa-SEGMENT_TYPE,
               tmp_str,
               TMP_STR3,
               tmp_str2,
               IDOC_STRUCT_wa-SYNTAX_ATTRIB-HLEVEL,
               IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-plast,
               IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-DESCRP.
          if d_excel = 'X'.
            concatenate 'Segment Name' tab_cr
                        'Mand / Opt ' tab_cr
                        'Qual / non-Qual' tab_cr
                        'Seq of Max' tab_cr
                        'Level' tab_cr
                        'Owner' tab_cr
                        'Description'
                        into excel_tab.
            append excel_tab.
            concatenate IDOC_STRUCT_wa-SEGMENT_TYPE tab_cr
                  tmp_str tab_cr
                  TMP_STR3 tab_cr
                  tmp_str2 tab_cr
                  IDOC_STRUCT_wa-SYNTAX_ATTRIB-HLEVEL tab_cr
                  IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-plast tab_cr
                  IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-DESCRP
                  into excel_tab.
            append excel_tab.
            concatenate tab_cr
                        'Field Nma' tab_cr
                        'Type' tab_cr
                        'Length' tab_cr
                        'Byte From' tab_cr
                        'Byte To' tab_cr
                        'Description' tab_cr
                        'Value' tab_cr
                        'Qualifier Meaning'
                        into excel_tab.
            append excel_tab.
          endif.
        endif.
        sort pt_fields2 by field_pos.
        byte_first = 0.
        loop at pt_fields2.
          clear: field_val.
          byte_last = pt_fields2-EXTLEN.
          write int_edidd-sdata+byte_first(byte_last) to
                field_val left-justified.
          shift pt_fields2-EXTLEN left deleting leading '0'.
          shift pt_fields2-byte_first left deleting leading '0'.
          shift pt_fields2-byte_last left deleting leading '0'.
          write:/ '   ', pt_fields2-fieldname,
                  pt_fields2-datatype,
                  pt_fields2-EXTLEN,
                  pt_fields2-byte_first ,
                  pt_fields2-byte_last,
                  pt_fields2-descrp,
                  field_val.
          read table pt_fvalues2 with key fieldname = pt_fields2-fieldname
                        fldvalue_l = field_val.
          add byte_last to byte_first.
          if sy-subrc = 0.
            write : pt_fvalues2-descrp.
          else.
            clear pt_fvalues2-descrp.
          endif.
          if d_excel = 'X'.
            concatenate tab_cr pt_fields2-fieldname tab_cr
                    pt_fields2-datatype tab_cr
                    pt_fields2-EXTLEN tab_cr
                    pt_fields2-byte_first tab_cr
                    pt_fields2-byte_last tab_cr
                    pt_fields2-descrp tab_cr
                    field_val tab_cr
                    pt_fvalues2-descrp
                    into excel_tab.
            append excel_tab.
          endif.
        endloop.
      endloop.
    ENDFORM.                    "" display_data_records
    FORM read_idoc_structure.
      data: idoctype type LEDID_IDOCTYPE.
      if not idoc_control-cimtyp is initial.
        STRUCT_TYPE = 'E'. ""Extended
        idoctype = idoc_control-cimtyp.
      else.
        STRUCT_TYPE = 'B'. ""Basic
        idoctype = idoc_control-idoctp.
      endif.
      CALL FUNCTION 'IDOC_TYPE_COMPLETE_READ'
           EXPORTING
                RELEASE              = sap_rel
                STRUCT_TYPE          = STRUCT_TYPE
                IDOCTYPE             = idoctype
                VERSION              = pi_ver
          IMPORTING
               IDOC_TYPE            = idoctype
           TABLES
                IDOC_STRUCT          = idoc_struct
                SEGMENTS             = segments
                SEGMENT_STRUCT       = segment_struct
           EXCEPTIONS
                IDOCTYPE_UNKNOWN     = 1
                IDOCSTRUCT_UNKNOWN   = 2
                SEGMENT_DATA_MISSING = 3
                ILLEGAL_STRUCT_TYPE  = 4
                OTHERS               = 5.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "" read_idoc_structure
    FORM download_to_excel.
      data: name like RLGRAP-FILENAME.
      shift docnum left deleting leading '0'.
      concatenate docnum '-' idoc_control-idoctp '.xls'
                  into name.
      CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
       EXPORTING
         DATA_NAME                 = name
         DATA_TYPE                 = 'ASC'
         WAIT                      = ' '
       TABLES
         DATA_TAB                  = excel_tab
       EXCEPTIONS
         NO_BATCH                  = 1
         EXCEL_NOT_INSTALLED       = 2
         WRONG_VERSION             = 3
         INTERNAL_ERROR            = 4
         INVALID_TYPE              = 5
         CANCELLED                 = 6
         DOWNLOAD_ERROR            = 7
         OTHERS                    = 8
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "" download_to_excel
    reward point if helpful.
    thanks
    mrutyun^

  • How can I read the EXCEL file while Program is running in background.

    Hi all Expert,
    How can I read the EXCEL file while Program is running in background.
    Thanks

    you need to place ur excel file on application server and follow this thread: Reading an Excel file from the application server?
    loots of information if you can search forum.. thanks

  • How to save data in New Excel Sheet on each time run the VI?

    Hello everyone 
    I am doing my dissertation. In that i have to store the data of load cell in the excel sheet. I have done that.
    Here i have attach the vi , template in which want to save data named My , and output when complete the rn of vi named My Report.
    Now the problem is once i have run the vi , my report is generated but second time when i run the vi the new my report sheet is not generated. and the second problem is i am getting out put as 511, 0,  2.49.  
    I want the when ever i run the vi every time the new excel sheet should be generated and saved with date, time and my report tag. ex. My Report 20/11/13 12:00
    And i want the output 511,2.49,...dont want this 0.
    please hepl me out its urgent
    Attachments:
    COM TO EXCEL WITH EXCEL TOOLKIT.vi ‏44 KB
    MY.xlsx ‏12 KB
    My_Report 1.xlsx ‏12 KB

    You just need to change the settings. Whenever it will write to excel it will display the save as option.
    Then user will confirm the same
    In the excel dispose report.vi passsave change and close report boolean input as TRUE and see
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet

  • Is it possible to download to excel when a report running in background

    Dear All,
    I tried to execute one ALV report in foreground and background. In foreground the report is giving excel download but in background no excel download is coming. Is there any specific reason for that?
    Thanks and regards,
    Atanu

    Atanu dey,
    If you wnat to download excel in back ground
    You have to download in application server only.
    EX:
    DATA :  v_filepath(80)     VALUE '/data/sapdata/inc/error_log/pme_br/',
      c_coma     VALUE ',' .
    OPEN DATASET v_filepath FOR OUTPUT IN TEXT MODE.
        IF sy-subrc EQ 0.
         LOOP AT i_errors_bat.
         CONCATENATE i_errors_bat-plant c_coma
                                 i_errors_bat-zzvendor c_coma
                           INTO v_string.
            TRANSFER v_string TO v_filepath.
          ENDLOOP.
       CLOSE DATASET v_filepath.
    Note : you can download in presentation server also.
    but it requires lot of authorizations and have to use
    FTP commands.
    Reason is Apllication server in back ground has to
    recognize the from which system request came.
    Better go for OPEN DATA sets.
    Don't forget to reward if useful.....

  • Spool List output display 255 char when the rpt is run in Background

    Hi Friends,
    I tried executing a program in Background.. The report output has more than 64 columns ( more than 255 char ) ..
    Iam using "REUSE_ALV_GRID_DISPLAY" for displaying the list.
    My Problem:
    1. The spool list is truncated after 255 characters when i run in background.
    2. Th output in Spool List is coming in 2 rows ... not very clear ... becoz of that the grid lines are not getting displayed.
    3. I ve not used any Standard - line size for dislaying ..
    4. In foreground i am able to display all the 64 columns... Y not in Background......
    5. My Printer setting is ..X_255 .... only ...
    Requirement:
    1. What should i do to increase the spool list display to more than 255 characters
    2. Or how to save the background run reports output to an excel sheet as how we 'll take the from the foreground.
    Expecting your answers,
    Thanks in Advance...
    Cheers,
    R.Kripa .........
    Enjoy ABAPing ..........
    new upcoming Abaper ....

    Hello Kripa,
    You need to perform two actions.
    1. set an appropriate format for the printer you are using. As explained from the previous messages you go to: SPAD -> output devives (type the printer you are using) -> from the menu ..-> goto -> device type -> formats. In there create a new format like Z_65_650
    or Z_65_xxxx where xxxx could be up to 1065. This is the length of your report.
    When you give your report in background, do not forget to choose the new format you created.
    2. After the spool request is created, you take its number and use it ar a parameter in the following report.
    Please copy and paste it in a new program, maybe called ZRSPOSHOWSPOOLLIST.
    It should work then.
    roxani
    Display spool list > 255 columns
    This is a SAP utility report to allow display of
    spool request lists with line size more than 255 characters in
    releases 4.6B and 4.6C (4.6D kernel must be used)
    REPORT ZRSPOSHOWLIST LINE-SIZE 80.
    PARAMETERS: RQIDENT LIKE TSP01-RQIDENT,
    FIRSTL TYPE I DEFAULT 0,
    LASTL TYPE I DEFAULT 0.
    global data from LSPOXTOP
    DATA: RC(10) TYPE C,
    ERRMSG(100) TYPE C,
    STATUS LIKE SY-SUBRC,
    DSN_TYPE(8) TYPE C.
    DATA: BEGIN OF DATA_SET_LINE,
    DATA_LENGTH(5),
    PRECOL(1),
    DATA_LINE(1000),
    DATA_LINE(5000), "MODAB
    END OF DATA_SET_LINE,
    DATA_SET_LENGTH(5) TYPE C.
    TABLES: TSP01, TST05, TSPOPTIONS.
    DATA: TEMSE_NAME LIKE TST01-DNAME,
    TEMSE_CLIENT LIKE TST01-DCLIENT,
    TEMSE_HANDLE LIKE RSTSTYPE-HANDLE,
    TEMSE_PART LIKE TST01-DPART,
    TEMSE_OBJTYP LIKE TST01-DTYPE,
    TEMSE_RECTYP LIKE RSTSTYPE-RECTYP,
    TEMSE_CHARCO LIKE TST01-DCHARCOD.
    DATA: IS_OTF.
    global data from LSPOCTOP
    DATA: BEGIN OF SPOC
    , escape
    , prtctrl
    , FIRST_BYTES(4) " collection of the first bytes of the
    " escape sequences, which I am searching for.
    , PRTCTRL_START_LENGTH TYPE I
    , PRTCTRL_TOTAL_LENGTH TYPE I
    , PRTCTRL_START(10)
    , SYMBOL_LOW_START(10)
    , SYMBOL_HGH_START(10)
    , SYMBOL_START_LENGTH TYPE I
    , ICON_START(10)
    , ICON_START_LENGTH TYPE I
    , ICON_SEL TYPE I VALUE 1
    , FRAME_START(10)
    , FRAME_START_LENGTH TYPE I
    , END OF SPOC.
    FIELD-SYMBOLS: <SPOC_PRTCTRL> TYPE C
    , <SPOC_FRAME> TYPE C
    , <SPOC_ICON> TYPE C
    , <SPOC_SYMBOL_LOW> TYPE C
    , <SPOC_SYMBOL_HGH> TYPE C
    copied from RSPO_DISPLAY_ABAP_SPOOLJOB
    DATA: BUFFER LIKE DATA_SET_LINE OCCURS 1000.
    TABLES: TSP02L.
    SELECT SINGLE * FROM TSP01 WHERE RQIDENT = RQIDENT.
    IF SY-SUBRC <> 0.
    WRITE: / 'Spool request does not exist:'(001), RQIDENT.
    EXIT.
    ENDIF.
    CALL FUNCTION 'RSPO_CHECK_JOB_PERMISSION'
    EXPORTING
    ACCESS = 'DISP'
    SPOOLREQ = TSP01
    EXCEPTIONS
    NO_PERMISSION = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    WRITE: / 'No authorization to display'(002).
    EXIT.
    ENDIF.
    PERFORM READ_DATA TABLES BUFFER
    USING TSP01 FIRSTL LASTL.
    IF SY-SUBRC <> 0.
    WRITE: / 'Error reading spoolo request'(003).
    EXIT.
    ENDIF.
    IF IS_OTF = 'X'.
    WRITE: / 'This spool request is not an ABAP list'(004).
    EXIT.
    ENDIF.
    PERFORM DISPLAY_DATA TABLES BUFFER USING TSP01-RQPAPER TSP01-RQIDENT.
    FORM GET_SPOOL_LINE.
    DO.
    IF TEMSE_RECTYP+1(1) = 'Y'.
    CALL 'C_RSTS_READ'
    ID 'HANDLE' FIELD TEMSE_HANDLE
    ID 'BUFF' FIELD DATA_SET_LINE
    ID 'BUFFLG' FIELD 1006
    ID 'BUFFLG' FIELD 5006 "MODAB
    ID 'ALLINE' FIELD 'X'
    ID 'BINARY' FIELD ' '
    ID 'SHOWLG' FIELD 'X'
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    STATUS = SY-SUBRC.
    ELSE.
    CALL 'C_RSTS_READ'
    ID 'HANDLE' FIELD TEMSE_HANDLE
    ID 'BUFF' FIELD DATA_SET_LINE+1
    ID 'BUFFLG' FIELD 1005
    ID 'BUFFLG' FIELD 5005 "MODAB
    ID 'ALLINE' FIELD 'X'
    ID 'BINARY' FIELD ' '
    ID 'SHOWLG' FIELD 'X'
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    STATUS = SY-SUBRC.
    DATA_SET_LINE(5) = DATA_SET_LINE+1(5).
    DATA_SET_LINE-PRECOL = ' '.
    ADD 1 TO DATA_SET_LINE-DATA_LENGTH.
    ENDIF.
    STATUS = SY-SUBRC.
    IF STATUS <> 6. " EOF, error condition, or got data
    EXIT.
    ENDIF.
    end of this part, try to open next part
    ADD 1 TO TEMSE_PART.
    CALL 'C_RSTS_CLOSE'
    ID 'HANDLE' FIELD TEMSE_HANDLE
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    STATUS = SY-SUBRC.
    IF STATUS = 0.
    CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
    EXPORTING
    AUTHORITY = 'SP01'
    CLIENT = TEMSE_CLIENT "hjl
    NAME = TEMSE_NAME
    PART = TEMSE_PART
    IMPORTING
    CHARCO = TEMSE_CHARCO
    CREATER =
    CREDATE =
    DELDATE =
    MAX_CREDATE =
    MAX_DELDATE =
    NON_UNIQ =
    NOOF_PARTS =
    RECTYP = TEMSE_RECTYP
    SIZE =
    STOTYP =
    type =
    OBJTYPE = TEMSE_OBJTYP
    EXCEPTIONS
    FB_ERROR = 1
    FB_RSTS_OTHER = 2
    NO_OBJECT = 3
    NO_PERMISSION = 4
    OTHERS = 5.
    STATUS = SY-SUBRC.
    ENDIF.
    IF STATUS = 0.
    CALL 'C_RSTS_OPEN_READ'
    ID 'HANDLE' FIELD TEMSE_HANDLE
    ID 'CLIENT' FIELD TEMSE_CLIENT "hjl
    ID 'NAME' FIELD TEMSE_NAME
    ID 'PART' FIELD TEMSE_PART
    ID 'TYPE' FIELD TEMSE_OBJTYP
    ID 'CONV' FIELD ' '
    ID 'ALLINE' FIELD 'X'
    ID 'BINARY' FIELD ' '
    ID 'RECTYP' FIELD TEMSE_RECTYP
    ID 'CHARCO' FIELD TEMSE_CHARCO
    ID 'PROM' FIELD 'I'
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    STATUS = SY-SUBRC.
    ENDIF.
    ENDDO.
    IF STATUS = 4.
    STATUS = 12. "EOF
    ENDIF.
    IF STATUS = 8.
    STATUS = 40. "Line too long
    ENDIF.
    DATA_SET_LENGTH = DATA_SET_LINE-DATA_LENGTH.
    ENDFORM.
    FORM READ_DATA TABLES BUFFER
    USING TSP01 LIKE TSP01 VALUE(FIRST) TYPE I
    VALUE(LAST) TYPE I.
    DATA: LINES TYPE I.
    REFRESH BUFFER.
    CLEAR IS_OTF.
    TEMSE_CLIENT = TSP01-RQCLIENT.
    TEMSE_NAME = TSP01-RQO1NAME.
    TEMSE_PART = 1.
    CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
    EXPORTING
    AUTHORITY = 'SP01'
    CLIENT = TEMSE_CLIENT
    NAME = TEMSE_NAME
    PART = TEMSE_PART
    IMPORTING
    CHARCO = TEMSE_CHARCO
    CREATER =
    CREDATE =
    DELDATE =
    MAX_CREDATE =
    MAX_DELDATE =
    NON_UNIQ =
    NOOF_PARTS =
    RECTYP = TEMSE_RECTYP
    SIZE =
    STOTYP =
    type =
    OBJTYPE = TEMSE_OBJTYP
    EXCEPTIONS
    FB_ERROR = 1
    FB_RSTS_OTHER = 2
    NO_OBJECT = 3
    NO_PERMISSION = 4
    OTHERS = 5.
    IF SY-SUBRC = 0.
    IF TEMSE_OBJTYP(3) = 'OTF'.
    IS_OTF = 'X'.
    ENDIF.
    ELSE.
    EXIT.
    ENDIF.
    CLEAR TEMSE_HANDLE.
    CALL 'C_RSTS_OPEN_READ'
    ID 'HANDLE' FIELD TEMSE_HANDLE
    ID 'CLIENT' FIELD TEMSE_CLIENT "hjl
    ID 'NAME' FIELD TEMSE_NAME
    ID 'PART' FIELD TEMSE_PART
    ID 'TYPE' FIELD TEMSE_OBJTYP
    ID 'CONV' FIELD ' '
    ID 'ALLINE' FIELD 'X'
    ID 'BINARY' FIELD ' '
    ID 'RECTYP' FIELD TEMSE_RECTYP
    ID 'CHARCO' FIELD TEMSE_CHARCO
    ID 'PROM' FIELD 'I'
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    STATUS = SY-SUBRC.
    IF STATUS = 0.
    DO.
    PERFORM GET_SPOOL_LINE.
    IF STATUS <> 0 AND STATUS <> 40 AND STATUS <> 12.
    PERFORM CLOSE_JOB.
    EXIT.
    ENDIF.
    IF STATUS <> 12. " 12 = End
    IF NOT ( DATA_SET_LENGTH IS INITIAL ).
    DATA_SET_LINE-DATA_LENGTH = DATA_SET_LENGTH - 1.
    ENDIF.
    ADD 1 TO LINES.
    IF LINES >= FIRST.
    APPEND DATA_SET_LINE TO BUFFER.
    ENDIF.
    IF ( NOT LAST IS INITIAL ) AND ( LINES >= LAST ).
    EXIT.
    ENDIF.
    ELSE.
    IF LINES = 0.
    PERFORM CLOSE_JOB.
    EXIT.
    ENDIF.
    IF LINES < FIRST .
    PERFORM CLOSE_JOB.
    EXIT.
    ENDIF.
    EXIT.
    ENDIF.
    ENDDO.
    PERFORM CLOSE_JOB.
    ENDIF.
    ENDFORM.
    FORM CLOSE_JOB *
    FORM CLOSE_JOB.
    IF STATUS <> 0 AND STATUS <> 12.
    CALL 'C_RSTS_CLOSE'
    ID 'HANDLE' FIELD TEMSE_HANDLE
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    MESSAGE E112(PO) WITH STATUS RC ERRMSG RAISING READ_ERROR.
    ENDIF.
    CALL 'C_RSTS_CLOSE'
    ID 'HANDLE' FIELD TEMSE_HANDLE
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    STATUS = SY-SUBRC.
    IF STATUS <> 0.
    MESSAGE E112(PO) WITH STATUS RC ERRMSG RAISING READ_ERROR.
    ENDIF.
    ENDFORM.
    FORM DISPLAY_DATA TABLES BUFFER USING RQPAPER LIKE TSP01-RQPAPER
    RQID LIKE TSP01-RQIDENT.
    DATA: LINE_LENGTH TYPE I, GCOL TYPE I, GLINES TYPE I,
    LINE_LENGTH2 LIKE RSTSTYPE-LINELENGTH,
    V, V2.
    CALL FUNCTION 'RSPO_SPOOLDATA_WRITE_INIT'.
    PERFORM SPOOLDATA_WRITE_INIT. "MODAB
    select single * from tspoptions where spoption = 'REALWIDTH'.
    if sy-subrc = 0.
    V = 'X'.
    endif.
    select single * from tspoptions where spoption = 'REALHEIGHT'.
    if sy-subrc = 0.
    V2 = 'X'.
    endif.
    IF NOT V IS INITIAL OR NOT V2 IS INITIAL.
    GCOL = 0.
    GLINES = 0.
    SELECT SINGLE * FROM TSP02L WHERE PJIDENT = RQID
    AND PJNUMMER = 0.
    IF SY-SUBRC = 0.
    GCOL = TSP02L-COLUMNS.
    GLINES = TSP02L-LINES.
    ELSE.
    CALL FUNCTION 'RSPO_GET_SIZE_OF_LAYOUT'
    EXPORTING
    LAYOUT = RQPAPER
    IMPORTING
    ANSWER =
    COLUMNS = GCOL
    LINES = GLINES
    PFORMAT =
    ENDIF.
    ENDIF.
    IF GCOL < 80 OR V IS INITIAL.
    GCOL = 255.
    ENDIF.
    IF GLINES < 5 OR V2 IS INITIAL.
    GLINES = 0.
    ENDIF.
    IF GCOL >= 1024. "MODAB
    GCOL = 1023.
    ENDIF.
    NEW-PAGE NO-HEADING NO-TITLE LINE-SIZE GCOL
    LINE-COUNT GLINES. " make a wide list
    SET BLANK LINES ON.
    LOOP AT BUFFER.
    DATA_SET_LINE = BUFFER.
    IF DATA_SET_LINE-PRECOL = 'P'.
    IF DATA_SET_LINE(1) = ' '. " Echter Vorschub ?"
    NEW-PAGE.
    ENDIF.
    CONTINUE.
    ENDIF.
    Zeilenlange berechnen, falls unbekannt.
    IF DATA_SET_LINE-DATA_LENGTH IS INITIAL.
    LINE_LENGTH = STRLEN( DATA_SET_LINE-DATA_LINE ).
    ELSE.
    LINE_LENGTH = DATA_SET_LINE-DATA_LENGTH.
    ENDIF.
    IF LINE_LENGTH > 0.
    LINE_LENGTH2 = LINE_LENGTH.
    PERFORM SPOOLDATA_WRITE USING DATA_SET_LINE-DATA_LINE "MODAB
    LINE_LENGTH2
    1.
    ELSE.
    " Leerzeile
    SKIP.
    ENDIF.
    ENDLOOP.
    ENDFORM.
    copied from RSPO_SPOOLDATA_WRITE
    FORM SPOOLDATA_WRITE USING VALUE(SPOOL_DATA)
    VALUE(DATA_LENGTH) LIKE RSTSTYPE-LINELENGTH
    VALUE(START_POS) LIKE SY-COLNO.
    function globals
    DATA: LPOS LIKE SY-COLNO
    , REST_LEN TYPE I
    , AREA_LEN TYPE I
    , NEXT_HOT TYPE I " offset of next special character
    , COLS TYPE I " columns used by special character
    , BYTES TYPE I " bytes used by special character
    , HOT2
    , HOT3
    , HOT4
    , HOT5
    , HOT6
    , HOT7
    , BEGIN OF ESCAPE_TRICK
    , X1(1) TYPE X
    , END OF ESCAPE_TRICK
    , THE_PRTCTRL(5) TYPE C
    Because of a problem within the ABAP listprocessing, I shall
    never output the same icon side by side with the same color
    and without a gap.
    As I don't know the data, I will use two different variables
    alternatively.
    , ICON_ID1 LIKE ICONS-L4
    , ICON_ID2 LIKE ICONS-L4.
    FIELD-SYMBOLS: <LDATA>
    , <PLAIN_TEXT>
    , <PRTCTRL>
    , <HOT_PRTCTRL>
    , <HOT_FRAME>
    , <HOT_ICON>
    , <HOT_SYMBOL>
    IF START_POS < 2.
    write at / ' ' no-gap.
    NEW-LINE.
    LPOS = 1.
    ELSE.
    LPOS = START_POS.
    ENDIF.
    REST_LEN = STRLEN( SPOOL_DATA ).
    DESCRIBE FIELD SPOOL_DATA LENGTH AREA_LEN.
    IF DATA_LENGTH = 0.
    " fine.
    ELSEIF DATA_LENGTH <= AREA_LEN.
    REST_LEN = DATA_LENGTH.
    ELSE.
    WRITE: / 'Fehler beim Decodieren der Listendaten'(005).
    STOP.
    ENDIF.
    CHECK REST_LEN > 0.
    ASSIGN SPOOL_DATA(REST_LEN) TO <LDATA>.
    WHILE <LDATA> CA SPOC-FIRST_BYTES.
    NEXT_HOT = SY-FDPOS.
    IF NEXT_HOT > 0.
    ASSIGN <LDATA>(NEXT_HOT) TO <PLAIN_TEXT>.
    MODAB
    PERFORM WRITE_BIGFIELD USING <PLAIN_TEXT>
    NEXT_HOT
    LPOS.
    WRITE AT LPOS <PLAIN_TEXT> NO-GAP.
    ADD NEXT_HOT TO LPOS.
    SUBTRACT NEXT_HOT FROM REST_LEN.
    ASSIGN <LDATA>+NEXT_HOT(REST_LEN) TO <LDATA>.
    ENDIF.
    IF REST_LEN >= SPOC-PRTCTRL_START_LENGTH.
    ASSIGN <LDATA>(SPOC-PRTCTRL_START_LENGTH) TO <HOT_PRTCTRL>.
    ELSE.
    ASSIGN 'too_short' TO <HOT_PRTCTRL>.
    ENDIF.
    IF REST_LEN >= SPOC-FRAME_START_LENGTH.
    ASSIGN <LDATA>(SPOC-FRAME_START_LENGTH) TO <HOT_FRAME>.
    ELSE.
    ASSIGN 'too_short' TO <HOT_FRAME>.
    ENDIF.
    IF REST_LEN >= SPOC-ICON_START_LENGTH.
    ASSIGN <LDATA>(SPOC-ICON_START_LENGTH) TO <HOT_ICON>.
    ELSE.
    ASSIGN 'too_short' TO <HOT_ICON>.
    ENDIF.
    IF REST_LEN >= SPOC-SYMBOL_START_LENGTH.
    ASSIGN <LDATA>(SPOC-SYMBOL_START_LENGTH) TO <HOT_SYMBOL>.
    ELSE.
    ASSIGN 'too_short' TO <HOT_SYMBOL>.
    ENDIF.
    IF REST_LEN > 1.
    HOT2 = <LDATA>+1(1).
    IF REST_LEN > 2.
    HOT3 = <LDATA>+2(1).
    IF REST_LEN > 3.
    HOT4 = <LDATA>+3(1).
    ELSE.
    HOT4 = '?'.
    ENDIF.
    ELSE.
    HOT3 = '?'.
    ENDIF.
    ELSE.
    HOT2 = '?'.
    ENDIF.
    IF <HOT_FRAME> = <SPOC_FRAME>.
    COLS = 1. " in most cases.
    BYTES = 2. " in most cases.
    CASE HOT2.
    WHEN '0'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
    WHEN '1'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
    WHEN '2'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
    WHEN '3'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
    WHEN '4'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
    WHEN '5'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
    WHEN '6'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
    WHEN '7'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
    WHEN '8'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
    WHEN '9'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
    WHEN ':'. WRITE AT LPOS HOT2 AS LINE NO-GAP.
    WHEN ';'. " box_drawings_light_left
    WRITE AT LPOS '4' AS LINE NO-GAP.
    WHEN '<'. " box_drawings_light_up
    WRITE AT LPOS '5' AS LINE NO-GAP.
    WHEN '='. " box_drawings_light_right
    WRITE AT LPOS '4' AS LINE NO-GAP.
    WHEN '>'. " box_drawings_light_down
    WRITE AT LPOS '5' AS LINE NO-GAP.
    WHEN '?'. " drawings_checkbox_off
    WRITE AT LPOS ' ' AS CHECKBOX INPUT OFF NO-GAP.
    WHEN '@'. " drawings_checkbox_on
    WRITE AT LPOS 'X' AS CHECKBOX INPUT OFF NO-GAP.
    WHEN OTHERS.
    BYTES = 0.
    ENDCASE.
    ENDIF.
    IF <HOT_SYMBOL> = <SPOC_SYMBOL_LOW>.
    ESCAPE_TRICK = HOT3.
    SUBTRACT 32 FROM ESCAPE_TRICK-X1.
    IF HOT4 = SPACE.
    WRITE AT LPOS(2) ESCAPE_TRICK AS SYMBOL NO-GAP.
    COLS = 2.
    BYTES = 4.
    ELSE.
    WRITE AT LPOS(1) ESCAPE_TRICK AS SYMBOL NO-GAP.
    BYTES = 3.
    ENDIF.
    ENDIF.
    IF <HOT_SYMBOL> = <SPOC_SYMBOL_HGH>.
    ESCAPE_TRICK = HOT3.
    ADD 32 TO ESCAPE_TRICK-X1.
    IF HOT4 = SPACE.
    WRITE AT LPOS(2) ESCAPE_TRICK AS SYMBOL NO-GAP.
    COLS = 2.
    BYTES = 4.
    ELSE.
    WRITE AT LPOS(1) ESCAPE_TRICK AS SYMBOL NO-GAP.
    BYTES = 3.
    ENDIF.
    ENDIF.
    IF <HOT_ICON> = <SPOC_ICON>.
    IF SPOC-ICON_SEL >< 1.
    SPOC-ICON_SEL = 1.
    ICON_ID1 = '@00@'.
    ICON_ID1+1(1) = HOT3.
    ICON_ID1+2(1) = HOT4.
    ELSE.
    SPOC-ICON_SEL = 2.
    ICON_ID2 = '@00@'.
    ICON_ID2+1(1) = HOT3.
    ICON_ID2+2(1) = HOT4.
    ENDIF.
    IF REST_LEN > 4.
    HOT5 = <LDATA>+4(1).
    IF REST_LEN > 5.
    HOT6 = <LDATA>+5(1).
    IF REST_LEN > 6.
    HOT7 = <LDATA>+6(1).
    ELSE.
    HOT7 = '?'.
    ENDIF.
    ELSE.
    HOT6 = '?'.
    ENDIF.
    ELSE.
    HOT5 = '?'.
    ENDIF.
    IF HOT5 = SPACE.
    IF HOT6 = SPACE.
    IF HOT7 = SPACE.
    IF SPOC-ICON_SEL = 1.
    WRITE AT LPOS(4) ICON_ID1 AS ICON.
    write at lpos icon_id1 as icon no-gap.
    ELSE.
    WRITE AT LPOS(4) ICON_ID2 AS ICON.
    write at lpos icon_id2 as icon no-gap.
    ENDIF.
    COLS = 4.
    BYTES = 7.
    ELSE.
    IF SPOC-ICON_SEL = 1.
    WRITE AT LPOS(3) ICON_ID1 AS ICON.
    write at lpos icon_id1 as icon no-gap.
    ELSE.
    WRITE AT LPOS(3) ICON_ID2 AS ICON.
    write at lpos icon_id2 as icon no-gap.
    ENDIF.
    COLS = 3.
    BYTES = 6.
    ENDIF.
    ELSE.
    IF SPOC-ICON_SEL = 1.
    WRITE AT LPOS(2) ICON_ID1 AS ICON.
    write at lpos icon_id1 as icon no-gap.
    ELSE.
    WRITE AT LPOS(2) ICON_ID2 AS ICON.
    write at lpos icon_id2 as icon no-gap.
    ENDIF.
    COLS = 2.
    BYTES = 5.
    ENDIF.
    ELSE.
    "rite at lpos(1) icon_id as icon.
    WRITE AT LPOS(1) '#' NO-GAP. " Not enough space for any icon.
    COLS = 1.
    BYTES = 4.
    ENDIF.
    ENDIF.
    IF <HOT_PRTCTRL> = <SPOC_PRTCTRL>.
    COLS = 0. " in most cases.
    BYTES = 6. " in most cases.
    IF REST_LEN >= SPOC-PRTCTRL_TOTAL_LENGTH.
    THE_PRTCTRL = <LDATA>+SPOC-PRTCTRL_START_LENGTH(5).
    IF THE_PRTCTRL = 'SABLD'.
    FORMAT INTENSIFIED ON.
    "no 3.0 'SAULN'.
    "no 3.0 FORMAT UNDERSCORED ON.
    ELSEIF THE_PRTCTRL = 'SAOFF'.
    FORMAT INTENSIFIED OFF.
    "no 3.0 FORMAT UNDERSCORED OFF.
    ELSEIF THE_PRTCTRL(3) = 'COL'.
    CASE THE_PRTCTRL+3(1).
    WHEN '0'.
    FORMAT COLOR OFF.
    WHEN '1'.
    FORMAT COLOR 1.
    WHEN '2'.
    FORMAT COLOR 2.
    WHEN '3'.
    FORMAT COLOR 3.
    WHEN '4'.
    FORMAT COLOR 4.
    WHEN '5'.
    FORMAT COLOR 5.
    WHEN '6'.
    FORMAT COLOR 6.
    WHEN '7'.
    FORMAT COLOR 7.
    ENDCASE.
    CASE THE_PRTCTRL+4(1).
    WHEN 'N'.
    FORMAT INTENSIFIED OFF INVERSE OFF.
    WHEN 'H'.
    FORMAT INTENSIFIED ON INVERSE OFF.
    WHEN 'V'.
    FORMAT INTENSIFIED ON INVERSE ON.
    ENDCASE.
    ENDIF. "printcontrol
    ELSE. "??
    ENDIF.
    ENDIF.
    IF BYTES = 0.
    BYTES = 1.
    WRITE AT LPOS(1) '#'.
    COLS = 1.
    ENDIF.
    ADD COLS TO LPOS.
    SUBTRACT BYTES FROM REST_LEN.
    IF REST_LEN > 0.
    ASSIGN <LDATA>+BYTES(REST_LEN) TO <LDATA>.
    ELSE.
    EXIT.
    ENDIF.
    ENDWHILE.
    MODAB
    IF REST_LEN > 0.
    ASSIGN <LDATA>(REST_LEN) TO <PLAIN_TEXT>.
    PERFORM WRITE_BIGFIELD USING <PLAIN_TEXT>
    REST_LEN
    LPOS.
    ENDIF.
    ENDFORM.
    FORM WRITE_BIGFIELD USING VALUE(FIELD) TYPE C
    VALUE(LEN)
    VALUE(POS).
    FIELD-SYMBOLS <P>.
    DATA: CHUNK TYPE I.
    WHILE LEN > 0.
    IF LEN > 255.
    CHUNK = 255.
    ELSE.
    CHUNK = LEN.
    ENDIF.
    WRITE AT POS FIELD(CHUNK) NO-GAP.
    ADD CHUNK TO POS.
    LEN = LEN - CHUNK.
    IF LEN > 0.
    FIELD = FIELD+CHUNK.
    ENDIF.
    ENDWHILE.
    ENDFORM.
    FORM SPOOLDATA_WRITE_INIT.
    DATA: BEGIN OF ESCAPE_TRICK
    , X1(1) TYPE X
    , END OF ESCAPE_TRICK
    FIELD-SYMBOLS: <LDATA>
    , <PLAIN_TEXT>
    , <PRTCTRL>
    ESCAPE_TRICK-X1 = '1C'.
    SPOC-PRTCTRL_START = ESCAPE_TRICK.
    SPOC-PRTCTRL_START_LENGTH = 1.
    SPOC-PRTCTRL_TOTAL_LENGTH = SPOC-PRTCTRL_START_LENGTH + 5.
    ASSIGN SPOC-PRTCTRL_START(SPOC-PRTCTRL_START_LENGTH) TO <SPOC_PRTCTRL>.
    ESCAPE_TRICK-X1 = '1B'.
    SPOC-FRAME_START = ESCAPE_TRICK.
    SPOC-FRAME_START_LENGTH = 1.
    ASSIGN SPOC-FRAME_START(SPOC-FRAME_START_LENGTH) TO <SPOC_FRAME>.
    ESCAPE_TRICK-X1 = '1B'.
    SPOC-ICON_START = ESCAPE_TRICK.
    SPOC-ICON_START+1 = ','.
    SPOC-ICON_START_LENGTH = 2.
    ASSIGN SPOC-ICON_START(SPOC-ICON_START_LENGTH) TO <SPOC_ICON>.
    ESCAPE_TRICK-X1 = '1B'.
    SPOC-SYMBOL_LOW_START = ESCAPE_TRICK.
    SPOC-SYMBOL_LOW_START+1 = '('.
    SPOC-SYMBOL_HGH_START = ESCAPE_TRICK.
    SPOC-SYMBOL_HGH_START+1 = ')'.
    SPOC-SYMBOL_START_LENGTH = 2.
    ASSIGN SPOC-SYMBOL_LOW_START(SPOC-SYMBOL_START_LENGTH)
    TO <SPOC_SYMBOL_LOW>.
    ASSIGN SPOC-SYMBOL_HGH_START(SPOC-SYMBOL_START_LENGTH)
    TO <SPOC_SYMBOL_HGH>.
    SPOC-FIRST_BYTES+0(1) = SPOC-PRTCTRL_START(1).
    SPOC-FIRST_BYTES+1(1) = SPOC-FRAME_START(1).
    SPOC-FIRST_BYTES+2(1) = SPOC-ICON_START(1).
    SPOC-FIRST_BYTES+3(1) = SPOC-SYMBOL_LOW_START(1).
    ENDFORM.

  • Code to download output to excel sheet

    Hi friends,
    My requirement is to schedule a batch job in which a program runs with a particular variant. The output should be transported to an excel file and this file has to be placed in the Y drive.
    Can you please tell me how I can code to transfer the output to an excel sheet. Also how to go about this requirement.
    Appreciate your help.
    Thanks in advance,
    Dikshitha
    Moderator message - Please search before asking - post locked
    Edited by: Rob Burbank on Oct 9, 2009 9:17 AM

    Hi,
    If your Y drive is in the presentation server it wont be possible to download the excel in background. If its a application server you can use DATASET statements and download in the application server.
    If its a windows shared network drive probably you could check this blog
    [http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417600)ID1328113750DB01926002626283648817End?blog=/pub/wlg/6830]
    Vikranth

  • Excel sheet download problem from ALV

    Hi all,
    when i am trying to download an ALV report into localfile... Excel, two middle coloum values are not appeared in excel sheet but headings are available.
    last three coloums values are overlapped in these headings.
    Where might be the problem exist?

    Hi,
    Reprots
    http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV? http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV? http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV? http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Check this for basic concepts of OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Tabstrip
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
    Editable ALV
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
    Tree
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
    General Tutorial for OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
    http://www.sapdevelopment.co.uk/reporting/alvhome.htm
    http://www.sap-img.com/abap/what-is-alv-programming.htm
    http://www.sap-img.com/abap-function.htm
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm
    http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf
    http://www.sap-img.com/abap-function.htm

Maybe you are looking for