cancel
Showing results for 
Search instead for 
Did you mean: 

Reg Displaying Current Date & Time on PageHeader

former_member186491
Contributor
0 Kudos

Hi,

I need to display current Date & Time on the page header element of WDA. How can I do so?

Please suggest.

Thanks.

Kumar Saurav.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Saurabh,

Use sy-datum & sy-uzeit to get the current date and time. You can also use the FM "OIL_GET_CURRENT_DATE_TIME"for this by giving the time Zone E.g. INDIA.

former_member186491
Contributor
0 Kudos

Hi Sanket,

Thanks for the suggestion. But, will I need to add one dedicated Node with Attribute to display date and time..?

thanks.

Kumar Saurav.

Former Member
0 Kudos

If you want to use the data globally/Locally in View methods, then you need to create a node say NODE1 with the two attributes as leow:

DATE type sydatum

Time type syuzeit.

Get the Node1 structure using code wizard and set the values with Sy-datum & sy-uzeit in DATE & TIME fileds.

Hope it helps.

former_member186491
Contributor
0 Kudos

Hi Sanket,

Thanks for your answer. I made the node called N_TIMESTAMP under which made two attributes named DATE and TIME.

Now, I have one landing page where I'm embedding all the pages as per navigation required and I've to display Date and Time on all the Views. Hence, I am adding this into my LANDING page. In that page, I added one PageHeader Element. There, using TITLE in Properties, I made the Context-Binding of DATE and TIME.

However, the PageHeader reamains blank.

Can you suggest what is missing out here..?

Thanks.

Kumar Saurav.

Former Member
0 Kudos

Hi Kumar,

I have taested this one in my systema and it's working fine. I think you have not created the N_TIMESTAMP in Component controller.

Do the below steps:

1) Create the N_TIMESTAMP in Comp Controller and the attribute say date & time.

2) In the WDDOINIT method of the Comp controller you need to fill the value as below:\

data:

Node_Node type ref to If_Wd_Context_Node,

Elem_Node type ref to If_Wd_Context_Element,

Stru_Node type If_Main=>Element_N_TIMESTAMP .

  • navigate from <CONTEXT> to <NODE> via lead selection

Node_Node = wd_Context->get_Child_Node( Name = IF_MAIN=>wdctx_N_TIMESTAMP ).

  • get element via lead selection

Elem_Node = Node_Node->get_Element( ).

Stru_Node-date = sy-datum.

Stru_Node-time = sy-uzeit.

  • get all declared attributes

Elem_Node->set_Static_Attributes(

Static_Attributes = Stru_Node ).

3) Map this N_TIMESTAMP in your View, where you are going to bind the Page header title.

4) Then assign the Title property of the two Page headers with Date & time fields of the Node N_TIMESTAMP.

Hope it works for you as well.

former_member186491
Contributor
0 Kudos

Hi Sanket,

Thanks for your support. Actually, I missed one step of setting the vale. Silly mistake....must say.

Thanks a lot.

Kumar Saurav.

former_member186491
Contributor
0 Kudos

Hi Sanket,

If it is possible to display Time as ticker i.e., as digital display..?

Kumar Saurav.

Answers (1)

Answers (1)

Former Member
0 Kudos

HI Kumar ,

For Displaying the Date and time in Page header , add Title content or add insert area , you can see this option when you Right click on your Page Header UI element , You can add only one Tile content and one area for Page header

Surly you have to create a attribute to hold the date & time and bind the attribute to the Title content

Regards

chinnaiya P