2007 Mar 16 10:25 AM
Hello!
For this write command I get the following error message.
What has to be done ?
WRITE: /50 s_vmeng-sign, s_vmeng-option, s_vmeng-low.
Use addition UNIT when outputting S_VMENG-LOW
Use auxiliary field when outputting with MESSAGE
Regards
Ilhan
2007 Mar 16 10:31 AM
Hi,
For all the Qty and Currency fields you have to add a UNIT field(MEINS) for QTY and Currency field (WAERS) for Amount fields.
WRITE: /50 s_vmeng-sign, s_vmeng-option, s_vmeng-low unit ekpo-meins.
Regards,
Anji
2007 Mar 16 10:29 AM
data : s_vmeng-sign type i value 99, s_vmeng-option type i value 99,
s_vmeng-low type i value 99.
WRITE: /50 s_vmeng-sign, s_vmeng-option, s_vmeng-low.
this is properly working
more about write statement
WRITE
Syntax
WRITE [AT] [/][pos][(len||*)] dobj
[int_format_options]
[ext_format_options]
[list_elements]
[QUICKINFO info].
Extras:
1. ... [AT] [/][pos][(len||*)]
2. ... QUICKINFO info
Effect
This statement writes the content of the data object dobj to the current page of the current list in the list buffer. All flat data types and the data type string are allowed for dobj; flat structures are treated as a data object of type c. The data object dobj can be specified by a field symbol or a dereferenced data reference (for release 6.10 and later). The format of the output is predefined ( see predefined output formats), but can be modified with the additions AT and int_format_options. The output that has been formatted in this way, can be formatted further with ext_format_options, and list_elements allows specific list elements to be displayed.
The output position is either determined by the list cursor , or specified with pos after AT. At the start of every output, the output position in the list buffer is the same as that in the list representation. In Unicode systems, the positions of individual characters within an output field can differ between the list representation and the list buffer. In both cases, though, the output length is the same.
The output length is determined through the data type of dobj or can be specified with len||* after AT. len specifies an absolute length , whereas * or ** ensure that characters in Unicode systems are not truncated by mistake.
If the last line of the current page is reached and a subsequent line is output, a new page is generated. The maximum number of lines is determined with the addition LINE-COUNT of the introductory statement or the statement NEW-PAGE. For the basics list, the END-OF-PAGE event is triggered when the area reserved for the page footer is reached, and a new page is subsequently generated.
After positioning of the list cursor with a previous output statement, if the output length is larger than the area available in the current line of the list buffer, the output goes to the next line. If this line is also not sufficient for a complete output, the output length is correspondingly shortened and the output is displayed in this line.
If the list cursor is positioned using the pos specification or a statement BACK, NEW-LINE, NEW-PAGE, POSITION or SKIP and not with a previous output statement, then the output is always displayed in the current line, and the output length is shortened, if necessary.
After the output is displayed, the list cursor is positioned by default in the second position after the output; the sy-colno and sy-linno system fields are set correspondingly.
If the data object dobj is declared with reference to a data type from the ABAP Dictionary, the field and input help defined there are available in th elist displayed on the screen.
Note
In the default setting, the system does not place a new line in a list that contains only blank characters. Such a line is displayed only if the list cursor is directly positioned in an existing line, i.e. , not via a line break. You can change this setting with the statement SET BLANK LINES ON.
Addition 1
... [AT] [/][pos][(len||*)]
Effect
The output position and length for the current statement WRITE can be defined after AT. The output position of already existing outputs in the list buffer is overwritten with the output length of the new output. After overwriting an already existing output, the list cursor is placed at the next position, not two positions over.
The components of the position and length specification /,pos and len resp. * resp. ** must be listed with no spaces and in the specified sequence. If pos and len are not specified at all or are declared as numeric literals, the addition AT can be omitted.
With / , the output is displayed in the next line after the current line. If no position pos is specified, the output is written from the first column onward. The specification of / has no effect immediatel after positioning the list cursor in a list line (that is not the result of a previous output statement). This is the case during initial writing to a list page, and after explicit positioning with the statements SKIP, NEW-LINE, NEW-PAGE and BACK.
The output position is determined by pos. pos is expected to be a data object of the type i, which contains a value within the list width. No output is displayed if the value in pos is less than 1 or greater than the current list width.
The output length is determined by specifying len, * or ** in brackets. Using len, an absolute value can be specified. len is expected to be a data object of type i, which contains a value within the current list width. No output is displayed if the content of len is less than or equal to 0. In Unicode systems, the number of characters displayed in the list can be different than the number of characters stored in the list buffer by specifying len. By specifying * or **, the output length depends on the data type of the data object dobj, as shown in the following table.
Data type * **
c Number of columns needed in the list to display the entire content; no final blank characters are taken into account. In Unicode systems, this length can be greater than the implicit length. Doubled data object length.
string implicit length Doubled number of characters contained therein.
n, x, xtring implicit length implicit length
d 10 10
t 8 8
i, f, p Necessary length to output current value, including thousands separator; value determined after evaluating possible additions CURRENCY, DECIMALS, NO-SIGN, ROUND or UNIT. Necessary length to output maximum possible vlaue, including thousands separator; value determined after evaluating possible additions CURRENCY, DECIMALS, NO-SIGN, ROUND or UNIT.
When a conversion routine is executed with reference to a data type in the ABAP Dictionary, when len is specified, it is carried out for the lengths specified thereein, and when * or ** are specified, it is carried out for the output lengths specified in the ABAP Dictionary. When specifying * or **, the output length is then determined according to the aforementioned rules from the result of the conversion routine. The specification of * or ** when using formatting templates (USING EDIT MASK, DD/MM/YYYY etc.) is described in the respective section.
Notes
The specification of the output length len after AT should always be preferred over the use of a length specification for data object dobj (partial field access). In contrast to partial field access, the specification of the output length is not restricted to byte- and character-type data objects. Furthermore, the assignment of the list output to the data object is lost during a partial field access, in that it can no longer be addressed in the list.
The specification of * or ** for the output length ensures that, independent of data type, all characters from dobj are presented, even when more columns are needed in the list than positions in the list buffer. With *, the minimum possible length is used, and with **, the maximum possible length is used.
When an output position is specified within an already existing output, you should ensure that the position always refers to the characters stored in the list buffer. If characters that require more than one column in the list are displayed in a Unicode system, the displayed output position can differ from the specified output position. In addition, the displayed content of a partially overwritten output can be shifted, depending on the characters that overwrote the output.
Example
This example outputs a text field text at different positions, with different output lengths.
DATA: text TYPE string VALUE '0123456789ABCDEF',
col TYPE i VALUE 25,
len TYPE i VALUE 5.
WRITE text.
WRITE /5(10) text.
WRITE AT col(len) text.
Addition 2
... QUICKINFO info
Effect
A Quickinfo is assigned to the output. If the mouse cursor is placed on the output area of dobj, the content of info appears in a coloured rectangle. For info, a character-type data object of the length 40 is expected.
The addition QUICKINFO has no effect on ready-for-input fields and line elements. If a list output is overwritten by another output, then no Quickinfo for the overwritten field appears beginning from the position at which the overwriting starts.
Example
Additional information to output of date and time.
WRITE: (10) sy-datum QUICKINFO 'Date of list creation',
(8) sy-uzeit QUICKINFO 'Time of list creation'.
WRITE - Output Length
When data is written with a WRITE statement, the output is stored in the list buffer and accessed from there for display when the list is called.
Each time a data object is output with a WRITE statement, an output length is defined, either implicitly or explicitly (if len is specified after the addition AT). The output length defines the following:
The number of positions (or memory spaces) available for characters in the list buffer
The number of columns (or cells) available in the actual list
Output Length in the List Buffer
If the output length is shorter than the length of the format specified for the data object or defined with int_format_options, the output is shortened as follows when it is written to the list buffer:
In data objects of the numeric data types i and p, the thousand separators are removed from left to right and the object is then cut off on the left. These objects are marked with an asterisk ("*") in the first position.
In data objects of the type f, the number of decimal places is reduced and the number is rounded accordingly. If the output length is too short for scientific notation, asterisks ("*") are displayed instead of the numbers.
All other data types are cut off on the right and not marked, although the separators are removed first in the data types d and t.
If the output length is greater than the length of a predefined or user-defined format, this output length is filled in the list buffer and output is arranged there according to the predefined or user-defined alignment. Space that is not required is filled with blanks.
Output Length in the List
When displaying or printing a list, the content stored in the list buffer is transferred to the list as follows:
In non-Unicode systems, each character requires the same amount of space in the list buffer as columns in the list. In single-byte systems, a character occupies one byte in the list buffer and one column in the list, while a character that occupies several bytes in the list buffer in multi-byte systems also occupies the same number of columns in the list. For this reason, all the characters stored in the list buffer are displayed in the list in non-Unicode systems.
In Unicode systems, each character usually occupies one position in the list buffer. However, a character can occupy more than one column in the list (this is particularly the case with East Asian characters). However, since the list only contains the same number of columns as there are positions in the list buffer, this means the list can only display fewer characters than are stored in the list buffer. The list output is shortened accordingly, and the page formatted according to the alignment specified, and assigned an indicator ( > or <). To display the entire content of a list, choose System → List → Unicode Display.
Class for Calculating Output Lengths
The methods of the system class CL_ABAP_LIST_UTILITIES can be used to calculate output lengths in the list buffer and in list display. The return values of these methods can be used to program a correct column alignment for ABAP lists, even if they contain characters that require more than one column.
Message was edited by:
sunil kumar
2007 Mar 16 10:29 AM
Hi...,
Check this code for example...
Syntax has to be like this..
i am not getting any error !!!
<b>tables vbap.
select-options s_smeng for vbap-smeng.
WRITE: /50 s_smeng-sign, s_smeng-option, s_smeng-low.</b>
While writing Quantity and Amount fields using WRITE u need to mention the currency field also..
like for example ..
<b><b>Write : s_vmeng_low unit <fieldname , which contains the unit value >, s_amount_low currency <field which contains Currency value >
</b>
This is EPC error i think , not the program error !! right !!</b>
regards,
sai ramesh
2007 Mar 16 10:29 AM
Hi,
the second message is related to other part of the code i think...
For the first, the message is a warning message??
you can use the addition
write s_vmeng-low unti 'UN'.
Could you put more code in the post?
Regards
2007 Mar 16 10:30 AM
you have to loop through s_vmeng
loop at s_vmeng.
WRITE: /50 s_vmeng-sign, s_vmeng-option, s_vmeng-low.
endloop.
2007 Mar 16 10:31 AM
Hi,
For all the Qty and Currency fields you have to add a UNIT field(MEINS) for QTY and Currency field (WAERS) for Amount fields.
WRITE: /50 s_vmeng-sign, s_vmeng-option, s_vmeng-low unit ekpo-meins.
Regards,
Anji
2007 Mar 16 10:33 AM
Hi Ilhan,
WRITE: /50 s_vmeng-sign, s_vmeng-option, s_vmeng-low unit 'LB'.
YOu should have the UNIT specified when you use write statement for Quantities or amounts, time etc:
example:
DATA HOUR TYPE P DECIMALS 3 VALUE '1.200'.
WRITE (6) HOUR UNIT 'STD'. "output: 1,2
HOUR = '1.230'.
WRITE (6) HOUR UNIT 'STD'. "output: 1,230
2007 Mar 16 10:37 AM
Ilhan,
Might be u r getting warning.
while you write any currency and Qty type of fields, its good programming approch to use references.
Regards,
Sujatha.