2008 Jun 04 12:43 PM
Hi,
i do append from tables (itab1) with fields with type dec or num to
table (itab2) that all fields their are type char,
i get in itab 2 some fields are alignment to left and some is to right , how can i avoid that?
Regards
2008 Jun 04 12:47 PM
Don't use move or equal when moving the fields. Use
WRITE itab1-field TO itab2-field RIGHT-JUSTIFIED.
2008 Jun 04 12:47 PM
Don't use move or equal when moving the fields. Use
WRITE itab1-field TO itab2-field RIGHT-JUSTIFIED.
2008 Jun 04 12:53 PM
Hi Paul,
Thanks for replay.
with write statement i use append to?
Regards
2008 Jun 04 1:01 PM
Cosmo
Use the WRITE to move the data from one to the other, you will still need to APPEND the record after you do all the WRITEs.
Edited by: Paul Chapman on Jun 4, 2008 8:02 AM
2008 Jun 04 12:51 PM
HI.
WRITE - TO
Syntax
WRITE {source|(source_name)} TO destination
[int_format_options].
Effect:
This statement assigns the formatted content of the data object source, or the formatted content of the data object whose name is contained in source_name, to the data object destination. The data objects source_name and destination must be character type and flat. source_name can contain the name of the data object to be assigned in upper or lower case. If the data object specified in source_name does not exist, the assignment is not executed, and sy-subrc is set to 4.
The statement WRITE TO has the same effect as the statement WRITE for lists. This statement formats the content of source or the source field specified in source_name as described in the field. It does not, however, store the result in an output area of a list in the list buffer, but instead stores it in a variable. The output length is determined by the length of the variable.
The same additions int_format_options can be specified for formatting the content as in the statement WRITE for lists, except for NO-GAP and UNDER.
System fields
sy-subrc Meaning
0 The data object specified in source_name was found and the assignment was executed.
4 The data object specified in source_name was not found and the assignment was not executed.
For the static specification of source, sy-subrc is not set.
Note:
If destination is specified as an untyped field symbol or an untyped formal parameter, and is not flat and character-type when the statement is executed, this leads to an untreatable exception in a Unicode program. In non-Unicode programs, this only leads to an exception for deep types. Flat types are handled as character-type data types.
Example:
After the assignment, the variables date_short and date_long receive the current date in the order specified in the user master record. The variable date_long also contains the defined separators, as the output length is sufficiently long. The content of the variable date_mask is formatted according to the formatting addition DD/MM/YY.
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.
Reward all helpfull answers.
Regards.
Jay
2008 Jun 04 12:54 PM
Other option is, if your internal table is not too large, try the code below:
loop at itab1 into wa1.
move wa1-dec to wa2-char.
shift wa2-char left deleting leading space.
append wa2 to itab2.
clear: wa1, wa2.
endloop.
Hope this helps.
Cheers,
Sougata.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |