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

Save variant problem

Former Member
0 Likes
3,227

Hi Experts,

I have a requirement of saving variant.

In my report program, on selection screen, i have one button which pops-up a new window which has Table Control. User enters some data in table control and comes back to selection screen.

Now if i user saves variant, then the data on selection screen as well as data entered in Table Control (saved using pop-up) should be saved.

If user again selects that variant, then data on selection screen will appear (which is coming) as well as if user clicks button and when table control window will appear, then in that table control data should appear as it was saved earlier while saving Variant (which is not coming).

Can we do this or can we save variant of selection screen as well as any other window which pos-up in selection screen. How to retain that data of other window?

\[removed by moderator\]

Kindly let me know whether is it possible or not also and if possible, then how.

Regards,

Neha

Edited by: Jan Stallkamp on Jul 30, 2008 4:24 PM

5 REPLIES 5
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,345

Declare the table control internal table (and other non selection-screen data) as a NO-DISPLAY parameter(s), so the data will be saved/restored with variants.

Regards

Read only

Former Member
0 Likes
1,345

Can you please elaborate the point.

Read only

Former Member
0 Likes
1,345

May be this code will give an idea about how to create a custom variant for a dynpro (not selection screen).

This code is posted in a SDN blog. For details u search it in blog area.

REPORT Z_VARIANTS.

----


  • TABLES *

----


TABLES: SPFLI.

----


  • TYPE-POOLS *

----


TYPE-POOLS: SLIS.

----


  • INTERNAL TABLES *

----


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.

----


  • VARIABLES *

----


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.

----


  • SELECTION-SCREEN *

----


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.

----


  • INITIALIZATION *

----


INITIALIZATION.

W_REPORT = SY-REPID.

PERFORM VARIANT_EXISTS.

----


  • START-OF-SELECTION *

----


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 = SY-REPID

VARI_REPORT = SY-REPID

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

----


  • FORM CHOOSE_VARIANT *

----


FORM CHOOSE_VARIANT CHANGING L_SEL_VARIANT.

CALL FUNCTION 'RS_VARIANT_CATALOG'

EXPORTING

REPORT = W_REPORT

MASKED = 'X'

IMPORTING

SEL_VARIANT = L_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.

&----


*& 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

Regards,

Joy.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Jun 25, 2008 3:43 PM

Read only

Former Member
0 Likes
1,345

Hi Neha,

It is very well possible to do that.

declarae this variable which holds any gen. data.

data: dg_iobjnm like rsgeneral-fieldnm.

First do this way in your selction screen:

select-options s_obj for dg_iobjnm no-display.

Let this hold your table control data.

In at selection scree.

do this.

case sy-ucomm.

when 'IOBJ'. (okcode for your button)

perform 1000_fill_selection.

endcase.

form 1000_fill_selection.

loop at dt_sflds." your table control

move: dt_sflds-iobjnm to s_obj-low.

move: dt_sflds-flt to s_obj-high+0(1).

move: dt_sflds-sort to s_obj-high+1(29).

append s_obj.

endloop.

endform

" you have 30 chars in the low and high fileds . concatenate your table control fields into this s_obj and use accordingly.

If 30 chars is not enough use a new definition for s_obj.

I faced a similar situation.

Thanks,

Keerthi.

Read only

Former Member
0 Likes
1,345

Hi,

I am now able to retain my data on selection-screen. for ex. i catched the data of table control in p_data on selection screen while saving variant.

But now i am facing a new problem. I want to display same data what when user cilck on button which pops-up table control. But in PBO , there is loop at table control reference table (i.e. t_data in my case) to display data in table control, but now i want to display p_data 's data as it contains data which was saved earlier while saving variant.

So now i need to loop at p_data in PBO (when variant is selected). But how can i do this at the same time when there is one loop already there.

\[removed by moderator\]

Edited by: Jan Stallkamp on Jul 30, 2008 4:24 PM