Skip to Content
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 -:)

image

image

image

image

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

To report this post you need to login first.

10 Comments

You must be Logged on to comment or reply to a post.

  1. Ryan Quackenboss
    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.

    Thanks,

    Quack

    (0) 
    1. Alvaro Tejada Galindo Post author
      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 -;)

      Greetings,

      Blag.

      (0) 
  2. Alex Dan
    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’.
    (0) 
    1. Alvaro Tejada Galindo Post author
      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.

      Greetings,

      Blag.

      (0) 
      1. Alex Dan
        Yo Alvaro!
        with making some change in your code smth like this..  🙂

        FORM SAVE_VARIANT.
          data: var TYPE RSVAR-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.

          var = ‘main’.
          T_RKEY-VARIANT = var.
          MODIFY T_RKEY INDEX 1.
          CALL FUNCTION ‘RS_RWSET_SAVE_VARIANT’
            EXPORTING
              RKEY    = T_RKEY
            TABLES
              SELCTAB = T_SELCTAB.

        ENDFORM.                    ” SAVE_VARIANT

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

        (0) 
      2. Michael Makushev
        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?
        (0) 
  3. Megha H
    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.

    Regards
    Megha

    (0) 
  4. Ali Sánchez
    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.

    (0) 
    1. Alvaro Tejada Galindo Post author
      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.

      Greetings,
      Blag.

      (0) 

Leave a Reply