Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8338

A dynamic internal table having datatype of INT4 is of inttype I or X?

$
0
0

Hello,

 

 

I have a custom table ZEXAMPLE which has a table field ZFIELD which is of datatype INT4.

 

My requirement is to create a dynamic internal table <dyn_tab> having ZFIELD as one of its fields.

 

My code for creation:

CALLMETHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE                      "create dynamic table for input

     EXPORTING

       IT_FIELDCATALOG = LTX_FLDCAT

     IMPORTING

       EP_TABLE        = NEW_TABLE.

 

   ASSIGN NEW_TABLE->* TO<DYN_TABLE>.

 

Now in LTX_FLDCAT, for ZFIELD, I have filled the DataType, IntType, etc by using data from table DD03L,

In DD03L, for table ZEXAMPLE, ZFIELD is of DataType = "int4" and  IntType = 'X'.

So in <DYN_TABLE>, the IntType = 'X'.

 

However, If i just create the dynamic internal table using the below statement:

 

CREATEDATA REF_TAB TYPESTANDARDTABLEOF (P_TAB). "here p_tab is ZEXAMPLE

ASSIGN REF_TAB->* TO<LT_TAB>.

 

In <LT_TAB>, the IntType = 'I'. 

 

My problem:

Suppose I have entered value '341' in <DYN_TABLE>'s ZFIELD, when I assign it to <LT_TAB>'s ZFIELD, the value is getting converted to '831'.

 

 

Which is the right INTTYPE? I or X for INT4??

Why is this problem not occurring with INT2?

Why is <LT_TAB>'s IntType 'I'?

 

I have made the fix:

IF LX_DD03L-DATATYPE = 'INT4'.

       LX_DD03L-INTTYPE = 'I'.

ENDIF.

 

 

Now even my <DYN_TABLE>'s ZFIELD is of IntType, 'I', so value '341', when assigned  to <LT_TAB>'s ZFIELD, remains as '341'.

It works, but will be there be any issues because of the change in IntType, from 'X' to 'I'?

 

 

Thanks,

Kavya

 

 

 

Additional Information:

My dynamic internal table also has length twice as the actual field length.

So if ZEXAMPLE has a field ZCHAR_FIELD of length 10, then in the <DYN_TAB>, it will be of length 20. That was because in DD03L, the INTLEN value was twice of LENG.

For more on this, see this link --> http://scn.sap.com/thread/1030356


Viewing all articles
Browse latest Browse all 8338


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>