Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Internal Table Header Offset problem

Former Member
0 Likes
1,279

Hi all,

I enhanced the BW datasource 0EMPLOYEE_ATTR and making code changes to EXIT_SAPLRSAP_002.

I enhanced the structure 0EMPLOYEE_ATTR to include a 40 character field at the end (data component STEXT). I am trying to move a variable <i>l_jobfamilytext</i> of type <i>STEXT</i> into this field of the datasource.

However, when writing directly to the internal table header using either one of the following methods:

MOVE l_jobfamilytext TO I_T_DATA+186(40).
I_T_DATA+186(40) = l_jobfamilytext.

results in the following error.....

Short text
    Offset specification for a structure too large

Error analysis
    In Unicode-compatible programs, the offset and length specifications
    for structures are limited to the length of the character-type initial
    part.

    In this case, the offset specification 372 for the structure "I_T_DATA"
    exceeds the length of the character-type initial part (=208).

Yes I know that I did not specify "372" as an offset ANYWHERE in my code.

Does anyone know what is wrong?

Message was edited by:

Kevin Wong

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,089

Hi

i_t_data is of type BIW_MARA_S....

and you r specifying the offset from 186th character onwards... means it goes to different fields.... i mean the data goes into more than one field FERTH, FORMT ....

Check the same.....

ALso coming to offset error

I checked with the code...

MOVE 'agfghhjjkjkkjkj' TO I_T_DATA+186(40).

I_T_DATA+186(40) = 'agfghhjjkjkkjkj'.

NO ERROR

7 REPLIES 7
Read only

Former Member
0 Likes
1,089

Hi Kevin,

i tnink , in programs with an active Unicode check, assignments, operand checks, and accesses using offset and length are also affected and problems can arise For example, if a purely character-type structure is enhanced by inserting numeric or deep components, it can lose its character-type nature.

rgds

Deepak.

Read only

Former Member
0 Likes
1,090

Hi

i_t_data is of type BIW_MARA_S....

and you r specifying the offset from 186th character onwards... means it goes to different fields.... i mean the data goes into more than one field FERTH, FORMT ....

Check the same.....

ALso coming to offset error

I checked with the code...

MOVE 'agfghhjjkjkkjkj' TO I_T_DATA+186(40).

I_T_DATA+186(40) = 'agfghhjjkjkkjkj'.

NO ERROR

Read only

0 Likes
1,089

Hmm,

Perhaps here's a better picture, please view the attachments for my settings in RSA6 and SE11.

http://img133.imageshack.us/img133/4920/screen1rh1.gif

http://img133.imageshack.us/img133/2031/screen2pu9.gif

Read only

0 Likes
1,089

I realize something, for example if my internal table I_T_DATA (with header line) was based on a structure that looked like this...

Type Size Decimal Text

CHAR 2 0 Pay Scale Level

DEC 5 2 Capacity Utilization Level

CURR 15 2 Annual salary

CUKY 5 0 Currency Key for Annual Salary

DEC 5 2 Employment percentage

CHAR 1 0 Employment Status

DATS 8 0 Entry Date

CHAR 2 0 Pay Grade Type

I would only be able to do an offset..

i.e.

MOVE xxx TO I_T_DATA+0(2) "To change pay scale level

...up to the point where it changes from CHAR to something

else like DEC. Once the offset goes beyond a field that is not of type CHAR (in the structure) the program throws a dump.

Hence doing something like MOVE xxx TO I_T_DATA+2(5) will throw a dump.

This means that the last field (i.e. Pay Grade Type) cannot be written to using MOVE and offset. Simply because not all the types before this field in the structure are CHAR.

Does anyone understand what I'm saying?

Message was edited by:

Kevin Wong

Message was edited by:

Kevin Wong

Message was edited by:

Kevin Wong

Read only

0 Likes
1,089

something like this


DATA: BEGIN OF ls_data,
              field1 (of CHAR 2 0 Pay Scale Level),
              field2 (of DEC 5 2 Capacity Utilization Level)
              field3 (of CURR 15 2 Annual salary)
              field4 (of CUKY 5 0 Currency Key for Annual Salary)
              field5 (of DEC 5 2 Employment percentage)
              field6 (of CHAR 1 0 Employment Status)
              field7 (of DATS 8 0 Entry Date)
              field8 (of CHAR 2 0 Pay Grade Type)
DATA: END OF ls_data.

ls_data = i_t_data.
MOVE 'abc' TO ls_data-field8.
i_t_data = ls_data.

.

If this doesn't work, then you will have to work with field symbols.

Read only

0 Likes
1,089

Hi Srinivas,

Thanks for your help, I tried it but still does not work, the 2 are not convertible.

Could you provide me with an example using field symbols?

Thanks!

Kevin

Read only

Former Member
0 Likes
1,089

You define a local work area just like your internal table structure and move IT_DATA to that work area. After that you can work with the individual fields.