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

Data nt pulling in internal table

Former Member
0 Likes
655

HI guys,

I am working on a report where I need to execute the report based on the selection options that user selects.

The thing is that user can enter any of the parameter and can execute the reort, I mean he can just enter the date and will want to look at the outcome for that period only, or he can enter the date, customer number and account number to look specifically the outcome for that particular customer, between that particular period of time and for that particular g/a only.

for example :

1. if user enters date as b/w 08/16/2007 and 10/16/2007, so he should be able to look out the record of all the customers between this report

2. if user enters date as b/w 08/16/2007 and 10/16/2007,

customer name Rajeev

G/L account 12345, so in this scenario the report should display the particular record of Rajeev between this period of time and for g/c a/c # 12345.

for this I have written the following code:

selection-screen begin of block b1 with frame title text-001.

select-options a_bukrs for vbkpf-bukrs default 'UC'.

select-options a_blart for vbkpf-blart default 'PC'.

select-options a_date for ZTEST-postingdate .

select-options a_mname for ZTEST-MERCHANTNAME.

select-options a_anum for ZTEST-CARDNUMBER6.

select-options a_cname for ZTEST-CARDHOLDER.

select-options a_hname for ZTEST-HIER_NAME.

select-options a_ref for VBSEGS-XREF3.

select-options a_glact for VBSEGS-SAKNR.

select-options a_chngb for VBKPF-USUPD.

select-options a_compb for VBKPF-USCMP.

select-options a_docom for VBKPF-XPRFG.

select-options a_fisyr for VBKPF-gjahr.

select-options a_docnum for VBKPF-BELNR .

selection-screen end of block b1.

data: begin of it_output occurs 0,

syst_date like sy-datum,

syst_time like sy-uzeit,

belnr like vbkpf-belnr,

gjhar like vbkpf-gjahr,

xprfg like vbkpf-xprfg,

uscmp like vbkpf-uscmp,

usupd like vbkpf-usupd,

hwaer like vbkpf-hwaer,

blart like vbkpf-blart,

bukrs like vbkpf-bukrs,

shkzg like vbsegs-shkzg,

dmbtr like vbsegs-dmbtr,

saknr like vbsegs-saknr,

geber like vbsegs-geber,

fkber like vbsegs-fkber,

kostl like vbsegs-kostl,

grant_nbr like vbsegs-grant_nbr,

ps_psp_pnr like vbsegs-ps_psp_pnr,

aufnr like vbsegs-aufnr,

kblnr like vbsegs-kblnr,

kblpos like vbsegs-kblpos,

anln1 like vbsegs-anln1,

anln2 like vbsegs-anln2,

xref3 like vbsegs-xref3,

sgtxt like vbsegs-sgtxt,

bschl like vbsegs-bschl,

gsber like vbsegs-gsber,

fipos like vbsegs-fipos,

fistl like vbsegs-fistl,

ausbk like vbsegs-ausbk,

TRANS_ID like ZTEST-TRANS_ID,

HIER_NAME like ZTEST-HIER_NAME,

CARDHOLDER like ZTEST-CARDHOLDER,

CARDNUMBER like ZTEST-CARDNUMBER,

CARDNUMBER6 like ZTEST-CARDNUMBER6,

POSTINGDATE like ZTEST-POSTINGDATE,

MERCHANTNAME like ZTEST-MERCHANTNAME,

MERCHANTCITY like ZTEST-MERCHANTCITY,

MERCHANTSTATE like ZTEST-MERCHANTSTATE,

MERCHANTZIP like ZTEST-MERCHANTZIP,

MCC like ZTEST-MCC,

MCCDESCRIPTION like ZTEST-MCCDESCRIPTION,

REFNUMBER like ZTEST-REFNUMBER,

CURRENCYCODE like ZTEST-CURRENCYCODE,

TRANSMEMO like ZTEST-TRANSMEMO,

UNIQUEID like ZTEST-UNIQUEID,

COSTCENTER like ZTEST-COSTCENTER,

ACCTLVLGLNUM like ZTEST-ACCTLVLGLNUM,

MASTERACCTCODE like ZTEST-MASTERACCTCODE,

EXPENSECATEGORY like ZTEST-EXPENSECATEGORY,

PURCHASEID like ZTEST-PURCHASEID,

CRI like ZTEST-CRI,

MINORITYVENDCDE like ZTEST-MINORITYVENDCDE,

STATUS1099 like ZTEST-STATUS1099,

INCORPSTATUS like ZTEST-INCORPSTATUS,

INCORPDESCR like ZTEST-INCORPDESCR,

FEDTAXID like ZTEST-FEDTAXID,

RDATE like ZTEST-RDATE,

RTIME like ZTEST-RTIME,

select VBKPFBELNR VBKPFGJAHR VBKPFXPRFG VBKPFUSCMP VBKPFUSUPD VBKPFHWAER VBKPFBLART VBKPFBUKRS VBSEGS~BSCHL

VBSEGSGSBER VBSEGSDMBTR VBSEGSKOSTL VBSEGSAUFNR VBSEGSSAKNR VBSEGSPS_PSP_PNR VBSEGSFIPOS VBSEGSANLN1

VBSEGSANLN2 VBSEGSKBLNR VBSEGSKBLPOS VBSEGSGEBER VBSEGSFISTL VBSEGSFKBER VBSEGSXREF3 VBSEGSGRANT_NBR

VBSEGSAUSBK vbsegsshkzg vbsegssgtxt vbsegsbschl VBSEGSBELNR VBSEGSGJAHR ztest~cardnumber

ztestuniqueid ztestcostcenter ztestacctlvlglnum ztestmasteracctcode

ztestrdate ztestrtime ZTESTHIER_NAME ZTESTCARDHOLDER ZTEST~CARDNUMBER6

ZTESTMERCHANTNAME ZTESTMERCHANTCITY ZTESTMERCHANTSTATE ZTESTMERCHANTZIP

ZTESTMCC ZTESTMCCDESCRIPTION ZTESTREFNUMBER ZTESTTRANSMEMO

ZTESTEXPENSECATEGORY ZTESTPURCHASEID ZTESTCRI ZTESTMINORITYVENDCDE

ZTESTSTATUS1099 ZTESTINCORPSTATUS ZTESTINCORPDESCR ZTESTFEDTAXID

ZTESTPOSTINGDATE ZTESTBUKRS ZTESTbelnr ZTESTgjahr

into table it_output

from VBKPF

inner join VBSEGS

on VBSEGSAUSBK = VBKPFAUSBK

and VBSEGSBELNR = VBKPFBELNR

and VBSEGSGJAHR = VBKPFGJAHR

inner join ZTEST

on ZTESTBUKRS = VBSEGSAUSBK

and ZTESTBELNR = VBSEGSBELNR

and ZTESTGJAHR = VBSEGSGJAHR

where VBKPF~USUPD in chngb

and VBKPF~USCMP in compb

and VBKPF~XPRFG in a_docom

and VBKPF~GJAHR in a_fisyr

and VBKPF~BELNR in a_docnum

and VBKPF~BLART in a_blart

and VBKPF~BUKRS in a_bukrs

and VBSEGS~XREF3 in a_ref

and VBSEGS~SAKNR in a_glact

and ZTEST~MERCHANTNAME in a_mname

and ZTEST~CARDNUMBER6 in a_anum

and ZTEST~CARDHOLDER in a_cname

and ZTEST~HIER_NAME in a_hname

and ZTEST~POSTINGDATE in a_date.

but the now the problem is when I am looking into my internal table i.e. it_output its not getting any data in it and just coming blank. so can you please tell me where I am doing it wrong.

Thanks,

Rajeev

1 ACCEPTED SOLUTION
Read only

Sm1tje
Active Contributor
0 Likes
575

if the syntax is correct (looks like it) then probably the only thing that might give problems is the fact that the one or the other comparison comes up empty.

You have to make sure that ALL the data from the where clause will give you at least ONE entry:

where VBKPF~USUPD in chngb

and VBKPF~USCMP in compb

and VBKPF~XPRFG in a_docom

and VBKPF~GJAHR in a_fisyr

and VBKPF~BELNR in a_docnum

and VBKPF~BLART in a_blart

and VBKPF~BUKRS in a_bukrs

and VBSEGS~XREF3 in a_ref

and VBSEGS~SAKNR in a_glact

and ZTEST~MERCHANTNAME in a_mname

and ZTEST~CARDNUMBER6 in a_anum

and ZTEST~CARDHOLDER in a_cname

and ZTEST~HIER_NAME in a_hname

and ZTEST~POSTINGDATE in a_date.

It would be wise to (starting from the bottom for example) to delete one line like this:

where VBKPF~USUPD in chngb

and VBKPF~USCMP in compb

and VBKPF~XPRFG in a_docom

and VBKPF~GJAHR in a_fisyr

and VBKPF~BELNR in a_docnum

and VBKPF~BLART in a_blart

and VBKPF~BUKRS in a_bukrs

and VBSEGS~XREF3 in a_ref

and VBSEGS~SAKNR in a_glact

and ZTEST~MERCHANTNAME in a_mname

and ZTEST~CARDNUMBER6 in a_anum

and ZTEST~CARDHOLDER in a_cname

and ZTEST~HIER_NAME in a_hname.

If still no entry than also delete the current last AND.

3 REPLIES 3
Read only

Former Member
0 Likes
575

hi ,

i think u did some mistake in writiung inner join condition.

do like this , it is esy to un'stnd to evry bady..

ex: SELECT AVBELN BVTEXT AFKDAT CBUTXT ANETWR AWAERK INTO TABLE ITAB

FROM VBRK AS A INNER JOIN VBUK AS D

ON AVBELN = DVBELN INNER JOIN VBRP AS E

ON DVBELN = EVBELN

INNER JOIN TVKOT AS B ON

AVKORG = BVKORG

INNER JOIN T001 AS C ON

ABUKRS = CBUKRS

WHERE AVBELN IN BDOCU AND AFKSTO = ' '

AND A~FKDAT IN BDATE

AND E~POSNR = ITEM .

regrads,

chandu.

Read only

Sm1tje
Active Contributor
0 Likes
576

if the syntax is correct (looks like it) then probably the only thing that might give problems is the fact that the one or the other comparison comes up empty.

You have to make sure that ALL the data from the where clause will give you at least ONE entry:

where VBKPF~USUPD in chngb

and VBKPF~USCMP in compb

and VBKPF~XPRFG in a_docom

and VBKPF~GJAHR in a_fisyr

and VBKPF~BELNR in a_docnum

and VBKPF~BLART in a_blart

and VBKPF~BUKRS in a_bukrs

and VBSEGS~XREF3 in a_ref

and VBSEGS~SAKNR in a_glact

and ZTEST~MERCHANTNAME in a_mname

and ZTEST~CARDNUMBER6 in a_anum

and ZTEST~CARDHOLDER in a_cname

and ZTEST~HIER_NAME in a_hname

and ZTEST~POSTINGDATE in a_date.

It would be wise to (starting from the bottom for example) to delete one line like this:

where VBKPF~USUPD in chngb

and VBKPF~USCMP in compb

and VBKPF~XPRFG in a_docom

and VBKPF~GJAHR in a_fisyr

and VBKPF~BELNR in a_docnum

and VBKPF~BLART in a_blart

and VBKPF~BUKRS in a_bukrs

and VBSEGS~XREF3 in a_ref

and VBSEGS~SAKNR in a_glact

and ZTEST~MERCHANTNAME in a_mname

and ZTEST~CARDNUMBER6 in a_anum

and ZTEST~CARDHOLDER in a_cname

and ZTEST~HIER_NAME in a_hname.

If still no entry than also delete the current last AND.

Read only

Former Member
0 Likes
575

Just as a sanity check, do tables VBKPF, VBSEGS and ZTEST have values that "join"? To make sure, using SE16 take a record from VBKPF and read from VBSEGS and ZTEST. Make sure you get a hit. If not, then it is your test data or your logic of joining.

Otherwise, your select looks OK, assuming your logic is correct