‎2007 Mar 23 8:50 AM
Dear All
As we know deep structures with occurs 0 cannot be declared in Object Oriented context (will give a syntax error). Can some1 please suggest a workaround. I need to declare the following structure in a BADI implementation. But it is a deep structure & gives a syntax error.
BEGIN OF WI
OCCURS 0,
VL TYPE VALUE_DESCRIPTION OCCURS 5,
est_atwrt like ausp-atwrt, "Eingabestring (für EH&S) 4.0c
END OF WI.
Help needed urgently!!
Regards
Sudhir
‎2007 Mar 23 8:58 AM
Declare TYPES statement.
types: BEGIN OF WI,
MINDX LIKE SY-INDEX, "Index Merkmal
WINDX LIKE SY-INDEX, "Index in Datentabelle
WSELE TYPE C, "Kz. selektiert
WOHNE TYPE C, "Kz. ohne Wertedefinition
WWERT TYPE C, "Kz. weitere Werte vorhanden
ATSON TYPE C, "Kz. Sonderwerte erlaubt
ESWRT TYPE C, "Kz. Eingeschränkter Wertebereich
SSTRG TYPE C, "Kz. Stringsuche
STATU TYPE C, "Status
ATWRT LIKE CAWN-ATWRT, "Wert sprachneutral
ATFLV LIKE CAWN-ATFLV, "intern von
ATFLB LIKE CAWN-ATFLB, "intern bis
ATAWE LIKE CAWN-ATAWE, "abw. Einheit
ATAW1 LIKE CAWN-ATAW1, "abw. Einheit bis
ATCOD LIKE CAWN-ATCOD, "Operator-Ident.
ATTLV LIKE CAWN-ATTLV, "Toleranz von
X TYPE C,
ATTLB LIKE CAWN-ATTLB, "Toleranz bis
ATPRZ LIKE CAWN-ATPRZ, "Angabe in %
ATINC LIKE CAWN-ATINC, "Schrittweite
ATAUT LIKE AUSP-ATAUT, "Author
WSDEF LIKE CAWN-ATSTD, "Kz. Std.-Wert
ATZHL LIKE AUSP-ATZHL, "Zähler AUSP
TXTNR LIKE CAWN-TXTNR, "Text-Nr.
WTZHL LIKE CAWN-ATZHL, "Zähler CAWN
AENNR LIKE CAWN-AENNR, "Änderungsnr.
DATUV LIKE CAWN-DATUV, "Datum von aus Änderungsnr.
ATZHH LIKE CAWN-ATZHH, "Hierarchie: ATZHL des Parent
ATWHI LIKE CAWN-ATWHI, "Hierarchie: ATZHL ist Parent
ATVPL LIKE CAWN-ATVPL, "Kz. Vorplanung
NATWRT LIKE CAWN-ATWRT, "Sprachneutraler Wert
CATWRT LIKE CAWN-ATWRT, "CHAR-Wert in DDB
CATFLV LIKE CAWN-ATFLV, "NONCHAR-Wert in DDB
KNOBJ LIKE CAWN-KNOBJ, "Beziehungswissen
KNPRE TYPE C, "KNART: Precondition
KNACT TYPE C, "KNART: Action
KNPRO TYPE C, "KNART: Procedure
VL TYPE table of VALUE_DESCRIPTION
,est_atwrt like ausp-atwrt, "Eingabestring (für EH&S) 4.0c
END OF WI.
types: t_wi type standard table of wi.
data: wa type wi,
t_itab type t_wi.
‎2007 Mar 23 9:05 AM
Hi Buddy
I did try this, but it does not allow me to use a 'type table of" statement inside the types declaration. It gives a syntax error <b>"You cannot use generic type definitions within structures".</b>
‎2007 Mar 26 10:39 AM
Hi Dude,
Try this. Let me know in case u hav any probs..
REPORT zztest_deeptypes .
*--Consider VL TYPE VALUE_DESCRIPTION,
TYPES : BEGIN OF value_description_line,
matnr TYPE mara-matnr,
END OF value_description_line, "Line type
value_description_table TYPE STANDARD TABLE OF value_description_line INITIAL SIZE 0 WITH DEFAULT KEY,"Table type
*--This is my deep structure
BEGIN OF wi_line ,
mtart TYPE mara-mtart,
t_value TYPE value_description_table,
END OF wi_line,
wi_table TYPE STANDARD TABLE OF wi_line INITIAL SIZE 0.
*--Create a data variable
DATA : it_deep TYPE wi_table WITH HEADER LINE,
wa_value TYPE value_description_line.
CLEAR : it_deep[],
it_deep-t_value[],
wa_value.
*--Material type of HALB and Materials as a deep structure
it_deep-mtart = 'HALB'.
wa_value-matnr = 'MATHALB1'.
APPEND wa_value TO it_deep-t_value.
wa_value-matnr = 'MATHALB1'.
APPEND wa_value TO it_deep-t_value.
wa_value-matnr = 'MATHALB2'.
APPEND wa_value TO it_deep-t_value.
APPEND it_deep.
BREAK-POINT.
<b>AS</b>
‎2007 Mar 23 9:01 AM
Hello Sudhir
Define your complex structures using <b>type definitions</b>, e.g.:
TYPES:
ty_s_vl TYPE value_description,
ty_t_vl TYPE STANDARD TABLE OF ty_s_vl
WITH DEFAULT KEY.
TYPES: BEGIN OF ty_s_wi.
TYPES: mindx TYPE sy-index.
TYPES: windx TYPE sy-index.
TYPES: ...
TYPES: vl TYPE ty_t_vl. " table type
TYPES: END OF ty_s_wi.
TYPES: ty_t_wi TYPE STANDARD TABLE OF ty_s_wi
WITH DEFAULT KEY.
DATA:
ls_entry TYPE ty_s_wi,
lt_itab TYPE ty_t_wi.Regards
Uwe
‎2007 Mar 26 10:50 AM
Dear Arun/Arnie
<b>I really apprecitiate all ur effort. But u seem to have failed to notice the actual problem that I am facing.</b>
I know it is simple to declare a deep structure in a report program, absolutely no problem, but I am not able to do so in OO context, i.e. i am not able to create a deep structure in a method. Please address this problem if u can.
Regards
Sudhir
‎2011 Jul 14 9:12 PM
You can define a deep structure as a "type ref to" or as a method data element "importing wi type ty_wi" where ty_wi is your custom type, or "Data wi_tab like line of table_tab" where table_tab is a table type.