10-25-2006 1:28 PM
Hi all,
Iam giving my code please observer... and give me the reasonable solution.
-
t_mar LIKE STANDARD TABLE OF z_mar.
SELECT mandt
werks " Plant
lifnr " Vendor
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
-
By removing MANDT from select query, it is going to dump.
ex:
---
SELECT
werks " Plant
lifnr " Vendor
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
-
> Now it is going to dump ( here i removed the mandt field ).
Please give me a solution to fetch the data by removing mandt in select statement, with out chaning the internal table structure.
Thanks,
Ravi
10-25-2006 1:31 PM
hi Ravi,
Give this way
SELECT
werks " Plant
lifnr " Vendor
FROM z_mar
INTO <b>corresponding fields of</b> TABLE t_mar
where sal = 2000.
Regards,
Santosh
10-25-2006 1:30 PM
10-25-2006 1:31 PM
Hi,
u need to remove MANDT field from your table entry in Internal table declaration.
Madhavi
10-25-2006 1:31 PM
hi Ravi,
Give this way
SELECT
werks " Plant
lifnr " Vendor
FROM z_mar
INTO <b>corresponding fields of</b> TABLE t_mar
where sal = 2000.
Regards,
Santosh
10-25-2006 1:32 PM
Hi,
Check the highlighted code
SELECT mandt
werks " Plant
lifnr " Vendor
FROM z_mar
<b>INTO corresponding fields of TABLE t_mar</b>
where sal = 2000.
Thank you,
Ramu N.
10-25-2006 1:36 PM
Thanks,
But according to our coding standards i must not use Move Corresponding. Will you give me the resonable code with out using move corresponding.
Now Iam modifying the code which is pre-developed.
10-25-2006 1:43 PM
Hi,
than you have to use 2 tables.
SELECT mandt
werks " Plant
lifnr " Vendor
FROM z_mar
INTO TABLE t_mar "with MANDT
INTO TABLE t_mar1 "without MANDT
where sal = 2000.
but why don't whant to user move-correspondig?
Regards, Dieter
Message was edited by: Dieter Gröhn
10-25-2006 1:45 PM
Hi Ravi
Please try with below code:
types: begin of t_mar,
werks like z_mar-werks,
lifnr like z_mar-lifnr,
end of t_mar.
data: it_mar type STANDARD TABLE OF t_mar,
wa_mar type t_imar.
SELECT "mandt
werks " Plant
lifnr " Vendor
FROM z_mar
INTO TABLE it_mar
where sal = 2000.
Kind Regards
Eswar
10-25-2006 1:34 PM
HI,
By removing MANDT from select query, it is going to dump.
ex:
---
SELECT
werks " Plant
lifnr " Vendor
FROM z_mar
<b>INTO corresponding fields TABLE t_mar</b>where sal = 2000.
Regards
amole
10-25-2006 1:34 PM
Hi Ravi,
you have to fetch all the fields that are there in the internal table while usign 'into table'.
o.w u can use
into(t_mar-werks, t_mar-lifnr) and need to append each record to the internal table.
-Anu
10-25-2006 1:35 PM
You might also check whether MANDT is defined as the first field of transparent table Z_MAR. And if so, is it defined with data element MANDT.
Another consideration is why not use:
SELECT * FROM Z_MAR INTO TABLE T_MAR.
10-25-2006 2:16 PM
hi Ravi,
i also had to avoid move-corresponding and the following is what i did...its extra work and goes around but it will
do the needed work..............
t_mar LIKE STANDARD TABLE OF z_mar.
SELECT *
FROM z_mar
INTO TABLE t_mar
where sal = 2000.
the above gets you all the fields ...but if you still want to narrow it down to just two fields
*****Declaring structure with 2 fields
data:begin of fs_data.
data:werks type z_mar-werks,
lifnr type z_mar-lifnr ,
data:end of fs_data.
*******internal table of above
data:int_data like fs_data occurs 0 with headerline.
*****moving the only 2 required fields
loop at t_mar.
t_mar-werks = int_data-werks.
t_mar-lifnr = int_data-lifnr.
append int_data.
endloop.
Hope you found it useful...
Regards
Bx