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

system fields

Former Member
0 Likes
735

pls tell me the diff between sy-repid & sy-cprog.

6 REPLIES 6
Read only

Former Member
0 Likes
703

hi,

pl go through

SY-REPID:

Name of the current ABAP program. For externally-called procedures, it is the name of the main program of the procedure. If you pass SY-REPID as an actual parameter to an external procedure, the formal parameter does not contain the name of the caller, but that of the main program of the procedure. To avoid this, assign SY-REPID to an auxiliary variable and use that in the call, or use the system field SY-CPROG.

SY-CPROG:

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

For more information, please check this links.

http://help.sap.com/saphelp_nw2004s/helpdata/en/7b/fb96c8882811d295a90000e8353423/content.htm

http://help.sap.com/saphelp_46c/helpdata/en/7b/fb96c8882811d295a90000e8353423/content.htm

2..............

SY-REPID : It is name of the current program

SY-CPROG : Name of the calling program. It would be same as SY-REPID if it is the current program.

But for example check the below.

REPORT ZREP.

start-of-selection.

write : / sy-repid, sy-cprog.

submit zrep1 and return.

REport zrep1.

start-of-selection.

write : / sy-repid, sy-cprog.

The output would be.

zrep zrep

zrep1 zrep

pls rewad if it helpful

Thanks

Vana

Read only

0 Likes
703

thanks

Read only

0 Likes
703

I think a more appropriate example is:

*----


REPORT ZCHKSYREPID.

break-point.

start-of-selection.

write : / sy-repid, sy-cprog.

submit ZCHKSYREPID2 and return.

PERFORM r2 in program ZCHKSYREPID2.

*----


REPORT ZCHKSYREPID2.

start-of-selection.

write : / sy-repid, sy-cprog.

------ Form r2 -


form r2 .

write : / sy-repid, sy-cprog.

endform. " r2

Read only

Former Member
0 Likes
703

hi,

<b>sy-repid</b> :gives Current main program.

<b>SY-CPROG</b>

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

Regards

Reshma

Read only

Former Member
0 Likes
703

Hi shital,

SY-CPROG (MAIN program)

The name of the current program and name of the calling program within a procedure.

SY-REPID (CURRENT program)

Name of the current ABAP program.

Kindly reward if useful.

Regards,

Sunny

Read only

Former Member
0 Likes
703

Hi,

SY-REPID / SY-CPROG

SY-REPID is the Name of the current ABAP program.

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