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

Dateformat during BI

Former Member
0 Likes
705

Hello everyone,

I'm trying to make a very simple BI program but have one problem that I seem unable to find a solution for. It seems like such a trivial task.

During BI I need to fill a dnypro field with today's date (sy-datum). I can sucessfully put this value into the BI table, but during "playback" of the BI, depending on the users date format preferences, the BI fails because the dynpro misinterprets the date.

How can I force the date from sy-datum, that I store in my BI table, to be put into the dnypro field using the user specified date format? It always comes into the dnypro as yyyymmdd.

I'm glad for any help.

Thanks

Christoph

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
681

hi..

when u use sy-datum, it is always in the user settings format.

so take a variable of type sy-datum.

move the required date into that variable.

then send it to dynpro...

5 REPLIES 5
Read only

Former Member
0 Likes
682

hi..

when u use sy-datum, it is always in the user settings format.

so take a variable of type sy-datum.

move the required date into that variable.

then send it to dynpro...

Read only

0 Likes
681

Hi Rammohan and thank you for your quick reply.

I'm afraid I don't quite understand how I am supposed to do that. As far as I know during BI the system takes variables from a table of type bdcdata which defines which fields to put which values into. The value field FVAL in this table of structure is of type BDC_FVAL which really is char 132.

Perhaps a code excerpt can help:


DATA: BEGIN OF bdc_tab OCCURS 20.
        INCLUDE STRUCTURE bdcdata.
DATA: END OF bdc_tab.
....
....
bdc_tab-fnam = dynpro_field.
bdc_tab-fval = sy-datum.
append bdc_tab.
....
....
CALL TRANSACTION transaction_code using bdc_tab mode 'E'.

So I guess as soon as I move sy-datum into that bdc_tab it looses it's context and becomes a simple char value and once the transaction has been called I have no more control over what's happening. So my idea would have been to store sy-datum formatted and converted into the user specific format into the bdc_tab itself before! I ever call the transaction.

Perhaps there is a better way? This seems like such a common requirement I'm must be missing something.

Thanks again.

Christoph

Read only

0 Likes
681

Hi,

instead of

bdc_tab-fval = sy-datum.

try this:

write sy-datum to bdc_tab-fval.

or:


data: lv_date(10).
write sy-datum to lv_date.
bdc_tab-fval = lv_date.

Now the User-dependent Format should be used.

Martin

Message was edited by:

Martin Pfeiffer

Read only

0 Likes
681

Thanks Martin, so simple and yet so effective.

That was the solution!

Christoph

Read only

Former Member
0 Likes
681

Hi,

Christoph

Depending on your user setting for a date you can write a code like,

Declare variable date of type N or C (10) width

and then use

WRITE statement to write into BDC.

It will format date as per your requirement.

Reward if useful