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

Problem with select query

Former Member
0 Likes
508

Hi ,

I had a requirment as follows.

In the Selection screen i have 4 blocks.

in the first block i have company code.

second block:

Customer ID

Industry key:

third block:

Posting document type:

posting date

clearing date

debit/credit indicator

offsetting account type

offsetting account

minimum amount.

I have designed above selection screen.

To featch the data there is two rules.

1)

SELECT Customer KNA1-KUNNR,

BP name KNA1-NAME1,

BP street address KNA1-STRAS,

BP post code KNA1-PSTLZ,

BP city KNA1-ORT01

BP country KNA1-LAND1

FROM KNA1

WHERE KNA1-KUNNR and KNA1-BRSCH correspond to values from u201Ccustomer master selectionu201D on selection screen.

for the above i have return the code as follows.

select kunnr

name1

stras

pstlz

ort01

land1

from kna1 into table it_kna1 where kunnr in kunnr and brsch in

brsch.

2)

For customers, selected in p.2, Select from BSAD payment items corresponding to selection criteria for payment documents from selection screen

Fields to select

Document type BSAD u2013 BLART

Document number BSAD-BELNR

Customer BSAD-KUNNR

Text BSAD-SGTXT (Contract nb)

Offsetting account (*see Rule 1)

Payment type (**see Rule 2)see

Payment amount (to get from offsetting GL account)

Posting date BSAD-BUDAT,

Clearing date BSAD-AUGDT,

Clearing document BSAD-AUGBL

Reference BSAD-XBLNR (bordereau)

Assignement BSAD-ZUONR (cheque nb)

Debit/credit indicator BSAD-SHKZG

Amount BSEG-DMBTR (*see Rule 1)

Sort by customer (BSAD-KUNNR) and payment type

for the above how to featch the data i am not getting.

Two rules to select the above off setting account and pament type.

Rule 1

SELECT offsetting account number BSEG-HKONT and BSEG-DMBTR from BSEG

WHERE BSEG-BELNR = BSAD-BELNR and BSEG-KOART = offsetting account type from selection screen and BSEG-DMBTR bigger then minimum amount from selection screen for payment documents.

Rule 2

IF ((document type = BT and offsetting account = 550000011) or (document type = ZF and offsetting account = 550000011)) THEN payment type = CASH

IF ((document type = ZF and offsetting account = 550##03 or 550##12) or (document type = DM)) THEN payment type = CHEQUE

IF (document type = BT and offsetting account = 550##06) THEN payment type = VIREMENT

IF (document type = DZ and offsetting account = 550##05) THEN payment type = PRELEVEMENT

.

Can you please help me how to get the data in the above case.

2 REPLIES 2
Read only

Former Member
0 Likes
465

To the above questuion i am trying to write the query in the following format.

select kunnr

name1

stras

pstlz

ort01

land1

from kna1 into table it_kna1 where kunnr in kunnr and brsch in

brsch.

select blart belnr kunnr xblnr zuonr sgtxt budat augdt augbl shkzg from

bsad INTO CORRESPONDING FIELDS OF TABLE it_item1

FOR ALL ENTRIES IN it_kna1

where kunnr = it_kna1-kunnr.

But when it is comming to select for all entries it is going to dump,can any body help in this problem

Read only

0 Likes
465

check the first internal table if is initial or not. and then come up with a clear condtion in the where part of the query