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

issue with currency field

Former Member
0 Likes
2,230

Hi all,

IAM HAVING AN ISSUE WITH CURRENCY FIELD IN MODULE POOL.

My requirement is that i have a quantity column in table control.

The user enters value of 0 sometimes . But it should not be blank.

I have the column declared as MENGE_D -data element(length 13 and 3 decimals)

i have the following code in pai

FIELD ITAB-QUANT MODULE QUANT2.

MODULE QUANT2 INPUT.

if itab-quant is initial.

MESSAGE I999(00) WITH 'Enter the Qty'.

endif.

endmodule.

PROBLEM IS WHEN THE USER ENTER 0 STILL HE GETS THE MESSAGE.

THE USER SHOULD GET MESSAGE ONLY IF THE FIELD IS BLANK I MEAN NO VALUE .

I HAVE ITAB-QUANT IS 0.000 STILL IT GIVES A MESSAGE.

SO I TRIED THIS WAY,

data : testq(16) type p decimals 3.

testq = ITAB-qUANT.

BUT FOR SOME REASON THE LENGTH OF TESTQ IS QUITE BIGGER THAN THAT OF ITAB-QUANT.

SHOULD I DECLARE IT AS

data : testq(13) type p decimals 3.

bUt this will solve the problem .

let me know if anyone has an easier solution .

Thanks

Hi all,

IAM HAVING AN ISSUE WITH CURRENCY FIELD IN MODULE POOL.

My requirement is that i have a quantity column in table control.

The user enters value of 0 sometimes . But it should not be blank.

I have the column declared as MENGE_D -data element(length 13 and 3 decimals)

i have the following code in pai

FIELD ITAB-QUANT MODULE QUANT2.

MODULE QUANT2 INPUT.

if itab-quant is initial.

MESSAGE I999(00) WITH 'Enter the Qty'.

endif.

endmodule.

PROBLEM IS WHEN THE USER ENTER 0 STILL HE GETS THE MESSAGE.

THE USER SHOULD GET MESSAGE ONLY IF THE FIELD IS BLANK I MEAN NO VALUE .

I HAVE ITAB-QUANT IS 0.000 STILL IT GIVES A MESSAGE.

SO I TRIED THIS WAY,

data : testq(16) type p decimals 3.

testq = ITAB-qUANT.

BUT FOR SOME REASON THE LENGTH OF TESTQ IS QUITE BIGGER THAN THAT OF ITAB-QUANT.

SHOULD I DECLARE IT AS

data : testq(13) type p decimals 3.

bUt this will solve the problem .

let me know if anyone has an easier solution .

Thanks

10 REPLIES 10
Read only

Former Member
0 Likes
1,447

try this if it works..

if itab-quant is initial and
   itab-quant ne '0.000'.
MESSAGE I999(00) WITH 'Enter the Qty'.
endif.

Read only

0 Likes
1,447

Hi chandrasekhar,

The problem is when it display, its not displaying if the value is 0.000

LET ME KNOW

THANKS

Read only

0 Likes
1,447

It's right, because a P field it's null if it's 0.000.

Try set up the "Leading Zeroes" flag in SE51 - Screen Painter for your field.

I'm not sure it works, but you can simply try!

Read only

Former Member
0 Likes
1,447

can u make the screen field as a character type and pass the value to it .

cause when it is zero character will be space whereas netpr/quant will be 0.000

so then ur condition will be if netpr/quant = ' ' or intial will work if the screen field is of type character .

try this .

regards,

vijay

Message was edited by:

vijay k

Read only

Former Member
0 Likes
1,447

HI,

Try this one

<b>FIELD ITAB-QUANT MODULE QUANT2.

MODULE QUANT2 INPUT.

if itab-quant LE 0..

MESSAGE I999(00) WITH 'Enter the Qty'.

endif.</b>endmodule.

Regs

Manas Ranjan Panda

Read only

Former Member
0 Likes
1,447

Just try it out. If this works or not.

if itab-quant is space

MESSAGE I999(00) WITH 'Enter the Qty'.

endif.

Read only

0 Likes
1,447

Hi all,

i cannot change the table control because i am just changing the code that already in production.

I tried to declare

data : testq(13) type p decimals 3.

though my quant field is 13 lenth and 3 decimals , way too smaller than my testq.

whyis that.

its like 26 digits big when i check in debug.

Thanks

Read only

Former Member
0 Likes
1,447

hi preethi ,

just check this code .

data : quant like ekpo-menge,       " ur data type 
          v_quant(13) type c.                     " --->proposed 
          quant = 0.                                 " made initial.
          v_quant = quant.
 write:/ quant.                          

 if quant is initial.
 write:/ 'hi'.                            "gets triggered cause some value is there
 endif.

 if v_quant is initial.
 write:/ 'hi'.                           "even though value is there dosent get triggered
 endif.

"cause its character.

if u can make the screen field as character then u can have solution in my opinion .

just check if this alternate can help ur code ..

regards,

vijay.

Read only

0 Likes
1,447

Hi Vijay,

The problem is that sometimes i may have the value like 12.231.

so in that the char field doesnot hold the decimal value right.

AM I RIGHT.

THANKS

Read only

Former Member
0 Likes
1,447

no problem it will hold u can check the same in the code .

data: v_quant(13) type c,
      quant like ekpo-menge value '12.341'.
 v_quant = quant.
 write:/ v_quant.

regards,

vijay