Skip to Content
0
Former Member
Apr 04, 2013 at 09:13 AM

report based on 3 tables

83 Views

I am new to ABAP development

I have 3 table, A905, A919 and KONP. Knumh field - condition record is common in both A905 and A919.

common fields in A905 and A919 is VKORG, VTWEG , KSCHL, KSCHL, REGIO . From A919 AUART_sd to be be displayed in the report with VKORG,VTWEG,KSCHL,REGIO, from A905 and knumh referrence from a905 and a919 to KONp-KNUMH.

Following are the codes :But when executed the below codes data from A919 which has different condition reocrd is not getting displayed. But auart_sd is filled in the data that is executed from A905. Please help to make correction in the following program.

tables : A905,A919,KONP.

TYPE-POOLS : slis.

TYPES : begin of ty_A905,

ALAND TYPE A905-ALAND,

TaXK1 TYPE A905-TAXK1,

TaxM1 TYPE A905-TAXM1,

VKORG TYPE A905-VKORG,

VTWEG TYPE A905-VTWEG,

KONDM TYPE A905-KONDM,

DATAB TYPE A905-DATAB,

DATBI TYPE A905-DATBI,

KAPPL TYPE A905-KAPPL,

KSCHL TYPE A905-KSCHL,

MWSK1 Type konp-MWSK1,

ALAND1 TYPE A919-ALAND,

TaXK2 TYPE A919-TAXK1,

TaxM2 TYPE A919-TAXM1,

VKORG1 TYPE A919-VKORG,

VTWEG1 TYPE A919-VTWEG,

KONDM1 TYPE A919-KONDM,

DATAB1 TYPE A919-DATAB,

DATBI1 TYPE A919-DATBI,

KAPPL1 TYPE A919-KAPPL,

KSCHL1 TYPE A919-KSCHL,

MWSK2 Type konp-MWSK1,

knumh TYPE A919-knumh,

AUART_sd TYPE A919-auart_sd,

wkreg1 TYPE a919-wkreg,

regio1 TYPE a919-regio,

image TYPE c,

END OF ty_a905.

DATA : it_display TYPE TABLE OF ty_A905 WITH HEADER LINE.

DATA : it_display1 TYPE TABLE OF ty_A905 WITH HEADER LINE.

DATA : it_fieldcat TYPE slis_t_fieldcat_alv,

wa_fieldcat TYPE slis_fieldcat_alv.

DATA : w_ssfctrlop TYPE ssfctrlop,

w_func TYPE rs38l_fnam ,

w_doinfo TYPE ssfcrespd ,

w_opinfo TYPE ssfcrescl ,

w_joopt TYPE ssfcresop .

DATA : w_no_of_lines TYPE int4.

SELECT-OPTIONS :

so_KAPPL FOR A905-KAPPL,

so_kschl FOR A905-kschl,

so_VKORG FOR A905-VKORG,

so_VTWEG FOR A905-VTWEG,

so_kondm FOR A905-kondm,

so_wkreg FOR A919-wkreg.

START-OF-SELECTION.

SELECT A905~VKORG

A905~KAPPL

A905~kschl

A905~VTWEG

A905~KONDM

A905~DATAB

A905~DATBI

A905~ALAND

A905~TaxK1

A905~TaxM1

A905~KNUMH

A919~AUART_SD

A919~VKORG

a919~VTWEG

KONP~MWSK1

KONP~KNUMH

INTO CORRESPONDING FIELDS OF TABLE it_display from a905

INNER JOIN a919 on a905~kschl = a919~kschl

INNER JOIN konp on a905~knumh = konp~knumh

where a905~kappl in so_kappl

and a905~kschl in so_kschl

and a905~VKORG in so_vkorg

and a905~vtweg in so_vtweg

and a905~kondm in so_kondm

and a905~wkreg in so_wkreg.