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

write

Former Member
0 Likes
599

hi,

may i know why need to have unit here? can have example with data for the below?

thank you.

write lw_mlgn-lhmg1 to lv_pall+6(10)

unit lw_mseg-meins.

4 REPLIES 4
Read only

dev_parbutteea
Active Contributor
0 Likes
570

Hi,

Effect

This addition cuts off decimal places that have the value 0 and are outside the exactness of a unit of measure during output of data objects of data type p. For all other data types, except f, this addition is ignored. For unit, a three-digit, character-type field is expected that contains a unit key from the column MSEHI in the database table T006 in uppercase letters. The system determines the number of decimal places from the column DECAN in the corresponding row in the database table T006. If the content of unit is not found in T006, the addition is ignored.

If the data type of dobj is p and has at least as many decimal places as specified by unit, and if no positions are thus cut off that are not equal to 0, then dobj is output with this number of decimal places.

In the case of data objects of type f, the addition UNIT will be treated like the addition DECIMALS (see above). Here, the number of decimal places is determined by unit.

If the addition UNIT is used with the length specification * or ** after AT, it is used first, and the output length is determined from the result.

If the addition CURRENCY is used at the same time, this is used first for data type p and then the addition UNIT is used. In the case of data type f, the addition UNIT is ignored.

Example

If no decimal places are specified for the number "PC" in T006, the output of the WRITE statement is "1234".

DATA pack TYPE p DECIMALS 4 VALUE '1234.0000'.

WRITE pack NO-GROUPING UNIT 'PC'.

Read only

Former Member
0 Likes
570

hi,

meins is a unit field it will determine number of decimal places.So it will display unit of mseg.

Reward with points if helpful.

Message was edited by:

Vinutha YV

Read only

Former Member
0 Likes
570

Hi,

when the unit is assigned the write will display it correctly as the unit is defined in the dictionary (e.g. decimals).

Unit KG == 12,345

Unit cm == 12,35

Best regards

Frank

Read only

Former Member
0 Likes
570

Hi Eliana ,

The Unit extension is used along with the write statement , when we are tying to move a a value ( quantity ) to another varaible , so that the data is moved to the varaible in the format the quantity is expressed in the said unit.

in short it used to represent the quanitity in the unit meantioned in the unit extension.

Regards

Arun