cancel
Showing results for 
Search instead for 
Did you mean: 

Wrote the current Date and Time in the backend

Former Member
0 Kudos

HI everyone,

I created a table view, where I display several records. Right now I will add an record to this table, which should be written back in the backend and automaticaly add the current date and time.

But I don´t know to make this. I tried several time with the funktion "now()", but it doesn´t work. So any help for me, to explain how I can display the actual time and then write it back to the backend?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Marcus,

I created a table view, where I display several

records. Right now I will add an record to this

table, which should be written back in the backend

and automaticaly add the current date and time.

If you want to write it back you can use a RFC function module, there is ABAP function for the actual date and time. You have transfer your data from the table and the timestamp can you get from your backendsystem. Then you have it already in the internal format.

But I don´t know to make this. I tried several time

with the funktion "now()", but it doesn´t work. So

any help for me, to explain how I can display the

actual time and then write it back to the backend?

So you do not need any "now()" function in VC, if you do it like that.

Hope it helps.

Best Regards,

Marcel

Former Member
0 Kudos

Hi Marcel,

well sounds like it could work, but I´m very new at VC so I´m not really clear with RFC moduls and even I don´t know yet how to write back in the backend. Maybe you have an example or could it explain for a newbie

Thanks in advance.

Former Member
0 Kudos

Hi Marcus,

you must log on over SAP GUI to your backendsystem. Over transaction SE37 you can create your new function module. The function module must remote-enabled (RFC).

Then you have the import paramters, these are the parameters which you get from VC. Then you have write your ABAP coding, maybe there is already a function module which you can use or you have to write everything, which inserting your your values in the corresponding fields.

After you write your function module, you must connect the backendsystem to the portal, so that you can use the RFCs with from your backendsystem as a service in VC.

That's it. I hope it helps and you understand everything, if not so, ask again.

Best Regards,

Marcel

Former Member
0 Kudos

Thanks, it comes clear what to do. But I´m not a technican, so I´m not able to write ABAP. Guess I need to search for an other way within the VC and use the function "tnow()" given there.

Former Member
0 Kudos

Hi Marcus,

if you know the table in the backend it is a easy SQL statement you need. Then you have no validation, but the validation you can do in VC. Or you can search for a BAPI, RFC for your requirements in the backend, if you find one you don't have to write any ABAP coding.

Can you tell me what you want write back in which backendsystem? Maybe I can give you a pointer.

Best Regards,

Marcel

Former Member
0 Kudos

I will get a API with this functionality from my collegues.Ir should be simple store some text in a table, wich will be a kind of attribute of the BP.Automatically the curret time should be added in a field of this table. So that every time you check this table again, you will see all records with the time they were created.

What I wanna know is how to build this in VC. To learn this I´m playing with the standard BAPI´s for "change" and "add" a adress of a BP, but I don´t know how this will work in the VC. For example:

I choose the BAPI_BUPA_ADRESS_ADD. What should I do? I have two Inputfiels. First the BP-Number zu identifie the BP. and then I have a INputform called "Adressdata". But because this are two Input´s I have to make two Inputforms. So I don´t know how this works.

I think about just to add a row to the displayed table (i guess there is an video instruction for this) but then I have to wrote back this table entry to the backend, and don´t know how.

So hope that my problem comes clear.

Thanks for your time and help

Former Member
0 Kudos

Hi Marcus,

can you tell me, what backendsystem do you want to use? R/3, BW...

So that I can look for the BAPI.

But I think if you use standard BAPIs and there is no time for the parameters you have not the chance to add a time in this table. Therefore you can look in the system for the tables of your BP and if there is no time field, then you have to do a lot in your backend system...

I think it's not so easy as you think... there is a possibilty to do it, but then you need help from a abap programmer of your department.

Best Regards,

Marcel

Former Member
0 Kudos

we use a crm system. but the BAPI I mentioned was just to play with. My basis will develop a new API for the project, that have the requested Inputfields. But what I tottaly forget was, that there has to be a field for the time, so thanks for the advice.

I´m still of the opinion , that it should be possible to add the curret time in a field with the funcionality of the VC, even there is a way to show a clock with the current time. My problem is that I can´t figuer out how to do this.

Former Member
0 Kudos

we use a crm system. but the BAPI I mentioned was

just to play with. My basis will develop a new API

for the project, that have the requested Inputfields.

But what I tottaly forget was, that there has to be a

field for the time, so thanks for the advice.

No Problem.

I´m still of the opinion , that it should be possible

to add the curret time in a field with the

funcionality of the VC, even there is a way to show a

clock with the current time. My problem is that I

can´t figuer out how to do this.

Therefore you can use the TNow() function (Time functions) and the Now() Function (Date functions). You can cast them to a string and concatenate the string, then you have the date of today with the current time. This string you can format and transfer it as input for your BAPI_ADD_BP for example.

Hope that helps.

Best Regards,

Marcel

Former Member
0 Kudos

see, thats what i guess. But what are the expressions I need to use. I simply try to make an input field in an Form View and insert the function TNOW() on this field. But when I do this I get the error message "expected tex/value expression". Do I need to add something in the brackets?

Former Member
0 Kudos

Hi Marcus,

this is an error in your formula. You have for example a form with an inputfield of the type text, but the fuctions TNOW() and NOW() returns a value of the type time and date. You have to use the date function DSTR(d,mask) and the time function TSTR(t,mask) so that you get strings.

Best Regards,

Marcel

Former Member
0 Kudos

ok, but what should I enter for the "d" and the "mask"? Where were them declared?

Former Member
0 Kudos

Hi Marcus,

if you use a date or time field on your formular you can switch to formatting, there are some exmples. Then you can use DSTR(d,mask) for example DSTR(@yourdate,"dd.mm.yyyy"). So you can format the output for your requirements.

Best Regards,

Marcel

Former Member
0 Kudos

Sorry for my stupid questions, but I don´t got it.

So simple: What should I do to show in a field on the screen the curret time and date?

Answers (2)

Answers (2)

Former Member
0 Kudos

HI, so right now I get want you wanna tell me the hole time. Sometimes it helps to make a little break to think about it.

Thanks for your help.

Now , afer I declared the field as a date field, it works with the standard fuctionality now().

Former Member
0 Kudos

Hmmm, don't know about the now()-functionality in VC, but have you tried to create in your backend system in the table that you update on the field to include a now()-functionality? I remember from MS Access (and MS SQL Server?) that it is possible to have that built in the table, so that you don't have to take care of that in the application.