Skip to Content
author's profile photo Former Member
Former Member

sy-

Hi.

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

what is the diff b/w them.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 11:18 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 11:19 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 11:14 AM

    hi,

    sy-cprog will give the current program name

    whereas sy-dynnr will give the current screen number.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 11:14 AM

    sy-cprog gives the current program name

    sy-dynnr gives the current screen number

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 11:16 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 11:16 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 11:17 AM

    <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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 11:26 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 12, 2007 at 11:15 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.