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: 

displaying amounts in ALV grid

Former Member
0 Kudos

hi,

iam fetching ESBTR from FEBKO which i have to display using ALV grid.

but the problem is when there is no value in that field it should display zeros 0.00

but it is displaying space.

can somebody help me in this.

neha

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try giving the currency field along in the field catalog .. and that will solve your problem

Assign reward points if it helps.

-Gaurang

4 REPLIES 4

Former Member
0 Kudos

Hi,

Try giving the currency field along in the field catalog .. and that will solve your problem

Assign reward points if it helps.

-Gaurang

Former Member
0 Kudos

check field catalog

<b>fcat-no_zero = ' '.</b> then it will display.

to display space u have to call this is

<b>fcat-no_zero = 'X'.</b>

  • Bank Account Balance

CLEAR afield.

afield-fieldname = 'ESBTR'.

afield-no_zero = ' '.

afield-reptext_ddic = 'Bank Statement Balance'.

afield-just = 'L'.

<b>here u have to pass DATATYPE = CURR , bcos whe u pass ref table , it will take properties of that ref.table field.</b>Regards

Prabhu

0 Kudos

hi,

I tried using no_zero property also .Iam sending the sample code . please check it.

&----


*& Report ZTEST17 *

*& *

&----


*& *

*& *

&----


REPORT ZTEST17 .

type-pools: slis.

types: begin of x_tab1,

bukrs type bukrs,

hbkid type hbkid,

hktid type hktid,

bankn type bankn,

waers type waers,

hkont type hkont,

ESBTR type ESBTR_EB,

AZDAT type AZDAT_EB,

end of x_tab1,

begin of x_tab2,

KUKEY type KUKEY_EB,

ESBTR type ESBTR_EB,

AZDAT type AZDAT_EB,

waers type waers,

end of x_tab2.

data: t_tab1 type standard table of x_tab1,

w_tab1 type x_tAb1,

t_tab2 type standard table of x_tab2,

w_tab2 type x_tab2.

data: g_bukrs type bukrs,

g_hbkid type hbkid,

g_hktid type hktid,

g_kukey type KUKEY_EB.

DATA: afield TYPE slis_fieldcat_alv,

t_fieldcat TYPE slis_t_fieldcat_alv.

data: l_tabix type sy-tabix.

select-options: s_bukrs for g_bukrs,

s_hbkid for g_hbkid,

s_hktid for g_hktid,

s_kukey for g_kukey.

SELECT bukrs hbkid hktid bankn waers hkont

INTO CORRESPONDING FIELDS OF TABLe t_tab1

FROM t012k

WHERE bukrs IN s_bukrs

AND hbkid IN s_hbkid

AND hktid IN s_hktid.

LOOP AT T_TAB1 into w_tab1.

l_tabix = sy-tabix.

SELECT kukey esbtr azdat waers

INTO TABLE t_tab2

FROM febko

WHERE anwnd = '0001'

AND hkont = w_tab1-hkont

AND bukrs = w_tab1-bukrs

AND kukey IN s_kukey.

SORT t_tab2 BY kukey DESCENDING.

READ TABLE t_tab2 into w_tab2 INDEX 1.

if sy-subrc eq 0.

move w_tab2-esbtr TO w_tab1-esbtr .

modify t_tab1 from w_tab1 index l_tabix.

endif.

endloop.

CLEAR afield.

afield-fieldname = 'BUKRS'.

afield-ref_tabname = 'BSEG'.

afield-ref_fieldname = 'BUKRS'.

afield-col_pos = '1'.

APPEND afield TO t_fieldcat.

  • House Bank Account

CLEAR afield.

afield-fieldname = 'HBKID'.

afield-ref_tabname = 'T012K'.

afield-ref_fieldname = 'HBKID'.

afield-col_pos = '2'.

APPEND afield TO t_fieldcat.

  • House Bank Account ID

CLEAR afield.

afield-fieldname = 'HKTID'.

afield-ref_tabname = 'T012K'.

afield-ref_fieldname = 'HKTID'.

afield-col_pos = '3'.

APPEND afield TO t_fieldcat.

  • Bank Name

CLEAR afield.

afield-fieldname = 'BANKN'.

afield-ref_tabname = 'BNKA'.

afield-ref_fieldname = 'BANKN'.

afield-col_pos = '4'.

APPEND afield TO t_fieldcat.

  • Currency

CLEAR afield.

afield-fieldname = 'WAERS'.

afield-ref_tabname = 'TCURC'.

afield-ref_fieldname = 'WAERS'.

afield-col_pos = '5'.

APPEND afield TO t_fieldcat.

  • G/L Account

CLEAR afield.

afield-fieldname = 'HKONT'.

afield-ref_tabname = 'T012K'.

afield-ref_fieldname = 'HKONT'.

afield-col_pos = '6'.

APPEND afield TO t_fieldcat.

  • Bank Account Balance

CLEAR afield.

afield-fieldname = 'ESBTR'.

afield-no_zero = ' '.

afield-reptext_ddic = 'Bank Statement Balance'.

afield-just = 'L'.

afield-cfieldname = 'KRW'.

afield-ref_fieldname = 'ESBTR'.

afield-ref_tabname = 'FEBKO'.

afield-col_pos = '7'.

APPEND afield TO t_fieldcat.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = sy-repid

IT_FIELDCAT = t_fieldcat

TABLES

t_outtab = t_tab1[]

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Former Member
0 Kudos

give the datatype as CURR in fieldcatalog

wa_fieldcatalog-datatype = 'CURR'.