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

Zeros displaying

Former Member
0 Likes
684

Hi

I want to hardcode value as "2" and i want to add those 2 and display in total .

in output its taking as 20.00 and its not adding ..

DATA: BEGIN OF I_FINAL OCCURS 0,

JES LIKE PC207-BETRG, "Employee share

JER TYPE I VALUE this value ..i want as 2..

WRITE: '2'.

v_jer = v_jer + wa_final-jer.

condense v_jer.

6 REPLIES 6
Read only

Former Member
0 Likes
661

Hi

Depends how you are defining v_jer. Have a variable of same type and default it to 2. Then do the addition.

Regards,

Raj

Read only

former_member404244
Active Contributor
0 Likes
661

Hi,

Declare the JER as type N instead of I.

TRY like below and chk.

DATA: BEGIN OF I_FINAL OCCURS 0,

JES LIKE PC207-BETRG, "Employee share

JER TYPE N VALUE this value ..i want as 2..

WRITE: '2'.

v_jer = v_jer + wa_final-jer.

condense v_jer.

regards,

nagaraj

Read only

Former Member
0 Likes
661

Hi still not working

Find my code

DATA: BEGIN OF I_FINAL OCCURS 0,

PERNR LIKE PA0001-PERNR, "Personnel number

ENAME LIKE T500P-NAME1, "Name of employee

GESCH LIKE PA0002-GESCH, "Gender

JES LIKE PC207-BETRG, "Employee share

JER TYPE N value '2',

END OF I_FINAL

DATA: V_JER type N.

LOOP AT i_final INTO wa_final.

WRITE /80 '2' .

ENDLOOP.

v_jer = v_jer + wa_final-jer.

condense v_jer.

AT LAST.

WRITE:/80 v_jer.

ENDAT.

Read only

0 Likes
661

Try the below code

Please note the change you need to get the last piece of code before ENDLOOP.

DATA: BEGIN OF I_FINAL OCCURS 0,

PERNR LIKE PA0001-PERNR, "Personnel number

ENAME LIKE T500P-NAME1, "Name of employee

GESCH LIKE PA0002-GESCH, "Gender

JES LIKE PC207-BETRG, "Employee share

JER TYPE N value '2',

END OF I_FINAL

DATA: V_JER type N.

LOOP AT i_final INTO wa_final.

WRITE /80 '2' .

v_jer = v_jer + wa_final-jer.

condense v_jer.

AT LAST.

WRITE:/80 v_jer.

ENDAT.

ENDLOOP.

<b>From your code it does not seem to be the case...try the above and check the result.</b>

Message was edited by: Anurag Bankley

Read only

former_member404244
Active Contributor
0 Likes
661

Hi RK,

Why are u adding outside the loop.do it inside the loop and chk it.

loop at it_final into wa_final.

v_jer = v_jer + wa_final-jer.

condense v_jer.

endloop.

do one thing remove the JER field from the internal table it_final.

delare a constant.

constants : c_jer type n value '2'.

Now loop ..

loop at it_final into wa_final.

v_jer = v_jer + c_jer.

endloop.

try like this...

regards,

Nagaraj

Message was edited by: nagaraj kumar nishtala

Read only

0 Likes
661

Hi

Nagaraj,

Iam adding inside the loop only..

Iam displaying outside the loop.