Application Development 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: 

swc_get_element: error

Former Member
0 Kudos

Hello,

I am getting an error on the statement

swc_get_element container 'REQUISITION_NUM' newvariable.

And the error is:

Class ZCL_HRMSS_RECRUITING_WF,Method CREATENBOBJECT

Statement "SWC_GET_ELEMENT" is not defined. Check your spelling.

spelling.

Anybody has an idea whats goin on here.

Regards.

Srinivas.

1 ACCEPTED SOLUTION

0 Kudos

Hi,

At the start of the code please include this

INCLUDE <CNTAIN>.

The macro that you are using SWC_GET_ELEMENT is available in this include and it has to be there at the start of the code.

Hope this helps,

Sudhi

6 REPLIES 6

0 Kudos

Hi,

At the start of the code please include this

INCLUDE <CNTAIN>.

The macro that you are using SWC_GET_ELEMENT is available in this include and it has to be there at the start of the code.

Hope this helps,

Sudhi

0 Kudos

Hi Sudhi,

Thanks for you reply. I still get some other 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

0 Kudos

Everything must be inside the METHOD.... ENDMETHOD.



METHOD ......

INCLUDE <CNTAIN>.


....

ENDMETHOD.

Regards,

RIch Heilman

0 Kudos

Hello All,

I am getting error:

Include <CNTAIN>

Within classes and interfaces, you can only use "TYPE" to refer to ABAP

Dictionary types, not "LIKE" or "STRUCTURE".

Here is the code:

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.

ENDMETHOD.

Can anybody tell me whats wrong.

Thanks and Regards

Srinivas

0 Kudos

Please award points for helpful answers and close this thread and continue on with your other thread.

Regards,

Rich Heilman

0 Kudos

Hello Srinivas,

In Class and Methods U need to declare the internal tables and structure with <b>TYPE</b> only.

U should not use the <b>Like</b>

Try like this

<b>DATA ITAB TYPE TABLE OF MARA</b>

<b>DATA WA_ITAB TYPE LINE OF MARA</b>

In ur error double click on the error message it will take u to the line where syntax is incorrect.

There make the change like this

Regards,

Vasanth