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

character to quantity type

Former Member
0 Likes
1,313

Hi All,

I had a requirement to move character to Quantity type field.can any body help me how to move character type field to Quantity type field of length 13, decimal 3 ?

Thanks & Regards,

Anil.

Hi All,

I had a requirement to move character to Quantity type field.can any body help me how to move character type field to Quantity type field of length 13, decimal 3 ?

Thanks & Regards,

Anil.

7 REPLIES 7
Read only

Former Member
0 Likes
1,128

Hello,

In the domain of a particular field, check the 'output length' ( Definition tab )value. hope this helps.

Best regards, Murugesh AS

Read only

former_member628175
Active Participant
0 Likes
1,128

Hi Anil ,

I think 'WRITE' statement will do the job .

e.g . write <char> to <quant> .

Hope this helps .

Regards ,

Shounak M

Read only

naimesh_patel
Active Contributor
0 Likes
1,128

Hello,

Conversion of Char (type c) to Qty (type p) is not possible. If you try to move it, it will give an error like: unbale_to_interpret_as_number.

Regards,

Naimesh

Read only

Former Member
0 Likes
1,128

Hei Anil,

do extacly what you said:

move C to Q

Don't use WRITE if the destination is a P.

If C contains not only numbers a dump occurs for sure.

Read only

Former Member
0 Likes
1,128

Try and use the pack command...

PACK l_char to l_qty.

Regards

Anurag

Read only

Former Member
0 Likes
1,128

Hi,

if you want to convert the character to amount then you can use the FM <b>HRCM_STRING_TO_AMOUNT_CONVERT</b>

regards

vijay

Read only

Former Member
0 Likes
1,128

in this case, WRITE TO will not work, as you are sending CHAR value to a numeric field.

here is the logic i followed to overcome the (user settings of comma(,) and DOT(.))

DATA : V_WEIGHT TYPE LTAP-BRGEW,

V_WT_CHAR(21) TYPE C.

assume you have weight value in a CHAR field.

v_WT_CHAR = '21,987.258'.

here your requirement is to push this value to a weight field.for that follow this,

REPLACE ALL OCCURRENCES OF ',' IN V_WT_CHAR WITH ''.

REPLACE ALL OCCURRENCES OF '.' IN V_WT_CHAR WITH ''.

CONDENSE V_WT_CHAR.

MOVE V_WT_CHAR TO V_WEIGHT.

V_WEIGHT = V_WEIGHT / 1000.

now your V_WEIGHT will have value '21987.258' (as it stores in INTERNAL format)

Check this& let me know,is this working for you ?

Regards

Srikanth