2022 Dec 12 7:15 AM
hello Export,
Please help me, I am try to fech data from one of already developmed Z program. But Not able to fetch data after execute. Please check my below code.
step 1 : SUBMIT Zxxxxxxxx EXPORTING LIST TO MEMORY USING SELECTION-SCREEN '1000'
WITH SELECTION-TABLE RSPAR_TAB
AND RETURN.
step 2 : CL_SALV_BS_RUNTIME_INFO=>GET_DATA_REF( IMPORTING R_DATA = O_ZFICAG ).
ASSIGN O_ZFICAG->* TO <LT_DATA>.
unable to read data into <LT_DATA>
2022 Dec 12 7:37 AM
To get data from ALV you first need to inform the ALV framework BEFORE calling the program using it, like this:
* Set Handler
CALL METHOD cl_salv_bs_runtime_info=>set
EXPORTING
display = abap_false
metadata = abap_true
data = abap_true.
* Your ALV program goes here
* get data back
TRY.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = gr_submit_output ).
ASSIGN gr_submit_output->* TO <gfs_table>.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE: TEXT-m01 TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDTRY.
Then it works. Complete example is avaiable.
2022 Dec 12 7:26 AM
Hi,
you can try the function LIST_FROM_MEMORY to retrieve the result.
2022 Dec 12 7:37 AM
To get data from ALV you first need to inform the ALV framework BEFORE calling the program using it, like this:
* Set Handler
CALL METHOD cl_salv_bs_runtime_info=>set
EXPORTING
display = abap_false
metadata = abap_true
data = abap_true.
* Your ALV program goes here
* get data back
TRY.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = gr_submit_output ).
ASSIGN gr_submit_output->* TO <gfs_table>.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE: TEXT-m01 TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDTRY.
Then it works. Complete example is avaiable.
2022 Dec 12 8:11 AM
Thanks for Replay.
I had already done this activity. When checking below import component was fail.
import t_component to lt_component from memory id cl_salv_bs_runtime_info=>c_memid_data_def.
Pradip Patel
2023 Jan 24 12:20 PM
pradipmca
You have marked this answer "best/accepted" just now, but at the time of the answer, you said that this solution did not work. Was it right finally?
2022 Dec 12 9:50 AM
Rewrite your Z program so that it instantiates a class that has methods for getting the report data and returning it. I.e. separate the business logic from the gui/frontend/view logic.
Then call the class directly from your calling program.
2022 Dec 12 1:39 PM
Could you remove the EXPORTING LIST TO MEMORY in the SUBMIT statement, it could prevent creation of the ALV grid, so preventing the class to access data.
Also free the memory once data read with
cl_salv_bs_runtime_info=>clear_all( ).
2022 Dec 12 4:38 PM
Please share the important parts of your submitting program, we can see that some very important steps are missing, like calling cl_salv_bs_runtime_info=>set.
Please share the code how the program Zxxxxxxxx outputs data to the screen. Not everything can be captured.
Also, did you debug Zxxxxxxxx to make sure that it runs as expected?
2022 Dec 12 4:39 PM
Also what do you mean "unable to read data into <LT_DATA>", what is shown in debug, what is your code to read?