cancel
Showing results for 
Search instead for 
Did you mean: 

If i want to parameterize date as system date

Former Member
0 Kudos

Hello All,

i have a doubt in CATT.

i am going through transaction ME21N, for the document date field i would like to paramterize it as System's Date. Which data element do i need to take so that when ever i create any purchase order the date is automatically taken as the systems date.or is thr any other method through which i can do it.

Thanks in Advance.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Afroz,

I think, i have a simple solution as compared to the others,

just declare a local variable say v_date,

v_date = &date .

then the current date comes into v_date,

just parameterize v_date where ever u want,

&date is predefined in eCATT,

hope it helps you, if yes pls reward the points,

Regards,

Chandra shekhar.A

Former Member
0 Kudos

Hi,

I've approached this in a different way - I wanted the script to adopt itself to the user settings of the person running it. So I did the folllowing:

1) Declared internal variable V_TD (char 10) and called it "Today's Date".

2) Declared import parameter I_DOC_DATE for the script transaction.

3) Found a function module that did the conversion I was looking for.

My code is below. I didn't program any checks or exception handling at this time. I left it in the code for future use.

************************************************************************************

abap.

CALL FUNCTION 'DATUMSAUFBEREITUNG'

EXPORTING

idate = sy-datum

IMPORTING

tdat8 = v_td

EXCEPTIONS

datfm_ungueltig = 01

datum_ungueltig = 02.

endabap.

I_DOC_DATE = V_TD.

************************************************************************************

Hope it helps, AM

Former Member
0 Kudos

Hi Afroz,

To assign current date to a date field. You can do the following.

Assign a local parameter to the date field( to be parameterized), say v_current_date.

Before the recording of ME21n, call the ABAP..ENDABAP command and write the following code:

Create two more parameters v_date and v_separator.ABAP type and length of any of these local parameters can be given default values.

ABAP.

v_date = sy-datum. (Assigns current system date)

V_SEPARATOR = '.'.

CONCATENATE V_DATE6(2) V_SEPARATOR V_DATE4(2) V_SEPARATOR V_DATE(4) INTO V_INVOICE_DATE.

ENDABAP.

Assigning system date SY-DATUM directly will result in date field getting filled up as, say for today, '20.06.0118'.

Hope you find the above solution useful.

Thanks & regards,

Sasmita Sahoo

Former Member
0 Kudos

Hello Afroz,

You can create one Import parameter for that date field of type D that you want as system date.

If you are using TCD mode of recording, then just before the TCD command in the eCATT editor, assign the Import parameter to SY-DATUM, the system date field.

eg.

  • Assign the system date to Import variable

P_IC_DocDate = SY-DATUM.

  • Log the Import variable

LOG P_IC_DocDate.

  • If TCD: Recording of ME21N transaction

TCD ( ME21N , ME21N_1 ).

=> If instead of TCD, SAPGUI is used for recording then the following is the way -

SAPGUI (---).

SAPGUI (---).

SAPGUI (---).

SAPGUI (---).

  • Assign the system date to Import variable

P_IC_DocDate = SY-DATUM.

  • Log the Import variable

LOG P_IC_DocDate.

  • SAPGUI: Recording of ME21N transaction

SAPGUI ( ME21N_1400_STEP_1).

SAPGUI (---).

SAPGUI (---)

Hope this helps!

Regards