cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SUBMIT program USING SELECTION-SET goes to GUI SCREEN instead of providing a list.

sh4il3sh
Participant
0 Likes
313

    SUBMIT riaufk20
      USING SELECTION-SET p_varnam
      EXPORTING LIST TO MEMORY AND RETURN.

    TRY.
        cl_salv_bs_runtime_info=>get_data_ref(
          IMPORTING
            r_data DATA(lo_data)
        ).
        IF lo_data IS NOT BOUND.
          MESSAGE 'No data was captured from the ALV runtime.' TYPE 'E'.
          RETURN.
        ELSE.
          ASSIGN lo_data->TO FIELD-SYMBOL(<lfs_datatab>).


I am using above code to call IW38 report, which gives a list of orders to be confirmed, user clicks the order from the list and goes to below screen to confirm the order

sh4il3sh_0-1768029933277.png

In case of multiple orders IW38 provides a list of orders and I can call the BAPI to confirm the orders inside a loop.
But in case of 1 record, the transaction IW38 itself goes to the above screen instead of providing a list.

But my code fails and opens a new window for the gui transaction, is there anyway I can get list of 1 record instead of above screen?

 

Accepted Solutions (0)

Answers (1)

Answers (1)

KjetilKilhavn
Active Contributor
0 Likes

Looks like this should be possible by exporting 'X' to memory ID 'G_VARIANT_SAVE' before submitting the report.

Form DISPLAY_LIST_F14 checks if global variable g_variant_save is 'X' - if it is it behaves as if there's more than one hit.
Form VARIANT_INIT_F14 tries to get g_variant_save from memory ID 'G_VARIANT_SAVE' and otherwise sets it to 'U'

sh4il3sh
Participant
0 Likes

did not work unfortunately:
EXPORT value = abap_true TO MEMORY ID 'G_VARIANT_SAVE'..

It still opens the IW32 screen which is in the screenshot.

sh4il3sh
Participant
0 Likes

I feel really stuck here, I tried with reading SUBMIT REPORT documentation but nothing.

sh4il3sh
Participant
0 Likes

@KjetilKilhavnI can see that based on number of rows, different subroutines are getting called.
In case of multiple records, it calls PERFORM call_listviewer_f14.
but with single record, it calls PERFORM fcodes_with_mark_f16.

Is there any way I can call the SUBMIT PROGRAM in some way that sets SY-BATCH = 0?
my Z program is supposed to run as a background job, but it seems SUBMIT RIAUFK20 statement doesn't set SY-BATCH = X.
SY-BATCH = X only when my Z Program is running.



sh4il3sh
Participant
0 Likes

Unable to find any enhancement. 

KjetilKilhavn
Active Contributor

That's too bad. Either that means VARIANT_INIT_F14 isn't called when you submit the report, or a different value is assigned to variable g_variant_save before DISPLAY_LIST_F14 is called.

Debug to find out. I don't have any other tips.

KjetilKilhavn
Active Contributor

Perhaps you need to start looking for some other solution than submitting RIAUFK20?

sh4il3sh
Participant
0 Likes

Horrible comment feature, button is disabled and it still takes whatever is typed in.

sh4il3sh
Participant

@KjetilKilhavn eventually SPOOL was used and list was collected with string manipulation from spool output.
Thank you for your suggestion!

    SUBMIT riaufk20 TO SAP-SPOOL
    SPOOL PARAMETERS ls_params
    WITHOUT SPOOL DYNPRO
      USING SELECTION-SET p_varnam
        VIA JOB lv_jobname NUMBER lv_jobcount
      AND RETURN.