Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Tuesday, April 22, 2008

Doubt in Unicode Enabling ABAP Interview Questions

In a unicode system... while using the describe field length statement... for what data types we'll use the addition in character mode and for what data types we use the addition in byte mode...


Determining the Length and Distance
You may no longer use the DESCRIBE DISTANCE statement to define the lengths and distances of fields. It must be replaced with one of the new statements DESCRIBE DISTANCE ... IN BYTE MODE or DESCRIBE DISTANCE ... IN CHARACTER MODE.

The DESCRIBE FIELD ... LENGTH statement is also obsolete and must be replaced with one of the new statements DESCRIBE FIELD ... LENGTH ... IN BYTE MODE or DESCRIBE FIELD ... LENGTH ... IN CHARACTER MODE.

Until now, the DESCRIBE FIELD ... TYPE field statement returned type C for flat structures. In a UP, type u is now returned for flat structures. This can be queried in the ABAP source code.
There are no changes for the DESCRIBE FIELD ... TYPE ... COMPONENTS ... statement under US. Similarly, the DESCRIBE ... OUTPUT LENGTH ... statement still returns the output length in characters.


My doubt is for a character type field (i.e. for c,n,d,t or character type structures) if am writing the addition character mode or byte mode its not throwing any error, but for type i, f,x,p or xstring if I give character mode its throwing an error and if I give byte mode its not throwing an error.

Type i is expected for ilen.

The variant with the addition IN BYTE MODE determines the length of the data object dobj in bytes. The variant with the addition IN CHARACTER MODE determines the length of the data object dobj in characters.

When using IN CHARACTER MODE, the data type of dobj must be flat and character-type. You can only specify IN BYTE MODE for deep data types and in this case, the length of the reference (8 bytes) is determined.

In non-Unicode programs and in releases prior to 6.10, LENGTH can be used without the addition MODE. In this case, the addition IN BYTE MODE is used implicitly

This covers the all the possiblities of Describe stmt.


Also Use, try this Method:

REPORT Z_TEST_FIELD_SYMBOLS1.
TABLES MARA.
class CL_ABAP_CONTAINER_UTILITIES definition load.

DATA: I_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF I_TEST OCCURS 0,
LINE(8000) TYPE C,
END OF I_TEST.
DATA: BEGIN OF I_TEST1 OCCURS 0,
LINE(1500) TYPE C,
END OF I_TEST1.
FIELD-SYMBOLS: TYPE ANY.
FIELD-SYMBOLS: TYPE ANY.
FIELD-SYMBOLS: TYPE ANY.
SELECT * UP TO 2 ROWS
FROM MARA
INTO MARA.
call method CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C
exporting IM_VALUE = mara
importing EX_CONTAINER = i_test-line
exceptions ILLEGAL_PARAMETER_TYPE = 1
others = 2.
APPEND I_TEST.
ENDSELECT.
LOOP AT I_TEST.
WRITE:/ I_TEST.
ENDLOOP.

LOOP AT I_TEST.
call method cl_abap_container_utilities=>read_container_c
exporting IM_CONTAINER = i_test-line
importing EX_VALUE = mara
exceptions ILLEGAL_PARAMETER_TYPE = 1
others = 2.
write:/ mara-matnr, mara-mtart.
clear mara.
ENDLOOP.

No comments:

Post a Comment

Content

Recent Topics