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: 

simple query plz help

Former Member
0 Kudos

hi experts

i have a variable in which i have stores a date

from that date i want to store only the month value in a seperate variable .

plz give me the code for this

thanks in advance .

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Here is the code:

data: l_datum like sy-datum.

data: l_month(2) type c.

  • Assign value to L_DATUM

l_month = l_datum+4(2).

Hope this helps.

ashish

4 REPLIES 4

Former Member
0 Kudos

The example below gives you the month of the current date. You can use with any date variable to get the month.

DATA lc_month(2) TYPE c.

lc_month = sy-datum+4(2).

former_member223537
Active Contributor
0 Kudos

Hi Anit,

l_date = '2006.05.24'. "YYYY.MM.DD

l_month = l_date+5(2).

Best regards,

Prashant

Former Member
0 Kudos

Here is the code:

data: l_datum like sy-datum.

data: l_month(2) type c.

  • Assign value to L_DATUM

l_month = l_datum+4(2).

Hope this helps.

ashish

Former Member
0 Kudos

DATA : date TYPE sy-datum VALUE '20071201'.

  • Format 'YYYYMMDD'

DATA: month TYPE char2.

month = date+4(2).

WRITE: month.

Rewards if useful.....................

Minal