10-18-2007 9:23 AM
Hello,
I need some help to PUT an ALV result into MEMORY.
I have created a RFC FM in wich I wanted to copy the result of a HR Ad Hoc Query in an internal Table.
My program has been copied from rhe FM: HR_QUERY_CALL.
With parameters:
WORKSPACE : *
QUERY : QUERY_NAME
USERGROUP : USER_GROUP_NAME
VARIANT
DBACC : 0
SKIP_SELSCREEN: X
DATA_TO_MEMORY
EXTERNAL_PRESENTATION
BEGDA : 18.01.2001
ENDDA : 18.01.1007
I have insert this in my FM:
SUBMIT (HR_ad_hoc_query_name)
WITH PNPINDEX IN PERNR_INDEX
WITH PNPBEGDA EQ BEGDA
WITH PNPENDDA EQ ENDDA
WITH PNPBEGPS EQ BEGDA
WITH PNPENDPS EQ ENDDA
WITH PNPTIMED EQ ' '
WITH SELECTION-TABLE SELECTION_TABLE
USING SELECTION-SET L_VARIANT
AND RETURN
<b>EXPORTING LIST TO MEMORY . </b>
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = itab_list.
CALL FUNCTION 'DISPLAY_LIST'
TABLES
LISTOBJECT = itab_list.
-
But an error occurs with: "no list generated" (even if the ALV displayed the good result).
Can someone help me to understand why this itab_list is not filled.
10-19-2007 10:53 PM
Only non ALV reports can be listed to memory. For ALV reports, you have to write it to the spool and read the spool. Here is some sample code I used in one of my programs.
data: v_spno like tsp01-rqident,
v_spool like pri_params-plist,
v_text like pri_params-prtxt.
get time.
v_spool = sy-uzeit.
v_text = sy-uname.
v_name1 = sy-uzeit.
call function 'GET_PRINT_PARAMETERS'
exporting
authority = space
copies = '1'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
in_archive_parameters = space
in_parameters = space
layout = space
list_name = v_spool
list_text = v_text
mode = space
new_list_id = 'X'
no_dialog = 'X'
user = sy-uname
importing
out_parameters = v_print_parms
valid = v_valid
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
if v_print_parms-pdest = space.
v_print_parms-pdest = 'LOCL'.
endif.
v_print_parms-linsz = '65'.
v_print_parms-paart = 'X_65_255'.
submit (p_report)
to sap-spool
spool parameters v_print_parms
without spool dynpro
using selection-set p_var
and return.
perform get_spool_number using p_report sy-uname
changing v_spno.
call function 'RSPO_RETURN_ABAP_SPOOLJOB'
exporting
rqident = v_spno
FIRST_LINE = 1
LAST_LINE =
tables
buffer = i_text
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 w014 with 'No output found - Please check the program'.
stop.
endif.
form get_spool_number using f_repid f_uname changing f_rqident.
select * from tsp01 where rq2name = v_name1
and rqowner = sy-uname
order by rqcretime descending.
f_rqident = tsp01-rqident.
exit.
endselect.
if sy-subrc ne 0.
clear f_rqident.
endif.
endform." get_spool_number
10-19-2007 10:53 PM
Only non ALV reports can be listed to memory. For ALV reports, you have to write it to the spool and read the spool. Here is some sample code I used in one of my programs.
data: v_spno like tsp01-rqident,
v_spool like pri_params-plist,
v_text like pri_params-prtxt.
get time.
v_spool = sy-uzeit.
v_text = sy-uname.
v_name1 = sy-uzeit.
call function 'GET_PRINT_PARAMETERS'
exporting
authority = space
copies = '1'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
in_archive_parameters = space
in_parameters = space
layout = space
list_name = v_spool
list_text = v_text
mode = space
new_list_id = 'X'
no_dialog = 'X'
user = sy-uname
importing
out_parameters = v_print_parms
valid = v_valid
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
if v_print_parms-pdest = space.
v_print_parms-pdest = 'LOCL'.
endif.
v_print_parms-linsz = '65'.
v_print_parms-paart = 'X_65_255'.
submit (p_report)
to sap-spool
spool parameters v_print_parms
without spool dynpro
using selection-set p_var
and return.
perform get_spool_number using p_report sy-uname
changing v_spno.
call function 'RSPO_RETURN_ABAP_SPOOLJOB'
exporting
rqident = v_spno
FIRST_LINE = 1
LAST_LINE =
tables
buffer = i_text
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 w014 with 'No output found - Please check the program'.
stop.
endif.
form get_spool_number using f_repid f_uname changing f_rqident.
select * from tsp01 where rq2name = v_name1
and rqowner = sy-uname
order by rqcretime descending.
f_rqident = tsp01-rqident.
exit.
endselect.
if sy-subrc ne 0.
clear f_rqident.
endif.
endform." get_spool_number
10-23-2007 10:50 AM
Thank you very much Krishna for your code. I checked it this morning, it works very well.
Thank you again for having shared your knowledge.
Regards