Application Development and Automation 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: 
Read only

Intitialize screen Field

Former Member
0 Likes
2,063

HI all,

I need to Initialize a screen Field ( type DATS ) to the current system date. It is a Dictionary field, i do not see anything in the screen Painter.

Thanks in advance,

Ravi.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,580

Hi,

in PBO loop the screen and modify the screen field value.

Module modify_screen.

loop at screen.

if screen-name = 'P_DATE'.

P_DATE = sy-datum.

endif.

modify screen.

endloop.

thanks

vijay

HI all,

I need to Initialize a screen Field ( type DATS ) to the current system date. It is a Dictionary field, i do not see anything in the screen Painter.

Thanks in advance,

Ravi.

10 REPLIES 10
Read only

Former Member
0 Likes
1,580

Ravi, You can initialize the field in PBO. just set the field to SY-DATUM in PBO .And you can probably default it to sy-datum, only when the field is empty so that some other value is not overwritten

Read only

Former Member
0 Likes
1,580

Hi

You can do it in the logic flow of your dynpro, not in the screen painter.

PROCESS PBO.

MODULE INIT.

MODULE INIT.

CHECK FL_INIT = SPACE.

FL_INIT = 'X'.

DATE = SY-DATUM.

ENDMODULE.

But it should be better you do that before calling the screen.

DATE = SY-DATUM.

CALL SCREEN 100.

Max

Message was edited by: max bianchi

Read only

Former Member
0 Likes
1,581

Hi,

in PBO loop the screen and modify the screen field value.

Module modify_screen.

loop at screen.

if screen-name = 'P_DATE'.

P_DATE = sy-datum.

endif.

modify screen.

endloop.

thanks

vijay

Read only

0 Likes
1,580

Thanks for prompt answers, I am able to initialize, but i need to see the value on the Screen too.

Thanks,

Ravi.

Read only

0 Likes
1,580

Hi

The initial value of date field is 00000000 not SY-DATUM.

If you want to do that in screen painter (but I can't understand why you want to do it), I think you should assign an your own convertion exit.

Max

Read only

0 Likes
1,580

Hi Max,

How does SAP know if this is a Screen Field or Not?

Should i include field Names in any Includes..?

Let me know...

Thanks,

Ravi.

Read only

0 Likes
1,580

The transfer of data from the ABAP program to the dynpro(screen) is transparent to the developer. We just say that it "Magically Happens". The only way that it will happen is if the name of the screen field in screen painter has a corresponding DATA statement in the ABAP program. For example, lets say that you have a screen field in screen painter that has the name of P_DATUM, its defined as a DATS field and has a length of 10. You must have a DATA statement in your program.

DATA: P_DATUM TYPE SY-DATUM.


p_datum = sy-datum.

call screen 100.

Regards,

Rich Heilman

Read only

0 Likes
1,580

if you define a screen field & abap variable with the same name , automatically changes will reflect in each place.

i.e, if you change field value in the screen automatically the changes will reflect in the program also,if screen field is defined in the abap program also.

so try to give same name in both screen painter & define a variable of sy-datum in program also.

then in PBO event

say date_field = sy-datum.

automatically current date will appear in screen

regards,

srikanth

Read only

0 Likes
1,580

Hi Ravi

From the scratch:

1) Create a program of type module pool

2) Create a screen and put a field on the screen with 'SYST-DATUM' as the Input/Output field.

3) In the TOP include of your program you have to map the field by defining the field as TABLES : syst.

4) Now in your PBO of the screen you can say syst-datum = sy-datum.

Hope it helps.

Sunil Achyut

Read only

Former Member
0 Likes
1,580

Hi Ravi,

If u can initialize u can see that on the screen....

But I dont know ur exact senario...

Alternate for this is...

U cane use the FM DYNP_VALUES_UPDATE, to update the screen values

Sreedhar