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: 

how to add a -ve sign into a quantyty field

Former Member
0 Kudos

Hi,

I have a requirement where i need to loop the internal table with a condition if the condition becomes true then a particula field of that row should be added with a -ve sign,and modify that row.

The field is of type quantity.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

when condition is satisfied

multiply with -1.

i.e.,

itab-field1 = itab-field1 * -1.

modify itab.

Rgds.,

subash

13 REPLIES 13

Former Member
0 Kudos

Hi

Take that sign into a variable var1 and the field var2.

Use concatenate statement..CONCATENATE VAR1 VAR2 INTO VAR3.(another variable.)

Regards,

Vishwa.

Former Member
0 Kudos

hi,

when condition is satisfied

multiply with -1.

i.e.,

itab-field1 = itab-field1 * -1.

modify itab.

Rgds.,

subash

GauthamV
Active Contributor
0 Kudos

hi,

check this.


if it_bsis-shkzg = it_bseg-shkzg.

 if it_bseg-shkzg = 'H'.
 it_bsis-wrbtr = it_bsis-wrbtr * -1 .
 it_bsis-dmbtr = it_bsis-dmbtr * -1 .
 IT_FINAL-wrbtr = IT_bsis-wrbtr.
 IT_FINAL-dmbtr = IT_bsis-dmbtr.

 else.

it_bsis-wrbtr = it_bsis-wrbtr .
 it_bsis-dmbtr = it_bsis-dmbtr .
 IT_FINAL-wrbtr = IT_bsis-wrbtr.
 IT_FINAL-dmbtr = IT_bsis-dmbtr.
endif.
endif.

 it_final-waers1 = 'INR'.
 APPEND IT_FINAL.
 CLEAR IT_FINAL.

Former Member
0 Kudos

Hi Anjali,

Try this way :

Loop at itab into wa.

    if <condition>

         wa-qty = wa-qty * (-1).

         modify itab from wa.

    else.

          <do something>

    endif.

endloop.

Regards,

Swapna.

0 Kudos

the -ve sign is coming at the end not in the begining

0 Kudos

Did you check all replies?

check Sniper's reply.

CLOI_PUT_SIGN_IN_FRONT

0 Kudos

Hi,

we can use below FM

CLOI_PUT_SIGN_IN_FRONT

Regards,

Suresh

0 Kudos

thank you allllll

i got it.

0 Kudos

Than could you do a small task by Closing the thread now?

former_member195383
Active Contributor
0 Kudos

loop at itab.

if <reqd. condition>

itab-quantity = -1*itab-quantity.

modify itab transporting quantity.

endif.

former_member598013
Active Contributor
0 Kudos

Hi Anjali,

For this type of issue what you need to do is first change the variable type to CHAR(10) and check if Value is negative. Then assign the value with the negative sign in the variable and then modify the table.

Thanks,

Chidanand

Former Member
0 Kudos

I suppose u mean to say the sign should be in front ..

-131.23

and now u might have a case where the o/p is 131.23- when u are dealing with q fields.

To get the sign in front use the FM CLOI_PUT_SIGN_IN_FRONT but here the data type has to be char to handle the sign part.

Vijay.

Former Member
0 Kudos

hi,

to add -ve sign to quantity field,multiply that field with -1.

like:

data int1 type i.

int1 = '500'.

int1 = int1 * -1.

now int1 will be -500.