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: 

Char issue

Former Member
0 Kudos
359

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...

1 ACCEPTED SOLUTION

Former Member
0 Kudos
332

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

5 REPLIES 5

Former Member
0 Kudos
330

Pl Exp clrearly.. send me the full code

0 Kudos
330

See Raj...code is around 1500 lines of code..i have pasted some lines...whole code is nothing to do with this block...

Former Member
0 Kudos
330

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.

Former Member
0 Kudos
333

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

0 Kudos
330

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.