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

Fieldcatalog error

rnb86
Participant
0 Likes
1,402

Hi Experts,

i have a issue in the fieldcatalog of my ALV report. I have few packed decimal fields in my internal table for field1.

data: begin of itab occurs 0,

f1 type p decimals 2,

f2 type p decimals 2,

f3 type p decimals 2,

f4 type p decimals 2,

f5 type i,

....

end of itab.

the report was in ALV list. we converted that into ALV grid.

After converting the report to ALV grid, the packed decimal fields [f1 to f4], if they have zeroes, they are shown as blank. Zeroes are not appearing on the report. In debug mode, i checked, and the itab has all the values. But when i execute, the zeroes are not showing.

The report has used fieldcatalog merge function module, and after that they used a macro to edit the fieldcat properties of the fields. I also tried using fieldcat properties like lzero. no_zero etc, but they are of no use.

What i did was to remove the fieldcat merge function module and also the macro and manually assigned the properties to the fields of fieldcatalog and changed the declaration of f1,f2,f3,f4 fields from packed decimal to currency fields[Ex: f1 like mseg-dmbtr].

But still i do not get zeroes in the output. Any help will be greatly appreciated.

Can we display packed decimal fields with value zero in the ALV grid display?? is tehre any way to do this? i am using ECC 6.0.

6 REPLIES 6
Read only

Former Member
0 Likes
963

Hi,

Check these fields in the Fiedlcatalog...

decimalsfieldname

decimalstabname

decimals_out

Read only

0 Likes
963

Hi Avinash,

i tried your suggestion, but it is still not resolved. No_decimals is not correct. Do u know any other solutions?

Read only

Former Member
0 Likes
963

alv display can not show leading zeros or zeros in currency.

u can move these to charcter field and then display. in this case zero will be considered as charatecter and then it will be displayed.

in this case u can not sum on amounts( since those are characters).

Read only

Former Member
0 Likes
963

hi rnb,

i wrote a little test programm and the type p columns are displayed fine. in col 4 there ist 0,00.

I guess you should just use the packed numbers as such and don't convert them.

I hope this helps:


REPORT  ZTEST001.

types: begin of gt_itab ,
f1 type p decimals 2,
f2 type p decimals 2,
f3 type p decimals 2,
f4 type p decimals 2,
f5 type i,
  end of gt_itab.
data: ok_code like sy-ucomm,

      itab type table of gt_itab,
      wa_itab like line of itab,

      it_fcat type table of lvc_s_fcat,
      wa_fcat type lvc_s_fcat,

  go_container type ref to cl_gui_custom_container,
  go_alv type ref to cl_gui_alv_grid.

do 5 times.
  wa_itab-f1 = sy-index * 5.
  wa_itab-f2 = wa_itab-f1 / 2.
  wa_itab-f3 = wa_itab-f1 / 3.
  wa_itab-f4 = 0.
  wa_itab-f5 = sy-index.
  append wa_itab to itab.
enddo.


  wa_fcat-fieldname = 'F1'.
  wa_fcat-inttype = 'P'.
  wa_fcat-outputlen = 10.
  wa_fcat-coltext = 'F1'.

  append wa_fcat to it_fcat.
  clear wa_fcat.
  wa_fcat-fieldname = 'F2'.
  wa_fcat-inttype = 'P'.
  wa_fcat-outputlen = 10.
  wa_fcat-coltext = 'F2'.

  append wa_fcat to it_fcat.
  clear wa_fcat.
  wa_fcat-fieldname = 'F3'.
  wa_fcat-inttype = 'P'.
  wa_fcat-outputlen = 10.
  wa_fcat-coltext = 'F3'.

  append wa_fcat to it_fcat.
  clear wa_fcat.
  wa_fcat-fieldname = 'F4'.
  wa_fcat-inttype = 'P'.
  wa_fcat-outputlen = 10.
  wa_fcat-coltext = 'F4'.

  append wa_fcat to it_fcat.
  clear wa_fcat.
  wa_fcat-fieldname = 'F5'.
  wa_fcat-inttype = 'I'.
  wa_fcat-outputlen = 3.
  wa_fcat-coltext = 'F5'.

  append wa_fcat to it_fcat.
  clear wa_fcat.




call screen 0100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module STATUS_0100 output.
  SET PF-STATUS 'STAT0100'.
*  SET TITLEBAR 'xxx'.
CREATE OBJECT go_container
    EXPORTING
      container_name              = 'CONTAINER'.
  CREATE OBJECT go_alv
    EXPORTING
       i_parent          = go_container.
  go_alv->set_table_for_first_display(
    CHANGING
      it_outtab                     = itab
      it_fieldcatalog               = it_fcat ).
endmodule.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module USER_COMMAND_0100 input.
case ok_code.
  when 'EXIT'.
    leave program.
endcase.
endmodule.                 " USER_COMMAND_0100  INPUT

Read only

agnihotro_sinha2
Active Contributor
0 Likes
963

Try transferring the data to character variable b4 passing it 2 Fcat.

It wont truncate zeros if they are in char field

Read only

rnb86
Participant
0 Likes
963

complete