‎2007 Nov 27 4:36 PM
Hi All,
can any tell me how to export Select-options .This is an object oriented question
include ztest.
select-options : s_werks for marc-werks obligatory,
s_matnr for mara-matnr obligatory.
data : O_object type ref to lcl_test.
start-of-selection.
CREATE OBJECT O_object EXPORTING IM_S_WERKS[] IN S_WERKS[]
IM_S_LGORT[] in s_matnr[].
Above statment is the problem
This is my include ztest.
CLASS lcl_test DEFINITION.
METHODS constructor IMPORTING IMWERKS[] TYPE MARC-WERKS
imLGORT[] TYPE MARD-LGORT.
Above statment is the problem
endclass.
Can anyone tell me how to declare
Thanks
Adi
‎2007 Nov 27 6:41 PM
Basically this is all you need to do.
REPORT rich_0001.
*----------------------------------------------------------------------*
* CLASS lcl_test DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_test DEFINITION.
PUBLIC SECTION.
TYPES: t_datum TYPE RANGE OF sy-datum.
DATA: r_datum TYPE t_datum.
METHODS: constructor IMPORTING im_datum TYPE t_datum.
ENDCLASS. "lcl_test DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_test IMPLEMENTATION.
METHOD constructor.
r_datum = im_datum.
ENDMETHOD. "constructor
ENDCLASS. "lcl_test IMPLEMENTATION
SELECT-OPTIONS: s_datum FOR sy-datum.
DATA : o_object TYPE REF TO lcl_test.
START-OF-SELECTION.
CREATE OBJECT o_object
EXPORTING
im_datum = s_datum[].
Regards,
Rich Heilman
‎2007 Nov 27 5:09 PM
You have to declare local types (e.g. werks_sel_type and lgort_sel_type) that has the same structure of s_werks and lgort_sel_type as a standard table.
CLASS lcl_test DEFINITION.
METHODS constructor IMPORTING imwerks TYPE werks_sel_type.
imLGORT TYPE lgort_sel_type.Then
CREATE OBJECT O_object EXPORTING IM_S_WERKS = S_WERKS
IM_S_LGORT = s_matnr.
I suggest you read the ABAP help for select-options to see how they are actually defined internally.
Also look carefully in the ABAP help for how to declare parameters for constructors and methods. [] is not valid!
matt
‎2007 Nov 27 6:29 PM
Hi Matthew,
I declared like this
types : begin of iwerks ,
SIGN(2) type c,
OPTION(2) type c,
low(4) type c,
high(4) type c,
end of iwerks.
METHODS constructor IMPORTING IM_S_WERKS TYPE iwerks.
start-of-selection.
CREATE OBJECT O_IMARD EXPORTING IM_S_WERKS = S_WERKS.
This one gives me an error
saying im_s_werks is not compatible with s_werks.
Let me know
Thanks
‎2007 Nov 27 6:11 PM
‎2007 Nov 27 6:41 PM
Basically this is all you need to do.
REPORT rich_0001.
*----------------------------------------------------------------------*
* CLASS lcl_test DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_test DEFINITION.
PUBLIC SECTION.
TYPES: t_datum TYPE RANGE OF sy-datum.
DATA: r_datum TYPE t_datum.
METHODS: constructor IMPORTING im_datum TYPE t_datum.
ENDCLASS. "lcl_test DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_test IMPLEMENTATION.
METHOD constructor.
r_datum = im_datum.
ENDMETHOD. "constructor
ENDCLASS. "lcl_test IMPLEMENTATION
SELECT-OPTIONS: s_datum FOR sy-datum.
DATA : o_object TYPE REF TO lcl_test.
START-OF-SELECTION.
CREATE OBJECT o_object
EXPORTING
im_datum = s_datum[].
Regards,
Rich Heilman
‎2007 Nov 27 7:26 PM
Hi Rich,
This is what i have
start-of-selection.
CREATE OBJECT O_IMARD EXPORTING IM_WERKS = S_WERKS[].
CLASS lcl_par DEFINITION.
public section.
TYPES: t_werks TYPE RANGE OF werks.
DATA: r_werks TYPE t_werks.
*types : begin of iwerks ,
*SIGN(2) type c,
*OPTION(2) type c,
*low(4) type c,
*high(4) type c,
*end of iwerks.
METHODS: constructor IMPORTING im_werks TYPE t_werks.
endclass.
CLASS lcl_par implementation.
METHOD constructor.
r_werks = im_werks.
endmethod.
endclass.
My PROGRAM THROWS AN ERROR SAYINGS
S_WERKS IS NOT COMPATABILE WITH IM_WERKS
Let me know whats the issue in here
Thanks
Adi
‎2007 Nov 27 7:32 PM
Hi Rich,
Thanks Your reply solved my issue.
I awarded full points to You
Thanks
Adi