Application Development 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: 

i want to know

Former Member
0 Kudos

tel about 'WRITE TO' statement. where it is used.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

The statement WRITE TO has the same effect as the statement WRITE for lists.

<u>Syntax:</u>

WRITE {source|(source_name)} TO destination

Here is the Example for WRITE TO Statement.

DATA: date_short(8) TYPE c,

date_long(10) TYPE c,

date_mask(8) TYPE c.

WRITE sy-datum TO: date_short,

date_long,

date_mask DD/MM/YY.

Regards,

Padmam.

2 REPLIES 2

Former Member
0 Kudos

Hi,

The statement WRITE TO has the same effect as the statement WRITE for lists.

<u>Syntax:</u>

WRITE {source|(source_name)} TO destination

Here is the Example for WRITE TO Statement.

DATA: date_short(8) TYPE c,

date_long(10) TYPE c,

date_mask(8) TYPE c.

WRITE sy-datum TO: date_short,

date_long,

date_mask DD/MM/YY.

Regards,

Padmam.

Former Member
0 Kudos

hi Geetha,

The WRITE TO statement always checks the settings in the user’s master record. These specify, for example, whether the decimal point appears as a period (.) or a comma (,). You can also use all of the formatting options available with the WRITE statement, apart from UNDER and NO-GAP.

DATA: NUMBER TYPE F VALUE '4.3',

TEXT(10),

FLOAT TYPE F,

PACK TYPE P DECIMALS 1.

WRITE NUMBER.

WRITE NUMBER TO TEXT EXPONENT 2.

WRITE / TEXT.

WRITE NUMBER TO FLOAT.

WRITE / FLOAT.

WRITE NUMBER TO PACK.

WRITE / PACK.

MOVE NUMBER TO PACK.

WRITE / PACK.

In this example, the syntax check would warn you that PACK and FLOAT should be character fields (types C, D, N, T, or X). The output list is as follows:

4.30000000000000E+00

0.043E+02

1.50454551753894E-153

20342<33452;30,3

4.3

The first line contains the contents of the field NUMBER in the standard output format for type F fields. The second line contains the string resulting from the conversion of the field NUMBER to a type C field with length 10 and the formatting option EXPONENT 2. The third and fourth output lines show that it is not feasible to use target fields which are of numeric data type. The fifth line illustrates that the MOVE statement works differently to WRITE TO. The type F field has been correctly converted to type P.

Regards

Siva

<b>reward useful points</b>