Skip to Content

Save a variant from a Dynpro screen

I was working on some dynpro application, and testing was really messy, because I needed to fill the parameters each time I wanted to executed it…That why I thought about saving a variant…But…My application was on Dynpro and not on standard report…After browsing trough function modules and standard programs, I came to this nice example of how to achieve that goal.

We need a Dynpro screen with a SubScreen are called Parameters (I need some Select-Options, so using a SubScreen was the best choice).

This is the source code.

And of course, some pictures -:)





Well…There’s a few drawbacks in this example…

  • You can’t save the Variant description.
  • When you create a new variant, SAP ask you if you want to replace it…Even when it doesn’t exists!

If someone can fix that, I would be very happy -:D

You must be Logged on to comment or reply to a post.
  • Good one Blag!

    We may be able to use this piece in the Nugget editor for SAPLink.  We haven’t solidified the design, but we considered generating subscreens.  This may not work, given the runtime generation of the subscreen…but something to think about and possibly implement.



    • Hi Quack:

      Thanks for your comment! -:D It’s nice to think that my humble blog gives you ideas for the new Nugget editor -:)

      Runtime generated screens are hard to catch…I realized that when I was doing research for this weblog…Good luck on that -;)



  • Hi Alvaro!
    Have an error (system erp2005)
    When i press ‘save’ button and call func ‘RS_VARIANT_SAVE_FROM_SELSCREEN’ i have an error ‘Selection screen 0100 contains no objects’.
    • That’s weird…Haven’t got any problems myself…Gonna do some testing…But it might be a problem with either the function in your system or the declaration of the Selection-Screen in the Dynpro.



      • Yo Alvaro!
        with making some change in your code smth like this..  🙂

          data: var TYPE RSVAR-VARIANT.
          APPEND T_RKEY.
        *    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.

          var = ‘main’.
          T_RKEY-VARIANT = var.
          MODIFY T_RKEY INDEX 1.
              RKEY    = T_RKEY
              SELCTAB = T_SELCTAB.

        ENDFORM.                    ” SAVE_VARIANT

        all works fine!
        Thanks a lot! very useful!
        Best regards, Russian bear.

      • At me a similar problem and precisely same error… What to do?
        I the beginning programmer and me would be desirable to learn from what to begin the decision of this error?
  • Hi,

    The Blog is really good.
    But it will work only for select-options or selection screens (maybe included in subscreen of Module pool screen).

    But it is not working for Module pool screens.
    I searched FMs for this but didn’t find any.

    For e.g. there are 2 checkboxes in screen and 1 subscreen with parameters,
    then by using these FMs i can store the values of the parameters but not checkboxes.


  • Hello Guys , Does anyone of you figure out how to solve the problem with the error: ” Selection screen 0300 contains no objects

         Message no. DB280″  ? , im facing it also.
    thank you for your answers.

    • Have you tried the solution posted by Alex Dan (Down in the comment list)? I never had this problem, but according to him, he solved it like that.