‎2005 Jun 15 8:11 AM
Hi
I would like to use Business object method in my function. In BOR browser is e.g. object Flight object type SFLIGHT. I have tried to call this object method with:
FLIGHT=>create( ).
and
SFLIGHT=>create( ).
and compiler response is always
Class not known.
What should I do??
Regards
Bogdan
Message was edited by: Bogdan Rokosa
‎2005 Jun 15 10:50 AM
Thanks for answer:)
I must this tutorial studying a little
I have heard about SWC macros but I unfortunately can't use it:( I know, i should <object> include. But when I try do it (add to includes node in function module) i have a message:
Object <OBJECT> already exists
then when i try use macro:
Statement SWC_GET_ELEMENT not defined.
What is not correct?
‎2005 Jun 15 8:47 AM
Have you ever heard of the SWC-macros?!
First you have to instantiate your SFLIGHT with
SWC_CREATE_OBJECT <field to hold obj instance> <obj type> <key of obj>. After this you have access to all attributes and methods of your SFLIGHT instance.
Then create the object container with
SWC_CONTAINER <container>.
Call the method you want with
SWC_CALL_METHOD <filed to hold obj instance> <name of method> <container>.
Greets
--MIKE
‎2005 Jun 15 8:49 AM
‎2005 Jun 15 10:50 AM
Thanks for answer:)
I must this tutorial studying a little
I have heard about SWC macros but I unfortunately can't use it:( I know, i should <object> include. But when I try do it (add to includes node in function module) i have a message:
Object <OBJECT> already exists
then when i try use macro:
Statement SWC_GET_ELEMENT not defined.
What is not correct?
‎2005 Jun 15 10:55 AM
Please post your code if possible. That would make safe a lot of time spent on speculations otherwise!
‎2005 Jun 15 1:59 PM
Hi Mike
I have tried e.g. with code
FUNCTION Z_BO_TEST.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"----------------------------------------------------------------------
DATA: flight TYPE SWC_OBJECT.
SWC_CREATE_OBJECT flight SFLIGHT '1111'.
SWC_CONTAINER cont.
SWC_CREATE_CONTAINER cont.
SWC_SET_ELEMENT cont <par1> <Value1>.
.
.
.
SWC_CALL_METHOD flieght getlist cont.
ENDFUNCTION.That is function module in function group. I can't this function compile (try include object). Where and how can i do it?
regards
bogdan
‎2005 Jun 15 3:03 PM
‎2005 Jun 15 3:24 PM
I dod not check this code, but this is the way it should work:
* structure to save the key to instantiate SFLIGHT
* ATTENTION: This structure must be filled before
* instantiating the object !!!!
DATA: BEGIN OF gs_sflight_key,
mandt LIKE sflight-mandt,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
END OF gs_sflight_key.
DATA: go_sflight TYPE swc_object.
* generate swc container
SWC_CONTAINER gc_container.
* instantiate object GO_SFLIGHT with key GS_SFLIGHT_KEY
SWC_CREATE_OBJECT go_sflight 'SFLIGHT' gs_sflight_key.
* instantiate container
SWC_CREATE_CONTAINER gc_container.
* call method DISPLAY of obj instance GO_SFLIGHT within
* conatiner GC_CONTAINER
SWC_CALL_METHOD go_sflight 'DISPLAY' gc_container.
‎2005 Jun 15 5:40 PM
Please don't define a new include in your function group program.
Just put the include statement
INCLUDE <cntn01>.
in your function group's top include ( XXXTOP include...)...Where you declare global data ...
Cheers,
Ram
‎2005 Jun 16 12:47 PM
Hi Mike
I can't compile this example
I have written:
*&---------------------------------------------------------------------*
*& Module pool ZZZZZTEST *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
include <object>.
* structure to save the key to instantiate SFLIGHT
* ATTENTION: This structure must be filled before
* instantiating the object !!!!
DATA: BEGIN OF gs_sflight_key,
mandt LIKE sflight-mandt,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
END OF gs_sflight_key.
DATA: go_sflight TYPE swc_object.
* generate swc container
SWC_CONTAINER gc_container.
* instantiate object GO_SFLIGHT with key GS_SFLIGHT_KEY
SWC_CREATE_OBJECT go_sflight 'SFLIGHT' gs_sflight_key.
* instantiate container
SWC_CREATE_CONTAINER gc_container. "!!!!!!!!!!!!!
* call method DISPLAY of obj instance GO_SFLIGHT within
* conatiner GC_CONTAINER
SWC_CALL_METHOD go_sflight 'DISPLAY' gc_container.and i have got a compiler message:
"Statement is not accessible "
in line with "!!!!!!!!!!!!!)
I have superseded macros with his code and that works.
I have no idea what exactly should I do to use this macros
Regards
Bogdan
‎2005 Jun 16 12:52 PM
Than do not execute the following line
SWC_CREATE_CONTAINER gc_container.
Just comment it out.
What happens now?!
‎2005 Jun 16 2:21 PM
you might check my last response and try that also.
Further, I am not sure you first wrote the code in a FM and then a module pool..
In case you are doing it in an FM ...
Call the include <cntn01> in your top include along with the global data declaration...
And also that cntn01> is sufficient for your work <object> is not required.
Cheers,
Ram
‎2005 Jun 16 2:49 PM
Hi Ram
excuse me, I have tried with function module and program
In program I can use include at the beginning my code. Where and how should I do that in function group?
Would you like to explain me that exactly?
Regards
Bogdan
‎2005 Jun 16 2:51 PM
‎2005 Jun 16 2:51 PM
You have to include <cntn01> in the top include of your function group!
‎2005 Jun 16 3:03 PM
‎2005 Jun 16 3:04 PM
Why are you stupid?! Was this the cause for your problem?? Really??????
Don´t forget to reward points...
‎2005 Jun 17 8:10 AM
Hi Mike
The reason was lack of include.
And if I am stupid und why hmmmm I think that is not goot subjcet for this forum
Thanks once more for your help.
Bogdan