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: 

assigning many Member id's to One Member-id.?

Former Member
0 Kudos

Dear Friendz

I have a doubt Can I relate DIFFERENT MemberID Fields from different Tables to ONE MEMBER-ID Field in a Structure.. for example..

In EURX table their is a field Eur_id

IN REPO table their is a field rep_id

In EUS table their is a field Eus_id

in my Function module i have declared some Constants followed by a case statement ..

data: lt_member type table of zmember_s_universal with header line,

ls_member type zmember_s_universal,

lv_table(30).

constants: lc_xtra_market type zdgp_market value '01',

lc_fwb_market type zdgp_market value '02',

lc_eurx_market type zdgp_market value '03',

lc_repo_market type zdgp_market value '04',

case iv_market.

when lc_eurx_market.

lv_table = 'ZTGP_MEMBER_EUR'.

select * from ztgp_member_eur

appending corresponding fields of table et_member_data

where eur_id = iv_member_id and

status = iv_status and

beg_dat le iv_date_effective and

end_dat ge iv_date_effective.

when lc_eus_market.

lv_table = 'ZTGP_MEMBER_EUS'.

select * from ztgp_member_eus

appending corresponding fields of table et_member_data

where eus_id = iv_member_id and

status = iv_status and

beg_dat le iv_date_effective and

end_dat ge iv_date_effective.

Currently I am using another field called MEMBER_ID which I have in a Universal structure with similar data elements for the USER ID's ...But this MEMBER_ID is not related to the fields of the respective fields of the table

SO now in my OUTPUT list if I enter 01 market then under the Member id I want the member id of that particular Market..

1 ACCEPTED SOLUTION

christian_wohlfahrt
Active Contributor
0 Kudos

Hi,

I'm not sure, if I got your problem. Do you want to know, if you can select different database files into same field (, even when definition is different)?

Yes - but there are two restrictions.

If field size is not identical, destination should be defined according biggest source fields - then field names have to be identical and 'corresponding fields' has to be used.

If your database field names aren't identical, then you can define an internal table as destination, which has to have identical field sizes. Then you should select specific fields and don't use 'corresponding fields'. Be careful with correct order of 'select' fields.

Regards,

Christian

2 REPLIES 2

christian_wohlfahrt
Active Contributor
0 Kudos

Hi,

I'm not sure, if I got your problem. Do you want to know, if you can select different database files into same field (, even when definition is different)?

Yes - but there are two restrictions.

If field size is not identical, destination should be defined according biggest source fields - then field names have to be identical and 'corresponding fields' has to be used.

If your database field names aren't identical, then you can define an internal table as destination, which has to have identical field sizes. Then you should select specific fields and don't use 'corresponding fields'. Be careful with correct order of 'select' fields.

Regards,

Christian

0 Kudos

Hello,

You can also compose a SELECT statement dynamically. E. g. you could write

DATA table_name(10) TYPE c.

DATA wa_mara TYPE mara.

table_name = 'MARA'.

SELECT SINGLE * FROM (table_name) INTO wa_mara WHERE matnr = '123456'.

You can even use JOIN clauses etc. Just look it up iun online help for SELECT statement.

If you have the problem that fieldnames don't match in the CORRESPONDING clause you might try the AS keyword, e. g.:

SELECT eur_id AS member_id FROM ... INTO CORRESPONDING FIELDS OF ...

However, it is vitally important that the type of those fields whose name you mathc with the AS keyword are at least type-compatible. Otherwise short-dumps or other hard-to-debug errors might occur.

Hope that helps (please reward me if it does ,

Joerg