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: 

DYNP_VALUES_READ & DYNP_VALUES_UPDATE at Selection-Screen Output

kurt_slater3
Explorer
0 Kudos

Hello Friends

I've noticed that if I invoke either of FM's DYNP_VALUES_READ & DYNP_VALUES_UPDATE that they do not work during the event At Selection-Screen Output.

The Scenario

I created a class that provides F4 help to the user to open and/or save files either to the file server or on the local machine.  When the user invokes F4 help, the F4 help object already knows which file the user is asking help for.  At this time, the object invokes DYNP_VALUES_READ and pre-populates fields in a dialog box.  When the dialog step is complete, the object invokes DYNP_VALUES_UPDATE to return the values back to the selection screen.

So far so good.

The Problem

We use logical files for files located on the file server.  What I would like to do is pretty much the same thing as above except without the dialog step in between.  In other words, take the screen defaults (i.e. logical file + filename) determine the full path using FILE_GET_NAME and populate the full path on the screen.  If the user wants to change this later, s/he can do so using F4 help.

But when I use DYNP_VALUES_READ during At Selection-Screen Output it doesn't return the current screen parameter values, so I replaced it with FM RS_REFRESH_FROM_SELECTOPTIONS.  This works, but then DYNP_VALUES_UPDATE did not update the screen even though I can see the internal table for DYNPFIELDS is populated.  The function appears to work correctly and SY-SUBRC = 0, but the field is blank.

I know the code works because I invoke the same methods during F4 and this does populate the screen.

Is what I am doing not possible during At Selection-Screen Output?

4 REPLIES 4

OttoGold
Active Contributor
0 Kudos

Hi Kurt,

I am wondering about the same thing

cheers Otto

SuhaSaha
Advisor
Advisor
0 Kudos

What a pleasant surprise, this FM has been bugging me since the last few weeks. A colleague of mine also asked me a question about it today morning

Anyway, i have read the documentation of this FM thoroughly and found the following interesting points -


This function module reads screen field contents that are to be processed by the help modules.

=> This FM works in the POV event only. E.g., you are in the search-help exit & want to read the screen contents.


  • DYNAME: Name of program (of calling screen)
            Meaning: Name of program from which the function module is
                       called. Do not set any SY-fields, because these
                       are filled dynamically during the call of function
                       modules.
            Value set: None
            Preallocation: None
  • DYNUMB: Number of calling screen
            Meaning:   Number of screen from which the function module is
                       called. Do not set SY-DYNNR.
                       sy-dynnr gesetzt werden.
            Value set: None
            Preallocation: None

=> This FM can only read the contents of the screen of the program from which it is called

Feel free to correct me.

BR,

Suhas

raymond_giuseppi
Active Contributor
0 Kudos

But when I use DYNP_VALUES_READ during At Selection-Screen Output it doesn't return the current screen parameter values, so I replaced it with FM RS_REFRESH_FROM_SELECTOPTIONS.  This works, but then DYNP_VALUES_UPDATE did not update the screen even though I can see the internal table for DYNPFIELDS is populated.  The function appears to work correctly and SY-SUBRC = 0, but the field is blank.

You are in PBO so BEFORE dynpro display in the PAI/PBO cycle and you call a FM that read the dynpro that you didn't yet display. I'm surprised that you're surprised. Even if FM worked, the actual PBO execution would overwrite those values from program global data.

In PBO and PAI those FM are no use, only intended from POV, in PBO and PAI use the data of the program not of the dynpro (READ FM can be effective in PAI, but I won't build code on this sand)

So you cannot use same exact code in POV and PBO (OUTPUT or even INITIALIZATIOn)

Regards,

Raymond

OttoGold
Active Contributor
0 Kudos

Ok, got it. My solution is awkward, but works.

Original thought: Have a class method (in the controller) that takes care of transferring the data from the model to the screen. I couldn't find an easy and elegant way of doing this. It works fine from the screen to the class, but as you can see I struggle with the other direction.

Solution: I have a code in AT SELECTION-SCREEN event of my program (I am using the generated selection screen 1000, that's the whole point of this exercise) where I transfer what is in the model class to the selection screen.

It feels sub-optimal, but I couldn't find a more elegant way. May this helps someone or maybe you have a better idea, in which case you let me know.

Thanks for the explanation, I appreciate it. It helped me further.

cheers Otto