Application Development and Automation 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: 
Read only

Regarding the date format

Former Member
0 Likes
1,074

Hi,

My requirement is:

We have to generate a batch number in such a way that

the first character should be the last digit of the current date

the second character should be the month identifier(1-9 from Jan to sept and for the rest Oct-A Nov-B and Dec-C)

the third character should be the day identifier(for dates 1-9,its 1,2..9 and for the rest consecutive dates starting frm a,b,...v)

Please help me how to achive this.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,047

Hello


pointer type i.
if day LE 9.
  third_character = day.
else.
  pointer = day - 10.
  third_character = SY-ABCDE+pointer(1).
endif.

9 REPLIES 9
Read only

Former Member
0 Likes
1,047

Hi

You can use SPLIT or OFFSET key words to get what you want

for further info go through the KEY word documentaion where examples are provided

Regards

Ramchander Rao.k

Read only

Former Member
0 Likes
1,047

Hi,

Just declare a string variable which stores the batch number. Declare 3 more variable to store all other information. And then concatenate all variables to get a unique batch number.

Implement this logic. Hope this will be helpful for you.

Thanks

Nitesh

Read only

0 Likes
1,047

That is okay...but i want to know the logic how to increment the numbers and continue with the alphabets progressing...Since for the days, we need to go on from A to V, how to implement that?

Edited by: Aish S on Dec 2, 2008 1:21 PM

Read only

Former Member
0 Likes
1,047

Hi

U can do this by using Character String Operations on DATE and based on value use IFELSE control statement.

like ur DATE is 20081202 then

if date+6(2) = 01.

c3 = 1.

elseif date+6(2) = 02.

endif.

but this is simple way , u can find some more optamize way.

Regards

Sachin

Read only

Former Member
0 Likes
1,047

Hi,

Just use case statement for that.

Thanks

Read only

0 Likes
1,047

If we use the case statement, for the dates from 10 to 31st, case statemnt would be very lengthy.Is there any other possible way for this?

Read only

Former Member
0 Likes
1,048

Hello


pointer type i.
if day LE 9.
  third_character = day.
else.
  pointer = day - 10.
  third_character = SY-ABCDE+pointer(1).
endif.

Read only

0 Likes
1,047

Thanks a lot Maroz....it has worked perfectly....

Read only

Former Member
0 Likes
1,047

Hi,

I think you will have to go for case only. No other go.

Thanks

Nitesh