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: 

many tables many fields

Former Member
0 Kudos

Hello Everybody!

In my case there are three tables:

CCIHT_IAL, CCIHT_IPEVINJ, CCIHT_IPEVA .

I need a select statement that returns datas regarding

below shown fields. How looks such a select statement with these fields

and three tables ? I hope somebody can help me.

Regards

erdem

SELECTION-SCREEN BEGIN OF BLOCK ...
SELECT-OPTIONS:  
s_kat  FOR ccihs_ialhiot-ialid,"*table CCIHT_IAL*
s_katart  FOR ccihs_ialhiot-iatype, "*table CCIHT_IAL*
s_stat FOR ccihs_ialhiot-iashstatnam,"*table CCIHT_IAL*
s_date FOR ccihs_ialhiot-evdat,     "*table CCIHT_IAL*
s_rep  FOR ccihs_ialhiot-iarephdflg, "*table CCIHT_IAL*
s_dead FOR ccihs_ialhiot-ialdeadflg, "*table CCIHT_IAL*
s_utyp FOR CCIHS_IPEVAIOT-IALPCAT. "*CCIHT_IPEVA*

PARAMETERS      
p_orgeh   TYPE orgeh .

SELECT-OPTIONS:  
s_verlet  FOR CCIHS_IPEVINJIOT-INJURY, "*table CCIHT_IPEVINJ*
s_kteil   FOR CCIHS_IPEVINJIOT-BODYPART, "*table CCIHT_IPEVINJ*
s_babwes  FOR CCIHS_IPEVAIOT-IPABSBEGDAT,"*table CCIHT_IPEVA*
s_eabwes  FOR CCIHS_IPEVAIOT-IPABSENDDAT,"*table CCIHT_IPEVA*
s_atabw   FOR CCIHS_IPEVAIOT-IPABSDAYS, "*table CCIHT_IPEVA*
s_apalt   FOR CCIHS_IPEVAIOT-IALPEXP, "*table CCIHT_IPEVA*
s_palter  FOR CCIHS_IPEVAIOT-IPAGE, "*table CCIHT_IPEVA*
s_ursach  FOR CCIHS_IPEVAIOT-IACAUS,"*table CCIHT_IPEVA*
s_ausl    FOR CCIHS_IPEVAIOT-IAOBJ, "*table CCIHT_IPEVA*
s_tdverl  FOR CCIHS_IPEVAIOT-IPACT, "*table CCIHT_IPEVA*
s_bewver  FOR CCIHS_IPEVAIOT-IPMOV. "*table CCIHT_IPEVA*
SELECTION-SCREEN END OF BLOCK ...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

syntax error at

from ccihs_ialhiot.

It is not defined in the ABAP Dictionary. I think it is a structure.

Rgds

sas

6 REPLIES 6

Former Member
0 Kudos

hi check this ..

REPORT ZTESTPROG002.

tables : ccihs_ialhiot ,

CCIHS_IPEVAIOT ,

CCIHS_IPEVINJIOT .

data: begin of itab occurs 0,

iatype like ccihs_ialhiot-iatype,

iashstatnam like ccihs_ialhiot-iashstatnam ,

evdat like ccihs_ialhiot-evdat,

iarephdflg like ccihs_ialhiot-iarephdflg,

IALPCAT like CCIHS_IPEVAIOT-IALPCAT,

end of itab.

data: begin of itab1 occurs 0,

IPABSBEGDAT like CCIHS_IPEVAIOT-IPABSBEGDAT,

IPABSENDDAT like CCIHS_IPEVAIOT-IPABSENDDAT,

IPABSDAYS like CCIHS_IPEVAIOT-IPABSDAYS ,

IALPEXP like CCIHS_IPEVAIOT-IALPEXP,

IPAGE like CCIHS_IPEVAIOT-IPAGE ,

IACAUS like CCIHS_IPEVAIOT-IACAUS ,

IAOBJ like CCIHS_IPEVAIOT-IAOBJ,

IPACT like CCIHS_IPEVAIOT-IPACT,

IPMOV like CCIHS_IPEVAIOT-IPMOV ,

end of itab1 .

data: begin of itab3 occurs 0,

INJURY like CCIHS_IPEVINJIOT-INJURY,

BODYPART like CCIHS_IPEVINJIOT-BODYPART,

end of itab3 .

SELECTION-SCREEN BEGIN OF BLOCK b1 .

SELECT-OPTIONS:

s_kat FOR ccihs_ialhiot-ialid,"table CCIHT_IAL

s_katart FOR ccihs_ialhiot-iatype, "table CCIHT_IAL

s_stat FOR ccihs_ialhiot-iashstatnam,"table CCIHT_IAL

s_date FOR ccihs_ialhiot-evdat, "table CCIHT_IAL

s_rep FOR ccihs_ialhiot-iarephdflg, "table CCIHT_IAL

s_dead FOR ccihs_ialhiot-ialdeadflg, "table CCIHT_IAL

s_utyp FOR CCIHS_IPEVAIOT-IALPCAT. "CCIHT_IPEVA

PARAMETERS

p_orgeh TYPE orgeh .

SELECT-OPTIONS:

s_verlet FOR CCIHS_IPEVINJIOT-INJURY, "table CCIHT_IPEVINJ

s_kteil FOR CCIHS_IPEVINJIOT-BODYPART, "table CCIHT_IPEVINJ

s_babwes FOR CCIHS_IPEVAIOT-IPABSBEGDAT,"table CCIHT_IPEVA

s_eabwes FOR CCIHS_IPEVAIOT-IPABSENDDAT,"table CCIHT_IPEVA

s_atabw FOR CCIHS_IPEVAIOT-IPABSDAYS, "table CCIHT_IPEVA

s_apalt FOR CCIHS_IPEVAIOT-IALPEXP, "table CCIHT_IPEVA

s_palter FOR CCIHS_IPEVAIOT-IPAGE, "table CCIHT_IPEVA

s_ursach FOR CCIHS_IPEVAIOT-IACAUS,"table CCIHT_IPEVA

s_ausl FOR CCIHS_IPEVAIOT-IAOBJ, "table CCIHT_IPEVA

s_tdverl FOR CCIHS_IPEVAIOT-IPACT, "table CCIHT_IPEVA

s_bewver FOR CCIHS_IPEVAIOT-IPMOV. "table CCIHT_IPEVA

SELECTION-SCREEN END OF BLOCK b1 .

start-of-selection .

select

ialid

iatype

iashstatnam

evdat

iarephdflg

ialdeadflg

from ccihs_ialhiot

into table itab

where ialid in s_kat

and iatype in s_katart

and iashstatnam in s_stat

and evdat in s_date

and iarephdflg in s_rep

and ialdeadflg in s_dead .

select IPABSBEGDAT

IPABSENDDAT

IPABSDAYS

IALPEXP

IPAGE

IACAUS

IAOBJ

IPACT

IPMOV

from CCIHS_IPEVAIOT

into table itab1

where IPABSENDDAT in s_babwes

and IPABSENDDAT in s_eabwes

and IPABSDAYS in s_eabwes

and IALPEXP in s_atabw

and IPAGE in s_apalt

and IACAUS in s_palter

and IAOBJ in s_ursach

and IPACT in s_ausl

and IPMOV in s_tdverl .

select

INJURY

BODYPART

from CCIHS_IPEVINJIOT

into itab3

where INJURY in s_verlet

and BODYPART in s_kteil .

you need to code from here ..

regards,

venkat.

0 Kudos

I have checked it but doesn't work .

rgd

sas erdem

0 Kudos

What doesn't work? Does code give syntax error, or is it not retrieving any data from database?

If so, is it because you have entered any parameters / select-options?

Former Member
0 Kudos

Perform one select for each table, using the comparison "IN" to see if the value is on the informed "SELECT-OPTION" range. Doing that, you'll restrict your search only to the entered values (if some is entered).


* Sample code:

SELECT * FROM scarr
INTO TABLE tg_internal_table_name
WHERE carrid IN s_carrid.

Hope it helps you!

Former Member
0 Kudos

syntax error at

from ccihs_ialhiot.

It is not defined in the ABAP Dictionary. I think it is a structure.

Rgds

sas

0 Kudos

Well, then first thing you will have to do is determine all database tables in which the data is stored.

Coding above looks OK to me, but won't work if you have supplied structures in stead of database tables.

Good luck with that.