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

Regarding Control break Statements

Former Member
0 Likes
713

hi all

can u help me regarding coontrol brak statements.

i have a data like this:

ex:

Line DATe CARTNO VBELN

1 20081022 0000000004 0080030087

2 20081022 0000000005 0080030058

3 20081022 0000000006 0080030078

4 want to insert a line

5 20081023 0000000004 0080030087

6 20081023 0000000005 0080030058

7 20081023 0000000006 0080030078

8 want to insert a line.

in my final internal table i got 6 records which u can see in above example..

loop at it_final into wa_final.

CLEAR lv_tabix.

  • lv_tabix = sy-tabix.

  • at new ccdat.

  • wa_final_tp-pckno = lv_pckno.

  • wa_final_tp-qanty = lv_qty.

  • insert wa_final_tp into table it_final_tp.

wa_final_tp-ccdat = wa_final-ccdat.

wa_final_tp-cartno = wa_final-cartno.

wa_final_tp-lifnr = wa_final-lifnr.

wa_final_tp-loryno = wa_final-loryno.

wa_final_tp-frloc = wa_final-frloc.

wa_final_tp-pckno = wa_final-pckno.

wa_final_tp-qanty = wa_final-qanty.

wa_final_tp-vbeln = wa_final-vbeln.

wa_final_tp-repid = wa_final-repid.

wa_final_tp-matnr = wa_final-matnr.

wa_final_tp-openo = wa_final-openo.

wa_final_tp-name1 = wa_final-name1.

wa_final_tp-toloc = wa_final-toloc.

  • wa_final-todat = wa_freight-todat.

wa_final_tp-flgort = wa_final-flgort.

  • wa_final-tlogrt = wa_freight-tlgort.

wa_final_tp-dmbtr = wa_final-dmbtr.

wa_final_tp-lfgja = wa_final-lfgja.

wa_final_tp-lfmon = wa_final-lfmon.

wa_final_tp-tlfgja = wa_final-tlfgja.

wa_final_tp-tlfmon = wa_final-tlfmon.

wa_final_tp-flfgja = wa_final-flfgja.

wa_final_tp-flfmon = wa_final-flfmon.

wa_final_tp-usnam = wa_final-usnam.

wa_final_tp-modat = wa_final-modat.

wa_final_tp-motim = wa_final-motim.

APPEND wa_final_tp to it_final_tp.

  • read table it_freight into wa_freight with key ccdat = wa_final-ccdat

  • loryno = wa_final-loryno.

  • if sy-subrc = 0.

*endat.

  • endif.

  • lv_tabix = sy-tabix.

  • at new ccdat.

  • lv1_tabix = lv_tabix.

  • lv_tabix = sy-tabix.

  • lv2_tabix = lv_tabix + 1.

*insert wa_final_tp into table it_final_tp.

  • ENDAT.

*

endloop.

if do like this it is not working.. can any help in this regrd.

endform. " DISPLAY_DATA

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
679

Hello,

Line DATe CARTNO VBELN

1 20081022 0000000004 0080030087

2 20081022 0000000005 0080030058

3 20081022 0000000006 0080030078

4 want to insert a line

5 20081023 0000000004 0080030087

6 20081023 0000000005 0080030058

7 20081023 0000000006 0080030078

8 want to insert a line.

When you want to insert a new line in 4th place then

using

at last 20081002 filed name.

append 3lines before at last

and append 4th line in the at last statement.

endat.

i.e creat a new internal table in the loop move all the fileds in before at last and also append before at last then in u r internal table u will have 3records then in at last 4th record will be add.

Edited by: Santosh Marupally on Oct 24, 2008 9:10 AM

6 REPLIES 6
Read only

Former Member
0 Likes
679

u want to insert lines after 3 and 6 records?

Line DATe CARTNO VBELN

1 20081022 0000000004 0080030087

2 20081022 0000000005 0080030058

3 20081022 0000000006 0080030078

4 want to insert a line

5 20081023 0000000004 0080030087

6 20081023 0000000005 0080030058

7 20081023 0000000006 0080030078

8 want to insert a line.

at end of 'date'.

<insert line in itab.>

endat.

Edited by: Anil Kalive on Oct 24, 2008 12:42 PM

Read only

Former Member
0 Likes
680

Hello,

Line DATe CARTNO VBELN

1 20081022 0000000004 0080030087

2 20081022 0000000005 0080030058

3 20081022 0000000006 0080030078

4 want to insert a line

5 20081023 0000000004 0080030087

6 20081023 0000000005 0080030058

7 20081023 0000000006 0080030078

8 want to insert a line.

When you want to insert a new line in 4th place then

using

at last 20081002 filed name.

append 3lines before at last

and append 4th line in the at last statement.

endat.

i.e creat a new internal table in the loop move all the fileds in before at last and also append before at last then in u r internal table u will have 3records then in at last 4th record will be add.

Edited by: Santosh Marupally on Oct 24, 2008 9:10 AM

Read only

0 Likes
679

hi all,

wat ever logic u said is not wrking.

at last fieldname

enat.

this dnt work?

what i mean with the same date i should a add aline.

Read only

Former Member
0 Likes
679

Hi,

Use at-end of on date field of itab..

Read only

Former Member
0 Likes
679

Insert into <ITAB> at index sy-tabix will work.

Just a word of caution.

Since you are looping and inserting in same internal table, takecare that loop will not go into infinity.

Cheers

Sudhaker

Read only

Former Member
0 Likes
679

hi,

you want insert a record in itab before coming new date.

as per ur example...

Line DATe CARTNO VBELN

1 20081022 0000000004 0080030087

2 20081022 0000000005 0080030058

3 20081022 0000000006 0080030078

4 want to insert a line

5 20081023 0000000004 0080030087

6 20081023 0000000005 0080030058

7 20081023 0000000006 0080030078

8 want to insert a line.

So wat u will do for this, use At End statement in loop on field DATE

In that u write code like this..

At New itab-Date.

Read table itab2 into wa_itab2.

insert wa_itab2 into table itab index sy-tabix.

Regards,

Shankar.