Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Select statement -Problem

Former Member
0 Likes
748

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
671

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

5 REPLIES 5
Read only

ThomasZloch
Active Contributor
0 Likes
671

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.

Read only

0 Likes
671

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

Read only

0 Likes
671

Please see my first reply (hint: option "AS" of the SELECT statement).

Thomas

Read only

Former Member
0 Likes
672

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

Read only

0 Likes
671

Thanks...