Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

for all entries on custom tables

i have created 2 custom tables::zhospital_info n zpatient_info..

zhospitalinfo tab fields:::_

doc_name::prim key

patient_name:::prim key

place::prim key

zpatientinfo tab fields::_

ZDATE ::prim key

JOINING

MEDICINE

PRICE

QUANTITY

DOC_NAME ::for key

PATIENT_NAME::for key

PLACE ::for key

and inserted some values to the table contents..

this is my logic:::

TYPES: BEGIN OF ZHOSPITAL_INFO,

DOC_NAME TYPE ZDOC_NAME,

PATIENT_NAME TYPE ZPATIENT_NAME,

PLACE TYPE ZPLACE,

END OF ZHOSPITAL_INFO.

DATA: W_HI TYPE ZHOSPITAL_INFO.

DATA:T_HI TYPE STANDARD TABLE OF ZHOSPITAL_INFO.

TYPES: BEGIN OF ZPATIENTL_INFO,

ZDATE TYPE ZDATE,

JOINING TYPE ZJOINING,

MEDICINE TYPE ZMEDICINE,

PRICE TYPE ZPRICE,

QUANTITY TYPE ZQUANTITY,

DOC_NAME TYPE ZDOC_NAME,

PATIENT_NAME TYPE ZPATIENT_NAME,

PLACE TYPE ZPLACE,

END OF ZPATIENTL_INFO.

DATA: W_PI TYPE ZPATIENTL_INFO.

DATA:T_PI TYPE STANDARD TABLE OF ZPATIENTL_INFO.

TYPES: BEGIN OF FTAB,

DOC_NAME TYPE ZDOC_NAME,

PATIENT_NAME TYPE ZPATIENT_NAME,

PLACE TYPE ZPLACE,

DATE TYPE ZDATE,

JOINING TYPE ZJOINING,

MEDICINE TYPE ZMEDICINE,

PRICE TYPE ZPRICE,

QUANTITY TYPE ZQUANTITY,

END OF FTAB.

DATA: W_FTAB TYPE FTAB,

T_FTAB TYPE STANDARD TABLE OF FTAB.

SELECT DOC_NAME

PATIENT_NAME

PLACE

INTO TABLE t_hi

FROM ZHOSPITAL_INFO .

IF NOT t_hi IS NOT INITIAL.

SELECT DOC_NAME

PATIENT_NAME

PLACE

ZDATE

    • MEDICINE*

PRICE

QUANTITY FROM ZPATIENTL_INFO INTO TABLE t_pi FOR ALL ENTRIES IN

t_hi

WHERE DOC_NAME = t_hi-doc_name.

ENDIF.

LOOP AT t_pi INTO w_pi.

MOVE-CORRESPONDING: w_pi TO W_FTAB.

READ TABLE t_hi INTO w_hi WITH KEY DOC_NAME = W_FTAB-DOC_NAME.

MOVE: w_hi-patient_name TO W_FTAB-PATIENT_NAME,

w_hi-place TO W_FTAB-PLACE.

APPEND W_FTAB TO T_FTAB.

ENDLOOP.

LOOP AT T_FTAB INTO W_FTAB.

WRITE:/ W_FTAB-DOC_NAME,

W_FTAB-PATIENT_NAME,

W_FTAB-PLACE,

W_FTAB-DATE,

W_FTAB-JOINING,

W_FTAB-MEDICINE,

W_FTAB-PRICE,

W_FTAB-QUANTITY.

ENDLOOP.

req output:::when i enter doc_name the related info accr to doc_name from the both tables should be display..

m getting no errors but i cant execute my prog..

please check out my code...

thanx in adv..

Former Member
Not what you were looking for? View more on this topic or Ask a question