cancel
Showing results for 
Search instead for 
Did you mean: 

MOVE DATA TO INTERNAL TABLE?

Former Member
0 Kudos

i Experts,

I HAVE ONE INTERNAL TABLE

IT_TADIR_DQT

THIS INTERNAL TABLE HAVING ONE FIELD CALLED 'OBJECT'.

THIS FIELD IS HAVING DATA LIKE

PROG

PROG

PROG

DELE

DELE

DOMN

DOMN

I WANT TO MOVE PROG TO IT_PROG,

LIKE THAT I WANT TO MOVE 'DELE' AND 'DOMN' TO IT_DOMN AND IT_DELE.

WITH MINIMUM ABAP STATEMENTS HOW I CAN MOVE THIS DATA TO CORRESPONDING INTERNAL TABLES.

PLEASE HELP IT'S URGENT.

REGARDS,

VIJAY

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

this is not possible without loop.

u have to use case statement within loop.

since case is used only one statement will be executed one at time

loop at internal table.

case object.

when 'PROG'.

append to it_prog

when 'DELE'.

append to it_dele

when 'DOMN'.

append to it_domn

encase.

Endloop.

Answers (6)

Answers (6)

Former Member
0 Kudos

Hay Vijay

Do the following code

&----


*& Report ZTEST_SDN *

*& *

&----


*& *

*& *

&----


REPORT ZTEST_SDN .

tables : tadir.

data : begin of it_tadir_dqt occurs 0,

object like tadir-object,

end of it_tadir_dqt.

data : begin of it_prog occurs 0,

object like tadir-object,

end of it_prog.

data : begin of it_dele occurs 0,

object like tadir-object,

end of it_dele.

data : begin of it_domn occurs 0,

object like tadir-object,

end of it_domn.

clear : it_prog,

it_dele,

it_domn.

refresh : it_prog,

it_dele,

it_domn.

select object

from tadir

into table it_tadir_dqt.

loop at it_tadir_dqt.

case it_tadir_dqt-object.

when 'PROG'.

move it_tadir_dqt to it_prog.

append it_prog.

clear it_prog.

when 'DELE'.

move it_tadir_dqt to it_dele.

append it_dele.

clear it_dele.

when 'DOMN'.

move it_tadir_dqt to it_domn.

append it_domn.

clear it_domn.

endcase.

endloop.

loop at it_prog.

write : / it_prog-object.

endloop.

loop at it_dele.

write : / it_dele-object.

endloop.

loop at it_domn.

write : / it_domn-object.

endloop.

endloop.

Thanks & regards

Sreenivasulu P

Former Member
0 Kudos

Hi,

find this code

Loop at IT_TADIR_DQT into wa_tadir_dqt.

case wa_tadir_dqt-object.

when 'PROG'.

append wa_tadir_dqt to it_prog.

when 'DELE'.

append wa_tadir_dqt to it_dele.

when 'DOMN'.

append wa_tadir_dqt to it_domn.

endcase.

Endloop.

Former Member
0 Kudos

Hi,

I think Latheesh's Reply is upto point.

You shouldnt have any problems in it.

Still if any problem persists do tell.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

sort it_tadir_dqt by object.

loop at it_tadir_dqt where object = 'PROG'.

move-corresponding it_tadir-dqt to it_prog.

append it_prog.

endloop.

loop at it_tadir_dqt where object = 'DELE'.

move-corresponding it_tadir-dqt to it_dele.

append it_dele.

endloop.

loop at it_tadir_dqt where object = 'DOMN'.

move-corresponding it_tadir-dqt to it_DOWN.

append it_DOWN.

endloop.

Kindly reward points if it helps.

Former Member
0 Kudos

Hi vijay,

As i said earlier, the code written by amit says it too.

A minimum of 6 statements are req.

But i dont understand your need to get the three values in an internal table.

You could have stored them in any field.

That further reduces the no. of statements.

For knowing the no. of repitions, you could have used some counter.

If the requirement is such, then you can refer to the code by amita mishra.

Regards,

Tanveer.

former_member927251
Active Contributor
0 Kudos

Hi Vijay,

Use the following.

Loop at IT_TADIR_DQT into wa_tadir_dqt.

if wa_tadir_dqt-object = 'PROG'.

append wa_tadir_dqt to it_prog.

elseif wa_tadir_dqt-object = 'DELE'.

append wa_tadir_dqt to it_dele.

elseif wa_tadir_dqt-object = 'DOMN'.

append wa_tadir_dqt to it_domn.

endif.

Endloop.

Hope this helps.

Please reward some points if it helps.

Regards,

Amit Mishra

Former Member
0 Kudos

Hi,

I guess in one loop you can have three check and append them to respective tables.

Minimum of 6 statements would be required, i think.

Regards,

Tanveer.

Mark if found helpful.