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: 

sy-

Former Member
0 Kudos

Hi.

what is the use of sy-cprog and sy-dynnr.

what is the diff b/w them.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Sy-cprog : it is little bit tricky

always it will give main program name,where as sy-repid will give current program name.

example :

main program zxyz.

sy-cprog

sy-repid,in this both will give you same name like zxyz.

example2.

main program zxyz.

you have include zabc.

you have written the code in include

sy-cprog.

sy-repid.

in this case sy-cprog will return zxyz.

in this case sy-repid will return zabc.

sy-dynnr - it will give current screen number

Thanks

Seshu

9 REPLIES 9

Former Member
0 Kudos

hi,

sy-cprog will give the current program name

whereas sy-dynnr will give the current screen number.

Former Member
0 Kudos

sy-cprog gives the current program name

sy-dynnr gives the current screen number

Former Member
0 Kudos

Hi,

sy-dynnr - to get current screen

sy-cprog - to get main program

I have one example - suppose you are program cursor at include program and you need to get main program for other purpose then use sy-cprog ( if you use sy-repid - it will have include program)

sy-dynnr - we use in module pool program to pass current screen number to function module to get other requirement,

Thanks,

Reward If Helpful.

Former Member
0 Kudos

hi..

<b>SY-CPROG</b> is he name of the current program OR the name of the calling program within a procedure (perform externaly, call function)

<b>SY-DYNNR</b> will give the current screen number

<b>Reward</b> <b>points if useful</b>

Regards

ashu

Former Member
0 Kudos

Hi,

<b>cprog</b> shall give you the name of the program which is calling the current control.

<b>dynnr</b> shall return the screen number that is being used in the current program.

<b>reward points if this helps,</b>

Kiran

Former Member
0 Kudos

<u>SY-DYNNR</u>

ABAP program, number of current screen

<u>SY-CPROG</u>

ABAP program, caller in external procedures

SY-DYNNR IS USED TO FOR SCREEN NUMBERS

SY-CPROG IS USED FIND OUT THE PROGRAM NAME

REWARD IF USEFULL

REGARDS

NARESH

Former Member
0 Kudos

Sy-cprog : it is little bit tricky

always it will give main program name,where as sy-repid will give current program name.

example :

main program zxyz.

sy-cprog

sy-repid,in this both will give you same name like zxyz.

example2.

main program zxyz.

you have include zabc.

you have written the code in include

sy-cprog.

sy-repid.

in this case sy-cprog will return zxyz.

in this case sy-repid will return zabc.

sy-dynnr - it will give current screen number

Thanks

Seshu

Former Member
0 Kudos

CPROG is of CHAR 40 used in ABAP Program for <b>External procedure call</b>

DYNNR is of CHAR 4 used in ABAP Program for <b>Number of current screen</b>

Regards,

Pavan

Former Member
0 Kudos

Hi,

SY-CPROG

The name of the calling program in an external routine, otherwise the name of the current program.

SY-DYNNR

Number of the current screen. During selection screen processing, SY-DYNNR contains the screen number of the current selection screen. During list processing, it contains the number of the container screen. During subscreen processing, SY-DYNNR contains the number of the subscreen. This also applies to tabstrip controls.

Regards,

Bhaskar