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: 

date in smartforms

Former Member
0 Kudos

hello everybody,

i have a field order_date which is in a format for eg 27.08.2007 how can i change into

27 august 2007 in smartforms

plz advise ...very urgent

thanks

11 REPLIES 11

Former Member
0 Kudos

select single ltx from t247 where mnr = date+4(2). Declare date and ltx in global declaration.

&date+6(2)& ltx & &date(4)& will do.

for putting subfield use the pencil icon on text node. Hope it helps.

Regards,

Mallick

Message was edited by:

DEBOPRIYO MALLICK

Message was edited by:

DEBOPRIYO MALLICK

Former Member
0 Kudos

Hi,

I think no direct way for this in SAP.

So u have to do it manually. Means,

Put CASE

ENDCASE

like this,

dt = ur date.

day = dt+6(2).

mon = dt+4(2).

yr = dt+0(4).

CASE mon.

WHEN '01'.

mon1 = 'JANUARY'.

WHEN '02'.

mon1 = 'FEBRUARY'.

WHEN '03'.

mon1 = 'MAR'CH.

WHEN '04'.

mon1 = 'APRIL'.

WHEN '05'.

mon1 = 'MAY'.

WHEN '06'.

mon1 = 'JUN'.

WHEN '07'.

mon1 = 'JULY'.

WHEN '08'.

mon1 = 'AUGUST'.

WHEN '09'.

.

.

.

.

.

ENDCASE.

concatenate day mon1 '-' yr into exp_date.

Hope it will helpful to u.

Former Member
0 Kudos

hi,

you can handle this feature in ABAP code.

1. Develope a code that can convert month number into text

2. create a string that will contain day month year in char format

3. This string you pass as date string

former_member188827
Active Contributor
0 Kudos

try:

data zdate type sy-datum.

data zmn(2) type c.

data: zdate(2) type c,zyear(4) type c.

zmn = order_date+4(2).

zdate = order_date+6(2).

zyear = order_date+0(4)

case zmn.

when '01'.

zmonth = 'Jan'.

when '02'.

zmonth = 'Feb'.

.

.

.

when '12'.

zmonth = 'Dec'.

endcase.

display zdate zmonth zyear on text element

0 Kudos

hi ,

this is my code

data : date(10),

text1(26),

num1(10),

test_day(15),

  • order_date type ZAZ2DEL_ORDER_DATE,

idate type ZAZ2DEL_ORDER_DATE .

data : Day(2), month(2), Year(4).

data : ODay(2), Omonth(2), OYear(4).

data : Ltext Type T247-LTX.

date = order_date.

day = date+6(2).

month = date+4(2).

year = date+0(4).

date = order_date.

concatenate year month day into idate.

CALL FUNCTION 'HR_IN_GET_DATE_COMPONENTS'

EXPORTING

idate = idate

IMPORTING

DAY = oday

MONTH = omonth

YEAR = oyear

LTEXT = ltext.

concatenate oday ltext oyear into order_date.

when iam excuting the smartform exception is raising saying text for month not maintiained...am i missing some thing up there

plz advise

regrds...

0 Kudos

Hi,

Try this Program,

TABLES : t247.

DATA : v_ktx LIKE t247-ktx,

v_date LIKE sy-datum VALUE '20070618',

v_final(9).

SELECT SINGLE ktx INTO v_ktx FROM t247 WHERE mnr EQ v_date4(2). CONCATENATE v_date6(2) v_ktx v_date+2(2) INTO v_final SEPARATED BY '-'.

WRITE : v_final. " Output: 18-JUN-2007.

Regards,

Padmam.

0 Kudos

thanks for your reply,

but iam not taking sydatum iam using the date field from the database table...

please help me on this

thanks

0 Kudos

Just write a program line node where you write the code I have written before.

clear the entries in each time after loop. After that display the text element it should work. Don't try to complicate things. Just copy and paste the code I have written it will work.

Regards,

Mallick

0 Kudos

that doesnt wrk....plzzzzzzzzzzzzzzzzzzz smbdy help meeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

0 Kudos

Both of the suggested code using table T247 should work, but they both need to be changed to specify a value for the field SPRAS (the language). I would suggest field CONTROL_PARAMETERS-LANGU so the language of the form is used.

Regards,

Nick

Former Member
0 Kudos

Hi .

You can use this function MONTH_NAMES_GET

CALL FUNCTION 'MONTH_NAMES_GET'

  • EXPORTING

  • LANGUAGE = SY-LANGU

  • IMPORTING

  • RETURN_CODE =

TABLES

month_names = it_month

  • EXCEPTIONS

  • MONTH_NAMES_NOT_FOUND = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at it_month where MNR = p_date+4(2).

there is month name.

endloop.

Have fun.

Sayan