‎2009 Nov 11 6:11 AM
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.
‎2009 Nov 11 8:58 AM
‎2009 Nov 11 9:04 AM
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