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: 

Select Query help req????

Former Member
0 Kudos

Hi

I have to hardcode in the case of Doc Type = NB i.e BSART = 'NB' & FRGKZ = SPACE,in this code .I have to maintian the same functionlity,but if this is the case,than release indicator FRGKZ = Space.this additional thing as to be maintain.Please tell me...?

SELECT DISTINCT eban~banfn

eban~badat

eban~matnr

eban~werks

eban~ekgrp

eban~bsart

ekko~ebeln

ekko~bedat

INTO CORRESPONDING FIELDS OF TABLE itab1

FROM eban AS eban INNER JOIN ekko AS ekko ON ebanebeln = ekkoebeln

WHERE eban~loekz EQ space AND

eban~banfn IN p_prno AND

eban~badat IN p_prdate AND

eban~matnr IN p_matnr AND

eban~werks IN p_plant AND

eban~ekgrp IN p_prgrp AND

eban~bsart IN p_doctyp AND

ekko~ebeln IN p_pono AND

ekko~bedat IN p_podate AND

ekko~frgke = 'R'

GROUP BY eban~banfn

eban~badat

eban~matnr

eban~werks

eban~ekgrp

eban~bsart

ekko~ebeln

ekko~bedat

eban~banpr

eban~frgkz .

regards

Vipin

6 REPLIES 6

Former Member
0 Kudos

Hi,

Loop at TAB1 where BSART = 'NB'.

if sy-subrc = 0.

Move ' ' to TAB1-FRGKZ.

modify TAB1.

Endloop.

Trythis,

KC

0 Kudos

Hi

well my prob is that i am selecting the data as per as the selection-screen.than i have to put it into an internal table & have to do the,claculations.

if user will put.doc type = 'nb',than its release indic is. frgkz is space,no entry.So my select query will not pick any data in case of NB as all the where condi has to be true.

so i am asking,where should i code,as per as my knowlege,i have to code before filling the data into the int. table.otherise,my table will be empty in case of BSART = NB.As its release indi is none,so i have to pass space in its filed.

please help me.if u got my prob??

0 Kudos

Hi Vipin,

Try this.

Loop at TAB1into wa_itab1 where BSART = 'NB'.

if sy-subrc = 0.

delete itab1 from wa_itab1.

Endloop.

  • you can do this after you fill the in ternal tables, so that wherenever there is a NB entry , that entry willbe deleted.

Reward If Useful.

Regards,

Chitra

0 Kudos

well in earlier select query,eban~frgkz = 'R' is already hardcoded. i forgot to write.

So now will 2 frgkz,means ebanfrgkz = '' ,ebanfrgkz = 'R' will work .?

0 Kudos

hi,can i use this??is displaying error?? "(" ")" has no closing.??

cn you please make it work.

SELECT DISTINCT eban~banfn

eban~badat

eban~matnr

eban~werks

eban~ekgrp

eban~bsart

eban~frgkz

eban~banpr

INTO CORRESPONDING FIELDS OF TABLE itab2 FROM eban AS eban

WHERE eban~loekz EQ space AND

eban~banfn IN p_prno AND

eban~badat IN p_prdate AND

eban~matnr IN p_matnr AND

eban~werks IN p_plant AND

eban~ekgrp IN p_prgrp AND

eban~bsart IN p_doctyp AND

( ebanfrgkz EQ 'R' or ebanfrgkz = space where eban~bsart = 'NB' ) and

( ebanbanpr EQ '05' or ebanbanpr = space where eban~bsart = 'NB' ) AND

eban~ebeln EQ space

GROUP BY eban~banfn

eban~badat

eban~matnr

eban~werks

eban~ekgrp

eban~bsart

eban~frgkz

eban~banpr.

Former Member
0 Kudos

Hi Vipin ,

Try this.

SELECT DISTINCT eban~banfn

eban~badat

eban~matnr

eban~werks

eban~ekgrp

eban~bsart

ekko~ebeln

ekko~bedat

INTO CORRESPONDING FIELDS OF TABLE itab1

FROM eban AS eban INNER JOIN ekko AS ekko ON ebanebeln = ekkoebeln

WHERE eban~loekz EQ space AND

eban~banfn IN p_prno AND

eban~badat IN p_prdate AND

eban~matnr IN p_matnr AND

eban~werks IN p_plant AND

eban~ekgrp IN p_prgrp AND

<b>( eban~bsart IN p_doctyp or " here put And / Or as reqd.

eban~bsart eq 'NB' ) and

eban-frgkz = ' ' and</b>

ekko~ebeln IN p_pono AND

ekko~bedat IN p_podate AND

ekko~frgke = 'R'

GROUP BY eban~banfn

eban~badat

eban~matnr

eban~werks

eban~ekgrp

eban~bsart

ekko~ebeln

ekko~bedat

eban~banpr

eban~frgkz .

Reward If Useful,

Regards,

Chitra