‎2006 Jul 19 7:02 AM
Hi,
i have to use both types and data without occurs n and i have to select the data from different tables and put in an internal table.Here is my code can any one modify this
Tables: mseg,mkpf,lfa1,ekko,ekpo,bseg,bkpf.
selection-screen begin of block b1 with frame title text-001.
parameters: p_werks like mseg-werks.
select-options: s_budat for Mkpf-budat.
selection-screen end of block b1.
types:begin of t_mseg,
p_werks type werks_d, "Plant location
mblnr type mblnr, "Number of Material Document
s_budat type budat, "Posting date in document
mtsnr type mtsnr1, "Number of external material slip
maktx type maktx, "Material description
menge type menge_d, "Quantity
lifnr type lifnr, "Vendor Number
name1 type name1_gp, "Name1
name2 type name2_gp, "Name2
telf1 type telf1, "Telephone number
trnam type ztrnam, "Transporter name
glano type zglano, "GR/LR/AWB No
J_1ICSTNO type J_1ICSTNO, "Central Sales Tax Number
J_1ILSTNO type J_1ILSTNO, "Local Sales Tax Number
J_1IEXRN type J_1IEXRN , "Excise Registration Number
end of t_mseg.
*data: begin of it_mseg ,
mblnr like mseg-mblnr,
budat like mkpf-budat,
mtsnr like gohead-mtsnr,
maktx like makt-maktx,
menge like mseg-menge,
lifnr like mseg-lifnr,
name1 like lfa1-name1,
name2 like lfa1-name2,
telf1 like lfa1-telf1,
trnam like zmigo_addition-trnam,
glano like zmigo_addition-glano,
end of it_mseg.
types: it_mseg type standard table of t_mseg,
wa_mseg type t_mseg.
select amblnr amatnr
amenge alifnr
b~budat
into it_mseg
from mseg as a
join mkpf as b
on amblnr = bmblnr
where werks = p_werks and
budat = s_budat.
append wa_MSEG to it_mseg.
endselect.
points will be given .
Thnaks in advance.
Regards,
Amit Teja.V
‎2006 Jul 19 7:11 AM
Hi
Just one Modification
Instead of using the following
types: it_mseg type standard table of t_mseg,use
data: it_mseg type standard table of t_mseg,Hope this Helps
Anirban
‎2006 Jul 19 7:04 AM
Hi amit,
1. I just tried your code.
2. do like this, and it will work.
3. remove the Type (2 lines)
and instead use DATA like this.
*types: it_mseg type standard table of t_mseg,
*wa_mseg type t_mseg.
<b>data : it_mseg type t_mseg occurs 0 with header line.
data : wa_mseg type t_mseg.</b>
regards,
amit m.
‎2006 Jul 19 7:07 AM
<b>data:</b> it_mseg type standard table of t_mseg,
wa_mseg type t_mseg.
and
select amblnr amatnr
amenge alifnr
b~budat
into <b>table</b> it_mseg
from mseg as a
join mkpf as b
on amblnr = bmblnr
where werks = p_werks and
budat = s_budat.
‎2006 Jul 19 7:07 AM
Declare the internal table as
<b>DATA</b>: it_mseg type standard table of t_mseg,
wa_mseg type t_mseg.
And not sure why you need the 'Append wa_mseg' statement? Data will be directly selected into the tab, you dont require a select-endselect there.
select amblnr amatnr
amenge alifnr
b~budat
into <b>table</b> it_mseg
from mseg as a
<b>inner</b> join mkpf as b
on amblnr = bmblnr
where werks = p_werks and
budat = s_budat.
Hope this helps.
Sudha
Message was edited by: Sudha Mohan
‎2006 Jul 19 7:08 AM
hi use the below code..
Tables: mseg,mkpf,lfa1,ekko,ekpo,bseg,bkpf.
selection-screen begin of block b1 with frame title text-001.
parameters: p_werks like mseg-werks.
select-options: s_budat for Mkpf-budat.
selection-screen end of block b1.
types:begin of t_mseg,
mblnr type mseg-mblnr,
matnr type mara-matnr,
menge type mseg-menge,
lifnr type mseg-lifnr,
budat type mkpf-budat,
end of t_mseg.
types: it_mseg type standard table of t_mseg,
wa_mseg type t_mseg.
data: itab type it_mseg,
wa type wa_mseg.
select amblnr amatnr
amenge alifnr
b~budat
into table itab
from mseg as a
join mkpf as b
on amblnr = bmblnr
where werks = p_werks and
budat in s_budat.
Cheers,
Abdul Hakim
‎2006 Jul 19 7:10 AM
Hi,
Just simple one..., change the Types to DATA.
Tables: mseg,mkpf,lfa1,ekko,ekpo,bseg,bkpf.
selection-screen begin of block b1 with frame title text-001.
parameters: p_werks like mseg-werks.
select-options: s_budat for Mkpf-budat.
selection-screen end of block b1.
types:begin of t_mseg,
p_werks type werks_d, "Plant location
mblnr type mblnr, "Number of Material Document
s_budat type budat, "Posting date in document
mtsnr type mtsnr1, "Number of external material slip
maktx type maktx, "Material description
menge type menge_d, "Quantity
lifnr type lifnr, "Vendor Number
name1 type name1_gp, "Name1
name2 type name2_gp, "Name2
telf1 type telf1, "Telephone number
trnam type ztrnam, "Transporter name
glano type zglano, "GR/LR/AWB No
J_1ICSTNO type J_1ICSTNO, "Central Sales Tax Number
J_1ILSTNO type J_1ILSTNO, "Local Sales Tax Number
J_1IEXRN type J_1IEXRN , "Excise Registration Number
end of t_mseg.
*data: begin of it_mseg ,
mblnr like mseg-mblnr,
budat like mkpf-budat,
mtsnr like gohead-mtsnr,
maktx like makt-maktx,
menge like mseg-menge,
lifnr like mseg-lifnr,
name1 like lfa1-name1,
name2 like lfa1-name2,
telf1 like lfa1-telf1,
trnam like zmigo_addition-trnam,
glano like zmigo_addition-glano,
end of it_mseg.
<b>data</b>: it_mseg type standard table of t_mseg,
wa_mseg type t_mseg.
select amblnr amatnr
amenge alifnr
b~budat
into it_mseg
from mseg as a
join mkpf as b
on amblnr = bmblnr
where werks = p_werks and
budat = s_budat.
append wa_MSEG to it_mseg.
endselect.
Regards
vijay
‎2006 Jul 19 7:11 AM
Hi,
Make the following changes
<b>1st Change</b>
types: it_mseg type standard table of t_mseg,
wa_mseg type t_mseg.
\/
data: it_mseg type table of t_mseg,
wa_mseg type t_mseg.
<b>2nd change</b>
select amblnr amatnr
amenge alifnr
b~budat
into it_mseg
from mseg as a
join mkpf as b
on amblnr = bmblnr
where werks = p_werks and
budat = s_budat.
append wa_MSEG to it_mseg.
endselect.
\/
select amblnr amatnr
amenge alifnr
b~budat
<b>into table it_mseg</b>
from mseg as a
join mkpf as b
on amblnr = bmblnr
where werks = p_werks and
budat = s_budat.
‎2006 Jul 19 7:11 AM
Hi Amit,
<b>What kind of error is coming to you....?</b>
There is no problem with your types statement.
You can create internal table like this:
data: it_mseg type table of t_mseg with header line,
wa_mseg type t_mseg.
Also you have to assign the selected values to an internal table in the inner join.
Refer this link if you have any doubt regarding inner joins...
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb39c4358411d1829f0000e829fbfe/content.htm
Regards,
SP.
‎2006 Jul 19 7:11 AM
Hi
Just one Modification
Instead of using the following
types: it_mseg type standard table of t_mseg,use
data: it_mseg type standard table of t_mseg,Hope this Helps
Anirban
‎2006 Jul 19 7:14 AM
Hi,
Making the following changes might help your cause :-
1. Instead of 'types' keyword use 'data' in the statement
types: it_mseg type standard table of t_mseg,
wa_mseg type t_mseg.
2. In SELECT statement 'table' keyword should follow into.
select a~mblnr a~matnr
a~menge a~lifnr
b~budat
into <b> table</b> it_mseg
from mseg as a
join mkpf as b
on a~mblnr = b~mblnr
where werks = p_werks and
budat = s_budat.
append wa_MSEG to it_mseg.
endselect.
Hope this helps you.
Regards,
Anirban.
‎2006 Jul 19 7:15 AM
use like this...
Ex Code:
-
types : begin of itab,
matnr like mara-matnr.
end of itab.
<b>Data Itab1 type standard table of Itab with header line.</b>
select Matnr from mara into <b>TABLE ITAB1</b>
from mara
where matnr < '000000000000000010'.
loop at itab1.
write : /, itab1.
end loop.
‎2006 Jul 19 7:17 AM
You have to use data instead of type
Data :begin of t_mseg,
p_werks type werks_d, "Plant location
mblnr type mblnr, "Number of Material Document
s_budat type budat, "Posting date in document
mtsnr type mtsnr1, "Number of external material slip
maktx type maktx, "Material description
menge type menge_d, "Quantity
lifnr type lifnr, "Vendor Number
name1 type name1_gp, "Name1
name2 type name2_gp, "Name2
telf1 type telf1, "Telephone number
trnam type ztrnam, "Transporter name
glano type zglano, "GR/LR/AWB No
J_1ICSTNO type J_1ICSTNO, "Central Sales Tax Number
J_1ILSTNO type J_1ILSTNO, "Local Sales Tax Number
J_1IEXRN type J_1IEXRN , "Excise Registration Number
end of t_mseg.
Correct code in this way..........
Rewards points if helpful.
Regards
Abhishek
‎2006 Jul 19 7:31 AM
Hi Amit,
Just copy it.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_werks LIKE mseg-werks.
SELECT-OPTIONS: s_budat FOR mkpf-budat.
SELECTION-SCREEN END OF BLOCK b1.
TYPES:BEGIN OF t_mseg,
mblnr TYPE mseg-mblnr,
matnr TYPE mara-matnr,
menge TYPE mseg-menge,
lifnr TYPE mseg-lifnr,
budat TYPE mkpf-budat,
END OF t_mseg.
<b>DATA: it_mseg TYPE STANDARD TABLE OF t_mseg,
wa_mseg TYPE t_mseg,
itab TYPE STANDARD TABLE OF t_mseg,
wa TYPE i_mseg.</b>
SELECT a~mblnr a~matnr
a~menge a~lifnr
b~budat
INTO TABLE itab
FROM mseg AS a
JOIN mkpf AS b
ON a~mblnr = b~mblnr
WHERE werks = p_werks AND
budat IN s_budat.
Regards,
Arun Sambargi.