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: 

what is the purpose of sy-repid during alv.

Former Member
0 Kudos

what is the purpose of sy-repid during alv.

why we are assigning sy-repid to a variable and using that variable in the FM

instead of directly assigning sy-repid in the FM

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi,

We use sy-repid to get the actual program name. We can save this value in a field and pass this field to ALV function modules to inform from which program its been called.

If we pass sy-repid directly, this system variable will take the value of the ALV function module frame program immediately when inside the function - no information about the calling program's name arrives.

For ALV it should be

DATA:

lv_repid TYPE sy-repid,

...

lv_repid = sy-repid.

...

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = lv_repid

...

Regards,

Ferry Lianto

4 REPLIES 4

former_member191977
Contributor
0 Kudos

To recognize the current program you are working on. You can pass it directly in the FM. Don't know exactly which assignment to the variable you are talking about. Post the code.

ferry_lianto
Active Contributor
0 Kudos

Hi,

We use sy-repid to get the actual program name. We can save this value in a field and pass this field to ALV function modules to inform from which program its been called.

If we pass sy-repid directly, this system variable will take the value of the ALV function module frame program immediately when inside the function - no information about the calling program's name arrives.

For ALV it should be

DATA:

lv_repid TYPE sy-repid,

...

lv_repid = sy-repid.

...

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = lv_repid

...

Regards,

Ferry Lianto

Former Member
0 Kudos

Hi Sripathi,

<b>SY-REPID:</b> Name of current ABAP program. With externally called procedures this is the name of the procedure’s main program.

If SY-REPID was transferred to an external procedure as an actual parameter before Release 6.10, the formal parameter was not given the name of the caller, but the name of the procedure’s main program. SY-REID had to be transferred to an auxiliary variable before the call or you had to use SY-PROG.

As of Release 6.10, SY-REPID is a separate constant that is no longer part of the structure SYST or SY. It can be transferred to external procedures directly.

Thanks,

Vinay

suresh_datti
Active Contributor
0 Kudos

If you are referring to the i_callback_program parameter of the ALV, there is no need to pass it ot variable, you can as well use i_callback_program = sy-repid. It could have passed via the variable just have an option to pass a diff program name to i_callback_program.

~Suresh