2009 Jun 12 5:49 AM
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
2009 Jun 12 6:00 AM
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
2009 Jun 12 6:00 AM
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
2009 Jun 12 6:45 AM
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.
2009 Jun 12 7:36 AM
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.
2009 Jun 12 8:03 AM
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