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: 

ALV spool output to internal table

former_member602116
Participant
0 Kudos
1,804

Hi Experts,

I am pulling spool data from ALV using function module

RSPO_RETURN_ABAP_SPOOLJOB. However, the output of the FM is in plain text only and not divided into the columns of the internal table(that was used in the ALV). So it includes even the | | lines in the ALV output. I would want to use a certain column in the ALV table for further processing. Is there another FM that I can use to do this? Or a way to achieve this?

Thank you.

Regards,

Katherine Darunday

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
862

Could you use class cl_salv_bs_runtime_info to wrap the alv execution, you can then get the displayed internal table (and most ALV information) - many samples already available in forum

CALL METHOD cl_salv_bs_runtime_info=>set
  EXPORTING
    display = abap_false
    metadata = abap_false
    data = abap_true.
SUBMIT <report>
  WITH ...
  AND RETURN.
TRY.
  CALL METHOD cl_salv_bs_runtime_info=>get_data_ref
    IMPORTING
      r_data = lr_data.
  ASSIGN lr_data->* TO <inttab>.
  CATCH cx_salv_bs_sc_runtime_info.
  " do your duty
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).
IF <inttab> IS NOT ASSIGNED.
  " do your duty
ELSE.
  " do your job
ENDIF. 

NB: There is also an old report in the wiki : Convert Spool List to ALV Grid, did you find it?

3 REPLIES 3

raymond_giuseppi
Active Contributor
863

Could you use class cl_salv_bs_runtime_info to wrap the alv execution, you can then get the displayed internal table (and most ALV information) - many samples already available in forum

CALL METHOD cl_salv_bs_runtime_info=>set
  EXPORTING
    display = abap_false
    metadata = abap_false
    data = abap_true.
SUBMIT <report>
  WITH ...
  AND RETURN.
TRY.
  CALL METHOD cl_salv_bs_runtime_info=>get_data_ref
    IMPORTING
      r_data = lr_data.
  ASSIGN lr_data->* TO <inttab>.
  CATCH cx_salv_bs_sc_runtime_info.
  " do your duty
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).
IF <inttab> IS NOT ASSIGNED.
  " do your duty
ELSE.
  " do your job
ENDIF. 

NB: There is also an old report in the wiki : Convert Spool List to ALV Grid, did you find it?

0 Kudos
862

Hi Raymond,

The report where I am pulling the data from is a standard program RM06BB30. I am not submitting any program in background and only have the spool id to work with which is why I used the aforementioned FM. I need to pull the purchase requisition, and purchase orders from the ALV report.

But I'll try to check the link you have provided and see if I can use the logic for my requirement.

Thank you.

Regards,

Kath

Sandra_Rossi
Active Contributor
0 Kudos
862

No need to output a spool, you may retrieve the ALV contents directly into an internal table, as you can see in Raymond answer.