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: 

How to enable dynamic timestamp values in selection screen variant

former_member367551
Participant
0 Kudos

Dear forumers,

I have the following scenario for a report program:-

The selection screen contains a data input parameter for timestamp data, P_START.

When a user maintains selection screen variants for the report program, the exact data values for P_START are saved as well.

However, there are times that the user would also prefer to maintain the data values for P_START dynamically, i.e. the first day of the current month.

This cannot be achieved currently. What can I do for enabling this feature?

In the selection screen variant under the Attributes setting, I am guessing that this can be done by selecting 'T (table variable from TVARVC)' as the Selection Variable. (Currently, this is blank.) Next, when checking on the Name of Variable, these appear in the search help:-

SAP_SCMA_DETAIL_LIST

SAP_SCMA_FISC_YEAR

SAP_SCMA_PERIOD

SAP_SCMA_POST_DATE

SAP_SCMA_POST_PERIOD

SAP_SCMA_SELV_PROJECT

SAP_SCMA_TEST_RUN

SAP_SCMA_VALUE_DATE

Would you please advise, on how shall I proceed with this?

Appreciate any input at all.

Many thanks.

P/S: P_START -- has the data format of UTC Time Stamp in Short Form (YYYYMMDDhhmmss)

1 ACCEPTED SOLUTION

former_member219162
Contributor
0 Kudos

Hello Deb,

Istead of choosing "T", just choose "D" and you would get option as First day of current month the the column 'Name of Variable..."

6 REPLIES 6

Ajit_K_Panda
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Tan,

I think you have to use dynamic variants. This link will guide you how to use dynamic variant creation:please check

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/700449a1-4659-2e10-8cbd-edccdc6da...

Regards,

Ajit

0 Kudos

Hi Ajit,

I am unable to use dynamic variants for the reasons below:-

- The data type for P_START is timestamp, not date.

- In Variant Attributes, for P_START - when selecting the search help for the Selection Variable, only one option is made available --> T (table variable from TVARVC). The 'D (dynamic variant)' option that you mentioned is not available for this data type, timestamp.

Any other suggestions, please?

former_member219162
Contributor
0 Kudos

Hello Deb,

Istead of choosing "T", just choose "D" and you would get option as First day of current month the the column 'Name of Variable..."

0 Kudos

Hi Anirban,

I am unable to use dynamic variants for the reasons below:-

- The data type for P_START is timestamp, not just date alone.

- Example: '14.11.2013 05:50:30'

- In Variant Attributes, for P_START - when selecting the search help for the Selection Variable, only one option is made available --> T (table variable from TVARVC). The 'D (dynamic variant)' option that you mentioned is not available for this data type, timestamp.

Any other suggestions, please?

0 Kudos

Hello Deb,

I don't think you can maintain Timestamp like that. What you need to do is;

1) goto to SM30 and put TVARV.

2) Maintain a Parameter named "ZTIMESTAMP". Keep the value blank.

3) In your custom program, in the Initialization section, write this;

TABLES: tvarvc.

DATA: lx_tstamp     TYPE timestamp,

      ITAB_TVARVC      LIKE tvarvc OCCURS 0 WITH HEADER LINE.

   

PARAMETERS: P_START     TYPE timestamp.

INITIALIZATION.

  GET TIME STAMP FIELD lx_tstamp.

  ITAB_TVARVC-name = 'ZTIMESTAMP'.

  ITAB_TVARVC-type = 'P'.

  ITAB_TVARVC-numb = '0000'.

  ITAB_TVARVC-low  = lx_tstamp.

  CONDENSE ITAB_TVARVC-low.

  APPEND ITAB_TVARVC.

  CLEAR ITAB_TVARVC.

 

  MODIFY tvarvc FROM TABLE ITAB_TVARVC.

4) Then you can create a dynamica variant. Use the "T" in the selection variable and choose "ZTIMESTAMP".

The idea is whenever the variant is called, ZTIMESTAMP would be updated with current date and time.

0 Kudos

Hi Anirban,

This was what I was looking for; much thanks~! Appreciate this.

Deborah