Application Development 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: 

How to get save layout butons in report display ?

Former Member
0 Kudos
117

Hi ,

Can any one tell how to get the save/ change layout buttons in status bar when status bar is user defined one. I ve a requirement to save the layout and use it in variants.

4 REPLIES 4

Former Member
0 Kudos
78

Hi,

Check this code.

SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-t45.

PARAMETERS: p_vari LIKE disvariant-variant.

SELECTION-SCREEN END OF BLOCK b5.

data:

gwa_variant1 LIKE disvariant,

gwa_variant LIKE disvariant,

gf_repid LIKE sy-repid,

gf_exit(1) TYPE c,

gf_save(1) TYPE c.

INITIALIZATION.

gf_repid = sy-repid.

gf_save = 'A'.

PERFORM variant_init.

  • Get default variant

gwa_variant1 = gwa_variant.

CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'

EXPORTING

i_save = gf_save

CHANGING

cs_variant = gwa_variant1

EXCEPTIONS

not_found = 2.

IF sy-subrc = 0.

p_vari = gwa_variant1-variant. "p_vari-parameter

ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.

PERFORM f4_for_variant.

AT SELECTION-SCREEN.

  • PAI

PERFORM pai_of_selection_screen.

&----


*& Form variant_init

&----


  • To set report name

----


FORM variant_init .

CLEAR gwa_variant.

gwa_variant-report = gf_repid.

ENDFORM. " variant_init

&----


*& Form f4_for_variant

&----


  • F4 help for variant

----


FORM f4_for_variant .

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = gwa_variant

i_save = gf_save

IMPORTING

e_exit = gf_exit

es_variant = gwa_variant1

EXCEPTIONS

not_found = 2.

IF sy-subrc = 2.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

IF gf_exit = space.

p_vari = gwa_variant1-variant.

ENDIF.

ENDIF.

ENDFORM. " f4_for_variant

&----


*& Form pai_of_selection_screen

&----


  • Checking for variant existence

----


FORM pai_of_selection_screen .

IF NOT p_vari IS INITIAL.

MOVE gwa_variant TO gwa_variant1.

MOVE p_vari TO gwa_variant1-variant.

CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'

EXPORTING

i_save = gf_save

CHANGING

cs_variant = gwa_variant1.

gwa_variant = gwa_variant1.

ELSE.

PERFORM variant_init.

ENDIF.

ENDFORM. " pai_of_selection_screen

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' "#EC *

EXPORTING

i_callback_program = gf_repid

is_layout = gwa_layout

it_fieldcat = gt_catalog

it_sort = gt_sort

it_events = gt_events

i_save = gf_save

is_variant = gwa_variant

i_callback_user_command = 'USER_COMMAND'

TABLES

t_outtab = gt_line

EXCEPTIONS

program_error = 1

OTHERS = 2.

Reward if helpful.

Regards,

Ramya

0 Kudos
78

i got how to get buttons, but when i've set a pf-status of my own then the buttons which i ve put, only those are coming i want even layout buttons how to get that ? thanks in advance

Former Member
0 Kudos
78

Hi,

Try this logic.

PARAMETERS: p_layout LIKE disvariant-variant.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.

v_variant-report = sy-repid.

v_variant-username = sy-uname.

**-- Display all existing variants

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = v_variant

i_save = 'A'

IMPORTING

e_exit = v_exit1

es_variant = v_variant1

EXCEPTIONS

not_found = 2.

IF sy-subrc = 2.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

IF v_exit1 = space.

p_layout = v_variant1-variant.

v_variant = v_variant1.

ELSE.

MESSAGE 'No layouts found' TYPE 'I'.

ENDIF.

ENDIF.

Hope this helps.

Please reward points if useful.

Regards

Rose

Former Member
0 Kudos
78

throw set pf-status( douple click)its take u to menu painter there u can create a save/change button.

or if u are using custom container go the screen create button swith save and dlete and then write the functionallity in flow logic....i think u got it..