on 04-22-2006 7:14 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.