‎2006 Jul 26 3:51 PM
Hi Gurus,
cau you help me how to write logic for below problem
BOTTLEAMOUNT CAUFVD-MATNR CHAR 18
BUT LAST TWO DIGITS OF THE MATERIAL SHOULD BE CONVERTED TO A SINGLE DIGIT WHERE APPLICABLE AND CONCATENATED WITH A "C"
EX: 0986-03456-01
01 = 1C THEN
BOTTLE AMOUNT = 1C (IF ITS ZERO HERE )
IF ITS NOT ZERO THERE THEN WHTS THE LOGIC I HAVE WRITE FOR ABOVE 2 CONDITIONS
PLZ REVERT BACK ME
THANKS & REGARDS
DIVYA
‎2006 Jul 26 4:22 PM
Hi Divya,
Consider this logic.
Will it suit your requirements.
REPORT zztest_arun .
PARAMETERS : btlamt(18) DEFAULT '0986-03456-01'.
DATA : tmp(2),
len TYPE i.
*Calculate the Length
len = STRLEN( btlamt ).
len = len - 2.
*Take the last two digits into one variable
tmp = btlamt+len(2).
*If there is 0 follow this logic.
IF tmp CA '0'.
TRANSLATE tmp USING '0 '.
CONDENSE tmp NO-GAPS.
CONCATENATE tmp 'C' INTO tmp.
btlamt+len(2) = tmp.
ELSE.
*Write any Logic you need or just display the Bottleamount.
ENDIF.
BREAK-POINT.
WRITE : / btlamt.
<b>Test this code by giving the Input in the way you want and check the output.</b>
Cheers,
AS
‎2006 Jul 26 4:09 PM
‎2006 Jul 26 4:20 PM
hi Rich,
i need to display bottle amount ex: 0987-0345-01
so the last two digits of the materil should be converted to asingle digit where applicable and concatenate with a "c"
ex: 0987-0345-01
01 = 1c
bottle amount = 1c
similarly if there is no zero in material ex:0987-0998-22
in this case how can we write logic and for above case also hw can we write logic
filed name is matnr char 18
regards,
divya
‎2006 Jul 26 4:32 PM
Hi Divya ,
do this.
data : lv_char2 type char2,
lv_temp type char15
lv_temp1 type char15,
lv_temp2 type char3
lv_amout type char18,
lv_lenght type i.
split amount at '-' into lv_temp lv_temp1 lv_char2.
translate lv_char2+(1) '0 '.
condense lv_char2 no-gaps.
concatenate lv_char2 'C' into lv_temp3.
lv_char2 = lv_temp3.
concatenate lv_temp lv_temp1 lv_char2
into lv_amount
seperated by '-'.<b>Please Reward Points & Mark Helpful Answers</b>
To mark Helpful Answers ;click radio Button next to the post.
RadioButtons
<b>o</b> Helpful Answer
<b>o</b> Very helpful Answer
<b>o</b> Problem Solved.
Click any of the above button next to the post; as per the anwers
<b>To close the thread; Click Probelm solved Radio Button next to the post , which u feel is best possible answers</b>
‎2006 Jul 26 4:12 PM
Hello Divya,
Can you give clear picture about úr requirement.
Regards,
Vasanth
‎2006 Jul 26 4:22 PM
Hi Divya,
Consider this logic.
Will it suit your requirements.
REPORT zztest_arun .
PARAMETERS : btlamt(18) DEFAULT '0986-03456-01'.
DATA : tmp(2),
len TYPE i.
*Calculate the Length
len = STRLEN( btlamt ).
len = len - 2.
*Take the last two digits into one variable
tmp = btlamt+len(2).
*If there is 0 follow this logic.
IF tmp CA '0'.
TRANSLATE tmp USING '0 '.
CONDENSE tmp NO-GAPS.
CONCATENATE tmp 'C' INTO tmp.
btlamt+len(2) = tmp.
ELSE.
*Write any Logic you need or just display the Bottleamount.
ENDIF.
BREAK-POINT.
WRITE : / btlamt.
<b>Test this code by giving the Input in the way you want and check the output.</b>
Cheers,
AS