cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Display

Former Member
0 Kudos

Hi guys. I have a program that displays a report in ALV however when I print the alv or click on the print preview there is a 'N/A' beside the material number. I tried looking at the internal table passed to the alv but it does not contain the 'N/A'. Do you guys know the reason behind this? Thanks in advance.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi, actually I have tried your code on my side, it goes well, no N/A fields.

So, can you certain from your server, which value of MATNR be shown as N/A?

Maybe something consistency in the datatable.

Thanks

Former Member
0 Kudos

That couldn't be it. I saw an alv report that displays the matnr without 'N/A'. And the program declared the variable as mseg-matnr (same as mine). I just can't figure out the difference...

Former Member
0 Kudos

Hi ferdinand,

As you have declared your material equal to mara-matnr.

but when it gets displayed it is getting converted internally by removing the leading zeros, so may be when you need a conversion exit to get all the 18 numbers of your material.

Then call the FM REUSE_ALV_GRID_DISPLAY.

It would be also helpful for me tackle this issue if you could provide me with the ALV sample code so that its more clear how the declarations have been done and how you have declared your fieldcatalog.

you also can use the FM REUSE_ALV_FIELDCATALOG_MERGE

Regards

Venugopal

Former Member
0 Kudos

Hi Venugopal,

Here are the parts of the code. Also, I'm retrieving matnr from table mseg. Thanks.

DATA: BEGIN OF I_DISPLAY OCCURS 0,
        MATNR        LIKE MSEG-MATNR,
        MAKTX        LIKE MAKT-MAKTX,
        DMBTR        LIKE MSEG-DMBTR,
        MANDT        LIKE MSEG-MANDT,
        MBLNR        LIKE MKPF-MBLNR,
        BUDAT        LIKE MKPF-BUDAT,
        MJAHR        LIKE MSEG-MJAHR,
        EBELN        LIKE MSEG-EBELN,
        EBELP        LIKE MSEG-EBELP,
        LINE_COLOR(4).
DATA: END OF I_DISPLAY.

FORM build_catalog.

  DATA: ls_fieldcat type slis_fieldcat_alv,
        l_concat(45).
  DATA: l_pos type i value 1,
        l_prem(10).

* --- local constants ---
  CONSTANTS: lc_billno(6)   TYPE C VALUE 'BILLNO',
             lc_FLIGHTNR(8) TYPE C VALUE 'FLIGHTNR',
             lc_COUNTRY(7)  TYPE C VALUE 'COUNTRY',
             lc_MATNR(5)    TYPE C VALUE 'MATNR',
             lc_MAKTX(5)    TYPE C VALUE 'MAKTX',
             lc_DMBTR(5)    TYPE C VALUE 'DMBTR',
             lc_tabname(13) TYPE C VALUE 'i_display'.

  g_repid = sy-cprog.

*billno
  CLEAR: ls_fieldcat,
         l_concat.

  ls_fieldcat-col_pos       = l_pos.
  ls_fieldcat-fieldname     = lc_billno.
  ls_fieldcat-reptext_ddic  = text-001.
  ls_fieldcat-outputlen     = '16'.
  ls_fieldcat-tabname       = lc_tabname.
*  ls_fieldcat-key           = 'X'.
  append ls_fieldcat to  gt_fieldcat.
  clear ls_fieldcat.

*flight nr
  ADD 1 to l_pos.
  ls_fieldcat-col_pos       = l_pos.
  ls_fieldcat-fieldname     = lc_flightnr.
  ls_fieldcat-reptext_ddic  = text-002.
  ls_fieldcat-outputlen     = '8'.
  ls_fieldcat-tabname       = lc_tabname.
  append ls_fieldcat to  gt_fieldcat.
  clear ls_fieldcat.

*country
  ADD 1 to l_pos.
  ls_fieldcat-col_pos       = l_pos.
  ls_fieldcat-fieldname     = lc_country.
  ls_fieldcat-reptext_ddic  = text-003.
  ls_fieldcat-outputlen     = '3'.
  ls_fieldcat-tabname       = lc_tabname.
  append ls_fieldcat to  gt_fieldcat.
  clear ls_fieldcat.

*material number
  ADD 1 to l_pos.
  ls_fieldcat-col_pos       = l_pos.
  ls_fieldcat-fieldname     = lc_matnr.
  ls_fieldcat-reptext_ddic  = text-004.
  ls_fieldcat-outputlen     = '18'.
  ls_fieldcat-tabname       = lc_tabname.
  append ls_fieldcat to  gt_fieldcat.
  clear ls_fieldcat.

*material description
  ADD 1 to l_pos.
  ls_fieldcat-col_pos       = l_pos.
  ls_fieldcat-fieldname     = lc_maktx.
  ls_fieldcat-reptext_ddic  = text-005.
  ls_fieldcat-outputlen     = '40'.
  ls_fieldcat-tabname       = lc_tabname.
  append ls_fieldcat to  gt_fieldcat.
  clear ls_fieldcat.

*amount in local currency
  ADD 1 to l_pos.
  ls_fieldcat-col_pos       = l_pos.
  ls_fieldcat-fieldname     = lc_dmbtr.
  ls_fieldcat-reptext_ddic  = text-006.
  ls_fieldcat-outputlen     = '13'.
  ls_fieldcat-tabname       = lc_tabname.
  append ls_fieldcat to  gt_fieldcat.
  clear ls_fieldcat.

 
ENDFORM.                    " build_catalog

FORM PRINT_ALV.

     REFRESH f_events.
     f_events-name = slis_ev_top_of_page.
     f_events-form = 'TOP_OF_PAGE'.
     APPEND f_events.

     f_events-name = slis_ev_end_of_list.
     f_events-form = 'END_OF_LIST'.
     APPEND f_events.

     f_grid_layout-colwidth_optimize = 'X'.
     f_grid_layout-info_fieldname = 'LINE_COLOR'.

     f_print_settings-no_print_selinfos  = 'X'.
     f_print_settings-NO_PRINT_LISTINFOS = 'X'.

*-------------- Actual ALV Report printed here -------------*
     call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
               i_interface_check  = ' '
               i_callback_program            = g_repid
               i_callback_html_top_of_page   = 'TOP_OF_PAGE_HTML'
               i_callback_html_end_of_list   = 'END_OF_LIST_HTML'
               i_html_height_top             = 20
               i_html_height_end             = 10
               is_layout                     = f_grid_layout
               it_fieldcat                   = gt_fieldcat[]
               it_events                     = f_events[]
               is_print                      = f_print_settings
          tables
               t_outtab                      = i_display.

     if sy-subrc <> 0.
     endif.

ENDFORM.                    " PRINT_ALV

Former Member
0 Kudos

How is your lc_matnr filled in and can post the code where get data from MSEG and the structure of the internal table collecting the MSEG data. It has to be your data or the length of your fields. Are you sure you are picking up the right value for the material from MSEG?

Regards,

Srinivas

Former Member
0 Kudos

How do I prevent this from happening?

The contents of the material number are:

000000000035000222

000000000035000221

000000000035000126

And it is being displayed/printed as:

35000222 N/A

35000221 N/A

35000126 N/A

My field catalog is:

*material number

ADD 1 to l_pos.

ls_fieldcat-col_pos = l_pos.

ls_fieldcat-fieldname = lc_matnr. "MATNR

ls_fieldcat-reptext_ddic = text-004. "Material No

ls_fieldcat-outputlen = '18'.

ls_fieldcat-tabname = lc_tabname. "i_display

append ls_fieldcat to gt_fieldcat.

clear ls_fieldcat.

I'm using FM REUSE_ALV_GRID_DISPLAY to display my ALV. please advise. Thanks

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

I am not sure.Just try to change the field type as char of size 18,instead of using mara-matnr.

Former Member
0 Kudos

Hi, 'N/A' mean not available.

Maybe the format or content of the material number you transfer into ALV is problem.

you can have a check, or paste the associated here.

Hope it will be helpful

Thanks a lot