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: 
Read only

Download dynamic ALV with Dynamic Program

former_member805393
Discoverer
0 Likes
1,657

Did anyone work with fetching dynamic ALV data from any dynamic program. Looking for alternatives for using SUBMIT (program) with (spool)

Did anyone work with fetching dynamic ALV data from any dynamic program. Looking for alternatives for using SUBMIT (program) with (spool)

7 REPLIES 7
Read only

Sandra_Rossi
Active Contributor
1,560

This question has been answered so many times. Please search CL_SALV_BS_RUNTIME_INFO.

Read only

former_member805393
Discoverer
0 Likes
1,560

I have used the class CL_SALV_BS_RUNTIME_INFO. But to use the internal table acquired from the class, we need to know the structure of the internal table we are using. In my case, the internal table received can be anything.

The structure of the output table can be anything in this case. I am unable to use the output structure <lt_pay_data> here without knowing which structure to it should be assigned.

cl_salv_bs_runtime_info=>set( EXPORTING display = abap_false metadata = abap_false

data = abap_true ).



SUBMIT <program_name> USING SELECTION-SET 'Variant'
AND RETURN.
IF sy-subrc IS INITIAL.
TRY.

cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = lr_pay_data ).
ASSIGN lr_pay_data->* TO <lt_pay_data>.

CATCH cx_salv_bs_sc_runtime_info.
MESSAGE `Unable to retrieve ALV data` TYPE 'E'.
ENDTRY.

IF <lt_pay_data> IS NOT INITIAL.
ENDIF.

ENDIF.

In the above case, the structure of the output table can be anything. I am unable to use the output structure <lt_pay_data> here without knowing which structure to it should be assigned.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,560

This question also has been asked already, one hundred times (at least). Search the Web for

LOOP AT <lt_pay_data> ASSIGNING FIELD-SYMBOL(<structure>).
  DO.
    ASSIGN COMPONENT sy-index OF STRUCTURE <structure> TO FIELD-SYMBOL(<component>).
    IF sy-subrc <> 0.
      EXIT.
    ENDIF.
    " here, process each <component> value
  ENDDO.
ENDLOOP.
Read only

FredericGirod
Active Contributor
0 Likes
1,560

I wonder how old Sandra is ... She saw so many questions 🙂

Read only

Sandra_Rossi
Active Contributor
1,560

I'm as old as Google search

"ASSIGN COMPONENT sy-index OF STRUCTURE" site:sap.com

result:

About 1,060 results (0.49 seconds) 
Read only

FredericGirod
Active Contributor
1,560

sandra.rossi : Google was founded on September 4, 1998, by Larry Page and Sergey Brin

you have a lot of experience and wisdom for a 24 year old 😉

Read only

Sandra_Rossi
Active Contributor
1,560

elderness doesn't imply knowledge and wisdom 😉