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

function module

Former Member
0 Likes
630

Hi all,

I m totally nem to fm.

i m reading a already developed code, having use of function module. Plz tell me in this code how we pass th parametr(criteria)like g_repid.....'x'.Plz explain line by line

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_callback_program = g_repid

i_callback_user_command = g_user_command

it_fieldcat = fieldcat[]

it_events = per_event

i_bypassing_buffer = 'X'

i_save = 'A'

tables

t_outtab = it_pursumry

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.

endform. " DISPLAY_ALV

Definitely Rewards pts

Regards,

Savita

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
612

hi,

i_callback_program = g_repid

means we are telling that the program from where the ALv is called is the program name which is stored in g_repid.......

u can populate value in this by g_repid = sy-repid.....

i_callback_user_command = g_user_command

if at click of any button on the ALV grid u want any user defined action to happen then and can be defined in this usercommand.....

it_fieldcat = fieldcat[]

if has the format of ur ALV...... like if u want color in ur ALV display ..... or any input enabled field ....... headings.....etc...

reward points if useful.......:-)

and mark the post answred once ur problem is solved ....

6 REPLIES 6
Read only

Former Member
0 Likes
613

hi,

i_callback_program = g_repid

means we are telling that the program from where the ALv is called is the program name which is stored in g_repid.......

u can populate value in this by g_repid = sy-repid.....

i_callback_user_command = g_user_command

if at click of any button on the ALV grid u want any user defined action to happen then and can be defined in this usercommand.....

it_fieldcat = fieldcat[]

if has the format of ur ALV...... like if u want color in ur ALV display ..... or any input enabled field ....... headings.....etc...

reward points if useful.......:-)

and mark the post answred once ur problem is solved ....

Read only

0 Likes
612

Hi Ajantha,

Plz explain me this line

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

Best Regards,

Savita

Read only

0 Likes
612

this is the system message ..when an error message occured it will shown automatically

Read only

0 Likes
612

hi,

while calling ALV if any error occurs then this this Sy fields will conatin the information which will be displayed on the screen

sy-msgid - msg id

sy-msgty - error / information/ warning

sy-msgno - msg number

sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4--- this will have some text more decriptive

Read only

raja_narayanan2
Active Participant
0 Likes
612

REUSE_ALV_LIST_DISPLAY is a function module used to display reports in ALV format. In which we can pass the values in exporting parameters and get the result in importing parameters.

1) i_callback_program --> you can pass your current program name or any ABAP progam.

2) i_callback_user_command --> you can pass user command like sy-ucomm. what you click it perfoms.

3) it_fieldcat --> you have to pass the field catlog structure..

4) it_events -> here you can pass SLIS_T_EVENT- that Table of events to perform.

5) i_bypassing_buffer --> to skip all buffers

6) i_save----> Variants can be saved

7) t_outtab ---> Table with data to be displayed

😎 exceptions ---> errors can be handled here.....

Read only

Former Member
0 Likes
612

hi here is the code for the simple alv display..

REPORT ztest_alv_perc_13317.

TYPE-POOLS: slis.

DATA: it_fieldcat TYPE slis_t_fieldcat_alv,

wa_fieldcat TYPE slis_fieldcat_alv,

it_events TYPE slis_t_event,

wa_events TYPE slis_alv_event,

it_sort TYPE slis_t_sortinfo_alv,

wa_sort TYPE slis_sortinfo_alv,

l_layout TYPE slis_layout_alv.

TYPES: BEGIN OF ty_itab,

field1(10),

qty1 TYPE i,

qty2 TYPE i,

qty3 TYPE i,

dummy TYPE i,

END OF ty_itab.

DATA: itab TYPE STANDARD TABLE OF ty_itab WITH HEADER LINE,

itab1 TYPE ty_itab.

START-OF-SELECTION.

itab-field1 = 'FIRST'.

itab-qty1 = 2.

itab-qty2 = 1.

itab-qty3 = 5.

itab-dummy = 10.

APPEND itab.

itab-field1 = 'FIRST'.

itab-qty1 = 2.

itab-qty2 = 1.

itab-qty3 = 5.

itab-dummy = 10.

APPEND itab.

itab-field1 = 'FIRST'.

itab-qty1 = 2.

itab-qty2 = 1.

itab-qty3 = 5.

itab-dummy = 10.

APPEND itab.

wa_fieldcat-col_pos = 1.

wa_fieldcat-fieldname = 'FIELD1'.

wa_fieldcat-reptext_ddic = 'field1'.

wa_fieldcat-tabname = 'ITAB'.

APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-col_pos = 2.

wa_fieldcat-fieldname = 'QTY1'.

wa_fieldcat-tabname = 'ITAB'.

wa_fieldcat-reptext_ddic = 'field2'.

APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-col_pos = 3.

wa_fieldcat-fieldname = 'QTY2'.

wa_fieldcat-tabname = 'ITAB'.

wa_fieldcat-reptext_ddic = 'field3'.

APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-col_pos = 4.

wa_fieldcat-fieldname = 'QTY3'.

wa_fieldcat-tabname = 'ITAB'.

wa_fieldcat-reptext_ddic = 'field4'.

APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-col_pos = 5.

wa_fieldcat-fieldname = 'DUMMY'.

wa_fieldcat-tabname = 'ITAB'.

wa_fieldcat-reptext_ddic = 'field5'.

APPEND wa_fieldcat TO it_fieldcat.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

it_fieldcat = it_fieldcat

TABLES

t_outtab = itab .

regards,

venkat