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: 

Create Variant on custom Dynpro

Former Member
0 Kudos

Hello,

Is it posible to Create a Variant on my custom Dynpros?, I mean I need how to do it like a report, clicking the save button, and getting it after the process, is it possible?,

Thanks all,

Gabriel

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check this piece of code:

*Display variant

SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE text-001.

************************************************************************

PARAMETERS: p_vari LIKE disvariant-variant.

************************************************************************

SELECTION-SCREEN END OF BLOCK b0.

************************************************************************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.

PERFORM f0034_variant_input_help CHANGING p_vari.

&----


*& Form f0034_check_variant

&----


  • To check variant.

----


FORM f0034_check_variant. "#EC NEEDED

IF NOT p_vari IS INITIAL.

MOVE ws_variant TO ws_x_variant.

MOVE p_vari TO ws_x_variant-variant.

CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'

EXPORTING

i_save = ws_save

CHANGING

ws_variant = ws_x_variant.

ELSE.

PERFORM f0033_variant_init.

ENDIF.

ENDFORM. " f0034_check_variant

&----


*& Form f0032_for_variant

&----


  • To get the variant list

----


FORM f0032_for_variant. "#EC NEEDED

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = ws_variant

i_save = ws_save

IMPORTING

e_exit = ws_exit

es_variant = ws_x_variant

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 ws_exit = space.

p_vari = ws_x_variant-variant.

ENDIF.

ENDIF.

ENDFORM. " f0032_for_variant

Probably this will give an idea how it can be done. This is just a part of the actuals.

Regards

Subramanian

1 REPLY 1

Former Member
0 Kudos

Hi,

Check this piece of code:

*Display variant

SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE text-001.

************************************************************************

PARAMETERS: p_vari LIKE disvariant-variant.

************************************************************************

SELECTION-SCREEN END OF BLOCK b0.

************************************************************************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.

PERFORM f0034_variant_input_help CHANGING p_vari.

&----


*& Form f0034_check_variant

&----


  • To check variant.

----


FORM f0034_check_variant. "#EC NEEDED

IF NOT p_vari IS INITIAL.

MOVE ws_variant TO ws_x_variant.

MOVE p_vari TO ws_x_variant-variant.

CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'

EXPORTING

i_save = ws_save

CHANGING

ws_variant = ws_x_variant.

ELSE.

PERFORM f0033_variant_init.

ENDIF.

ENDFORM. " f0034_check_variant

&----


*& Form f0032_for_variant

&----


  • To get the variant list

----


FORM f0032_for_variant. "#EC NEEDED

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = ws_variant

i_save = ws_save

IMPORTING

e_exit = ws_exit

es_variant = ws_x_variant

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 ws_exit = space.

p_vari = ws_x_variant-variant.

ENDIF.

ENDIF.

ENDFORM. " f0032_for_variant

Probably this will give an idea how it can be done. This is just a part of the actuals.

Regards

Subramanian