10-01-2014 5:06 PM
Hi~everyone~
I have create a transparent table ZTSD001 with a Quality field KWMENG, which type KWMENG,like the field in vbap
KWMENG | KWMENG | QUAN | 15 | 3 | Order quantity |
then,DATA: LT_ZTSD001 TYPE STANDARD TABLE OF ZTSD001.
i created a table control to output LT_ZTSD001,and for edit
my question is, since field kwmeng is defined as decimals 3,
can i set the colmun in table control to output as decimals 2? and how ?
since the program is used for about half an year, there are some data sotred in the table
can i adjust the field "kwmneg" in table ztsd001 from decimals 3 to decimals 2?
thx~
10-06-2014 2:57 PM
10-06-2014 2:57 PM
10-07-2014 6:49 AM
Hi,
You may declare KWMENG type NETPR (currency) or
Alternatively declare as a packed number like kwmeng(13) type P decimals 2.
If you want only in the output then you may use Edit Mask.
10-07-2014 11:32 AM
Hi Timothy,
ABAP includes a powerful handling of fields type currency and quantity. When defining ZTSD001 in data dictionary you are asked for a reference field for KWMENG of type UNIT. Put the unit field in the table and fill it accordingly. Yes, most unit fields are defined for 3 decimals output.
Table T006 controls the default setting of the individual units of measure. The T006-DECAN field gives the number of decimal places displayed and T006-ANDEC gives the number of decimal places on which you want to round the output.
If you go with the standard (which is based on world-wide used ISO rules), you are prepared for any kind of changes.
Still, you can always control the number of decimals in output in ALV field catalog or in a WRITE statement.
Regards
Clemens
10-07-2014 4:09 PM
thx~
at April 2014, i developed the program for our oversea company to create so, which is much more efficient than va01. and then nobody mentioned about decimal points, so i defined the Quality field like standard so Quality field.
but now we have a new Company in our system,and the user asked to only two decimals
10-07-2014 4:17 PM
thx~Clemens
i developed the program using screen, not alv
and i also konw there is a attribute "ref. field"
but i cannot used to control decimal points
10-07-2014 4:19 PM
Hi Timothy,
you still did not mention how you create the output.
I think I would add a parameter 'decimals' DEFAULT 3 to the selection screen. Then, depending on your specific output technique, set the number of decimals for the respective output fields.
BTW: I guess it is a quANTITY not quALITY field.
Regards
Clemens
10-07-2014 5:00 PM
Hi,
I just tried and it works fine
DATA:
kwmeng TYPE vbap-kwmeng VALUE '12.345',
netpr TYPE vbap-netpr VALUE '12.345'.
WRITE:
/ kwmeng,
/ kwmeng unit 'KG',
/ kwmeng DECIMALS 2,
/ netpr,
/ netpr unit 'KG',
/ netpr DECIMALS 2.
Result is:
12,345
12,345
12,35 <===========
12,35
12,35
12,35
Where's the problem?
Regards
Clemens