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

offset error

Former Member
0 Likes
1,493

Hi all,

I have to make a unicode check for all our old reports. There I got a problem with

the following statement:

DATA:

*--- Internal table Cust master gen data

t_kna1 TYPE kna1 OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF t_inrec OCCURS 0,

rec_typ_ind(1) TYPE c, "H, D or T Literals

kunnr(10) TYPE c, "Customer #

tabname(30) TYPE c, "SAP R/3 table segment name

tabdata(1500) TYPE c, "SAP R/3 table data

END OF t_inrec.

LOOP AT t_inrec WHERE rec_typ_ind = c_rec_ind.

CASE t_inrec-tabname.

WHEN 'KNA1'. "Create table t_kna1

MOVE t_inrec-kunnr TO t_kna1-kunnr.

MOVE t_inrec-tabdata TO t_kna1+13. <-----error

endloop.

Thanks

-Sikha

1 ACCEPTED SOLUTION
Read only

anilnal
Explorer
0 Likes
1,178

Hi,

You cannot directly move data to a offset on a table.

When you want the tabdata field to be distributed into the fields of kna1, you can move each field by providing offset on tabname

ex. t_kna1-name1 = t_inrec-tabname+0(35).

t_kna1-name2 = ...

or, create a workarea containing the fields in KNA1 ( from position 13 onwards ) you wish to populate and move t_inrec-tabname to wa_kna1_new

Then, do a move-corresponding to move the values from wa_kna1_new to t_kna1.

Either way, make sure the date field (ERDAT) and any non char/numc fields are populated correctly.

Regards,

Anil.

Message was edited by:

Anil

7 REPLIES 7
Read only

Former Member
0 Likes
1,178

u shud move th value t_inrec-tabdata to some field of internal table t_kna1.

like

MOVE t_inrec-kunnr TO t_kna1-kunnr.

Read only

Former Member
0 Likes
1,178

try out this tabdata(1500) to tabdata(500)... the length may be exceeding....

Read only

0 Likes
1,178

No it does not help.....

Thanks

Sikha

Read only

Former Member
0 Likes
1,178

t_kna1+13. <-----error

mention the field name into which you are passing the value

Read only

0 Likes
1,178

The field name has not been mentioned here......

Read only

anilnal
Explorer
0 Likes
1,179

Hi,

You cannot directly move data to a offset on a table.

When you want the tabdata field to be distributed into the fields of kna1, you can move each field by providing offset on tabname

ex. t_kna1-name1 = t_inrec-tabname+0(35).

t_kna1-name2 = ...

or, create a workarea containing the fields in KNA1 ( from position 13 onwards ) you wish to populate and move t_inrec-tabname to wa_kna1_new

Then, do a move-corresponding to move the values from wa_kna1_new to t_kna1.

Either way, make sure the date field (ERDAT) and any non char/numc fields are populated correctly.

Regards,

Anil.

Message was edited by:

Anil

Read only

Former Member
0 Likes
1,178

Hi,

Offset u have to specify as

<b>MOVE t_inrec-tabdata TO t_kna1-xxxx+0(13)</b>. <-----error

Specif the field name. But the above doesnot work.

tabdata(1500) the field u r moving should contain 1500 length.

You can move 13 to 1500 not the reverse.

<b>MOVE t_inrec-tabdata+0(13) TO t_kna1-xxxx</b>.

Try this.

If u want to move this as a whole to kna1, then

MOVE t_inrec-tabdata TO t_kna1.
APPEND t_kna1.