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: 

Date in Screen painter

sudhir_uppalapati
Participant
0 Kudos
1,939

Hi All,

I have designed a simple screen in which i have a date field.

i want the date field(current date) to be displayed automatically when i execute the transaction.

i have used sy-datum in PBO. but i am not able to get it in to the screen automatically when i execute it.

Regards,

Sudhir

1 ACCEPTED SOLUTION

shishupalreddy
Active Contributor
0 Kudos
423

Hi Sudeer,

Try the below code in PBO.

say screen field name as G_F_DATE.

WITHIN module pool declare a field of tyep sy-dtum

as g_f_date1 like sy-datum.

witin the flow logic ...try below

Module pbo_init.

g_f_date1 = sy-datum.

g_f_date = g_f_date1.

endModule

regards

4 REPLIES 4

shishupalreddy
Active Contributor
0 Kudos
424

Hi Sudeer,

Try the below code in PBO.

say screen field name as G_F_DATE.

WITHIN module pool declare a field of tyep sy-dtum

as g_f_date1 like sy-datum.

witin the flow logic ...try below

Module pbo_init.

g_f_date1 = sy-datum.

g_f_date = g_f_date1.

endModule

regards

sridhar_meesala
Active Contributor
0 Kudos
423

Hi,

Its better if you take the reference from a dictionary field for the date field.

example : VBAP-ERDAT.

now in PBO

vbap-erdat = sy-datum.

or else you can declare a field of type date and can achieve the same.

Thanks,

Sri.

former_member585865
Contributor
0 Kudos
423

Hi Sudhir,

If you Give in the PBO it will surely come just say whether your date field is standard database field or internal table field if it is internal table field just append it and see whether it is coming i think it is clearing at some stage just check in debug mode you will have a better idea.

MarcinPciak
Active Contributor
0 Kudos
423

Hi,

First of all you need a field on screen which either refers to some DDIC date field or is explicitly typed D.

- add your field and name it my_date

- go to attributes of field and choose from format - DATS

- in program declare data my_date type d.

i have used sy-datum in PBO

As for the default value you should use INITIALIZATION instead of PBO. This is beacuse if you change your date in screen field it will keep changing back to default one after dialog step is conculded (next PBO will be reached and you field will receive again default date). So you need to do it here.


INITIALIZATION.
my_date = sy-datum.

It will ensure that only once your field is set to default (today date) and next time user make any input it will overwrite the default one.

Regards

Marcin