‎2008 May 05 4:02 AM
while working on screen programming. example code:
PROGRAM ZTEST_SCREEN_ONE.
*&---------------------------------------------------------------------*
*& Module ZPRNV_ADD INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE ZPRNV_ADD INPUT.
"UNCOMMENT THE MODULE AND GIVE A NAME AND DOUBLE CLICK TO CREATE PAI MODULE
"SY-UCOMM system variable which gives the command name which triggered this function
IF SY-UCOMM = 'ADD'.
"declare the variable with same name as the name given in design layout
"with this data will be mapped automatically on/off the screen
DATA: TXT_A TYPE I ,
TXT_B TYPE I ,
TXT_RESULT TYPE I.
TXT_RESULT = TXT_A + TXT_B .
ELSE.
LEAVE.
ENDIF.
ENDMODULE. " ZPRNV_ADD INPUTif we somehow declare a variable in the function with the same name as of a control(eg textbox) , compiler maps them into one .
This may raise errors if we aren't aware of the variable names that are already in use and start to code on modules.
Q: Is there any way to avoid the same ?
i m new to ABAP
‎2008 May 05 4:21 AM
Hi,
In this condition u can use any variables so to diffrentiate frm urs better add 'Z' infront of the variable so tht u can easily identify.
Thanks,
Arunprasad.P
Reward if useful.
‎2008 May 05 9:03 AM
Hi,
Declare variables in main program and then use it in screen.We can use Screen field and prg variables are same in SAP.this method is better. don't use diferent name for screen and prg. that will not suport for long time. you will get idea about this.you just use this concept now.