on 03-10-2004 10:17 AM
Hello,
In my ONREQUEST event I have the following FORM
FORM REPLACE_STRING USING STRING TEMPLATE NEW.
CALL FUNCTION 'SDIT_REPLACE_STRING'
EXPORTING
IN_STRING = STRING
NEW = NEW
TEMPLATE = TEMPLATE
IMPORTING
OUT_STRING = STRING.
ENDFORM. "REPLACE_STRING
However when running a check on the code I get the error:
"Statement ENDMETHOD is missing"
Is it not possible to use a FORM in the event handler in a BSP?
Your problem is that your BPS page is actually an ABAP OO class. All the event handlers are actually methods of this class. Therefore anything you program in these event handlers has to follow the rules for ABAP OO. Forms are not really valid constructs inside ABAP OO Methods. What you are trying to do is similar to trying to declair a new form within an existing form.
Form Test1.
Form Test2.
endform.
endform.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, so I understand now that I am trying in essence to build nested "forms" which is working (changing the name did not change anything as well)
So then my only chance is to build a method in the application class correct?
Does anyone have any "good" examples of that? I'm beginning to think EJB's are easier than BSP's in the moment.
I've created a new METHOD in my application class and assigned the application class to the BSP.
method REPLACE_STRING .
CALL FUNCTION 'SDIT_REPLACE_STRING'
EXPORTING
IN_STRING = STRING
NEW = NEW
TEMPLATE = TEMPLATE
IMPORTING
OUT_STRING = STRING.
endmethod.
In my event handler I am now trying:
tmpRFC = 'H=%HOST,S=%SID,M=%MANDT,U=%USER,L=%LANGU,Z=%PWD,'.
CALL METHOD application->REPLACE_STRING
EXPORTING
STRING = tmpRFC
TEMPLATE = '%HOST'
NEW = tmphost
IMPORTING
OUT_STRING = tmpRFC.
However I get the error that:
The statement "IMPORTING" is not expected. A correct similar statement is "IMPORT".
How can I retrieve the newly changed string??
Craig:
You may want to change the name of the variable "STRING" to something else. "STRING" is an ABAP data type; use as a parameter / variable name may be confusing the compiler, thus causing the error message.
Regards,
D.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OnRequest, OnInit and so on are methods of you BSP Context so this will ever work. Why don't you create
a method in your application class??
Regards Matthias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.