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: 

FM to pop up and display a database tables contents?

Former Member
0 Kudos

Hello all,

Has anyone found a function module that has a database table as an input parameter that creates a pop-up of the database tables contents? POPUP_TO_SHOW_DB_DATA_IN_TABLE seemed like a good candidate but I couldn't get the function module to return the DB table contents.

I want to display the contents of a custom table at logon using the enhancement SUSR0001. The contents of the table are system messages.

We are creating this new functionality because the standard system message doesn't necessarily display the entries in the order we want the users to see these messages because of the three line limit in system messages.

Thanks

Bruce

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Check this sample program.....



report zrich_0002
       no standard page heading.


data: it001 type table of t001 with header line.
select * into corresponding fields of table it001
             from t001.

call function 'REUSE_ALV_POPUP_TO_SELECT'
  exporting
*   I_TITLE                       =
   I_SELECTION                   = space
*   I_ZEBRA                       = ' '
*   I_SCREEN_START_COLUMN         = 0
*   I_SCREEN_START_LINE           = 0
*   I_SCREEN_END_COLUMN           = 0
*   I_SCREEN_END_LINE             = 0
*   I_CHECKBOX_FIELDNAME          =
*   I_LINEMARK_FIELDNAME          =
*   I_SCROLL_TO_SEL_LINE          = 'X'
    i_tabname                     = 'T001'
    I_STRUCTURE_NAME              = 'T001'
*   IT_FIELDCAT                   =
*   IT_EXCLUDING                  =
*   I_CALLBACK_PROGRAM            =
*   I_CALLBACK_USER_COMMAND       =
*   IS_PRIVATE                    =
* IMPORTING
*   ES_SELFIELD                   =
*   E_EXIT                        =
  tables
    t_outtab                      = it001
* 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.

Regards,

Rich Heilman

8 REPLIES 8

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Check this sample program.....



report zrich_0002
       no standard page heading.


data: it001 type table of t001 with header line.
select * into corresponding fields of table it001
             from t001.

call function 'REUSE_ALV_POPUP_TO_SELECT'
  exporting
*   I_TITLE                       =
   I_SELECTION                   = space
*   I_ZEBRA                       = ' '
*   I_SCREEN_START_COLUMN         = 0
*   I_SCREEN_START_LINE           = 0
*   I_SCREEN_END_COLUMN           = 0
*   I_SCREEN_END_LINE             = 0
*   I_CHECKBOX_FIELDNAME          =
*   I_LINEMARK_FIELDNAME          =
*   I_SCROLL_TO_SEL_LINE          = 'X'
    i_tabname                     = 'T001'
    I_STRUCTURE_NAME              = 'T001'
*   IT_FIELDCAT                   =
*   IT_EXCLUDING                  =
*   I_CALLBACK_PROGRAM            =
*   I_CALLBACK_USER_COMMAND       =
*   IS_PRIVATE                    =
* IMPORTING
*   ES_SELFIELD                   =
*   E_EXIT                        =
  tables
    t_outtab                      = it001
* 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.

Regards,

Rich Heilman

0 Kudos

Rich,

That function module and code was exactly what I was looking for.

Thanks

Bruce

0 Kudos

Try using the following code.

tables:tj30t.

data:r_ind like sy-tabix.

data:begin of i_fields occurs 0.

include structure help_value.

data:end of i_fields.

data:begin of itabt occurs 0,

txt04 like tj30t-txt04,

txt30 like tj30t-txt30,

end of itabt.

i_fields-tabname = 'TJ30T'.

i_fields-fieldname = 'TXT04'.

i_fields-selectflag = 'X'.

append i_fields.

i_fields-tabname = 'TJ30T'.

i_fields-fieldname = 'TXT30'.

i_fields-selectflag = ' '.

append i_fields.

select * into corresponding fields of table itabt

from tj30t

where stsma = &2.

call function 'HELP_VALUES_GET_NO_DD_NAME'

exporting

selectfield = 'TXT04'

titel = 'User Status Selection'

importing

ind = r_ind

tables

fields = i_fields

full_table = itabt

exceptions

full_table_empty = 1

no_tablestructure_given = 2

no_tablefields_in_dictionary = 3

more_then_one_selectfield = 4

no_selectfield = 5

others = 6.

read table itabt index r_ind.

&1 = itabt-txt04.

refresh:itabt. free:itabt.

0 Kudos

Jagraj,

Thanks for your reply. The ALV popup solved my problem. Your solution however proved useful today when I had to make a change and use some of the table fields rather than all of them.

Thanks

Bruce

0 Kudos

Hi Bruce,

i think you owe some point 'very hepfult' to Jagraj

regards

0 Kudos

Hi Bruce,

i think you owe some point 'very helpful' to Jagraj

regards

0 Kudos

Surpreet,

10 points were awarded to Rich before Jagraj sent his response.

Bruce

0 Kudos

Bruce

Don't worry about the point, till the time this forum is helping to answer your questions.

Jagraj Dhillon