Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Reading spool data into excel

Former Member
0 Kudos

Hi all

while downloadng spool data into excel...

in my spool table i have 60500 records.here i am skipping first 3 records (some junk text)which i don't need in output excel,by adding sy-tabix >3 condition.with this am gettngs 59999 records in one page correctly.

when its turn to 60000 reocord which should be displayed in second page.here problem is in second page am getting those 3 records which i skipped initially as 60000th n so onrecords.i don't want to display those 3 records again here.can any one explain me how to do?

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

You must be having something in your TOP-OF-PAGE which can distinguish between your TOP-OF-PAGE and your actual data. You can read the spool as suggested by aRs and then deletes the header generated from TOP-OF-PAGE.

Program to generate the Spool


REPORT  ztest_np_1 LINE-COUNT 10 NO STANDARD PAGE HEADING.

start-of-selection.
 do 55 times.
   write: / sy-abcde.
 enddo.

top-of-page.
  write: / 'Top'.
  write: / 'Something'.

Read the spool and deletes header


DATA: lf_spool TYPE tsp01-rqident.

DATA: lt_buffer TYPE STANDARD TABLE OF txmisporow.

lf_spool = <spool>

CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
  EXPORTING
    rqident              = lf_spool
    first_line           = 2
  TABLES
    buffer               = lt_buffer
  EXCEPTIONS
    no_such_job          = 1
    not_abap_list        = 2
    job_contains_no_data = 3
    selection_empty      = 4
    no_permission        = 5
    can_not_access       = 6
    read_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.

DATA: la_buffer LIKE LINE OF lt_buffer.
LOOP AT lt_buffer INTO la_buffer WHERE ( line+0(3) = 'Top' or line = 'Something' ).
  DELETE lt_buffer.
ENDLOOP.

Regards,

Naimesh Patel

9 REPLIES 9

former_member194669
Active Contributor
0 Kudos

I think you are using fm to read the spool , then


      call function 'RSPO_RETURN_ABAP_SPOOLJOB'
        exporting
          rqident              = wa_spool
          first_line           = 4   " Give the value here to skip top lines on each page
        tables
          buffer               = i_spldata
        exceptions
          no_such_job          = 1
          not_abap_list        = 2
          job_contains_no_data = 3
          selection_empty      = 4
          no_permission        = 5
          can_not_access       = 6
          read_error           = 7
          others               = 8.

0 Kudos

yes, let me try with this FM..am already using but not passing the parameter ' FIRST LINE'.

thank you..

Edited by: sunny on Apr 15, 2009 11:33 AM

0 Kudos

hi try this ...may be helpful for you ...

0 Kudos

Hi a@s,

call function 'RSPO_RETURN_ABAP_SPOOLJOB'

exporting

rqident = wa_spool

first_line = 4 " Give the value here to skip top lines on each page

tables

buffer = i_spldata

exceptions

no_such_job = 1

not_abap_list = 2

job_contains_no_data = 3

selection_empty = 4

no_permission = 5

can_not_access = 6

read_error = 7

others = 8.

This one working for only first page...in the same way i want to skip lines for 2nd page n 3rd page..how to do..can u suggest me..

thank u..

0 Kudos

Hi Sunny,

How you solved your problem. I am also having the same type of requirement

0 Kudos

Not at solved..Don't know how to solve this..still trying..

0 Kudos

This may be a roundway solution.

While creating the spool keep the line to the maximum by


    call function 'GET_PRINT_PARAMETERS'
      exporting
        destination            = 'LOCL'
        immediately            = space
        new_list_id            = 'X'
        no_dialog              = 'X'
        user                   = sy-uname
      importing
        out_parameters         = wa_params
        valid                  = v_valid
      exceptions
        archive_info_not_found = 1
        invalid_print_params   = 2
        invalid_archive_params = 3
        others                 = 4.

    wa_params-linct = 1000000.   "<<<<  Keep this to maximum number of lines in 
    wa_params-paart = ' '.

then use


call function 'RSPO_RETURN_ABAP_SPOOLJOB'
        exporting
          rqident              = wa_spool
          first_line           = 4   " Give the value here to skip top lines on each page
        tables
          buffer               = i_spldata
        exceptions
          no_such_job          = 1
          not_abap_list        = 2
          job_contains_no_data = 3
          selection_empty      = 4
          no_permission        = 5
          can_not_access       = 6
          read_error           = 7
          others               = 8.

So in the Spool Heading part will come ONLY in the first page.

naimesh_patel
Active Contributor
0 Kudos

You must be having something in your TOP-OF-PAGE which can distinguish between your TOP-OF-PAGE and your actual data. You can read the spool as suggested by aRs and then deletes the header generated from TOP-OF-PAGE.

Program to generate the Spool


REPORT  ztest_np_1 LINE-COUNT 10 NO STANDARD PAGE HEADING.

start-of-selection.
 do 55 times.
   write: / sy-abcde.
 enddo.

top-of-page.
  write: / 'Top'.
  write: / 'Something'.

Read the spool and deletes header


DATA: lf_spool TYPE tsp01-rqident.

DATA: lt_buffer TYPE STANDARD TABLE OF txmisporow.

lf_spool = <spool>

CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
  EXPORTING
    rqident              = lf_spool
    first_line           = 2
  TABLES
    buffer               = lt_buffer
  EXCEPTIONS
    no_such_job          = 1
    not_abap_list        = 2
    job_contains_no_data = 3
    selection_empty      = 4
    no_permission        = 5
    can_not_access       = 6
    read_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.

DATA: la_buffer LIKE LINE OF lt_buffer.
LOOP AT lt_buffer INTO la_buffer WHERE ( line+0(3) = 'Top' or line = 'Something' ).
  DELETE lt_buffer.
ENDLOOP.

Regards,

Naimesh Patel

Former Member
0 Kudos

yes..