2010 Dec 27 7:07 AM
Hi ABAPers,
I want to select data from a custom (Z)table into internal table with a defalut value 'GM' do be added at end of every row selected from custom table into internal table.
I can do it at internal table level but I want to do it at database select level itself.
Ex:
1 abc 34 monday january 2011 GM
2 bbc 34 monday january 2011 GM
3 cbc 34 monday january 2011 GM
4 dbc 34 monday january 2011 GMHow do we acheive above..
-Dep
Hi ABAPers,
I want to select data from a custom (Z)table into internal table with a defalut value 'GM' do be added at end of every row selected from custom table into internal table.
I can do it at internal table level but I want to do it at database select level itself.
Ex:
1 abc 34 monday january 2011 GM
2 bbc 34 monday january 2011 GM
3 cbc 34 monday january 2011 GM
4 dbc 34 monday january 2011 GMHow do we acheive above..
-Dep
2010 Dec 27 7:14 AM
Hi,
Write select..endselect as :
data : begin of it_pa0001 occurs 0,
pernr like pa0001-pernr,
field1(2),
end of it_pa0001.
select pernr from pa0001 into it_pa0001-pernr
where pernr <> ''.
it_pa0001-field1 = 'GM'.
append it_pa0001.
endselect.
Regards,
Srini.
2010 Dec 27 7:43 AM
2010 Dec 27 7:15 AM
Hi,
Actually iam not clear what exactly is ur requirement ?
Do you want to update the GM value in the DB table or internal table ?
If you are having the last field value GM'' in the DB table then write the field in the selection criteria.
i.e
where field = 'GM'If you want to update the internal table then select the data from the DB table then write
wa-field = 'GM'.
Modify it from wa transporting field.Regards,
Madhukar Shetty
2010 Dec 27 7:45 AM
2010 Dec 27 7:17 AM
Hi,
In your internal table, try to make the value as 'GM' by default.
Otherwise, after selected the values from database, modify the internal table with the field value in one shot using transporting.
2010 Dec 27 7:35 AM
Hi Jaya,
Thanks for you reply,
I tried the first option you told that didnt work as all records are populated but the defalut value is not.
2010 Dec 27 8:11 AM
Hi,
Check my second option. I tis working.
types : begin of ty,
matnr type matnr,
field(2) ,
end of ty.
data : itab type standard table of ty,
wa type ty.
select matnr into corresponding fields of table itab from mara up to 10 rows.
wa-field = 'GM'.
modify itab from wa transporting field where field is initial .
loop at itab into wa .
write : / wa-matnr, wa-field.
endloop.
2010 Dec 27 8:53 AM
Hi Jaya,
Your solution is working fine but how about the first option if that would work my issue will be completely resolved.
--Dep
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |