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

Increment

joerg_arndt
Participant
0 Likes
690

Hi Friends,

in the sample below I want to fill the field tdcount with 1, 2, 3 etc.

I have no Idea how to manage this.

Any help would be apreciated.

Rg. Jimbob

data : begin of out_head occurs 0,

tdcount(6) type N,

TDOBJECT(10) type C,

TDNAME(70) TYPE C,

TDID(4) type c,

TDSPRAS(1) TYPE C,

end of out_head.

select TDOBJECT TDNAME TDID TDSPRAS from stxh into CORRESPONDING FIELDS OF TABLE out_head

Now it looks like this.

000000 ANKA 00001000 LTXT D

000000 ANKA 00001000 LTXT D

000000 ANKA 00001000 LTXT D

but it should like this.

000001 ANKA 00001000 LTXT D

000002 ANKA 00001000 LTXT D

000003 ANKA 00001000 LTXT D

1 ACCEPTED SOLUTION
Read only

joerg_arndt
Participant
0 Likes
647

Hi Abhishek,

I want to use it as an import file in LSMW to import long text.

I tried this below but it does not work.

I can see in the debugger the value of the out_head-tdcount is changed to 000001

but it is not saved in the out_head structure.

select TDOBJECT TDNAME TDID TDSPRAS from stxh into CORRESPONDING FIELDS OF TABLE out_head

where tdobject in objekt.

loop at out_head.

out_head-tdcount = SY-TABIX.

commit work.

endloop.

There is a trick?

4 REPLIES 4
Read only

former_member195698
Active Contributor
0 Likes
647

Hi,

What exactly will be the use of Count Field?

I don't see any method other than looping at the internal table and modifing the field.

If the requirement is just the identification of the row. Then you can use the SY-TABIX field. You will mostly be reading the table or looping at the table. In both the cases the Sy-tabix will indicate the count.

Read only

joerg_arndt
Participant
0 Likes
648

Hi Abhishek,

I want to use it as an import file in LSMW to import long text.

I tried this below but it does not work.

I can see in the debugger the value of the out_head-tdcount is changed to 000001

but it is not saved in the out_head structure.

select TDOBJECT TDNAME TDID TDSPRAS from stxh into CORRESPONDING FIELDS OF TABLE out_head

where tdobject in objekt.

loop at out_head.

out_head-tdcount = SY-TABIX.

commit work.

endloop.

There is a trick?

Read only

0 Likes
647

Change your code to this

loop at out_head.

out_head-tdcount = SY-TABIX.

modify out_head.

endloop.

Read only

joerg_arndt
Participant
0 Likes
647

Thank you Abhishek.