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

Data type conversion

rnb86
Participant
0 Likes
502

Hi Experts,

i have a question on data type conversion. My requirement is:

i have fields of type packed decimal in my internal table itab. I need to convert the values of packed decimal fields in itab to numeric type.

Example:

Data: begin of itab occurs 0,

ebeln like ekko-ebeln,

ebelp like ekpo-ebelp,

menge(15) type p decimals 2,

netpr(15) type p decimals 2,

end of itab.

if itab-menge has a value of 2.00, i need to convert that value to ' 200'. Right justified.

if itab-netpr has a value of 1,234.56, i need to convert that to ' 123456'.

The above internal table itab is passed to the Function module GUI_DOWNLOAD and the itab data is downloaded to a text file.

Please let me know how to acheive this objective.

2 REPLIES 2
Read only

rnb86
Participant
0 Likes
440

done.

Read only

Former Member
0 Likes
440

Hi,

You can use the following code:

DATA: MENGE(15) TYPE P DECIMALS 2,

V_NO(17) TYPE C.

MOVE MENGE TO V_NO.

CONDENSE V_NO.

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

CONDENSE V_NO NO-GAPS.

This will solve your problem.

Regards,

Mehreen