2007 Mar 13 10:45 PM
Hello All,
I get this error:
Include <CNTAIN>
You may only define methods between "CLASS ... IMPLEMENTATION" and
"ENDCLASS".
Here is the code:
INCLUDE <CNTAIN>.
METHOD CREATENBOBJECT.
DATA: newvariable(12) type n.
swc_get_element container 'REQUISITION_NUM' newvariable.
CALL FUNCTION 'ZHRWPC_EREC_CREATE_EREC_OBJECT'
EXPORTING
notif_objid = notificationid
notif_type = notificationtype
IMPORTING
return = return
EXCEPTIONS
no_isr_update = 1
database_error = 2
general_error = 3
req_object_found = 4
no_erec_approval = 5
erec_sys_error = 6
status_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
Messages already raised, exceptions should be handled here
due to workflow intricacy.
ENDIF.
What is wrong with the code.
Thanks and Regards.
Srinivas
2007 Mar 13 10:51 PM
Everything must be inside the METHOD...ENDMETHOD.
METHOD CREATENBOBJECT.
INCLUDE <CNTAIN>.
DATA: newvariable(12) type n.
swc_get_element container 'REQUISITION_NUM' newvariable.
CALL FUNCTION 'ZHRWPC_EREC_CREATE_EREC_OBJECT'
EXPORTING
notif_objid = notificationid
notif_type = notificationtype
IMPORTING
return = return
EXCEPTIONS
no_isr_update = 1
database_error = 2
general_error = 3
req_object_found = 4
no_erec_approval = 5
erec_sys_error = 6
status_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
* Messages already raised, exceptions should be handled here
* due to workflow intricacy.
ENDIF.
Regards,
Rich Heilman
Seems that classes have issues with the INCLUDE statement. You can simply copy our the macro definition from the INCLUDE and put it directly into the method.
method createnbobject.
data: container type table of swcont.
data: newvariable(12) type n.
define swc_get_element.
call function 'SWC_ELEMENT_GET'
exporting
element = &2
importing
field = &3
tables
container = &1
exceptions
not_found = 8
is_null = 4
others = 1.
end-of-definition.
swc_get_element container 'REQUISITION_NUM' newvariable.
endmethod.
Regards,
RIch Heilman
2007 Mar 13 10:51 PM
Everything must be inside the METHOD...ENDMETHOD.
METHOD CREATENBOBJECT.
INCLUDE <CNTAIN>.
DATA: newvariable(12) type n.
swc_get_element container 'REQUISITION_NUM' newvariable.
CALL FUNCTION 'ZHRWPC_EREC_CREATE_EREC_OBJECT'
EXPORTING
notif_objid = notificationid
notif_type = notificationtype
IMPORTING
return = return
EXCEPTIONS
no_isr_update = 1
database_error = 2
general_error = 3
req_object_found = 4
no_erec_approval = 5
erec_sys_error = 6
status_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
* Messages already raised, exceptions should be handled here
* due to workflow intricacy.
ENDIF.
Regards,
Rich Heilman
2007 Mar 13 10:56 PM
Hi Rich,
Thanks for your reply. I did like you said. Now the error changed to:
Include <CNTAIN>
Within classes and interfaces, you can only use "TYPE" to refer to ABAP
Dictionary types, not "LIKE" or "STRUCTURE".
Kindly help me out here.
Regards
Srinivas
2007 Mar 13 10:58 PM
2007 Mar 13 11:06 PM
Seems that classes have issues with the INCLUDE statement. You can simply copy our the macro definition from the INCLUDE and put it directly into the method.
method createnbobject.
data: container type table of swcont.
data: newvariable(12) type n.
define swc_get_element.
call function 'SWC_ELEMENT_GET'
exporting
element = &2
importing
field = &3
tables
container = &1
exceptions
not_found = 8
is_null = 4
others = 1.
end-of-definition.
swc_get_element container 'REQUISITION_NUM' newvariable.
endmethod.
Regards,
RIch Heilman
2007 Mar 13 11:15 PM
Hi Rich,
Did you mean like this:
METHOD CREATENBOBJECT.
INCLUDE <CNTAIN>.
DATA: newvariable(12) type n.
DATA: container type table of swcont.
define swc_get_element.
call function 'SWC_ELEMENT_GET'
exporting
element = &2
importing
field = &3
tables
container = &1
exceptions
not_found = 8
is_null = 4
others = 1.
end-of-definition.
swc_get_element container 'REQUISITION_NUM' newvariable.
CALL FUNCTION 'ZHRWPC_EREC_CREATE_EREC_OBJECT'
EXPORTING
notif_objid = notificationid
notif_type = notificationtype
IMPORTING
return = return
EXCEPTIONS
no_isr_update = 1
database_error = 2
general_error = 3
req_object_found = 4
no_erec_approval = 5
erec_sys_error = 6
status_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
Messages already raised, exceptions should be handled here
due to workflow intricacy.
ENDIF.
ENDMETHOD.
If yes, I am getting an error:
Include <CNTAIN>
Within classes and interfaces, you can only use "TYPE" to refer to ABAP
Dictionary types, not "LIKE" or "STRUCTURE".
Thanks and Regards
Srinivas
2007 Mar 13 11:17 PM
Hi Rich,
It did solve the problem, I didn't remove the Include statement last time.
Thanks and Regards!
Srinivas
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |