Application Development 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: 

Why this SQL/SELECT is NOT working ??????u00DFu00DF

Former Member
0 Kudos

Hi Experts,

I hv a sql, which is NOT working!!

1-working one...........

SELECT ekko~ebeln

ekko~bedat

ekko~aedat

ekko~ernam

ekko~frgke

ekko~ekorg

ekpv~kunnr

ekko~lifnr

ekpo~ebelp

ekpo~matnr

ekpo~meins

ekpo~werks

ekpo~menge

mara~prdha

mara~matkl

marc~dispo

INTO CORRESPONDING FIELDS OF TABLE t_po

FROM ekko

INNER JOIN ekpo

ON ekpoebeln = ekkoebeln

INNER JOIN ekpv ON

ekpvebeln = ekkoebeln

AND ekpvebelp = ekpoebelp

INNER JOIN mara ON

maramatnr = ekpomatnr

INNER JOIN marc ON

marcmatnr = ekpomatnr

AND marcwerks = ekpowerks

WHERE ekko~loekz = space

AND ekpo~loekz = space

AND ekko~lifnr = p_lifnr

AND ekko~reswk = p_reswk======== is defaulted with 1000 plant

AND ekko~frgsx = p_frgsx

AND ekko~frgke IN s_frgke

AND ekko~bukrs IN s_bukrs

AND ekko~ekorg IN s_ekorg

AND ekko~ekgrp IN s_ekgrp

AND ekko~ihrez IN s_ihrez

AND ekko~bsart IN s_bsart

AND ekko~ebeln IN s_ebeln

AND ekko~aedat IN s_aedat

AND ekko~ernam IN s_ernam

AND ekpo~lfret = p_lfret

AND ekpo~matnr IN s_matnr

AND mara~prdha IN s_prdha

AND mara~matkl IN s_matkl

  • AND marc~werks = '1000' ==============>if I comment

AND marc~dispo IN s_dispo.

2 - NOT working one.......

SELECT ekko~ebeln

ekko~bedat

ekko~aedat

ekko~ernam

ekko~frgke

ekko~ekorg

ekpv~kunnr

ekko~lifnr

ekpo~ebelp

ekpo~matnr

ekpo~meins

ekpo~werks

ekpo~menge

mara~prdha

mara~matkl

marc~dispo

INTO CORRESPONDING FIELDS OF TABLE t_po

FROM ekko

INNER JOIN ekpo

ON ekpoebeln = ekkoebeln

INNER JOIN ekpv ON

ekpvebeln = ekkoebeln

AND ekpvebelp = ekpoebelp

INNER JOIN mara ON

maramatnr = ekpomatnr

INNER JOIN marc ON

marcmatnr = ekpomatnr

AND marcwerks = ekpowerks

WHERE ekko~loekz = space

AND ekpo~loekz = space

AND ekko~lifnr = p_lifnr

AND ekko~reswk = p_reswk ======== is defaulted with 1000 plant

AND ekko~frgsx = p_frgsx

AND ekko~frgke IN s_frgke

AND ekko~bukrs IN s_bukrs

AND ekko~ekorg IN s_ekorg

AND ekko~ekgrp IN s_ekgrp

AND ekko~ihrez IN s_ihrez

AND ekko~bsart IN s_bsart

AND ekko~ebeln IN s_ebeln

AND ekko~aedat IN s_aedat

AND ekko~ernam IN s_ernam

AND ekpo~lfret = p_lfret

AND ekpo~matnr IN s_matnr

AND mara~prdha IN s_prdha

AND mara~matkl IN s_matkl

AND marc~werks = '1000' ==============> I took out the comment

AND marc~dispo IN s_dispo.

in the 1st case, am getting report, with 10 materails.............fine.

but, when i see these 10 materails......all they are present in MARC table for that WERKS(1000)

so,

why this difference? even though these 10 materails present, why the 2nd sql not giving any output.

i know there is

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You have added one more field along with the MARCWERKS in the where condition i.e. MARCDISPO.

Please check whether in the ouput report, you are getting the same value of this field that you are passing in S_DISPO.

This might be the problem in the second Select query.

See if it helps.

- Hemant

1 REPLY 1

Former Member
0 Kudos

Hi,

You have added one more field along with the MARCWERKS in the where condition i.e. MARCDISPO.

Please check whether in the ouput report, you are getting the same value of this field that you are passing in S_DISPO.

This might be the problem in the second Select query.

See if it helps.

- Hemant