‎2008 Jan 18 3:16 AM
Hi all,
I've included a text editor box into my project to allow the user to key in ABAP codes. i got the codes of a sample program but i'm not sure how it works. can anyone kind enough to explain to me how to add buttons or assign functions to the buttons?
secondly, because i allow free-text for the user to key in ABAP codes, is there a function to check the syntax of the codes entered by the user?
i'll reward handsomely for any help rendered and it will be better if you could include sample codes as well(:
thanks!!! (:
SAMPLE CODE FOR TEXT EDITOR:
IF CODE_EDITOR IS INITIAL.
CREATE OBJECT CODE_EDITOR_CONTAINER
EXPORTING
CONTAINER_NAME = 'GEN_CODE'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
CREATE OBJECT CODE_EDITOR
EXPORTING
PARENT = CODE_EDITOR_CONTAINER
WORDWRAP_MODE =
CL_GUI_TEXTEDIT=>WORDWRAP_OFF
CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
CL_GUI_TEXTEDIT=>WORDWRAP_AT_WINDOWBORDER
WORDWRAP_POSITION = G_EDITOR_LENGTH
WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE.
ENDIF.
Edited by: Leslie Koh on Jan 18, 2008 4:28 AM
‎2008 Jan 18 3:30 AM
Hi,
Please find the concept below.
1. you need to create a screen with a custom container.name it as 'GEN_CODE'.
2. Now in the PBO, write the code which have you given. basically, you need to pass the name of the custom container to create a container object and then pass this object to the code_editor object.
3. Once you have created the code_editor object you will be able to access all the static, public variables/methods which are defined in that class.
4. Goto Se24, give the object type as CL_GUI_TEXTEDIT. you can find all the methods, variable in it. use the appropriate methods.
Reward points if useful,
Regards,
Niyaz
‎2008 Jan 18 3:30 AM
Hi,
Please find the concept below.
1. you need to create a screen with a custom container.name it as 'GEN_CODE'.
2. Now in the PBO, write the code which have you given. basically, you need to pass the name of the custom container to create a container object and then pass this object to the code_editor object.
3. Once you have created the code_editor object you will be able to access all the static, public variables/methods which are defined in that class.
4. Goto Se24, give the object type as CL_GUI_TEXTEDIT. you can find all the methods, variable in it. use the appropriate methods.
Reward points if useful,
Regards,
Niyaz
‎2008 Jan 18 3:58 AM
Hi Niyaz,
Thanks for your fast response (: well, i'm looking at the methods available at SE24. i must say there's a lot and some of them are in german. haha. well, how to you call them? do you mind showing me some sample codes of calling them?
sorry i only rewarded you 2pts because i also looking for a solution for the ABAP syntax check function.
i wanna allow users to key in codes into the text editor and the user to press a button on the text editor to change for syntax error.
but thanks again for your help (: really appreciate it (:
Leslie
‎2008 Jan 18 4:22 AM
Hi Leslie
There is a abap key word which may help your purpose to do the syntax check. Please check the key work "SYNTAX-CHECK FOR itab " to be more in details,
Basic form :
SYNTAX-CHECK FOR itab ...MESSAGE f ...LINE g ...WORD h.
Extras:
1. ... PROGRAM f1
2. ... INCLUDE f2
3. ... OFFSET f3
4. ... TRACE-TABLE itab1
5. ... DIRECTORY ENTRY f4
6. ... REPLACING f5
7. ... FRAME ENTRY f6
8. ... MESSAGE-ID f7
9. ... ID id TABLE itab2
10.... SHORTDUMP-ID f8
11.... FILTER f9
This syntax will help you to check the syntax errors of ABAP program passed as internal table. You can get the entries keyed in by user in editor control through class method CL_GUI_TEXTEDIT->GET_TEXT_AS_R3TABLE in your PAI.
Hope this helps !
Kind Regards
Ranganath
‎2008 Jan 18 3:48 AM
Already SAP standard function modules are for text editor you can use.
ie
READ_TEXT
EDIT_TEXT
INIT_TEXT
SAVE_TEXT
a®
‎2008 Jan 18 4:00 AM
hi a®s,
the help you rendered is too little for me to reward you with pts. but i will reward you if you can show me some codes on how the 4 functions you mentioned works.
READ_TEXT
EDIT_TEXT
INIT_TEXT
SAVE_TEXT
thanks (:
Leslie
‎2008 Jan 18 4:21 AM
Hi leslie,
I am not sure about this... But it might be helpful..
Class CL_WB_EDITOR
Method SOURCE_CORRECTION
Regards,
Mohaiyuddin
‎2008 Jan 18 4:27 AM
Hi Leslie,
Try this method
Class : CL_WB_PGEDITOR
Method : check_source
Regards,
Mohaiyuddin