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: 

problem with quantity field in an alv while displaying

Former Member
0 Kudos

Hi eveyone,

I have one problem with quantity field in my ALV grid. I have ERFMG & Unit of measure fields in my ALV grid. ERFMG is of type QUAN 13 data type. My problem is while displaying ALV grid, if UOM is Meters, i have to display quantity in 3 decimal places and is UOM is in EA or PCS i have to display quantity field as Integer i.e without any decimal places.

Is there any FM to convert this?

Can anyone help me.

4 REPLIES 4

Former Member
0 Kudos

Hi,

Make the quantity field in the ALV output as character field. Depending on the UOM move it to the respective local variables and move it back to the final character field.

Regards,

Ram

Venkat_Sesha
Employee
Employee
0 Kudos

Hey You can check this out.

OIB_QCI_CONVERSION_SIMPLE

Note: If you are using ecc5.0 then this will not....

Regards,

Bhargav

Former Member
0 Kudos

The quantity field and the Unit have to be linked properly in the fieldcatalog for the ALV to display the quantity field value properly. Refer below...


* Quantity field - QUAN
Clear K_Fieldcat.
Add 1 to V_Pos.
K_Fieldcat-col_pos	= V_Pos.
K_Fieldcat-fieldname	= 'LFIMG'.
K_Fieldcat-qfieldname	= 'VRKME'.         " Quantity field
K_Fieldcat-quantity	= 'X'.
K_Fieldcat-qtabname	= 'I_RECORDS'.
K_Fieldcat-seltext_m	= 'Dlv. qty.'.
K_Fieldcat-ddictxt	= 'M'.
K_Fieldcat-outputlen	= 17.
Append K_Fieldcat to I_Fieldcat.

* Unit key for QUAN field - UNIT
Clear K_Fieldcat.
Add 1 to V_Pos.
K_Fieldcat-col_pos	= V_Pos.
K_Fieldcat-fieldname	= 'VRKME'.
K_Fieldcat-tabname	= 'I_RECORDS'.
K_Fieldcat-reptext_ddic = 'SU'.
K_Fieldcat-outputlen	= 3.
Append K_Fieldcat to I_Fieldcat.
Add 1 to V_Pos.

Former Member
0 Kudos

HELLOW,

i am using alv grid to display MM data , in query i m doing sum for qnty (LMNGA), i need to display that sum in other couimn , i tried but it display only 0.00 , my query and code is below, i relly thanks ful for help .

SELECT A~ARBID

A~BUDAT

A~WERKS

SUM( A~LMNGA ) -- I m displaying this field in alv grid

A~AUFNR

B~KDAUF

B~KDPOS

C~VBELN

C~KUNNR

D~NAME1

E~MATNR

F~KDKG1

INTO CORRESPONDING FIELDS OF TABLE i_alv

FROM AFRU AS A INNER JOIN AUFK AS B ON AAUFNR EQ BAUFNR

INNER JOIN VBAK AS C ON BKDAUF = CVBELN

INNER JOIN KNA1 AS D ON CKUNNR = DKUNNR

INNER JOIN VBAP AS E ON BKDAUF = EVBELN

INNER JOIN VBKD AS F ON BKDAUF = FVBELN

WHERE AARBID = '10000181' AND ABUDAT BETWEEN PONO AND jobno

GROUP BY AARBID ABUDAT AWERKS AAUFNR BKDAUF FKDKG1 EMATNR DNAME1 CKUNNR CVBELN B~KDPOS

ORDER BY B~KDPOS

displaying the alv grid

FORM get_fieldcatalog.

DATA: ls_fcat TYPE lvc_s_fcat.

REFRESH: fieldcat. CLEAR: ls_fcat.

ls_fcat-reptext = 'ObjectID'.

ls_fcat-fieldname = 'ARBID'.

ls_fcat-ref_table = 'I_ALV'.

ls_fcat-NO_OUT = 'X'.

ls_fcat-outputlen = '18'.

ls_fcat-fix_column = 'X'.

ls_fcat-key = 'X'.

ls_fcat-col_pos = '1'.

REFRESH: fieldcat. CLEAR: ls_fcat.

ls_fcat-reptext = 'ProductionOrderNo'.

ls_fcat-fieldname = 'AUFNR'.

ls_fcat-ref_table = 'I_ALV'.

ls_fcat-outputlen = '15'.

ls_fcat-col_pos = '2'.

APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.

ls_fcat-reptext = 'SalesOrder'.

ls_fcat-fieldname = 'KDAUF'.

ls_fcat-ref_table = 'I_ALV'.

ls_fcat-outputlen = '10'.

ls_fcat-col_pos = '3'.

APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.

ls_fcat-reptext = 'CustomerName'.

ls_fcat-fieldname = 'NAME1'.

ls_fcat-ref_table = 'I_ALV'.

ls_fcat-outputlen = '25'.

ls_fcat-col_pos = '4'.

APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.

ls_fcat-reptext = 'MaterialCode'.

ls_fcat-fieldname = 'MATNR'.

ls_fcat-ref_table = 'I_ALV'.

ls_fcat-outputlen = '25'.

ls_fcat-col_pos = '5'.

APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.

ls_fcat-reptext = 'KVA'.

ls_fcat-fieldname = 'KDKG1'.

ls_fcat-ref_table = 'I_ALV'.

ls_fcat-outputlen = '08'.

ls_fcat-col_pos = '6'.

APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.

ls_fcat-reptext = 'Qnty'.

ls_fcat-fieldname = 'LMNGA'. this is the field which shows 0.00

ls_fcat-ref_table = 'I_ALV'.

ls_fcat-outputlen = '08'.

ls_fcat-col_pos = '7'.

ls_fcat-DO_SUM = 'X'.

APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.

ls_fcat-reptext = 'PostingDate'.

ls_fcat-fieldname = 'BUDAT'.

ls_fcat-ref_table = 'I_ALV'.

ls_fcat-outputlen = '10'.

ls_fcat-fix_column = 'X'.

ls_fcat-key = 'X'.

ls_fcat-col_pos = '8'.

ls_FCAT-DATATYPE = 'DATS'.

ls_FCAT-INTTYPE = 'D'.

ls_FCAT-INTLEN = '000008'.

ls_FCAT-DD_OUTLEN = '000010'.

APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.

ENDFORM.