Unicode error:a line of internal table and a data object are not mutually c
Hi Friends,
This is the issue in upgradation from 4.6c to ECC6.0
I have an internal table itab which has include structure say 'xyz' . In xyz there is a field of type int4 as third field. I have a field as l_line which is a string.
data : begin of itab occurs 0.
include structure zxyz.
data: end of itab.
data: l_line type string.
In the program I am getting the unicode error as:
" A line of "itab" and "l_line" are not mutually convertible in unicode program." at he following line.
loop at itab into l_line.
endloop.
Thanks,
Ali.
Hi Narendran,
I did the same earlier, but the field l_line is again used in the another line as follows
IF l_line CS w_group.----
(1)
where w_group LIKE zstr-cctr_group.
here zstr-cctr_group is same as one of the fields of structure xyz.
in line 1 it is giving warning as
l_line is incompatible and it must be C,N,D,T or string.
Thanks,
Ali
Similar Messages
-
Error on extend an internal table, but the required space was not available
Hi All,
I am trying to retrieve cost data from COVP tables, as well as the quantity, cost centre, and price unit fields from MSEG / BSEG tables. Thing is, if the AWTYP value in COVP table = 'MKPF', i have to get the data from MSEG, otherwise, I need to get it from BSEG table.
I kept getting this error message:
<i>You attempted to extend an internal table, but the required space was not available.</i>
Anyone have any idea how to make my codes more efficient?
Please help. Thanks!
Regards,
Cecilia
REPORT ZMISCY004.
TABLES : COVP, BSIS, BSEG, MSEG, MAKT, CSKU.
PARAMETERS :
P_FILE(300) DEFAULT '\sapdcdatasaprptoh.txt' LOWER CASE.
DATA MSG_TEXT(50).
DATA :
XKOKRS LIKE COVP-KOKRS,
XBELNR LIKE COVP-BELNR,
XBUZEI LIKE COVP-BUZEI,
XGJAHR LIKE COVP-GJAHR,
XPERIO LIKE COVP-PERIO,
XWKGBTR LIKE COVP-WKGBTR,
XWTGBTR LIKE COVP-WTGBTR,
XREFBN LIKE COVP-REFBN,
XREFBZ LIKE COVP-REFBZ,
XKSTAR LIKE COVP-KSTAR,
XBEKNZ LIKE COVP-BEKNZ,
XMATNR LIKE COVP-MATNR,
XBUKRS LIKE COVP-BUKRS,
XREFGJ LIKE COVP-REFGJ,
XREFBK LIKE COVP-REFBK,
XLTEXT LIKE CSKU-LTEXT,
XMAKTX LIKE MAKT-MAKTX,
XAWTYP LIKE COVP-AWTYP,
XTWAER LIKE COVP-TWAER,
XSGTXT LIKE COVP-SGTXT,
BSEG_KOSTL LIKE BSEG-KOSTL,
BSEG_MEINS LIKE BSEG-MEINS,
BSEG_MENGE LIKE BSEG-MENGE,
MSEG_KOSTL LIKE MSEG-KOSTL,
MSEG_MENGE LIKE MSEG-MENGE,
MSEG_MEINS LIKE MSEG-MEINS.
DATA : BEGIN OF ITAB_COVP OCCURS 10,
KOKRS LIKE COVP-KOKRS,
BELNR LIKE COVP-BELNR,
BUZEI LIKE COVP-BUZEI,
GJAHR LIKE COVP-GJAHR,
PERIO LIKE COVP-PERIO,
WKGBTR(15) TYPE C,
WTGBTR(15) TYPE C,
REFBN LIKE COVP-REFBN,
REFBZ(3) TYPE C,
KSTAR LIKE COVP-KSTAR,
BEKNZ LIKE COVP-BEKNZ,
MATNR LIKE COVP-MATNR,
BUKRS LIKE COVP-BUKRS,
REFGJ LIKE COVP-REFGJ,
REFBK LIKE COVP-REFBK,
LTEXT LIKE CSKU-LTEXT,
MAKTX LIKE MAKT-MAKTX,
AWTYP LIKE COVP-AWTYP,
TWAER LIKE COVP-TWAER,
SGTXT LIKE COVP-SGTXT,
BSIS_WRBTR(13) TYPE C,
BSEG_KOSTL LIKE BSEG-KOSTL,
BSEG_MEINS LIKE BSEG-MEINS,
BSEG_MENGE LIKE BSEG-MENGE,
MSEG_KOSTL LIKE MSEG-KOSTL,
MSEG_MENGE LIKE MSEG-MENGE,
MSEG_MEINS LIKE MSEG-MEINS.
DATA : END OF ITAB_COVP.
SELECT M1~KOKRS
M1~BELNR
M1~BUZEI
M1~GJAHR
M1~PERIO
M1~WKGBTR
M1~WTGBTR
M1~REFBN
M1~REFBZ
M1~KSTAR
M1~BEKNZ
M1~MATNR
M1~BUKRS
M1~REFGJ
M1~REFBK
M1~AWTYP
M1~TWAER
M1~SGTXT
M4~KOSTL
M4~MENGE
M4~MEINS
INTO (XKOKRS,
XBELNR,
XBUZEI,
XGJAHR,
XPERIO,
XWKGBTR,
XWTGBTR,
XREFBN,
XREFBZ,
XKSTAR,
XBEKNZ,
XMATNR,
XBUKRS,
XREFGJ,
XREFBK,
XAWTYP,
XTWAER,
XSGTXT,
MSEG_KOSTL,
MSEG_MENGE,
MSEG_MEINS
FROM COVP AS M1
LEFT OUTER JOIN MSEG AS M4
ON M1~REFBN = M4~MBLNR AND M1~REFBZ = M4~ZEILE AND M1~REFGJ = M4~MJAHR
WHERE M1~SCOPE = 'OCOST' AND M1~AWTYP = 'BKPF'
OR M1~SCOPE = 'OCOST' AND M1~AWTYP = 'MKPF'
OR M1~KSTAR = '972022'.
IF XAWTYP = 'BKPF'.
SELECT KOSTL MENGE MEINS INTO (BSEG_KOSTL, BSEG_MENGE, BSEG_MEINS) FROM
BSEG WHERE BELNR = XREFBN AND BUZEI = XREFBZ AND GJAHR = XREFGJ AND
BUKRS = XREFBK.
ENDSELECT.
MOVE BSEG-KOSTL TO BSEG_KOSTL.
MOVE BSEG-MEINS TO BSEG_MEINS.
MOVE BSEG-MENGE TO BSEG_MENGE.
ELSE.
MOVE ' ' TO BSEG_KOSTL.
MOVE ' ' TO BSEG_MEINS.
MOVE ' ' TO BSEG_MENGE.
ENDIF.
*GET LTEST
SELECT LTEXT INTO XLTEXT
FROM CSKU
WHERE KTOPL = 'COAA' AND SPRAS = 'EN'.
*GET MAKTX
IF XMATNR <> ' '.
SELECT SINGLE * FROM MAKT WHERE MATNR = XMATNR.
MOVE MAKT-MAKTX TO XMAKTX.
ELSE.
MOVE ' ' TO XMAKTX.
ENDIF.
MOVE : XKOKRS TO ITAB_COVP-KOKRS,
XBELNR TO ITAB_COVP-BELNR,
XBUZEI TO ITAB_COVP-BUZEI,
XGJAHR TO ITAB_COVP-GJAHR,
XPERIO TO ITAB_COVP-PERIO,
XWKGBTR TO ITAB_COVP-WKGBTR,
XWTGBTR TO ITAB_COVP-WTGBTR,
XREFBN TO ITAB_COVP-REFBN,
XREFBZ TO ITAB_COVP-REFBZ,
XKSTAR TO ITAB_COVP-KSTAR,
XBEKNZ TO ITAB_COVP-BEKNZ,
XMATNR TO ITAB_COVP-MATNR,
XBUKRS TO ITAB_COVP-BUKRS,
XREFGJ TO ITAB_COVP-REFGJ,
XREFBK TO ITAB_COVP-REFBK,
XLTEXT TO ITAB_COVP-LTEXT,
XMAKTX TO ITAB_COVP-MAKTX,
XAWTYP TO ITAB_COVP-AWTYP,
XTWAER TO ITAB_COVP-TWAER,
XSGTXT TO ITAB_COVP-SGTXT,
BSEG_KOSTL TO ITAB_COVP-BSEG_KOSTL,
BSEG_MEINS TO ITAB_COVP-BSEG_MEINS,
BSEG_MENGE TO ITAB_COVP-BSEG_MENGE,
MSEG_KOSTL TO ITAB_COVP-MSEG_KOSTL,
MSEG_MENGE TO ITAB_COVP-MSEG_MENGE,
MSEG_MEINS TO ITAB_COVP-MSEG_MEINS.
APPEND ITAB_COVP.
CLEAR ITAB_COVP.
ENDSELECT.
ENDSELECT.
OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC NE 0.
WRITE: 'File cannot be opened. Reason:', MSG_TEXT.
EXIT.
ENDIF.
LOOP AT ITAB_COVP.
TRANSFER ITAB_COVP TO P_FILE.
ENDLOOP.
CLOSE DATASET P_FILE.Cecilia - I think your problemn is a nested select:
*GET LTEST
SELECT ltext INTO xltext
FROM csku
WHERE ktopl = 'COAA' AND spras = 'EN'.
*GET MAKTX
IF xmatnr <> ' '.
SELECT SINGLE * FROM makt WHERE matnr = xmatnr.
MOVE makt-maktx TO xmaktx.
ELSE.
MOVE ' ' TO xmaktx.
ENDIF.
MOVE : xkokrs TO itab_covp-kokrs,
etc.
mseg_meins TO itab_covp-mseg_meins.
APPEND itab_covp.
CLEAR itab_covp.
ENDSELECT.
Do you need to do the inner select for every cost element text?
Rob -
i updated my OS on macbook pro 13inch from mountain lion v10.8.4 to mountain lion v10.8.5 and when i played songs on itunes there was no sound from the speakers, when i plugged in my earphones there was still no sound. i restarted my mac a few times but still it did not help. I need to get my speakers started soon. Please help
Have you tried a PRAM reset?
http://support.apple.com/kb/ht1379
Ciao. -
Hi,
I am a beginer. I know how to create a structure and how to create an internal table using ABAP/4. My problem is, i don't understand where to use internal table and structure, also i find myself very confused about the explicit work areas.
Plese someone show me a program by explaining all of this clearly.Hi
Internal tables are the core of ABAP. They are like soul of a body. For any program we use
internal tables extensively. We can use Internal tables like normal data base tables only, but the
basic difference is the memory allocated for internal tables is temporary. Once the program is
closed the memory allocated for internal tables will also be out of memory.
But while using the internal tables, there are many performance issues to be considered. i.e which
type of internal table to be used for the program..like standard internal table, hashed internal
table or sorted internal table etc..
Internal tables
Internal tables provide a means of taking data from a fixed structure and storing it in working memory in ABAP. The data is stored line by
line in memory, and each line has the same structure. In ABAP, internal tables fulfill the function of arrays. Since they are dynamic data
objects, they save the programmer the task of dynamic memory management in his or her programs. You should use internal tables
whenever you want to process a dataset with a fixed structure within a program. A particularly important use for internal tables is for
storing and formatting data from a database table within a program. They are also a good way of including very complicated data
structures in an ABAP program.
Like all elements in the ABAP type concept, internal tables can exist both as data types and as data objects A data type is the abstract
description of an internal table, either in a program or centrally in the ABAP Dictionary, that you use to create a concrete data object. The
data type is also an attribute of an existing data object.
Internal Tables as Data Types
Internal tables and structures are the two structured data types in ABAP. The data type of an internal table is fully specified by its line type,
key, and table type.
Line type
The line type of an internal table can be any data type. The data type of an internal table is normally a structure. Each component of the
structure is a column in the internal table. However, the line type may also be elementary or another internal table.
Key
The key identifies table rows. There are two kinds of key for internal tables - the standard key and a user-defined key. You can specify
whether the key should be UNIQUE or NON-UNIQUE. Internal tables with a unique key cannot contain duplicate entries. The uniqueness
depends on the table access method.
If a table has a structured line type, its default key consists of all of its non-numerical columns that are not references or themselves
internal tables. If a table has an elementary line type, the default key is the entire line. The default key of an internal table whose line type
is an internal table, the default key is empty.
The user-defined key can contain any columns of the internal table that are not references or themselves internal tables. Internal tables
with a user-defined key are called key tables. When you define the key, the sequence of the key fields is significant. You should remember
this, for example, if you intend to sort the table according to the key.
Table type
The table type determines how ABAP will access individual table entries. Internal tables can be divided into three types:
Standard tables have an internal linear index. From a particular size upwards, the indexes of internal tables are administered as trees. In
this case, the index administration overhead increases in logarithmic and not linear relation to the number of lines. The system can access
records either by using the table index or the key. The response time for key access is proportional to the number of entries in the table.
The key of a standard table is always non-unique. You cannot specify a unique key. This means that standard tables can always be filled
very quickly, since the system does not have to check whether there are already existing entries.
Sorted tables are always saved sorted by the key. They also have an internal index. The system can access records either by using the
table index or the key. The response time for key access is logarithmically proportional to the number of table entries, since the system
uses a binary search. The key of a sorted table can be either unique or non-unique. When you define the table, you must specify whether
the key is to be unique or not. Standard tables and sorted tables are known generically as index tables.
Hashed tables have no linear index. You can only access a hashed table using its key. The response time is independent of the number of
table entries, and is constant, since the system access the table entries using a hash algorithm. The key of a hashed table must be unique.
When you define the table, you must specify the key as UNIQUE.
Generic Internal Tables
Unlike other local data types in programs, you do not have to specify the data type of an internal table fully. Instead, you can specify a
generic construction, that is, the key or key and line type of an internal table data type may remain unspecified. You can use generic
internal tables to specify the types of field symbols and the interface parameters of procedures . You cannot use them to declare data
objects.
Internal Tables as Dynamic Data Objects
Data objects that are defined either with the data type of an internal table, or directly as an internal table, are always fully defined in
respect of their line type, key and access method. However, the number of lines is not fixed. Thus internal tables are dynamic data objects,
since they can contain any number of lines of a particular type. The only restriction on the number of lines an internal table may contain are
the limits of your system installation. The maximum memory that can be occupied by an internal table (including its internal administration)
is 2 gigabytes. A more realistic figure is up to 500 megabytes. An additional restriction for hashed tables is that they may not contain more
than 2 million entries. The line types of internal tables can be any ABAP data types - elementary, structured, or internal tables. The
individual lines of an internal table are called table lines or table entries. Each component of a structured line is called a column in the
internal table.
Choosing a Table Type
The table type (and particularly the access method) that you will use depends on how the typical internal table operations will be most
frequently executed.
Standard tables
This is the most appropriate type if you are going to address the individual table entries using the index. Index access is the quickest
possible access. You should fill a standard table by appending lines (ABAP APPEND statement), and read, modify and delete entries by
specifying the index (INDEX option with the relevant ABAP command). The access time for a standard table increases in a linear relationship
with the number of table entries. If you need key access, standard tables are particularly useful if you can fill and process the table in
separate steps. For example, you could fill the table by appending entries, and then sort it. If you use the binary search option with key
access, the response time is logarithmically proportional to the number of table entries.
Sorted tables
This is the most appropriate type if you need a table which is sorted as you fill it. You fill sorted tables using the INSERT statement. Entries
are inserted according to the sort sequence defined through the table key. Any illegal entries are recognized as soon as you try to add
them to the table. The response time for key access is logarithmically proportional to the number of table entries, since the system always
uses a binary search. Sorted tables are particularly useful for partially sequential processing in a LOOP if you specify the beginning of the
table key in the WHERE condition.
Hashed tables
This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index.
The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always
have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for
processing large amounts of data.
Creating Internal Tables
Like other elements in the ABAP type concept, you can declare internal tables as abstract data
types in programs or in the ABAP Dictionary, and then use them to define data objects.
Alternatively, you can define them directly as data objects. When you create an internal table as a
data object, you should ensure that only the administration entry which belongs to an internal
table is declared statically. The minimum size of an internal table is 256 bytes. This is important if an
internal table occurs as a component of an aggregated data object, since even empty internal
tables within tables can lead to high memory usage. (In the next functional release, the size of the
table header for an initial table will be reduced to 8 bytes). Unlike all other ABAP data objects, you
do not have to specify the memory required for an internal table. Table rows are added to and
deleted from the table dynamically at runtime by the various statements for adding and deleting
records.
You can create internal tables in different types.
You can create standard internal table and then make it sort in side the program.
The same way you can change to hashed internal tables also.
There will be some performance issues with regard to standard internal tables/ hashed internal
tables/ sorted internal tables.
Internal table types
This section describes how to define internal tables locally in a program. You can also define internal tables globally as data types in the
ABAP Dictionary.
Like all local data types in programs , you define internal tables using the TYPES statement. If you do not refer to an existing table type
using the TYPE or LIKE addition, you can use the TYPES statement to construct a new local internal table in your program.
TYPES <t> TYPE|LIKE <tabkind> OF <linetype> [WITH <key>]
[INITIAL SIZE <n>].
After TYPE or LIKE, there is no reference to an existing data type. Instead, the type constructor occurs:
<tabkind> OF <linetype> [WITH <key>]
The type constructor defines the table type <tabkind>, the line type <linetype>, and the key <key> of the internal table <t>.
You can, if you wish, allocate an initial amount of memory to the internal table using the INITIAL SIZE addition.
Table type
You can specify the table type <tabkind> as follows:
Generic table types
INDEX TABLE
For creating a generic table type with index access.
ANY TABLE
For creating a fully-generic table type.
Data types defined using generic types can currently only be used for field symbols and for interface parameters in procedures . The generic
type INDEX TABLE includes standard tables and sorted tables. These are the two table types for which index access is allowed. You cannot
pass hashed tables to field symbols or interface parameters defined in this way. The generic type ANY TABLE can represent any table. You
can pass tables of all three types to field symbols and interface parameters defined in this way. However, these field symbols and
parameters will then only allow operations that are possible for all tables, that is, index operations are not allowed.
Fully-Specified Table Types
STANDARD TABLE or TABLE
For creating standard tables.
SORTED TABLE
For creating sorted tables.
HASHED TABLE
For creating hashed tables.
Fully-specified table types determine how the system will access the entries in the table in key operations. It uses a linear search for
standard tables, a binary search for sorted tables, and a search using a hash algorithm for hashed tables.
Line type
For the line type <linetype>, you can specify:
Any data type if you are using the TYPE addition. This can be a predefined ABAP type, a local type in the program, or a data type from the
ABAP Dictionary. If you specify any of the generic elementary types C, N, P, or X, any attributes that you fail to specify (field length, number
of decimal places) are automatically filled with the default values. You cannot specify any other generic types.
Any data object recognized within the program at that point if you are using the LIKE addition. The line type adopts the fully-specified data
type of the data object to which you refer. Except for within classes, you can still use the LIKE addition to refer to database tables and
structures in the ABAP Dictionary (for compatibility reasons).
All of the lines in the internal table have the fully-specified technical attributes of the specified data type.
Key
You can specify the key <key> of an internal table as follows:
[UNIQUE|NON-UNIQUE] KEY <col1> ... <col n>
In tables with a structured line type, all of the components <coli> belong to the key as long as they are not internal tables or references,
and do not contain internal tables or references. Key fields can be nested structures. The substructures are expanded component by
component when you access the table using the key. The system follows the sequence of the key fields.
[UNIQUE|NON-UNIQUE] KEY TABLE LINE
If a table has an elementary line type (C, D, F, I, N, P, T, X), you can define the entire line as the key. If you try this for a table whose line
type is itself a table, a syntax error occurs. If a table has a structured line type, it is possible to specify the entire line as the key. However,
you should remember that this is often not suitable.
[UNIQUE|NON-UNIQUE] DEFAULT KEY
This declares the fields of the default key as the key fields. If the table has a structured line type, the default key contains all non-numeric
columns of the internal table that are not and do not contain references or internal tables. If the table has an elementary line type, the
default key is the entire line. The default key of an internal table whose line type is an internal table, the default key is empty.
Specifying a key is optional. If you do not specify a key, the system defines a table type with an arbitrary key. You can only use this to
define the types of field symbols and the interface parameters of procedures . For exceptions, refer to Special Features of Standard Tables.
The optional additions UNIQUE or NON-UNIQUE determine whether the key is to be unique or non-unique, that is, whether the table can
accept duplicate entries. If you do not specify UNIQUE or NON-UNIQUE for the key, the table type is generic in this respect. As such, it can
only be used for specifying types. When you specify the table type simultaneously, you must note the following restrictions:
You cannot use the UNIQUE addition for standard tables. The system always generates the NON-UNIQUE addition automatically.
You must always specify the UNIQUE option when you create a hashed table.
Initial Memory Requirement
You can specify the initial amount of main memory assigned to an internal table object when you define the data type using the following
addition:
INITIAL SIZE <n>
This size does not belong to the data type of the internal table, and does not affect the type check. You can use the above addition to
reserve memory space for <n> table lines when you declare the table object.
When this initial area is full, the system makes twice as much extra space available up to a limit of 8KB. Further memory areas of 12KB each
are then allocated.
You can usually leave it to the system to work out the initial memory requirement. The first time you fill the table, little memory is used. The
space occupied, depending on the line width, is 16 <= <n> <= 100.
It only makes sense to specify a concrete value of <n> if you can specify a precise number of table entries when you create the table and
need to allocate exactly that amount of memory (exception: Appending table lines to ranked lists). This can be particularly important for
deep-structured internal tables where the inner table only has a few entries (less than 5, for example).
To avoid excessive requests for memory, large values of <n> are treated as follows: The largest possible value of <n> is 8KB divided by the
length of the line. If you specify a larger value of <n>, the system calculates a new value so that n times the line width is around 12KB.
Examples
TYPES: BEGIN OF LINE,
COLUMN1 TYPE I,
COLUMN2 TYPE I,
COLUMN3 TYPE I,
END OF LINE.
TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1.
The program defines a table type ITAB. It is a sorted table, with line type of the structure LINE and a unique key of the component
COLUMN1.
TYPES VECTOR TYPE HASHED TABLE OF I WITH UNIQUE KEY TABLE LINE.
TYPES: BEGIN OF LINE,
COLUMN1 TYPE I,
COLUMN2 TYPE I,
COLUMN3 TYPE I,
END OF LINE.
TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1.
TYPES: BEGIN OF DEEPLINE,
FIELD TYPE C,
TABLE1 TYPE VECTOR,
TABLE2 TYPE ITAB,
END OF DEEPLINE.
TYPES DEEPTABLE TYPE STANDARD TABLE OF DEEPLINE
WITH DEFAULT KEY.
The program defines a table type VECTOR with type hashed table, the elementary line type I and a unique key of the entire table line. The
second table type is the same as in the previous example. The structure DEEPLINE contains the internal table as a component. The table
type DEEPTABLE has the line type DEEPLINE. Therefore, the elements of this internal table are themselves internal tables. The key is the
default key - in this case the column FIELD. The key is non-unique, since the table is a standard table.
Internal table objects
Internal tables are dynamic variable data objects. Like all variables, you declare them using the DATA statement. You can also declare static
internal tables in procedures using the STATICS statement, and static internal tables in classes using the CLASS-DATA statement. This
description is restricted to the DATA statement. However, it applies equally to the STATICS and CLASS-DATA statements.
Reference to Declared Internal Table Types
Like all other data objects, you can declare internal table objects using the LIKE or TYPE addition of the DATA statement.
DATA <itab> TYPE <type>|LIKE <obj> [WITH HEADER LINE].
Here, the LIKE addition refers to an existing table object in the same program. The TYPE addition can refer to an internal type in the
program declared using the TYPES statement, or a table type in the ABAP Dictionary.
You must ensure that you only refer to tables that are fully typed. Referring to generic table types (ANY TABLE, INDEX TABLE) or not
specifying the key fully is not allowed (for exceptions, refer to Special Features of Standard Tables).
The optional addition WITH HEADER line declares an extra data object with the same name and line type as the internal table. This data
object is known as the header line of the internal table. You use it as a work area when working with the internal table (see Using the
Header Line as a Work Area). When you use internal tables with header lines, you must remember that the header line and the body of the
table have the same name. If you have an internal table with header line and you want to address the body of the table, you must indicate
this by placing brackets after the table name (<itab>[]). Otherwise, ABAP interprets the name as the name of the header line and not of the
body of the table. You can avoid this potential confusion by using internal tables without header lines. In particular, internal tables nested
in structures or other internal tables must not have a header line, since this can lead to ambiguous expressions.
TYPES VECTOR TYPE SORTED TABLE OF I WITH UNIQUE KEY TABLE LINE.
DATA: ITAB TYPE VECTOR,
JTAB LIKE ITAB WITH HEADER LINE.
MOVE ITAB TO JTAB. <- Syntax error!
MOVE ITAB TO JTAB[].
The table object ITAB is created with reference to the table type VECTOR. The table object JTAB has the same data type as ITAB. JTAB also
has a header line. In the first MOVE statement, JTAB addresses the header line. Since this has the data type I, and the table type of ITAB
cannot be converted into an elementary type, the MOVE statement causes a syntax error. The second MOVE statement is correct, since
both operands are table objects.
Declaring New Internal Tables
You can use the DATA statement to construct new internal tables as well as using the LIKE or TYPE addition to refer to existing types or
objects. The table type that you construct does not exist in its own right; instead, it is only an attribute of the table object. You can refer to
it using the LIKE addition, but not using TYPE. The syntax for constructing a table object in the DATA statement is similar to that for defining
a table type in the TYPES statement.
DATA <itab> TYPE|LIKE <tabkind> OF <linetype> WITH <key>
[INITIAL SIZE <n>]
[WITH HEADER LINE].
As when you define a table type , the type constructor
<tabkind> OF <linetype> WITH <key>
defines the table type <tabkind>, the line type <linekind>, and the key <key> of the internal table <itab>. Since the technical attributes of
data objects are always fully specified, the table must be fully specified in the DATA statement. You cannot create generic table types (ANY
TABLE, INDEX TABLE), only fully-typed tables (STANDARD TABLE, SORTED TABLE, HASHED TABLE). You must also specify the key and whether
it is to be unique (for exceptions, refer to Special Features of Standard Tables).
As in the TYPES statement, you can, if you wish, allocate an initial amount of memory to the internal table using the INITIAL SIZE addition.
You can create an internal table with a header line using the WITH HEADER LINE addition. The header line is created under the same
conditions as apply when you refer to an existing table type.
DATA ITAB TYPE HASHED TABLE OF SPFLI
WITH UNIQUE KEY CARRID CONNID.
The table object ITAB has the type hashed table, a line type corresponding to the flat structure SPFLI from the ABAP Dictionary, and a
unique key with the key fields CARRID and CONNID. The internal table ITAB can be regarded as an internal template for the database table
SPFLI. It is therefore particularly suitable for working with data from this database table as long as you only access it using the key. -
Posting date in AFRU and 2lis_04_p_arbpl data source is not matching
Hi Experts,
We are facing an issue with 2LIS_04_P_ARBPL data source, posting date in AFRU table and in data source is not matching.
For example: we booked an activity confirmation of value 100 on 01.01.2015 posting date, Counter 1, Operation 10
For the same operation another counter is confirmed on 01.02.2015 posting date.
So, in AFRU table:
Prod Order Operation Confirmation Number Counter PostingDate Activity
1001 10 8001 1 01.01.2015 100
1001 10 8001 2 01.02.2015 0
In 2lis_04_p_arbpl data source, counter field is missing due to which only 1 record is coming which is:
Prod Order Operation Confirmation Number Counter PostingDate Activity
1001 10 8001 1 01.02.2015 100
In data source, activity of value 100 is coming on 01.02.2015 date instead in AFRU table it is booked on 01.01.2015 posting date by which we are unable to match the value in query which is based on posting date.
Please help on this.
Thanks,
SameerHi Sameer,
Please check on which date the production order has status as "completed".
It could be on 01.02.2015.
Thanks,
Vimal -
Getting error of Defining an internal table with header line, SELECT-OPTIO
Hi all,
i have a coding for my smart form,In this coding i have define an structure which being used,but when i execute it it give me
error of Defining an internal table with header line, SELECT-OPTIONS, and RANGES is not allowed within a structure.Even tough you can see that in my coding im not using SELECT-OPTION or RANGES,but can't understand why it gives me this error.
Following are the code:
DATA: BEGIN OF traptab OCCURS 50.
INCLUDE STRUCTURE mseg.
DATA: vgart LIKE mkpf-vgart,
blart LIKE mkpf-blart,
blaum LIKE mkpf-blaum,
bldat LIKE mkpf-bldat,
budat LIKE mkpf-budat,
cpudt LIKE mkpf-cpudt,
cputm LIKE mkpf-cputm,
aedat LIKE mkpf-aedat,
usnam LIKE mkpf-usnam,
tcode LIKE mkpf-tcode,
xblnr LIKE mkpf-xblnr,
bktxt LIKE mkpf-bktxt,
frath LIKE mkpf-frath,
frbnr LIKE mkpf-frbnr,
wever LIKE mkpf-wever,
END OF traptab.
Thanks & Regards,
sappk25thanks
-
Loop at internal table and get the right line
Hi,
I've a table like this sorted by material1 and date.
Material 1...Date..........Material 2...Stock
A1.............01/01/08........A2..........100
A1.............01/01/07........A2..........150
B1.............01/05/08........B1..........50
B1.............01/03/07........B2..........100
B1.............01/02/07........B3..........75
I need to put in another table only the line for material1 which has the highest date.
For this example, line 1 and 3 should be selected.
Can anyone tell me how to code this??
Thanks.Hi tarick,
Try this,,
Create another internal table itab2 of type itab1 and copy all entries of itab1 to itab2.
itab2[] = itab1[].
Now delete adjacent duplicates from itab2 comparing material1.
DELETE ADJACENT DUPLICATES FROM itab2 comparing material1.
Effect
Deletes adjacent duplicate entries from the internal table itab2. If there are n duplicate entries in succession, the first entry is retained, and the following n-1 entries are deleted.
Reward Points if Helpful.
Regards,
Sachin M M -
Error occured in moving internal tables
Hi i have a doubt in internal tables
Actually i have created a internal table(rtab_alv ) for the output in the format of alv grid and after that i had created another internal table as iznew1 in which i had transfered all the values of a database view(znew1) into that internal table iznew1 after that while i was trying to move the values of iznew1 to rtab_alv its not accepting it was showing an error as
<b>rtab_alv and iznew1 are not mutually convertible in a unicode program</b>
so can u explain me what is the possible error in this and how to resolve it
solution will be rewarded pointsHi Mr. Sadiqui
By following your procedure an error has occured as
below field are coming from database view and i m passing view data into iznew1
fields of iznew1
LIFNR LIKE EKKO-LIFNR,
EBELN LIKE EKKO-EBELN,
VGABE LIKE EKBE-VGABE,
EBELP LIKE EKBE-EBELP,
BELNR LIKE EKBE-BELNR,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
KOSTL LIKE EKKN-KOSTL,
NAME1 LIKE LFA1-NAME1,
NAME2 LIKE LFA1-NAME2,
WERKS LIKE EKPO-WERKS,
NETWR LIKE EKPO-NETWR,
KNUMV LIKE EKKO-KNUMV,
GJAHR LIKE EKBE-GJAHR,
and now i want to pass
one field ED1 which i hase calculated separatly and i want to pass this value into iznew1
but error is coming that iznew1 is a table with out header line has no component like ED1.
so how can i pass calculated value to internal table iznew1, -
Time out error 1.6 million internal table fields are computed using FMs
Hi , All ...
The Report running fine in server with less 300 record but ...production server which has 1.6 million record it gives error as time-out error and takes hell amount of time.
Please suggest ugently ..
I have tried few things
Internal table having 1.6 lacs ... fields to compute .. i have token in a batch
loop at i_cinfo into s_cinfo from 1 to 100000.
and so on ...also applied all the performace related .. like indexs, work areas , deleting adjacent duplicates , for all entries ..wherever applicable.
Please Suggest .
Report is as below
REPORT ZUSOTCBD_CREDIT_REPORT .
TABLES : KNA1, " General Data Customer Master
KNB1, " Customer Master (Company Code)
KNC1, " Customer master (transaction figures)
KNKK, " Customer master credit management: Control area data
T009, " Fiscal Year Variants P
T009Y, " Shortened fiscal years in Asset Accounting P
T001, " Co. Codes
T001CM, " Permitted Credit Control Areas per Company Code
RF42B, " Structure to hold credit data.
RF035, " Structure to hold credit managment fields
RF02L, " Structure to hold credit data.
TRAS, " Interval for Days in Arrears P
T000CM. " Data for DSO calculation.
Types
TYPES:
BEGIN OF type_final,
string(50) TYPE c, " String Value for Title
END OF type_final.
data:wa_final TYPE type_final. " Work Area to hold Title Data
DATA: RASID TYPE RF035-RASID value 'R03N'. " For Days in interval
DATA: MONAT(2) TYPE N.
DATA: GJAHR TYPE KNC1-GJAHR.
DATA: LD_PERIODS(32) TYPE N
VALUE '01020304050607080910111213141516'.
DATA sytabix type sy-tabix.
DATA LAND TYPE KNA1-LAND1 VALUE 'US'. " Country Key
DATA: LD_PERIOD TYPE BSID-MONAT, " Fiscal Year Variant
LD_GJAHR TYPE KNC1-GJAHR,
LD_COUNTER TYPE SY-TABIX.
Internal Tables
Internal table to hold Title Data *
DATA:
i_final TYPE STANDARD TABLE OF type_final.
**Internal Table Permitted Credit Control Areas per Company Code
DATA: BEGIN OF TCMTAB OCCURS 10.
INCLUDE STRUCTURE T001CM.
DATA: END OF TCMTAB.
*Internal table to store Customer no.
DATA : BEGIN OF ICUST OCCURS 0,
KUNNR TYPE KNA1-KUNNR, " Customer No.
END OF ICUST.
DATA: BEGIN OF BUKTAB OCCURS 20,
KKBER LIKE T001-KKBER, " Credit Control Area
BUKRS LIKE T001-BUKRS, " Co. Code
WAERS LIKE T001-WAERS, " Currency
PERIV LIKE T001-PERIV, " Fiscal Year Variant
BUTXT LIKE T001-BUTXT,
END OF BUKTAB.
Internal Table to store Fiscal year Data .
DATA: BEGIN OF GJATAB OCCURS 5,
PERIV LIKE T001-PERIV, " Fiscal Year Variant
GJAHR LIKE KNC1-GJAHR, " Fiscal Year
MONAT LIKE T009-ANZBP, "
ANZBP LIKE T009-ANZBP, " Number of posting periods
END OF GJATAB.
*Main Output internal table to be used to store credit history Information
DATA : BEGIN OF I_CINFO occurs 0,
KUNNR TYPE KNB1-KUNNR, " Customer
KNKLI TYPE KNKK-KNKLI, " Customer's account number with credit limit reference
KKBER TYPE KNKK-KKBER, " Credit Control Area
CTLPC TYPE KNKK-CTLPC, " Risk Category
KLIMK TYPE KNKK-KLIMK, " Credit Limit
SBGRP TYPE KNKK-SBGRP, " Credit representative group for credit management
ERDAT TYPE KNKK-ERDAT, " Created On
DTREV TYPE KNKK-DTREV, " Last Internal Review
REVDB TYPE KNKK-REVDB, " Last External Review
SALDO TYPE RF42B-SALDO, " Balance
DSOIN TYPE RF02L-DSOIN, " DSO
H06SA TYPE RF035-H06SA, " Highest Balance at the end of 6 Months
H06JA TYPE RF035-H06JA, " Year highest Balance 6 Months
H06MO TYPE RF035-H06MO, " Month OF hihest Balance 6 Months
H12SA TYPE RF035-H12SA, " Highest Balance at the end of 12 Months
H12JA TYPE RF035-H12JA, " Year highest Balance 12 Months
H12MO TYPE RF035-H12MO, " Month OF hihest Balance 12 Months
UMP2U TYPE RF42B-UMP2U, " Sales from the current Year
UMP1U TYPE RF42B-UMP1U, " Sales from the Previous Year
SFAEL TYPE RF035-SFAEL, " Total Past Due Open Item
SFAE1 TYPE RF035-SFAE1, " Aging buckets 0-15
SFAE2 TYPE RF035-SFAE2, " Aging buckets 16-30
SFAE3 TYPE RF035-SFAE3, " Aging buckets 31-60
SFAE4 TYPE RF035-SFAE4, " Aging buckets 60-90
SFAE5 TYPE RF035-SFAE5, " Aging buckets Over 90
END Of I_CINFO.
DATA : BEGIN OF S_CINFO ,
KUNNR TYPE KNB1-KUNNR, " Customer
KNKLI TYPE KNKK-KNKLI, " Customer's account number with credit limit reference
KKBER TYPE KNKK-KKBER, " Credit Control Area
CTLPC TYPE KNKK-CTLPC, " Risk Category
KLIMK TYPE KNKK-KLIMK, " Credit Limit
SBGRP TYPE KNKK-SBGRP, " Credit representative group for credit management
ERDAT TYPE KNKK-ERDAT, " Created On
DTREV TYPE KNKK-DTREV, " Last Internal Review
REVDB TYPE KNKK-REVDB, " Last External Review
SALDO TYPE RF42B-SALDO, " Balance
DSOIN TYPE RF02L-DSOIN, " DSO
H06SA TYPE RF035-H06SA, " Highest Balance at the end of 6 Months
H06JA TYPE RF035-H06JA, " Year highest Balance 6 Months
H06MO TYPE RF035-H06MO, " Month OF hihest Balance 6 Months
H12SA TYPE RF035-H12SA, " Highest Balance at the end of 12 Months
H12JA TYPE RF035-H12JA, " Year highest Balance 12 Months
H12MO TYPE RF035-H12MO, " Month OF hihest Balance 12 Months
UMP2U TYPE RF42B-UMP2U, " Sales from the current Year
UMP1U TYPE RF42B-UMP1U, " Sales from the Previous Year
SFAEL TYPE RF035-SFAEL, " Total Past Due Open Item
SFAE1 TYPE RF035-SFAE1, " Aging buckets 0-15
SFAE2 TYPE RF035-SFAE2, " Aging buckets 16-30
SFAE3 TYPE RF035-SFAE3, " Aging buckets 31-60
SFAE4 TYPE RF035-SFAE4, " Aging buckets 60-90
SFAE5 TYPE RF035-SFAE5, " Aging buckets Over 90
END Of s_cinfo.
*Internal table to hold month-wise balance.
DATA: BEGIN OF SALTAB OCCURS 12,
LNUMM(2) TYPE N, " Month
SALDO LIKE RF42B-SALDO, " Balance
END OF SALTAB.
*Internal table used for computing the Balance fields
DATA: BEGIN OF SALDO,
UML01 LIKE KNC1-UM01S,
UML02 LIKE KNC1-UM01S,
UML03 LIKE KNC1-UM01S,
UML04 LIKE KNC1-UM01S,
UML05 LIKE KNC1-UM01S,
UML06 LIKE KNC1-UM01S,
UML07 LIKE KNC1-UM01S,
UML08 LIKE KNC1-UM01S,
UML09 LIKE KNC1-UM01S,
UML10 LIKE KNC1-UM01S,
UML11 LIKE KNC1-UM01S,
UML12 LIKE KNC1-UM01S,
END OF SALDO.
Structure to hold Bal fields ------ -------
DATA: BEGIN OF SKNKK,
KUNNR LIKE KNA1-KUNNR, " Customer Number 1: Debitor
KONTO LIKE KNKK-KUNNR,
SFAE1 LIKE RF035-SFAE1, " Aging buckets 0-15
SFAE2 LIKE RF035-SFAE2, " Aging buckets 16-30
SFAE3 LIKE RF035-SFAE3, " Aging buckets 30-60
SFAE4 LIKE RF035-SFAE4, " Aging buckets 60-90
SFAE5 LIKE RF035-SFAE5, " Aging buckets Over 90
SFAEL LIKE RF035-SFAEL, " Total Due of Items
UML01 LIKE KNC1-UM01S,
UML02 LIKE KNC1-UM01S,
UML03 LIKE KNC1-UM01S,
UML04 LIKE KNC1-UM01S,
UML05 LIKE KNC1-UM01S,
UML06 LIKE KNC1-UM01S,
UML07 LIKE KNC1-UM01S,
UML08 LIKE KNC1-UM01S,
UML09 LIKE KNC1-UM01S,
UML10 LIKE KNC1-UM01S,
UML11 LIKE KNC1-UM01S,
UML12 LIKE KNC1-UM01S,
UMP1U LIKE RF42B-UMP1U, " Sales from the Previous Year
UMP2U LIKE RF42B-UMP2U, " Sales from the current Year
SALDO LIKE RF42B-SALDO, " Balance
END OF SKNKK.
DATA : BEGIN OF ICUST1 OCCURS 0,
KUNNR TYPE KNA1-KUNNR, "For Customer Filter.
END OF ICUST1.
**Internal table to hold fiscal varriants
DATA: BEGIN OF LT_PERIODS OCCURS 12,
PERIOD LIKE BSID-MONAT,
GJAHR LIKE KNC1-GJAHR,
END OF LT_PERIODS.
**Constants
constants : BUKRS1 TYPE KNB1-BUKRS VALUE '1000',
BUKRS2 TYPE KNB1-BUKRS VALUE '1031',
Recs Type i value '200',
B_count type i value '2'.
INITIALIZATION
INITIALIZATION.
IF RASID IS INITIAL.
SELECT * FROM TRAS.
EXIT.
ENDSELECT.
IF SY-SUBRC = 0.
RASID = TRAS-RASID.
ENDIF.
ENDIF.
SELECTION-SCREEN
parameters : p_path type rlgrap-filename default 'C:\Documents and Settings\C890971\Desktop\Credit_history.XLS'.
Start of selection processing
START-OF-SELECTION.
**Get Customers for Co. Code 1000 & 1031.
PERFORM GET_CUST.
Get / Compute Credit Information data for Company Codes 1000 & 1031.
PERFORM GET_CREDIT_DATA.
End of selection processing
*END-OF-SELECTION.
Listing Credit History Data
PERFORM DOWNLOAD_CREDIT_DATA.
S U B R O U T I N E S
*& Form GET_CUST
text
--> p1 text
<-- p2 text
FORM GET_CUST .
Get US only Customers.
Refresh icust.
Select kunnr from kna1 appending table icust
where Land1 = land.
**Delete duplicate records
Delete Adjacent duplicates from icust comparing kunnr.
if icust[] is not initial.
Limit the selection some more to Co. Code 1000 & 1031
As join will cost overhead as compared.
Select kunnr from knb1 into table icust1
for all entries in icust
where kunnr = icust-kunnr
and bukrs = bukrs1
OR bukrs = bukrs2.
**Delete duplicate records
Delete Adjacent duplicates from icust1 comparing kunnr.
endif.
**Free memory.
Free icust.
Credit Control Area
select * from T001CM into table TCMTAB
where bukrs = bukrs1 OR
bukrs = bukrs2.
ENDFORM. " GET_CUST
*& Form GET_CREDIT_DATA
text
--> p1 text
<-- p2 text
FORM GET_CREDIT_DATA .
DATA : L_TEXT(60) TYPE C ,
Ltext1(50) type C value 'Computing Credit-History Data For',
Ltext2(10) type C value 'Customers',
L_PCT type i value '10',
L_recs type i,
l_batch_recs type i,
l_s_rec type i value 1,
l_recs1(7) type N.
***Fetch data from KNKK table
PERFORM GET_KNKK_DATA .
***Computing Crredit Fields
**Number of Customers For whom Deatils needed.
Describe table I_CINFO lines l_recs.
l_recs1 = l_recs.
Concatenate Ltext1 l_recs1 Ltext2 into l_text separated by ' '.
PERFORM GET_PGRESS_INDICATOR USING l_text l_pct.
***If records are more than 200000, should be processed batch-wise
If l_recs > recs.
l_batch_recs = abs( l_recs / b_count ).
Do b_count times.
loop at i_cinfo INTO S_CINFO from l_S_REC to l_batch_recs.
**Remember the row
sytabix = sy-tabix.
**Compute DSO
PERFORM GET_DSO_FIELD .
Compute rest credit history data.
PERFORM COMPUTE_SFIELDS.
endloop.
l_S_REC = l_S_REC + l_batch_recs.
l_batch_recs = l_batch_recs + l_batch_recs.
IF l_batch_recs ge l_recs.
l_batch_recs = l_recs.
eNDIF.
Commit up to here to release the DB locks.
Commit work.
enddo.
else.
loop at i_cinfo INTO S_CINFO.
**Remember the row
sytabix = sy-tabix.
**Compute DSO
PERFORM GET_DSO_FIELD .
Compute rest credit history data.
PERFORM COMPUTE_SFIELDS.
endloop.
Endif.
ENDFORM. " GET_CREDIT_DATA
*& Form GET_KNKK_DATA
text
-->P_ICUST_KUNNR text
FORM GET_KNKK_DATA .
if icust1[] is not initial.
SELECT KUNNR KNKLI KKBER CTLPC KLIMK
SBGRP ERDAT DTREV REVDB
from KNKK into corresponding fields of table I_Cinfo
for all entries in icust1
where kunnr = icust1-kunnr.
Delete Adjacent duplicates from i_cinfo comparing kunnr.
endif.
**Free Memory for internal table icust1.
Free icust1.
ENDFORM. " GET_KNKK_DATA
**& Form GET_DSO_FIELD
text
--> p1 text
<-- p2 text
FORM GET_DSO_FIELD .
***Determine DSO Parameter
PERFORM DSO_PARAMETER.
***Compute DSO
CALL FUNCTION 'CUSTOMER_DSO_CALCULATION'
EXPORTING
I_KKBER = s_cinfo-kkber
I_KUNNR = s_cinfo-kunnr
I_ANZBUPER = T000CM-DSOPP
I_XCHILDS = T000CM-DSOCH
I_ACTBALANCE = T000CM-DSOAB
IMPORTING
E_DSOIN = RF02L-DSOIN
EXCEPTIONS
ERROR_MESSAGE = 1.
ENDFORM. " GET_DSO_FIELD
*& Form DSO_PARAMETER
text
--> p1 text
<-- p2 text
FORM DSO_PARAMETER.
IF T000CM-DSOPP IS INITIAL.
SELECT SINGLE * FROM T000CM.
IF SY-SUBRC EQ 0.
IF T000CM-DSOPP IS INITIAL.
T000CM-DSOPP = '003'.
ENDIF.
ELSE.
T000CM-DSOPP = '003'.
T000CM-DSOCH = ' '.
T000CM-DSOAB = 'X'.
ENDIF.
ENDIF.
ENDFORM. " DSO_PARAMETER
--> p1 text
<-- p2 text
FORM PERIODE_ERMITTELN_EXC USING
P03_BUDAT LIKE SYST-DATUM
P03_GJAHR LIKE KNC1-GJAHR
P03_MONAT LIKE MONAT.
CALL FUNCTION 'FI_PERIOD_DETERMINE'
EXPORTING
I_BUDAT = P03_BUDAT
I_PERIV = T001-PERIV
I_BUKRS = T001-BUKRS
I_GJAHR = P03_GJAHR
I_MONAT = P03_MONAT
IMPORTING
E_GJAHR = P03_GJAHR
E_MONAT = P03_MONAT
EXCEPTIONS
ERROR_MESSAGE = 1.
ENDFORM. "PERIODE_ERMITTELN_EXC
*& Form COMPUTE_SFIELDS
text
--> p1 text
<-- p2 text
FORM COMPUTE_SFIELDS .
**Compute Balance
PERFORM GET_SFIELDS .
S_CINFO-DSOIN = RF02L-DSOIN.
S_CINFO-SALDO = RF035-SALDO.
S_CINFO-H06SA = RF035-H06SA.
S_CINFO-H06JA = RF035-H06JA.
S_CINFO-H06MO = RF035-H06MO.
S_CINFO-H12SA = RF035-H12SA.
S_CINFO-H12JA = RF035-H12JA.
S_CINFO-H12MO = RF035-H12MO.
S_CINFO-UMP2U = RF42B-UMP2U.
S_CINFO-UMP1U = RF42B-UMP1U.
S_CINFO-SFAEL = RF035-SFAEL.
S_CINFO-SFAE1 = RF035-SFAE1.
S_CINFO-SFAE2 = RF035-SFAE2.
S_CINFO-SFAE3 = RF035-SFAE3.
S_CINFO-SFAE4 = RF035-SFAE4.
S_CINFO-SFAE5 = RF035-SFAE5.
modify..
MODIFY I_CINFO FROM S_CINFO INDEX sytabix.
CLEAR: S_CINFO,RF035,RF02L, RF42B.
ENDFORM. " COMPUTE_SFIELDS
text
-->P_C_INFO_KUNNR text
FORM GET_CUST_BAL_INFO.
LOOP AT TCMTAB.
CALL FUNCTION 'FI_COMPANY_CODE_DATA'
EXPORTING
I_BUKRS = TCMTAB-BUKRS
IMPORTING
E_T001 = T001
EXCEPTIONS
ERROR_MESSAGE = 1.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T001 TO BUKTAB.
BUKTAB-KKBER = TCMTAB-KKBER.
COLLECT BUKTAB.
ENDIF.
ENDLOOP.
LOOP AT BUKTAB WHERE PERIV NE SPACE.
GJATAB-PERIV = BUKTAB-PERIV.
COLLECT GJATAB.
ENDLOOP.
CLEAR: MONAT.
LOOP AT GJATAB.
T001-PERIV = GJATAB-PERIV.
CLEAR: GJAHR, MONAT.
PERFORM PERIODE_ERMITTELN_EXC USING SY-DATLO GJAHR MONAT.
CHECK SY-SUBRC = 0.
GJATAB-GJAHR = GJAHR.
GJATAB-MONAT = MONAT.
SELECT SINGLE * FROM T009 WHERE PERIV = GJATAB-PERIV.
IF SY-SUBRC = 0.
GJATAB-ANZBP = T009-ANZBP.
ENDIF.
MODIFY GJATAB.
ENDLOOP.
LOOP AT BUKTAB.
CHECK NOT ( BUKTAB-PERIV IS INITIAL ).
READ TABLE GJATAB WITH KEY BUKTAB-PERIV.
CHECK SY-SUBRC = 0
AND NOT ( GJATAB-GJAHR IS INITIAL ).
CALL FUNCTION 'CUSTOMER_BALANCE'
EXPORTING
KUNNR = S_cinfo-kunnr
BUKRS = BUKTAB-BUKRS
GJAHR = GJATAB-GJAHR
MONAT = GJATAB-MONAT
PERIV = GJATAB-PERIV
ANZBP = GJATAB-ANZBP
XH6MON = 'X'
XH12MON = 'X'
IMPORTING
UMP2U = RF42B-UMP2U
VMP2U = RF42B-UMP1U
SALDO = RF035-SALDO
UML01 = SALDO-UML01
UML02 = SALDO-UML02
UML03 = SALDO-UML03
UML04 = SALDO-UML04
UML05 = SALDO-UML05
UML06 = SALDO-UML06
UML07 = SALDO-UML07
UML08 = SALDO-UML08
UML09 = SALDO-UML09
UML10 = SALDO-UML10
UML11 = SALDO-UML11
UML12 = SALDO-UML12
EXCEPTIONS
NO_BALANCE = 4.
IF SY-SUBRC = 0.
SKNKK-UMP1U = SKNKK-UMP1U + RF42B-UMP1U.
SKNKK-UMP2U = SKNKK-UMP2U + RF42B-UMP2U.
SKNKK-SALDO = SKNKK-SALDO + RF035-SALDO.
SKNKK-UML01 = SKNKK-UML01 + SALDO-UML01.
SKNKK-UML02 = SKNKK-UML02 + SALDO-UML02.
SKNKK-UML03 = SKNKK-UML03 + SALDO-UML03.
SKNKK-UML04 = SKNKK-UML04 + SALDO-UML04.
SKNKK-UML05 = SKNKK-UML05 + SALDO-UML05.
SKNKK-UML06 = SKNKK-UML06 + SALDO-UML06.
SKNKK-UML07 = SKNKK-UML07 + SALDO-UML07.
SKNKK-UML08 = SKNKK-UML08 + SALDO-UML08.
SKNKK-UML09 = SKNKK-UML09 + SALDO-UML09.
SKNKK-UML10 = SKNKK-UML10 + SALDO-UML10.
SKNKK-UML11 = SKNKK-UML11 + SALDO-UML11.
SKNKK-UML12 = SKNKK-UML12 + SALDO-UML12.
ENDIF.
ENDLOOP.
ENDFORM. "
*& Form GET_SFIELDS
text
--> p1 text
<-- p2 text
FORM GET_SFIELDS .
sknkk-kunnr = S_CINFO-KUNNR.
**Clear target to store computed values
CLEAR: RF035.
**Compute Balance fields
PERFORM GET_CUST_BAL_INFO.
REFRESH: SALTAB.
SALTAB-LNUMM = '01'. SALTAB-SALDO = SKNKK-UML01. APPEND SALTAB.
SALTAB-LNUMM = '02'. SALTAB-SALDO = SKNKK-UML02. APPEND SALTAB.
SALTAB-LNUMM = '03'. SALTAB-SALDO = SKNKK-UML03. APPEND SALTAB.
SALTAB-LNUMM = '04'. SALTAB-SALDO = SKNKK-UML04. APPEND SALTAB.
SALTAB-LNUMM = '05'. SALTAB-SALDO = SKNKK-UML05. APPEND SALTAB.
SALTAB-LNUMM = '06'. SALTAB-SALDO = SKNKK-UML06. APPEND SALTAB.
SALTAB-LNUMM = '07'. SALTAB-SALDO = SKNKK-UML07. APPEND SALTAB.
SALTAB-LNUMM = '08'. SALTAB-SALDO = SKNKK-UML08. APPEND SALTAB.
SALTAB-LNUMM = '09'. SALTAB-SALDO = SKNKK-UML09. APPEND SALTAB.
SALTAB-LNUMM = '10'. SALTAB-SALDO = SKNKK-UML10. APPEND SALTAB.
SALTAB-LNUMM = '11'. SALTAB-SALDO = SKNKK-UML11. APPEND SALTAB.
SALTAB-LNUMM = '12'. SALTAB-SALDO = SKNKK-UML12. APPEND SALTAB.
READ TABLE SALTAB INDEX 1.
RF035-H06SA = SALTAB-SALDO.
RF035-H06MO = SALTAB-LNUMM.
RF035-H12SA = SALTAB-SALDO.
RF035-H12MO = SALTAB-LNUMM.
------ SALTAB ---------------------------------------------
LOOP AT SALTAB.
IF SALTAB-SALDO > RF035-H06SA
AND SY-TABIX < 7.
RF035-H06SA = SALTAB-SALDO.
RF035-H06MO = SALTAB-LNUMM.
ENDIF.
IF SALTAB-SALDO > RF035-H12SA
AND SY-TABIX < 13.
RF035-H12SA = SALTAB-SALDO.
RF035-H12MO = SALTAB-LNUMM.
ENDIF.
ENDLOOP.
------ Period--------------------
REFRESH LT_PERIODS.
CLEAR LD_COUNTER.
READ TABLE BUKTAB INDEX 1.
IF SY-SUBRC = 0.
READ TABLE GJATAB WITH KEY BUKTAB-PERIV.
DO GJATAB-MONAT TIMES
VARYING LD_PERIOD FROM LD_PERIODS(2) NEXT LD_PERIODS+2(2)
RANGE LD_PERIODS.
LT_PERIODS-GJAHR = GJATAB-GJAHR.
LT_PERIODS-PERIOD = LD_PERIOD.
LD_COUNTER = LD_COUNTER + 1.
APPEND LT_PERIODS.
ENDDO.
IF LD_COUNTER LT 12.
LD_GJAHR = GJATAB-GJAHR - 1.
CLEAR T009Y.
SELECT SINGLE * FROM T009Y WHERE PERIV = GJATAB-PERIV
AND GJAHR = LD_GJAHR.
DO GJATAB-ANZBP TIMES
VARYING LD_PERIOD FROM LD_PERIODS(2) NEXT LD_PERIODS+2(2)
RANGE LD_PERIODS.
IF T009Y-ANZBP > 0.
CHECK SY-INDEX <= T009Y-ANZBP.
ENDIF.
LD_COUNTER = LD_COUNTER + 1.
LT_PERIODS-GJAHR = LD_GJAHR.
LT_PERIODS-PERIOD = LD_PERIOD.
APPEND LT_PERIODS.
ENDDO.
ENDIF.
IF LD_COUNTER LT 12.
LD_GJAHR = LD_GJAHR - 1.
DO GJATAB-ANZBP TIMES
VARYING LD_PERIOD FROM LD_PERIODS(2) NEXT LD_PERIODS+2(2)
RANGE LD_PERIODS.
LD_COUNTER = LD_COUNTER + 1.
LT_PERIODS-GJAHR = LD_GJAHR.
LT_PERIODS-PERIOD = LD_PERIOD.
APPEND LT_PERIODS.
ENDDO.
ENDIF.
SORT LT_PERIODS BY GJAHR ASCENDING PERIOD ASCENDING.
LD_COUNTER = LD_COUNTER - 12.
DO LD_COUNTER TIMES.
DELETE LT_PERIODS INDEX 1.
ENDDO.
SORT LT_PERIODS BY GJAHR DESCENDING PERIOD DESCENDING.
READ TABLE LT_PERIODS INDEX RF035-H06MO.
RF035-H06MO = LT_PERIODS-PERIOD.
RF035-H06JA = LT_PERIODS-GJAHR.
READ TABLE LT_PERIODS INDEX RF035-H12MO.
RF035-H12MO = LT_PERIODS-PERIOD.
RF035-H12JA = LT_PERIODS-GJAHR.
ENDIF.
**Compute Due Dates fields
PERFORM GET_AGING_BUCKETS .
RF035-SFAE1 = SKNKK-SFAE1.
RF035-SFAE2 = SKNKK-SFAE2.
RF035-SFAE3 = SKNKK-SFAE3.
RF035-SFAE4 = SKNKK-SFAE4 .
RF035-SFAE5 = SKNKK-SFAE5.
ENDLOOP.
ENDFORM. " GET_BALANCE_SFIELDS
*& Form GET_AGING_BUCKETS
text
--> p1 text
<-- p2 text
FORM GET_AGING_BUCKETS .
DATA: BEGIN OF LT_BUKRS OCCURS 0,
BUKRS LIKE T001-BUKRS,
END OF LT_BUKRS.
DATA: BEGIN OF LT_BUKTAB OCCURS 0,
BUKRS LIKE T001-BUKRS,
WAERS LIKE T001-WAERS,
KKBER LIKE T014-KKBER,
END OF LT_BUKTAB.
DATA: LD_LINES LIKE SY-TABIX.
*...performance optimization: for more than one company codes check....*
*...if balances exist and avoid selection of open items, if they don't.*
*...exist..............................................................*
REFRESH LT_BUKRS.
REFRESH LT_BUKTAB.
DESCRIBE TABLE BUKTAB LINES LD_LINES.
IF LD_LINES GT 1.
SELECT DISTINCT BUKRS APPENDING CORRESPONDING FIELDS
OF TABLE LT_BUKRS
FROM KNC1 FOR ALL ENTRIES IN BUKTAB
WHERE BUKRS = BUKTAB-BUKRS AND
KUNNR = Sknkk-KUNNR.
SELECT DISTINCT BUKRS APPENDING CORRESPONDING FIELDS
OF TABLE LT_BUKRS
FROM KNC3 FOR ALL ENTRIES IN BUKTAB
WHERE BUKRS = BUKTAB-BUKRS AND
KUNNR = Sknkk-KUNNR.
SORT LT_BUKRS.
DELETE ADJACENT DUPLICATES FROM LT_BUKRS.
LOOP AT LT_BUKRS.
LOOP AT BUKTAB WHERE BUKRS = LT_BUKRS-BUKRS.
MOVE-CORRESPONDING BUKTAB TO LT_BUKTAB.
APPEND LT_BUKTAB.
ENDLOOP.
ENDLOOP.
ELSE.
READ TABLE BUKTAB INDEX 1.
MOVE-CORRESPONDING BUKTAB TO LT_BUKTAB.
APPEND LT_BUKTAB.
ENDIF.
*...process company codes for customer given by interface..........*
LOOP AT LT_BUKTAB WHERE KKBER = s_cinfo-KKBER.
CALL FUNCTION 'CUSTOMER_DUE_DATE_ANALYSIS'
EXPORTING BUKRS = LT_BUKTAB-BUKRS
KKBER = ' '
KKBER = s_cinfo-KKBER
KUNNR = Sknkk-KUNNR
RASID = RASID
IMPORTING SFAE1 = RF035-SFAE1
SFAE2 = RF035-SFAE2
SFAE3 = RF035-SFAE3
SFAE4 = RF035-SFAE4
SFAE5 = RF035-SFAE5
SFAEL = RF035-SFAEL
EXCEPTIONS NO_OPEN_ITEMS = 4.
IF SY-SUBRC = 0.
*-- RF035 -
SKNKK-SFAE1 = SKNKK-SFAE1 + RF035-SFAE1.
SKNKK-SFAE2 = SKNKK-SFAE2 + RF035-SFAE2.
SKNKK-SFAE3 = SKNKK-SFAE3 + RF035-SFAE3.
SKNKK-SFAE4 = SKNKK-SFAE4 + RF035-SFAE4.
SKNKK-SFAE5 = SKNKK-SFAE5 + RF035-SFAE5.
SKNKK-SFAE5 = SKNKK-SFAE5 + RF035-SFAE5.
SKNKK-SFAEL = SKNKK-SFAEL + RF035-SFAEL.
ENDIF.
ENDLOOP.
ENDFORM. " GET_AGING_BUCKETS
*& Form header
This Subroutine gets data for displaying title *
There are no interface parameters to be passed to this subroutine. *
FORM header .
wa_final-string = text-000. APPEND wa_final TO i_final.
wa_final-string = text-001. APPEND wa_final TO i_final.
wa_final-string = text-002. APPEND wa_final TO i_final.
wa_final-string = text-003. APPEND wa_final TO i_final.
wa_final-string = text-004. APPEND wa_final TO i_final.
wa_final-string = text-005. APPEND wa_final TO i_final.
wa_final-string = text-006. APPEND wa_final TO i_final.
wa_final-string = text-007. APPEND wa_final TO i_final.
wa_final-string = text-008. APPEND wa_final TO i_final.
wa_final-string = text-009. APPEND wa_final TO i_final.
wa_final-string = text-010. APPEND wa_final TO i_final.
wa_final-string = text-011. APPEND wa_final TO i_final.
wa_final-string = text-012. APPEND wa_final TO i_final.
wa_final-string = text-013. APPEND wa_final TO i_final.
wa_final-string = text-014. APPEND wa_final TO i_final.
wa_final-string = text-015. APPEND wa_final TO i_final.
wa_final-string = text-016. APPEND wa_final TO i_final.
wa_final-string = text-017. APPEND wa_final TO i_final.
wa_final-string = text-018. APPEND wa_final TO i_final.
wa_final-string = text-019. APPEND wa_final TO i_final.
wa_final-string = text-020. APPEND wa_final TO i_final.
wa_final-string = text-021. APPEND wa_final TO i_final.
wa_final-string = text-022. APPEND wa_final TO i_final.
wa_final-string = text-023. APPEND wa_final TO i_final.
wa_final-string = text-024. APPEND wa_final TO i_final.
ENDFORM. " header
*& Form DOWNLOADCREDITDATA
text
-->P_P_PATH text
FORM DOWNLOADCREDITDATA USING P_PATH.
DATA:
lw_file2 TYPE string . " File Path
lw_file2 = p_PATH.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
filename = lw_file2
filetype = 'DBF'
APPEND = ' '
write_field_separator = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = 'X'
WRITE_LF = 'X'
COL_SELECT = 'X'
COL_SELECT_MASK = ' '
DAT_MODE = 'X'
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = '0'
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH = FILELENGTH
TABLES
data_tab = I_CINFO
fieldnames = i_final
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
IF sy-subrc <> 0.
Messege
ENDIF. " IF sy-subrc EQ 0
ENDFORM. " DOWNLOADCREDITDATA
*& Form DOWNLOAD_CREDIT_DATA
text
--> p1 text
<-- p2 text
FORM DOWNLOAD_CREDIT_DATA .
PERFORM HEADER.
PERFORM DOWNLOADCREDITDATA USING P_PATH.
ENDFORM. " DOWNLOAD_CREDIT_DATA
*& Form GET_PGRESS_INDICATOR
text
-->P_L_TEXT text
-->P_L_PCT text
FORM GET_PGRESS_INDICATOR USING L_TEXT
L_PCT.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = l_pct
TEXT = l_TEXT.
ENDFORM. " GET_PGRESS_INDICATORIf you are just Downloading to a Flat file then why dont you have logic in place for the program to dump the data read into the file to that point depending on any criteria like accounts or customer then clear the internal table and run it in the back ground.
try to use cursor to read the records from the table which will make it a bit more efficient than plain select stement. -
Error while creating dynamic internal table.
Hello Expert,
While creating a dynamic internal table, it throw an run time error as :
" LOAD PROGRAM NOT FOUND
CX_SY_PROGRAM_NOT_FOUND"
i tried to debug the program, it found this error comes while calling
CALL METHOD cl_alv_table_create=>create_dynamic_table
please anyone help me out to resolve this problem.
what could be the reason of error? and how to avoid it?
<REMOVED BY MODERATOR>
thanks in advance.
~ shweta.
Edited by: Alvaro Tejada Galindo on Feb 28, 2008 2:41 PMHi,
Go through this program.
Report z_dynamic.
type-pools : abap.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
selection-screen begin of block b1 with frame.
parameters: p_table(30) type c default 'T001'.
selection-screen end of block b1.
start-of-selection.
perform get_structure.
perform create_dynamic_itab.
perform get_data.
perform write_out.
form create_dynamic_itab.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
assign dy_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
endform.
Regards, -
Line incomaptibilty betwwen RAW and CHAR data types in SAP Unicode System.
Hi Gurus,
I am working in SAP Unicode system.
We have transferred the standard programs for Non-Unicode to Unicode system.
In one standard function module, <table name> is defined in TABLES parameter as a type of TLINE structure, which has two fields - one is 132 length CHAR and other is 2 length CHAR.
In the same function module , one subroutine is being called, for which <table name> is passed.
But in the FORM of subroutine, this table is defined as a type of HLINE, which has only one field - 134 length RAW data type.
So due to confilct in data types ( CHAR and RAW ) , I am getting an error that both data types are not line compatible.
Do i need to use casting concept to remove the error.
Please suggest me the way to handle this.hi,
declare the table as same data type.
dont go for any other types.
if you still want the form table as HLINE, then before the form call declare a varibale with TLINE data type pass the values to HLINE.
i think this will be little complex, because again it will be type incompatablity.
we can forcefully pass the values to HLINE with a class.
but i think no need, declaring with same data type might be easy.
Thanks
Vinod -
ALV - need to sum values of internal table and display in ALV
I have data in internal table as:
Material date sum1 sum2
Mat_A 19990101 4 4
Mat_A 20080501 3 0
Mat_A 20080601 2 0
Mat_B 19990101 2 0
Mat_B 20080601 5 5
Required output is :
Material qty1 qty2 19990101 20080501 20080601
Mat_A 432 4 4 3 2
Mat_B 2+5 5 2 5
Thinking of using ALV to pass the internal table and display as classical report (and also to save as excel spreadsheet).
Counting your help on the following questions:
1) How to accomplish the sum in ALV report? Can ALV FM do that or one has to use ABAP to compute the sum from the given internal table?
2) Mat_A can have more date values. Here it got 3 distinct date values 19990101, 20080601, 20080501. If it has say 5 date values, how to create the ALV date columns (from 3 to 5 date columns) dynamically?
Thanks for the help.for the sum inalv we use generally..
it_fieldcat-do_sum = 1.
check this examples...
http://www.****************/Tutorials/ALV/Subtotals/text.htm
*& Report ZTEST_ALV_PERC_13317
REPORT ztest_alv_perc_13317.
TYPE-POOLS: slis.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
it_events TYPE slis_t_event,
wa_events TYPE slis_alv_event,
it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv,
l_layout TYPE slis_layout_alv.
TYPES: BEGIN OF ty_itab,
field1(10),
qty1 TYPE i,
qty2 TYPE i,
qty3 TYPE i,
dummy TYPE c,
END OF ty_itab.
DATA: itab TYPE STANDARD TABLE OF ty_itab WITH HEADER LINE,
itab1 TYPE ty_itab.
START-OF-SELECTION.
itab-field1 = 'FIRST'.
itab-qty1 = 2.
itab-qty2 = 1.
itab-qty3 = 5.
itab-dummy = 10.
APPEND itab.
itab-field1 = 'FIRST'.
itab-qty1 = 2.
itab-qty2 = 1.
itab-qty3 = 5.
itab-dummy = 10.
APPEND itab.
itab-field1 = 'FIRST'.
itab-qty1 = 2.
itab-qty2 = 1.
itab-qty3 = 5.
itab-dummy = 10.
APPEND itab.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'FIELD1'.
wa_fieldcat-tabname = 'ITAB'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'QTY1'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 3.
wa_fieldcat-fieldname = 'QTY2'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 4.
wa_fieldcat-fieldname = 'QTY3'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 5.
wa_fieldcat-fieldname = 'DUMMY'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-no_out = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_events
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
ENDIF. -
How to export internal table and pass the internal table to another screen?
Hi,
I have a sql SELECT statement that select data from table into internal table. I would like to export out the internal table and pass to another screen and display the data in ALV list. How to export it out? I try but the error given was " The type of "OUT_SELECT_ITAB" cannot be converted to the type of "itab_result".
Another question is, how to pass the internal table that i export out from the function module to another screen?
Here is the code
==============================================================
FUNCTION ZNEW_SELECT_ZSTUD00.
""Local Interface:
*" IMPORTING
*" REFERENCE(IN_SELECT_YEAR) TYPE ZSTUD00-EYEAR
*" EXPORTING
*" REFERENCE(OUT_RESULT) TYPE CHAR9
*" REFERENCE(OUT_SELECT_ITAB) TYPE ZSTUD00
*& Global Declarations
DATA: itab TYPE ZSTUD00,
itab_result TYPE TABLE OF ZSTUD00.
*& Processing Blocks called by the Runtime Environment
itab-eyear = IN_SELECT_YEAR.
SELECT *
FROM ZSTUD00
INTO TABLE itab_result
WHERE eyear = IN_SELECT_YEAR.
IF sy-subrc = 0.
out_result = 'Success'.
OUT_SELECT_ITAB = itab_result.
ELSE.
out_result = 'Fail'.
ENDIF.
ENDFUNCTION.
===============================================================
Please advise. Thanks
Regards,
RaydenHi Nagaraj,
I try to change it in Tables tab page but it state that TABLES parameters are obsolete. when i "Enter". I try to "Enter" again. it seem to be ok but it stil give me the same error.
================================================================
FUNCTION ZNEW_SELECT_ZSTUD00.
""Local Interface:
*" IMPORTING
*" REFERENCE(IN_SELECT_YEAR) TYPE ZSTUD00-EYEAR
*" EXPORTING
*" REFERENCE(OUT_RESULT) TYPE CHAR9
*" TABLES
*" OUT_SELECT_ITAB STRUCTURE ZSTUD00
*& Global Declarations
DATA: itab TYPE ZSTUD00,
itab_result TYPE TABLE OF ZSTUD00.
*& Processing Blocks called by the Runtime Environment
itab-eyear = IN_SELECT_YEAR.
SELECT *
FROM ZSTUD00
INTO TABLE itab_result
WHERE eyear = IN_SELECT_YEAR.
IF sy-subrc = 0.
out_result = 'Success'.
OUT_SELECT_ITAB = itab_result.
ELSE.
out_result = 'Fail'.
ENDIF.
ENDFUNCTION.
===============================================================
regards,
Rayden -
Hi,
can anybody explain the concepts of Internal table and work area.Thanks in advance.hai,
This may help u.
WORKAREA is a structure that can hold only one record at a time. It is a collection of fields. We use workarea as we cannot directly read from a table. In order to interact with a table we need workarea. When a Select Statement is executed on a table then the first record is read and put into the header of the table and from there put into the header or the workarea(of the same structure as that of the table)of the internal table and then transferred top the body of the internal table or directly displayed from the workarea.
Each row in a table is a record and each column is a field.
While adding or retrieving records to / from internal table we have to keep the record temporarily.
The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
e.g.
data: begin of itab occurs 10,
ab type c,
cd type i,
end of itab. " this table will have the header line.
data: wa_itab like itab. " explicit work area for itab
data: itab1 like itab occurs 10. " table is without header line.
Internal tables are used for storing records which are obtained as a result when we use select statement on database. internal tables are run time entities and doesn't occupy any memory. they are dynamic.
internal tables are of types.
1. internal tables with header line. [header and body]
2. internal tables with out header line. [only body]
Workarea is the concept which is mainly useful when working with internal tables with out header line.
at any point of time we can access only one record through header of a internal table. every thing should be done [inserting,modifying, reading ] through header only.
ex: data: itab like standard table of mara with header line.
for internal tables with out header line we will create a work area [explicit header] as type of table for storing data into internal table.
ex: data: itab like mara,
wa like mara.
more about internal table types:
Standard table:
The key access to a standard table uses a sequential search. The time required for an access is linearly dependent on the number of entries in the internal table.
You should usually access a standard table with index operations.
Sorted table:
The table is always stored internally sorted by its key. Key access to a sorted table can therefore use a binary search. If the key is not unique, the entry with the lowest index is accessed. The time required for an access is logarithmically dependent on the number of entries in the internal table.
Index accesses to sorted tables are also allowed. You should usually access a sorted table using its key.
Hash table:
The table is internally managed with a hash procedure. All the entries must have a unique key. The time required for a key access is constant, that is it does not depend on the number of entries in the internal table.
You cannot access a hash table with an index. Accesses must use generic key operations (SORT, LOOP, etc.).
Hashed tables
This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index.
The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always
have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for
processing large amounts of data.
TYPES VECTOR TYPE HASHED TABLE OF I WITH UNIQUE KEY TABLE LINE.
TYPES: BEGIN OF LINE,
COLUMN1 TYPE I,
COLUMN2 TYPE I,
COLUMN3 TYPE I,
END OF LINE.
DATA ITAB TYPE HASHED TABLE OF SPFLI
WITH UNIQUE KEY CARRID CONNID.
with regards,
B.Sowjanya,
reward points if helpful. -
Large line to internal tables from tab delimited file
Dear All
I am trying to upload the large file of tab delimited data into a SAP internal table. I am basically stuck with the fact that there are multiple lines and multiple columns in tab delimited file. There are around 300 columns which are tab delimited and separated
For e.g (* indicates tab)
1material*****************1**9888**********5**********34*********3*********346************************-->upto 5000 columns
1material*****************1**99338************4***********************************6************7************-->upto 5000 columns
1material*****************1**22888********************5*********7*********************6*****7**************-->upto 5000 columns
1material*****************1**44844************************5***5*********************************************-->upto 5000 columns
1material***********34****1**54*******33********33*****33**************************************************-->upto 5000 columns
1material*****************1**99888*****************************************************************************-->upto 5000 columns
below upto 500 rows or more
I want to read this file into a columner internal table.
I am trying several ways . I have file on APP server. However Line breaks after 1024 characters or comes on another line.
Currently I am not able to load it in single line of internal table. The structure of file is dynamic .. not static
AmolHi Amolsonaikar,
you may try like this:
TYPES:
begin of line,
t_field type table of string,
end of line,
t_line type table of line.
DATA:
lt_line type t_line,
lv_line type string,
lt_field type table of string.
open dataset 'XYZ' for input in text mode encoding default.
while sy-subrc = 0.
read dataset into lv_line.
split lv_line at '|' into lt_field.
append lt_field to lt_line.
endwhile.
Regards,
Clemens
Maybe you are looking for
-
How Can I Display Embedded Equations in PowerPoint?
I am finding that my embedded equations are being stripped from PowerPoint presentations when i show them in the classroom and I am looking for a way to preserve them (I share to the classroom via either Shared Content or My Content). I am using Ma
-
Hi , can some one explain me the concept of document splitting when it comes to cross company code..how does document splitting work when a document has two company codes or for a cross company document..pls give a small example.. *help me out...look
-
Use an external hard drive - want to connect to a different computer...
Hi, pardon my ignorance but... I keep all my ipod music on an external hard drive since I only have my work laptop, but the programs are on the computer. I used to never have a problem accessing itunes through my work laptop once I plugged the hard d
-
I have Microsoft Office Word on my Mac and I saved a file various times that was very important, but now that I've gone back to re-open it the File will not open. It say's it cannot "locate the file". The file will not appear anywhere on my computer
-
How to un merge movie so I can edit frames
hi i have made a movie in iMovie using individual photos and recorded clips. I Played it in theatre and now the individual clips have merged and cannot be edited in time line. how can i separate the film so i can edit it.