2006 Oct 19 9:24 AM
Hi experts,
I have a problem on coding this,
Using the Status Profile (STSMA) from i_tab1 and Status (STAT)from i_tab2, get the value of Status Description (TXT30) from table TJ30 and store in i_tab3.
Table TJ30 has the ff fields:
MANDT
STSMA
ESTAT
SPRAS
TXT04
TXT30
LTEXT.
Thank you!
in that case it wont be possible. you must have some field of itab2 in itab1. if not we can not get the required data.
<b>OR ELSE JOIN T1 AND T2</b>
Regards
- Gopi
Message was edited by: Gopi Narendra
2006 Oct 19 9:29 AM
2006 Oct 19 9:32 AM
Hi,
but SAP does not allow two FOR ALL ENTRIES statement in a select command.
2006 Oct 19 9:37 AM
select <data> from table T1 into itab1.
select <data> from table T2 into itab2
for all entries in itab1
where stsma = itab1-stsma.
select <data> from table T3 into itab3
for all entries in itab2
where stsma = itab2-stsma.
This is one method.
Regards
- Gopi
2006 Oct 19 9:40 AM
2006 Oct 19 9:42 AM
in that case it wont be possible. you must have some field of itab2 in itab1. if not we can not get the required data.
<b>OR ELSE JOIN T1 AND T2</b>
Regards
- Gopi
Message was edited by: Gopi Narendra
2006 Oct 19 9:43 AM
You can create other internal table which contains STSMA, STAT or you can add one more field STAT in i_itab1 and append corresponding value into it.
Then use SELECT...FOR ALL ENTRIES in table i_itab1 or the new internal table.
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers
2006 Oct 19 9:44 AM
Hi,
can you be more specific of the tables you are using
regards,
sowjanya
2006 Oct 19 9:46 AM
The best way would be to form another internal table say itab with stsma and stat.
*Assuming there is no link between i_tab1 and i_tab2.
Loop at i_tab1.
loop at i_tab2.
move i_tab1-stsma to itab-stsma.
move i_tab2-stat to itab-stat.
collect itab.
endloop.
endloop.
SELECT stsma estat txt30 into table i_tab3
from tj30
for all entries in itab
where stsma = itab-stsma
and estat = itab-stat
and spras = sy-langu.
*If there is a link you can straight use i_tab2 in for all enteries.
2006 Oct 19 9:47 AM
There are two ways to achieve this:
1.
Combine itab1 and itab2 into one table: itab.
select txt30 into itab3
from tj30 for all entries in itab
where stsma = itab-stsma
and estat = itab-stat.
2.
get data originally from database tables and then go for a for all entries approach.
select <dbtab1>-stsma <dbtab2>-stat into itab1 from <dbtab1> join <dbtab2> on <dbtab1>-field1 = <dbtab2>-field2.
select txt30 into itab3
from tj30 for all entries in itab1
where stsma = itab1-stsma
and estat = itab1-stat.
Let me know if you have any further queries.
Don't forget to mark helpful answers!
Gaurav Parmar.
2006 Oct 19 10:08 AM
Hi Marc
I guess you are trying to get the statuses and their descriptions within a status profile. If that is the case, i guess below code can help you.
tables: tj20, tj30, tj30t.
types: begin of t_stat,
stsma like tj20-stsma,
estat like tj30-estat,
txt30 like tj30t-txt30,
end of t_stat.
data: it_status type standard table of t_stat,
wa_status type t_stat.
select a~stsma b~estat c~txt30
into table it_status
from tj20 as a
inner join tj30 as b
on a~stsma = b~stsma
inner join tj30t as c
on b~stsma = c~stsma
and b~estat = c~estat
where a~stsma eq 'SD_00001'.
break-point.
Copy the above code to a temporary program, give a status profile name in the where condition and check the values in internal table IT_STATUS.
Kind Regards
Eswar
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |