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

Concatenate

former_member251546
Participant
0 Likes
1,919

Hi,

Good day day.

Ive got a problem with concatenate..

in the billing the discount looks like 21.000- %.

In my programme level,iam pullling the discount value from standard stracture one which is ls_bill_invoice-it_kond. ive got the 210.00% from standard stracture.

Instead of 21%..now my result shows like 210 %. Plz can any one check where i am wrong


Loop at gs_it_kond into gs_kond where kschl = 'RA00'.
IF gs_kond-kbetr < 0.
  gs_kond-kbetr = gs_kond-kbetr  * -1.
ENDIF.
  gv_perc = gs_kond-kbetr.
endloop.
 WRITE gv_perc TO gv_disc LEFT-JUSTIFIED.
 concatenate gv_disc '%' into gv_disc separated by space.

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,850

hi,

take gv_disc as character type and take first two digits by offset i e +0(2) and then u can con catenate it as discount will probably be of two digit so this will hold good for all.

Thanks,

Gaurav.

Hi,

Good day day.

Ive got a problem with concatenate..

in the billing the discount looks like 21.000- %.

In my programme level,iam pullling the discount value from standard stracture one which is ls_bill_invoice-it_kond. ive got the 210.00% from standard stracture.

Instead of 21%..now my result shows like 210 %. Plz can any one check where i am wrong


Loop at gs_it_kond into gs_kond where kschl = 'RA00'.
IF gs_kond-kbetr < 0.
  gs_kond-kbetr = gs_kond-kbetr  * -1.
ENDIF.
  gv_perc = gs_kond-kbetr.
endloop.
 WRITE gv_perc TO gv_disc LEFT-JUSTIFIED.
 concatenate gv_disc '%' into gv_disc separated by space.

Regards

15 REPLIES 15
Read only

Former Member
0 Likes
1,851

hi,

take gv_disc as character type and take first two digits by offset i e +0(2) and then u can con catenate it as discount will probably be of two digit so this will hold good for all.

Thanks,

Gaurav.

Read only

0 Likes
1,850

DATA: gs_kond like line of gs_it_kond,

gv_kbetr like konv-kbetr,

gv_disc type char10,

gv_perc TYPE i.

Ive declared the gv_disc type cha10.

Regards

Read only

0 Likes
1,850

hi,

ok fine then in concatenate in palce of gv_disc jst write gv_disc+0(2) this will only take 21 rest will not be displayed.

Thanks.

Gaurav.

Read only

0 Likes
1,850

Hi,

sorry..in future, if the value is like 10.50% then

Regards

Read only

0 Likes
1,850

Sir@ That's what i'm saying change the data decleration.Whats the error?

Edited by: Mishra.Manas on Apr 20, 2010 9:58 AM

Read only

0 Likes
1,850

Hi balaji,

Thats nice question i have the same doubt, what happens if 20.5 %

so here offset will not work, you have to findout the ways specified above.

Regards and Best wishes.

Read only

0 Likes
1,850

sorry..

If declare the gv_disc type p decimals 2. then

ive got the error..gv_disc must be chartecter-type field(data type c,n,d or t)

thank you

Read only

Former Member
0 Likes
1,850

Hi,

KBETR is of type CURR with 2 decimals. define a variable with 3 decimals and use it.

Regards,

Srini.

Read only

Former Member
0 Likes
1,850

hI,

Declare gv_perc as type of gs_kond-kbetr.

And remove left-justified and try i think it will work.

Regards and Best wishes.

Read only

Former Member
0 Likes
1,850

Declare gv_disc of 2 decimals.

Change the decleration of

gv_kbetr like konv-kbetr,
                                          gv_disc type char10,
                                          gv_perc TYPE i

as per your requirement.

The issue lies in data decleration.

 data: gv_disc type p length <n> decimals 2

Edited by: Mishra.Manas on Apr 20, 2010 8:58 AM

Read only

0 Likes
1,850

Thank you for reply.

If i take gv_disc type p. then sys gives error.

Regards

Read only

0 Likes
1,850

What is the error you are facing?

Read only

former_member632458
Participant
0 Likes
1,850

Hi ,

data : L_KWERT type KWERT.

Loop at gs_it_kond into gs_kond where kschl = 'RA00'.

IF gs_kond-kbetr < 0.

gs_kond-kbetr = gs_kond-kbetr * -1.

l_KWERT = gs_kond-kbetr / 10 .

clear l_kwert.

ENDIF.

gv_perc = gs_kond-kbetr.

endloop.

WRITE gv_perc TO gv_disc LEFT-JUSTIFIED.

concatenate gv_disc '%' into gv_disc separated by space.

Regards.

Rajesh

Read only

Former Member
0 Likes
1,850

hi,

nice point then do one thing seperate the value after piont in another variable and then concatenate it seperately with gv_disc. once u got xact value then concatenate it again with all other things by checking if fter point variable i intial then +0(2)

else +0(4) . here u have to concatenate 3 times thats it.

try it.

Thanks Gaurav.

Read only

0 Likes
1,850

hi,

Ive solved the problem. As Mr.Rajesh S told

lv_kwert = gv_kond-kbetr / 10.

gives the solution.

Thank you very much for every one..