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

ALV Grid when No data

former_member156446
Active Contributor
0 Likes
2,828

Hi Gurus

How can we get a line in the alv grid saying "No data selected!" in the alv grid when the table i pass to reuse_alv_grid is empty...

He wants the field catalog every thing as usuall... but need a satetment, where data would have been there...

Thanks..

1 ACCEPTED SOLUTION
Read only

tarangini_katta
Active Contributor
0 Likes
1,896

Hi,

IF it_outtab(u r final inrenal table) is initial.

create to another fieldcatalog with the one empty line.

then call reuse alv grid once again with this fieldcatalog other wise.

endif.

Thanks,

Hi Gurus

How can we get a line in the alv grid saying "No data selected!" in the alv grid when the table i pass to reuse_alv_grid is empty...

He wants the field catalog every thing as usuall... but need a satetment, where data would have been there...

Thanks..

11 REPLIES 11
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,896

Hello J@Y,

Can you not use END_OF_LIST for this purpose. Just an idea, i have to try & see.

BR,

Suhas

Read only

tarangini_katta
Active Contributor
0 Likes
1,897

Hi,

IF it_outtab(u r final inrenal table) is initial.

create to another fieldcatalog with the one empty line.

then call reuse alv grid once again with this fieldcatalog other wise.

endif.

Thanks,

Read only

MarcinPciak
Active Contributor
0 Likes
1,896

Try with

APPEND INITIAL LINE TO itab.

It will dsiplay only one empty line.

Regards

Marcin

Sorry I misunderstood your query

Edited by: Marcin Pciak on Jan 28, 2009 5:39 PM

Read only

Former Member
0 Likes
1,896

You could use one big text field already present to put a "No Data selected" and append a record to the empty table if it had no data.

Read only

former_member156446
Active Contributor
0 Likes
1,896

SAP Std reports does that.... I dont want to go alternative methods(use other table/use append and all)... If I am right, there should be some event we can use....

Read only

Former Member
0 Likes
1,896

Hi,

If you want to display the message if the internal table is empty. then you need to write the code.

END-OF-SELECTION.

IF NOT itab[] IS INITIAL.
  CALL SCREEN 100.    " Display alv if internal table has data
ELSE.
  MESSAGE I016(PN) WITH 'No Date selected'.
  EXIT.
ENDIF.

Read only

0 Likes
1,896

Not working..

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,895

Hello Jay,

Does this fit your bill?


IF fp_it_final IS INITIAL.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = sy-repid
      i_callback_html_end_of_list = 'END_OF_LIST'
      is_layout                   = fp_st_layout
      it_fieldcat                 = fp_it_fieldcat
      it_sort                     = fp_it_sort
      i_save                      = 'A'
    TABLES
      t_outtab                    = fp_it_final
    EXCEPTIONS
      program_error               = 1
      OTHERS                      = 2.
  IF sy-subrc <> 0.
*   Error in calling Standard ALV Functional Module
    MESSAGE i036. "Error Occured in ALV Function Module
    LEAVE LIST-PROCESSING.
  ENDIF.
ENDIF.

ENDFORM.                    " F_DISPLAY_ALV
*&---------------------------------------------------------------------*
*&      Form  END_OF_LIST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM end_of_list USING cl_dd TYPE REF TO cl_dd_document.

  CALL METHOD cl_dd->add_text
    EXPORTING
      text         = 'This table is Initial'
      sap_style    = cl_dd_area=>heading
      sap_fontsize = cl_dd_area=>large
      sap_color    = cl_dd_area=>list_heading_int.

ENDFORM.                    "END_OF_LIST

Plz revert back.

BR,

Suhas

Read only

0 Likes
1,895

Hi...

Not exactly...I am expecting the line just under the Header of ALV.. but it was helpful..thanks.

example: BCALV_TEST_LIST_FIELDS

Read only

0 Likes
1,895

Its, as expected in List display but not in Grid display...

Read only

Former Member
0 Likes
1,895

u can display message simply as 'no data selected'

message id 'id' type 'I' number '000' or message id with ' no data selected'