Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Variants with subscreens in selection screen

I have a screen that contains a subscreens....this subscreen is a selection-screen....i need to save and load variants for this selection-screen.

My code:

REPORT zprueba_02.

----


u2013

  • TABLES *

----


u2013

TABLES: spfli.

----


u2013

  • TYPE-POOLS *

----


u2013

TYPE-POOLS: slis.

----


u2013

  • INTERNAL TABLES *

----


u2013

DATA: t_rkey TYPE STANDARD TABLE OF rsvarkey WITH HEADER LINE,

t_selctab TYPE STANDARD TABLE OF rsscr WITH HEADER LINE,

t_vari TYPE STANDARD TABLE OF rvari WITH HEADER LINE,

it_extab TYPE slis_t_extab,

wa_extab LIKE LINE OF it_extab.

----


u2013

  • VARIABLES *

----


u2013

DATA: ok_code TYPE sy-ucomm,

w_variant TYPE rsvar-variant,

w_user_vari TYPE rsvar-variant,

w_vari_report TYPE rsvar-report,

sel_variant TYPE rsvar-variant,

sel_variant_text TYPE rsvar-vtext,

w_report TYPE rsvar-report,

variant_exists TYPE c.

----


u2013

  • SELECTION-SCREEN *

----


u2013

SELECTION-SCREEN BEGIN OF SCREEN 101 AS SUBSCREEN.

SELECT-OPTIONS: s_carrid FOR spfli-carrid,

s_connid FOR spfli-connid.

SELECTION-SCREEN END OF SCREEN 101.

----


u2013

  • INITIALIZATION *

----


u2013

INITIALIZATION.

w_report = sy-repid.

PERFORM variant_exists.

----


u2013

  • START-OF-SELECTION *

----


u2013

START-OF-SELECTION.

CALL SCREEN 0100.

&----


*& Module STATUS_0100 OUTPUT *

&----


MODULE status_0100 OUTPUT.

SET PF-STATUS '100' EXCLUDING it_extab.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT *

&----


MODULE user_command_0100 INPUT.

ok_code = sy-ucomm.

CASE ok_code.

WHEN 'SAVE'.

PERFORM save_variant.

PERFORM variant_exists.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN 'GET_VAR'.

PERFORM load_variant.

WHEN 'DEL_VAR'.

PERFORM delete_variant.

PERFORM variant_exists.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Form SAVE_VARIANT *

&----


FORM save_variant.

t_rkey-report = sy-repid.

APPEND t_rkey.

CALL FUNCTION 'RS_VARIANT_SAVE_FROM_SELSCREEN'

EXPORTING

curr_report = w_report

  • USER_VARI = SY-SLSET

vari_report = w_report

IMPORTING

variant = w_variant

TABLES

p_sscr = t_selctab

p_vari = t_vari

EXCEPTIONS

illegal_variant_name = 1

not_authorized = 2

no_report = 3

report_not_existent = 4

report_not_supplied = 5

OTHERS = 6.

t_rkey-variant = w_variant.

MODIFY t_rkey INDEX 1.

CALL FUNCTION 'RS_RWSET_SAVE_VARIANT'

EXPORTING

rkey = t_rkey

TABLES

selctab = t_selctab.

ENDFORM. " SAVE_VARIANT

&----


*& Form LOAD_VARIANT *

&----


FORM load_variant.

PERFORM choose_variant CHANGING sel_variant.

IF sel_variant NE space.

CALL FUNCTION 'RS_SUPPORT_SELECTIONS'

EXPORTING

report = w_report

variant = sel_variant

EXCEPTIONS

variant_not_existent = 1

variant_obsolete = 2

OTHERS = 3.

ENDIF.

ENDFORM. " LOAD_VARIANT

&----


*& Form DELETE_VARIANT *

&----


FORM delete_variant.

PERFORM choose_variant CHANGING sel_variant.

IF sel_variant NE space.

CALL FUNCTION 'RS_VARIANT_DELETE'

EXPORTING

report = w_report

variant = sel_variant

flag_confirmscreen = 'X'

flag_delallclient = 'X'

EXCEPTIONS

not_authorized = 1

not_executed = 2

no_report = 3

report_not_existent = 4

report_not_supplied = 5

variant_locked = 6

variant_not_existent = 7

no_corr_insert = 8

variant_protected = 9

OTHERS = 10.

ENDIF.

ENDFORM. " DELETE_VARIANT

----


u2013

  • FORM CHOOSE_VARIANT *

----


u2013

FORM choose_variant CHANGING l_sel_variant.

CALL FUNCTION 'RS_VARIANT_CATALOG'

EXPORTING

report = w_report

masked = 'X'

IMPORTING

sel_variant = sel_variant

sel_variant_text = sel_variant_text

EXCEPTIONS

no_report = 1

report_not_existent = 2

report_not_supplied = 3

no_variants = 4

no_variant_selected = 5

variant_not_existent = 6

OTHERS = 7.

ENDFORM. "CHOOSE_VARIANT

&----


*& Form VARIANT_EXISTS *

&----


FORM variant_exists.

CALL FUNCTION 'RS_VARIANT_FOR_ONE_SCREEN'

EXPORTING

program = w_report

dynnr = '0101'

IMPORTING

variant_exists = variant_exists.

IF variant_exists EQ 'X'.

CLEAR: wa_extab, it_extab.

REFRESH it_extab.

ELSE.

CLEAR: wa_extab, it_extab.

REFRESH it_extab.

wa_extab-fcode = 'GET_VAR'.

APPEND wa_extab TO it_extab.

ENDIF.

ENDFORM. " VARIANT_EXISTS

At include modul i have:

PROCESS BEFORE OUTPUT.

MODULE status_0100.

CALL SUBSCREEN sb_0001 INCLUDING w_report '0101'.

PROCESS AFTER INPUT.

MODULE user_command_0100.

CALL SUBSCREEN sb_0001.

and i have declared in the screen a subscreen area called sb_001.

When i try to save the variant, the next error:

Selection screen 0100 contains no object.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question