Application Development and Automation 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: 

Program run in background

0 Kudos
1,434

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>


1 ACCEPTED SOLUTION

abo
Active Contributor
1,285

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.

8 REPLIES 8

ThorstenHoefer
Active Contributor
0 Kudos
1,285

Hi,

you can try the function LIST_FROM_MEMORY to retrieve the result.

EXPORTING LIST TO MEMORY | Die Codezentrale

abo
Active Contributor
1,286

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.

0 Kudos
1,285

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

Sandra_Rossi
Active Contributor
1,285

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?

matt
Active Contributor
1,285

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.

raymond_giuseppi
Active Contributor
0 Kudos
1,285

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( ).

Sandra_Rossi
Active Contributor
0 Kudos
1,285

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?

Sandra_Rossi
Active Contributor
0 Kudos
1,285

Also what do you mean "unable to read data into <LT_DATA>", what is shown in debug, what is your code to read?