Skip to Content

Define columns to be retrived within ref_to_ldata at RSAQ_QUERY_CALL


I created a Z program that calls a SAP Query with function module RSAQ_QUERY_CALL

In ref_to_ldata I get a reference to the table with all data from the SAP Query.

I created a SAP Query variant with a customized output layout that contains only needed columns in a specific order.

Now my expectation was when I call the SAP Query with my defined variant that contains a output layout ref_to_ldata would contain only the limited number of columns with their defined order. But I always get all columns in ref_to_ldata with the default order.

Do I need to use a different default output format in my SAP Query or do I have to pass another parameter in the CALL FUNCTION statement of RSAQ_QUERY_CALL?

SAP Query settings:

Code snippet:

    query  = lv_my_query  
    usergroup  = lv_usergroup  
    variant  = lv_query_variant  
    skip_selscreen  = 'X'  
    data_to_memory  = 'X'  
    ref_to_ldata  = g_dataref  
    no_usergroup  = 1  
    no_query  = 2  
    query_locked  = 3  
    generation_cancelled  = 4  
    no_selection  = 5    
    no_variant  = 6  
    just_via_variant  = 7  
    no_submit_auth  = 8  
    no_data_selected  = 9  
    data_to_memory_not_possible = 10  
  OTHERS  = 11  

Any help is highly appreciated.

Kind regards


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 09, 2018 at 11:22 AM

    Hi Florian, we are experiencing the same issue, have you found a solution or workaround?

    We are thinking on dynamically creating a table based on the layout variant and move the fields.

    Thanks for your reply,


    Add comment
    10|10000 characters needed characters exceeded

  • Nov 28, 2018 at 08:37 AM

    Hi Wouter,

    unfortunately we did not find a solution. :-(

    Kind regards


    Add comment
    10|10000 characters needed characters exceeded