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

Error regarding quantity unit

Former Member
0 Likes
1,827

Hi everyone.

I have the below statement in report program.WHEN I SYNTAX CHECK I DOESN'T SHOW ANY ERRORS

write:/ 'zorder : ', itab-zorder,

' with quantity ', itab-zQUAN.

BUT WHEN I DO THE EXTENDED SYNTAX CHECK AT SE10 OR SE09 I.E WHEN I DO THE EXTENDED CHECK TO THE TRANSPORT OF THAT REPORT I GET THE FOLLWING ERROR.

Use addition UNIT when outputting ITAB-ZQUAN

Use auxiliary field when outputting with MESSAGE

ZQUANT IS THE QUANTITY OF MATERIAL

PLEASE LET ME KNOW IF I NEED TO DO ANY THING TO OVERCOME THIS.

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,494

Hi

Even i use the unit the o/p dosn't show any thing

This is my write statement

write:/ 'zorder : ', itab-zorder,

' with quantity ', itab-zmenge UNIT itab-z340b-meins.

o/p

zorder : 5700002246 with quantity 90

let me know if iam wrong.

11 REPLIES 11
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,494

All it is saying, is that it might be a good idea to give the UOM along with the quantity.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,494

With quantity and currency value fields, you have to specify the unit when you are doing the WRITE for the system to get the correct number of decimal places to output. Without that, system will just use the default two decimals to output. If you are 200% sure that your values will always be of two decimal places, you don't have to worry about this, but if you are not sure, then you need a unit along with the quantity.

Read only

0 Likes
1,494

Thanks for your replies

Can you please tell me then how does my write looks like

This is my orginal write statement.

write:/ 'zorder : ', itab-zorder,

' with quantity ', itab-zQUAN.

Thanks in advance.

Read only

0 Likes
1,494

Taken from ABAP Help.....

<i>

<b>... UNIT unit</b>

This addition cannot be used together with the addition TIME ZONE.

<b>Effect</b>

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'.

</i>

REgards,

Rich Heilman

Read only

Former Member
0 Likes
1,494

Hi Suchi ,

can u tell which field ur ref.for the Qty Field.

regards

Rao

Read only

0 Likes
1,494

Hi Prabhu,

iam using a z field which is like menge.

please let me how would my write should look like

this is my orginal statment.

write:/ itab-zorder,

50 itab-zmenge.

waiting for ur replies

Thanks in advance

suchi

Read only

0 Likes
1,494

Suchitra,

Check Rich's reply.

Check in your Z-table, you must have UoM field associated with your menge field. Check in the tab 'Currency/Quantity Fields' in SE11. Select that field also and store in your internal table itab. And then do this:

WRITE: itab-menge UNIT itab-uom.

Where uom is the actual field name of the UoM field in Z-table.

Read only

Former Member
0 Likes
1,494

Hi suchitra,

write:/ 'zorder:',itab-zorder,

'with quantity :',itab-zquan UNIT c_un.

Here c_un is any dummy unit that you can use.

Cheers,

Bujji

Read only

Former Member
0 Likes
1,494

Hi

Even i use the unit the o/p dosn't show any thing

This is my write statement

write:/ 'zorder : ', itab-zorder,

' with quantity ', itab-zmenge UNIT itab-z340b-meins.

o/p

zorder : 5700002246 with quantity 90

let me know if iam wrong.

Thanks

Read only

Former Member
0 Likes
1,495

Hi

Even i use the unit the o/p dosn't show any thing

This is my write statement

write:/ 'zorder : ', itab-zorder,

' with quantity ', itab-zmenge UNIT itab-z340b-meins.

o/p

zorder : 5700002246 with quantity 90

let me know if iam wrong.

Read only

0 Likes
1,494

Suchitra,

Your o/p looks quite good. What's the problem?

Note that WRITE ..UNIT.. statement willl not output the UoM itself, it will just help output the quantity in a correct format and value.