2007 Jun 15 4:41 PM
Hi all,
Can we do adding or subtraction for char field directly..pls help for below code
DATA : LV_VERSION1 TYPE I.
DATA : LV_VERSION TYPE BBP_VERSION_NO.
*LS_VERSION-VERSION_NO has same as BBP_VERSION_NO
*BBP_VERSION_NO is CHAR08
MOVE LS_VERSION-VERSION_NO TO LV_VERSION1.
IF LV_VERSION1 = 1.
MOVE '1' TO LV_VERSION .
ELSEIF LV_VERSION1 = ' '.
MOVE ' ' TO LV_VERSION.
ELSEIF LV_VERSION1 > 1.
LV_VERSION = LV_VERSION1 - 1.
ELSE.
MOVE LV_VERSION1 TO LV_VERSION.
ENDIF.
Code is going to short - dump....pls help
Can any one pls help In general how to do adding or sub for a char field and for a I,P fields...by an example...
2007 Jun 15 5:24 PM
I tried your code (defining lv_version as type c, length 😎 and it worked for me without any dumps. Set a break point at your MOVE LS_VERSION-VERSION_NO statement and then debug step by step, looking at the field contents along the way to see exactly what is causing the dump. It's possible that your field has unexpected contents (for instance, a letter in the VERSION_NO field would cause a dump). I hope this helps.
- April King
2007 Jun 15 4:49 PM
2007 Jun 15 4:52 PM
See Raj...code is around 1500 lines of code..i have pasted some lines...whole code is nothing to do with this block...
2007 Jun 15 4:58 PM
Try the below opt.
IF LS_VERSION-VERSION_NO = '1'.
LV_VERSION = 1.
ELSEif LS_VERSION-VERSION_NO EQ ' '.
LV_VERSION = ' '.
ELSEIF LS_VERSION-VERSION_NO > 1.
LV_VERSION = LS_VERSION-VERSION_NO - 1.
ELSE.
LV_VERSION = LS_VERSION-VERSION_NO.
ENDIF.
2007 Jun 15 5:24 PM
I tried your code (defining lv_version as type c, length 😎 and it worked for me without any dumps. Set a break point at your MOVE LS_VERSION-VERSION_NO statement and then debug step by step, looking at the field contents along the way to see exactly what is causing the dump. It's possible that your field has unexpected contents (for instance, a letter in the VERSION_NO field would cause a dump). I hope this helps.
- April King
2007 Jun 15 5:36 PM
Use the below code-->
SHIFT LS_VERSION-VERSION_NO LEFT DELETING LEADING SPACE.
IF LS_VERSION-VERSION_NO = '1'.
MOVE '1' TO LV_VERSION .
ELSEIF LS_VERSION-VERSION_NO = ' '.
MOVE ' ' TO LV_VERSION.
ELSEIF LS_VERSION-VERSION_NO CA 'C*'.
MOVE LS_VERSION-VERSION_NO TO LV_VERSION.
ELSE. "IF LS_VERSION-VERSION_NO > '1'.
LV_VERSION = LS_VERSION-VERSION_NO - 1.
ENDIF.