2020 Feb 28 11:28 AM
Dear Experts,
I am facing an issue with SUBMIT functionality while retrieving the data when using cl_salv_bs_runtime_info class.
I have written the code in following way:
FIELD-SYMBOLS: <lt_data> TYPE ANY TABLE,
<ls_data> TYPE any,
<lt_dat2> TYPE ANY TABLE.
cl_salv_bs_runtime_info=>set( EXPORTING
display = abap_false metadata = abap_false data = abap_true ).
repname = 'RKAEP000'.
SUBMIT (repname) WITH p_tcode EQ 'KOB1'
WITH p_kokrs = 'XXX'
WITH aufnr IN rt_aufnr
WITH p_disvar = '/SAP_ABAP'
EXPORTING LIST TO MEMORY AND RETURN.
cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data_descr = lr_data_descr ).
CREATE DATA lr_data TYPE HANDLE lr_data_descr.
ASSIGN lr_data->* TO <lt_data>.
cl_salv_bs_runtime_info=>get_data( IMPORTING t_data = <lt_data> ).
Now, issue is when i execute this code, no data will be populated in <lt_data>.
But when i execute the Tcode KOB1 alone first, and then if I execute this above code from my report I am getting the correct result and <lt_data> is correctly populated.
Is the issue with memory?
How can i get my internal table filled with data without executing the Tcode alone, as I am using SUBMIT.
Any help will be appreciated.
Thank & Regards,
AV
2020 Mar 02 8:11 AM
To test the assumption, I recommend that you run KOB1 in background, make sure the ALV is output in a spool, then change temporarily the SUBMIT of your program:
SUBMIT RKAEP000 USING SELECTION-SET '000' AND RETURN.
(where 000 is to be replaced with the name of the program variant used by the background job)
If it works, then display the program variant and all its parameters, and change the SUBMIT to pass all the parameters of the program variant via WITH.
2020 Feb 28 1:07 PM
Could you remove the EXPORTING LIST TO MEMORY? (AFAIK it could trigger a good old list ALV and not a GRID so no data returned to the class)
2020 Feb 28 3:48 PM
You also forget some parameters (is this the reason you put the program name in a variable, to trick code inspector?) When you execute the transaction, some parameters id are set in memory, and the next execution is successful
You could save a default variant for the report and use it in the SUBMIT statement USING SELECTION-SET in addition to the parameters.
NB: I too used to set metadata to true, but it was intended to regenerate the grid later (or convert it to format XML or XLSX later WYSIWYG)
2020 Feb 28 1:19 PM
Please use the CODE button to format your code so that it's shown in a more user-friendly format (colorized).
2020 Feb 28 1:21 PM
Is it possible that the submit parameters are incorrect? To make sure, what happens if you create a little program as follows, is something displayed?
REPORT ztest.
SUBMIT RKAEP000
WITH p_tcode EQ 'KOB1'
WITH p_kokrs = 'XXX'
WITH aufnr IN rt_aufnr
WITH p_disvar = '/SAP_ABAP'.
2020 Feb 28 2:54 PM
Hello, I'm using the same technique without issue, but I set parameters metadata to true, not false.
Perhaps can you try with metadata set to true ?
And as asked by Raymond, don't use EXPORTING LIST TO MEMORY ! Else no data transferred to ALV...
With EXPORTING LIST TO MEMORY, use CALL FUNCTION 'LIST_FROM_MEMORY'
2020 Feb 28 3:25 PM
I just tried with a little demo program. There's no issue with using EXPORTING LIST TO MEMORY (although it's redundant with DISPLAY = ' '), and no issue with METADATA (can be left ' '). I think the only reason left is that the program RKAEP000 is called differently from KOB1 (parameters, sy-tcode, etc.)
2020 Feb 29 2:00 PM
Hello Stanislas,
Yes, I did that too.
But still no luck on this.
I have also used CALL FUNCTION 'LIST_FROM_MEMORY', but still didnt get any data.
I wonder why the data gets populated in my code when I run the Tcode KOB1 separately
cl_salv_bs_runtime_info=>set(
EXPORTING display = abap_false
metadata = abap_true
data = abap_true ).
SUBMIT rkaep000 AND RETURN
WITH p_tcode EQ 'KOB1'
WITH p_kokrs = 'VWDS'
WITH aufnr IN rt_aufnr
WITH p_disvar = '/SAP_ABAP'. --> Already created in KOB1 transaction.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data_descr = lr_data_descr ).
CREATE DATA lr_data TYPE HANDLE lr_data_descr.
ASSIGN lr_data->* TO <lt_data>.
cl_salv_bs_runtime_info=>get_data(
IMPORTING
t_data = <lt_data>
).
LOOP AT <lt_data> ASSIGNING <ls_data>.
2020 Feb 29 2:05 PM
@Sandra,
Thanks for help.
Yes this could be the issue,
I will try to pass selection set in submit command
2020 Mar 02 7:18 AM
Also during the debugging, i found out that the values are not getting refreshed from the memory while calling the SUBMIT command. The previous values are not getting cleared in the standard report rkaep000 (Like AUFNR, BUDAT ) Is there any way to clear out.
2020 Mar 02 8:11 AM
To test the assumption, I recommend that you run KOB1 in background, make sure the ALV is output in a spool, then change temporarily the SUBMIT of your program:
SUBMIT RKAEP000 USING SELECTION-SET '000' AND RETURN.
(where 000 is to be replaced with the name of the program variant used by the background job)
If it works, then display the program variant and all its parameters, and change the SUBMIT to pass all the parameters of the program variant via WITH.
2020 Mar 02 8:51 AM
2020 Mar 02 9:56 AM
Thank you so much experts.
Issue is resolved now.
I gone through sandra.rossi approach.
Scheduled the background job and checked which parameters are required.
Found that it is mandatory to pass RT_BUDAT range in the SUBMIT report.
Thread can be closed.