04-05-2019 8:33 AM
Hi Experts,
Currently i am working on a requirement to fetch output(ALV) of a standard report and place it on application server.
The standard report is using REUSE_ALV_GRID_DISPLAY to display the output.
I followed below approaches
1) SUBMIT XXXXXX AND RETURN EXPORTING LIST TO MEMORY and the FM's
'LIST_FROM_MEMORY' and 'LIST_TO_ASCI' .
The data is getting truncated while converting to ASCI when standard report output is run by selecting all columns.
2) Using Class CL_SALV_BS_RUNTIME_INFO .
1. I still see the output of the standard report after setting up run time info.
2. No data is retrieved in submit statement.
3. I set a break-point in the method SET_METADATA of CL_SALV_BS_RUNTIME_INFO but it is not getting triggered.
cl_salv_bs_runtime_info=>set(
EXPORTING display = space
metadata = space
data = 'X' ).
SUBMIT XXXXXX AND RETURN.
TRY.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = gt_pos_data ).
ASSIGN gt_pos_data->* TO <gt_pos_data>.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE `Unable to retrieve ALV data` TYPE 'E'.
ENDTRY.
Appreciate if you could let me know if I am missing something here.
Regards,
Muhammed
04-08-2019 1:55 AM
may i ask what report is it? maybe there is an option to display the report in ALV or not but you forget to set it when submit...
04-08-2019 3:58 AM
Hi ,
Thanks. The report is rkaep000 and tcode is 'KSB1'.
SUBMIT rkaep000 WITH p_kokrs = p_kokrs
WITH p_tcode EQ 'KSB1'
WITH kostl IN s_kostl
WITH r_budat IN s_budat
WITH p_disvar = p_disvar
WITH p_usegrd = ' '
AND RETURN.
Regards,
Muhammed
04-08-2019 5:07 AM
04-08-2019 5:17 AM
04-08-2019 9:02 AM
mohammed.mukhtar CL_SALV_BS_RUNTIME_INFO is used to get data from ALV Grid (EDIT: mistake - it should work for both Grid & List). But by that empty p_usegrd you are using ALV List. Try what Quynh Doan Manh recommended you...
04-08-2019 9:04 AM
You should run SUBMIT only to make sure there program doesn't stop on the selection screen (there should be no warning and no error). I just tried on my system, SUBMIT alone displays directly the ALV. If I wrap it with the CL_SALV_BS_RUNTIME_INFO stuff, then I retrieve the internal table.
I have tested it successfully in both P_USEGRD situations, p_usegrd = ' ' and p_usegrd = 'X'.
04-08-2019 9:54 AM
Hi,
Thanks tomas.buryanek sandra.rossi .
I posted this query in SCN after testing with both P_USEGRD situations, p_usegrd = ' ' and p_usegrd = 'X' in addition with CL_SALV_BS_RUNTIME_INFO which is used to get data from ALV Grid.
Ideally method SET_METADATA of CL_SALV_BS_RUNTIME_INFO should trigger in either of FM's REUSE_ALV_GRID_DISPLAY or REUSE_ALV_LIST_DISPLAY,but in my system this method is not triggering hence the metdata values are not set while ALV FM's are getting executed.
The program doesn't stop on the selection screen, it shows the output even after setting up ALV RUNTIME INFO values.
We are currently on ECC 5 version. May be this feature is not enabled in this version.
Regards,
Muhammed
04-08-2019 9:57 AM
sorry for last suggestion, p_usegrd display either ALV List and Grid so whatever you set you would still get data using cl_salv_bs_runtime_info. I tested in my system and it work as normal, you may check your input parameter as Sandra suggested.
04-08-2019 10:32 AM
I couldn't find SAP notes. Maybe the corrections were provided via a support package.
Anyway, if you're a little adventurous, to help you, on my S/4HANA system, I have this call stack (when I use P_USEGRD='X'):
CL_SALV_BS_RUNTIME_INFO set_data [method]
CL_GUI_ALV_GRID [system] do_runtime_info [method]
CL_GUI_ALV_GRID [system] set_table_for_first_display [method]
In method SET_DATA, there is the following check which is true (when I use cl_salv_bs_runtime_info=>set( data = 'X' )), consequently the data is made available "externally":
check ls_runtime_info-data eq abap_true.
And in method DO_RUNTIME_INFO, there's no display (when I use cl_salv_bs_runtime_info=>set( display = ' ' )) because of these lines:
case ls_runtime_info-display.
when abap_true.
when others.
set screen 0.
leave screen.
endcase.
04-08-2019 10:51 AM
Thanks sandra.rossi .
Can you please share the call stack when the below method(Program name) is triggered.
CL_GUI_ALV_GRID [system] do_runtime_info [method]
I will check in my system why this method is not getting triggered.
Regards,
Muhammed
04-08-2019 11:00 AM
Muhammed M cf my previous answer. What form of "call stack" do you want?
04-08-2019 11:08 AM
Hi Sandra Rossi
Call stack of CL_SALV_BS_RUNTIME_INFO set_data [method]
Regards
Muhammed
04-08-2019 12:02 PM
do_runtime_info is called by set_table_for_first_display:
CL_SALV_BS_RUNTIME_INFO set_data [method]
CL_GUI_ALV_GRID [system] do_runtime_info [method]
CL_GUI_ALV_GRID [system] set_table_for_first_display [method]
04-08-2019 12:21 PM
Hi Sandra Rossi
Thanks for your patience.
Can you share form/program/include name where method do_runtime_info is getting called in set table for display.
Regards
Muhammad
04-08-2019 12:54 PM
I'm probably infringing the copyright, so look at it quickly (---set-table-for-first-display.txt attachment deleted---) before I delete the message.
04-08-2019 1:05 PM
Thanks . I will go through and will let you know what's missing from our system.
Regards
Muhammed
04-09-2019 4:06 AM
Hi sandra.rossi ,
Thanks for your help. The call to method 'do_runtime_info' is missing from my system at line no 310 in method 'SET_TABLE_FOR_FIRST_DISPLAY'.
I will try to search OSS NOTES or will use some standard user exit to export internal table of KSB1 to memory and read it in my custom program.
me->do_runtime_info( ).
Regards,
Muhammed
04-09-2019 9:31 AM
if it help, in my 7.40 SP 14 system, that method at line 377 and CL_GUI_ALV_GRID last edited is 2015/10/10, note or sp it should around there...
you may see there is a memory ID : ALV_EXTRACT_MODE which used there, maybe you could use it instead of find enhancement (if you cant find a right note..)
04-09-2019 9:55 AM
Muhammed M what is the SAP_ABA/SAP_BASIS version/SP corresponding to your ECC5 ?
04-09-2019 10:15 AM
quynh.doanmanh Thanks for your inputs, checking the feasibility.
sandra.rossi
SAP_ABA 640 0027 SAPKA64027
SAP_BASIS 640 0027 SAPKB64027
Regards,
Muhammed
04-09-2019 10:33 AM
Muhammed M 640 is old, I don't think there is a note. The enhancement framework doesn't exist yet. I'd go for asking a SSCR modification key to change RKAEP000, just adding a piece of code to export the ALV internal table into memory, when RKAEP000 is called by your program.
04-09-2019 10:42 AM
Hi sandra.rossi
I am exploring the possibility(as suggested by quynh.doanmanh ) of exporting data to memory be setting up l_mode VALUE to 'B'.
FREE MEMORY ID 'ALV_EXTRACT_MODE'.
EXPORT l_mode FROM l_mode TO MEMORY ID 'ALV_EXTRACT_MODE'.
SUBMIT rkaep000 WITH p_kokrs = p_kokrs
WITH p_tcode EQ 'KSB1'
WITH kostl IN s_kostl
WITH r_budat IN s_budat
WITH p_disvar = p_disvar
WITH p_usegrd = 'X'
USING SELECTION-SCREEN 1000
AND RETURN.
IMPORT it_fieldcatalog TO it_fieldcatalog FROM MEMORY ID 'ALV_EXTRACT_FCAT'.
* Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcatalog
IMPORTING
ep_table = it_outtab.
ASSIGN it_outtab->* TO <gt_pos_data>.
"-->the program is going to dump in below statement
*- Runtime Error CONNE_IMPORT_WRONG_STRUCTURE
*- Except. CX_SY_IMPORT_MISMATCH_ERROR
IMPORT it_outtab to <gt_pos_data> FROM MEMORY ID 'ALV_EXTRACT_TABLE'.
FREE MEMORY ID : 'ALV_EXTRACT_MODE',
'ALV_EXTRACT_FCAT',
'ALV_EXTRACT_TABLE'.
Regards,
Muhammed
04-09-2019 4:55 PM
Hi quynh.doanmanh
I was trying with to export data using memory id 'ALV_EXTRACT_MODE'.
I am able to import internal table it_fieldcatlog from memory id 'ALV_EXTRACT_FCAT'.
When I'm trying to import it_outtab, the program is throwing up runtime error "
CONNE_IMPORT_WRONG_STRUCTURE" because the internal table structures are different.
IMPORT it_outtab to <gt_pos_data> FROM MEMORY ID 'ALV_EXTRACT_TABLE'.
Is there any way to declare dynamic internal table with name it_outtab .
sandra.rossi appreciate your inputs.
Regards,
Muhammed
04-10-2019 2:55 AM
Im afraid that catalog and table columns not always the same and it true in this case. you may have to check the difference by yourself and hardcode it...(table output is saved in mt_outtab attribute of alv).
04-10-2019 6:57 AM
Hi quynh.doanmanh
Exactly the internal tables it_outtab it_fieldcatlog columns are not same and causing runtime errors.
I will try to use exit EXIT_SAPLKAEP_009 to export/import <gt_pos_data> to memory.
Regards,
Muhammed