‎2010 Mar 25 1:40 PM
Hi Guys,
I want to read data from the tables likp,lips and vbpa.
I tried the select statement as follows:
In my itab I get some 40 lines but apart from the "vtweg" field(It shows 25),all other fields are empty.
What am I doing wrong?
SELECT likp~lfart likp~wadat_ist lips~matnr lips~lgmng lips~vtweg
lips~vbeln vbpa~land1 INTO CORRESPONDING FIELDS OF TABLE gt_sel_cum_opco
FROM likp INNER JOIN lips
ON likp~vbeln = lips~vbeln
iNNER JOIN vbpa ON lips~vbeln = vbpa~vbeln
WHERE likp~lfart IN so_lfart //From select -options
AND likp~wadat_ist IN so_datum //From select -options
AND lips~matnr = p_matnr //From paramter
AND lips~vtweg = '25'.
My itab struct is as follows:
TYPES : BEGIN OF gty_cum_opco,
matnummer TYPE lips-matnr,
vtweg TYPE lips-vtweg,
land TYPE vbpa-land1,"Land
month(5) TYPE c,
dqty TYPE lips-lgmng ,
date type likp-wadat_ist,
"kunnr TYPE string,
lieferschein TYPE lips-vbeln,
END OF gty_cum_opco.
DATA: gt_sel_cum_opco TYPE TABLE OF gty_cum_opco.Thanks
‎2010 Mar 25 2:09 PM
Hi
change the select as follow
SELECT likp~lfart likp~wadat_ist lips~matnr lips~lgmng lips~vtweg
lips~vbeln vbpa~land1 INTO(ls_sel_cum_opco-month,
ls_sel_cum_opco-date,
ls_sel_cum_opco-matnummer,
ls_sel_cum_opco-dqty,
ls_sel_cum_opco-vtweg,
ls_sel_cum_opco-lieferschein,
ls_sel_cum_opco-land,)
FROM likp INNER JOIN lips
ON likp~vbeln = lips~vbeln
iNNER JOIN vbpa ON lips~vbeln = vbpa~vbeln
WHERE likp~lfart IN so_lfart //From select -options
AND likp~wadat_ist IN so_datum //From select -options
AND lips~matnr = p_matnr //From paramter
AND lips~vtweg = '25'.
append ls_sel_cum_opco to gt_sel_cum_opco.
ENDSELECt.
Best regards
Marco
‎2010 Mar 25 1:48 PM
The field names in the selection field list do not match the field names of the target structure, except for VTWEG, so "CORRESPONDING" does not find matches.
Either rename the fields of the target structure or use the "AS" addition in the select statement (see online help for SELECT).
Thomas
P.S. please use a more meaningful subject line next time around.
‎2010 Mar 25 2:01 PM
I dont want to modify my itab fields.How to change the select statement then.....
Edited by: pazzuzu on Mar 25, 2010 3:01 PM
‎2010 Mar 25 2:03 PM
Please see my first reply (hint: option "AS" of the SELECT statement).
Thomas
‎2010 Mar 25 2:09 PM
Hi
change the select as follow
SELECT likp~lfart likp~wadat_ist lips~matnr lips~lgmng lips~vtweg
lips~vbeln vbpa~land1 INTO(ls_sel_cum_opco-month,
ls_sel_cum_opco-date,
ls_sel_cum_opco-matnummer,
ls_sel_cum_opco-dqty,
ls_sel_cum_opco-vtweg,
ls_sel_cum_opco-lieferschein,
ls_sel_cum_opco-land,)
FROM likp INNER JOIN lips
ON likp~vbeln = lips~vbeln
iNNER JOIN vbpa ON lips~vbeln = vbpa~vbeln
WHERE likp~lfart IN so_lfart //From select -options
AND likp~wadat_ist IN so_datum //From select -options
AND lips~matnr = p_matnr //From paramter
AND lips~vtweg = '25'.
append ls_sel_cum_opco to gt_sel_cum_opco.
ENDSELECt.
Best regards
Marco
‎2010 Mar 25 5:42 PM