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: 

Sy-uname as default for Input Field in Dynpro

Former Member
0 Kudos
588

Hi there,

i've got a question. I created a dynpro and I want to set sy-uname as default for an input field in a dynpro (field marked in picture). What is the easiest way to make this real?

Thankfully marko

Picture: [Dynpro|http://b.imagehost.org/download/0919/problem]

1 ACCEPTED SOLUTION

Former Member
0 Kudos
409

Dear markok,

The easiest way to populate the parameters/select-options on the screen is to populate the same in the INITIALIZATION block.

The code snippet:


" Selection screen
PARAMETERS:
pa_uname    TYPE  sy-uname.

INITIALIZATION.
pa_uname = sy-uname.

START-OF-SELECTION.
" your code goes here

Hope this helps...:)

Regards

s@k

19 REPLIES 19

Former Member
0 Kudos
409

In PBO mark that field = sy-uname

0 Kudos
409

How should i mark that field in PBO?If i try to set the field called "Benutzername" to sy-uname (Benutzername = sy-uname) I get a syntax problem. I cant declare the content of the field in PBO.

Thanks anyway

Edited by: markok on Feb 17, 2010 8:50 AM

0 Kudos
409

<li> If Benutzername is your screen field and wants to use in program, you need to define the variable Benutzername in TOP include and do the same, then it works. Thanks Venkat.O

0 Kudos
409

Hi Markok,

What is the syntax error you are getting?

Regards,

Swarna Munukoti.

0 Kudos
409

In PBO or PAI of a Dynpro there is no way to declare anything. You can only work with a few commands like field chain module and so on.

So i build a module where i try to move sy-uname to my field and i called the module from PBO.

But it doesnt work

0 Kudos
409

Hi,

If the name of your field is A, then go to your TOP include of the Dialog Program and declare it as


DATA: A(10) TYPE c.

This is what Venkat is trying to say.

0 Kudos
409

Hi,

In TOP Include 
Data : Benutzername type sy-uname.
" Follow these steps as mentioned here
in PBO of Screen.

Module status_100.

in program 
module status_100 output.

Benutzername = sy-uname. " Make sure you use the Same name(Benutzername) for Screen Field in Screen Painter.
endmodule.
"Make Sure you are not Clearing any Structure or this Value Individually

" We can't use Data key word in FLow Logic neither Assign statements
" The Fundamental Rule in Screen Programs
If Screen Field name and a Variable name in program is same then automatic data transfer takes place.

Cheerz

Ram

0 Kudos
409

You are absolutely correct Nitwick. Thanks Venkat.O

Former Member
0 Kudos
410

Dear markok,

The easiest way to populate the parameters/select-options on the screen is to populate the same in the INITIALIZATION block.

The code snippet:


" Selection screen
PARAMETERS:
pa_uname    TYPE  sy-uname.

INITIALIZATION.
pa_uname = sy-uname.

START-OF-SELECTION.
" your code goes here

Hope this helps...:)

Regards

s@k

0 Kudos
409

TO Siemens: Thanks but this isnt the solution too. I want that my field "Benutzername" is automatically filled with sy-uname ( For example: [Field|http://b.imagehost.org/download/0145/problem] ).

To others: I try again

Thankfully

Marko

Edited by: markok on Feb 17, 2010 9:28 AM

0 Kudos
409

create new module at PBO and assign sy-uname to that field in that module.

Sekhar

0 Kudos
409

hi,

in top include declare the field.

then in the pbo module pass the value field.

filedname = sy-uname.

if this doesnt work then check spa/gpa in the attributes.

regards.

0 Kudos
409

Dear Marko,

Can you show how you have declared the field "Benutzername"..?

Regards

s@k

0 Kudos
409

Thank you very much for your answers but it still doesnt work. I did some screenshots now.

Can anybody explain me whats wrong ? The problemfield "Benutzer" is called "einstruktur-erstellerein" in my program.

Its build in a structure ( Screenshot: [Declaration|http://b.imagehost.org/download/0827/problem1] ).

The second picture describes the fieldinput through sy-uname in my module (Screenshot: [Input|http://i.imagehost.org/download/0846/problem2] ). Screenshot three is the PBO calling of the module (Screenshot: [Module|http://i.imagehost.org/download/0735/problem3] ).

The problem is that in debug mode the field "einstruktur-erstellerein" is filled with sy-uname but in dynpro output the field is shown as empty. 😕

Thankfully marko

0 Kudos
409

Are you sure you're not doing a CLEAR somewhere in a PBO module?

Is the SCREEN field name exactly the same? One small typo is enough to not see the value.

And for testing purposes, try passing SY-UNAME in a PBO module and see if the screen field is still empty.

0 Kudos
409

Hi Maen Anachronos, thank you for your answer. What do you mean with try passing sy-uname in PBO Module??

The fieldnames are 100% correct. I checked them again and I did it about ten times today ;).

Thanks

0 Kudos
409

SY-UNAME in a PBO module... sorry misread your post: you already did that.

0 Kudos
409

Hello,

How is your field defined in the element list of your dynpro ?

Are the checkboxes Input and Output flagged ?

Did you create the reference yourself by creating the element directly on the screen (dynpro) or did you make a reference to the Dictionary with the Dictionary checkbox in the element list ?

The rest of your code seems correct to me.

Wim

0 Kudos
409

OH MY GOD

I created the dynpro last week and i forgot that i set the field to only input OH MY GOD

Thanks a lot it works !!!

Edited by: markok on Feb 17, 2010 2:20 PM