01-21-2009 8:39 AM
Hi,
I would to create a DB/maintenance view, in which the same DB table should be used twice (the table is the foreign key of two separate fields of main table).
In standard database views there is option of ALIAS definition, but I haven't been find any similar option in SAP.
For example:
View of main table ZMAT_CONVERT which contain the fields MATNR_FROM, MATNR_TO.
MATNR_FROM should be linked to MARA, but MATNR_TO should also be linked to MARA.
How can this be done?
Thanks in advance,
Shai
01-21-2009 8:56 AM
Hi
Goto SE11. Selct view and specify a name. Click on Create. Select Maintenance View. Now you need to specify your table ie ZMAT_CONVERT . Click on Relationships button. The set of all relationships ie foreign key relationships appear. Select the desired table ie. MARA. Automatically it displays the list of all join conditions.
Hope this helps
Regards,
Jayanthi.K
01-21-2009 9:01 AM
Shai wants to link MARA twice to two different MATNR fields, I don't think this is possible using the SAP data dictionary.
Thomas
01-21-2009 9:17 AM
01-22-2009 10:46 AM
Thanks your for your replies.
However, as Thomas mentioned, I am asking how can I use the same table twice in my view?
(For example: I have two fields: MATNR_FROM, MATNR_TO in my main table and I would like to link both of them separately to MARA table)
01-22-2009 10:55 AM
Hi
It's not possible to use a table twice in the same database view.
Max
01-28-2009 2:51 PM
Hi,
I understood that it is not possible use the same table twice in a database view.
Is there any way to do it in maintenance view screen (even if some programming is requried)?
For example: Display the material description for both fields: MATNR_FROM and MATNR_TO.
Thanks,
Shai
01-28-2009 3:00 PM
You can probably do it via table maintenance events.
http://help.sap.com/saphelp_nw70/helpdata/EN/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm
Thomas
01-29-2009 12:36 PM
Hi,
Thanks for your reply.
I have finally succeeded doing it, although it was kind of tricky:
1. First, I have created a maintenance view based on tables ZMARA_DEST and MAKT (MAKT was defined as foreign key and assigned to view tables only once).
2. Then, I have added to the View fields the field MAKT-MAKTX twice with two different view field names (For some reason, it is possible).
3. At last, I have implemented all 3 self-defined events: AA, AC, AD, for which I have copied the standard forms (get_data, read_single, compl), and made some modifications. In my case, I changed the selection method of MAKTX2 value.
Best regards,
Shai
01-29-2009 12:59 PM
10-30-2019 12:29 PM
Hi,
Shai (who posted the question) has answered this himself, but it is hidden in the comments, therefore I copy it here, and add an improvement below:
"Hi,
Thanks for your reply.
I have finally succeeded doing it, although it was kind of tricky:
1. First, I have created a maintenance view based on tables ZMARA_DEST and MAKT (MAKT was defined as foreign key and assigned to view tables only once).
2. Then, I have added to the View fields the field MAKT-MAKTX twice with two different view field names (For some reason, it is possible).
3. At last, I have implemented all 3 self-defined events: AA, AC, AD, for which I have copied the standard forms (get_data, read_single, compl), and made some modifications. In my case, I changed the selection method of MAKTX2 value.
Best regards,
Shai"
ADDITION:
For step 3, I implemented just events 05 (FORM add_text) and AA (FORM read_and_add_text).
Here is my example coding:
FORM add_text.
CHECK zieplant_ctrl_v-old_iwerk IS NOT INITIAL
AND zieplant_ctrl_v-old_iwerk_txt = zieplant_ctrl_v-new_iwerk_txt.
SELECT SINGLE name1
FROM t001w
WHERE werks = @zieplant_ctrl_v-old_iwerk
INTO @zieplant_ctrl_v-old_iwerk_txt.
ENDFORM.
FORM read_and_add_text.
PERFORM get_data_zieplant_ctrl_v. " standard-generated routine for reading
LOOP AT total[] ASSIGNING <vim_total_struc>.
zieplant_ctrl_v = <vim_total_struc>.
PERFORM add_text.
<vim_total_struc> = zieplant_ctrl_v.
ENDLOOP.
ENDFORM.
10-30-2019 12:33 PM
the abap syntax you are using did not exist in year 2009
why do you answer to a very old question ?
05-07-2020 5:50 AM
Thank you, Edo. It helped me in 2020!
I must say I had to implement the event 05 as well for changes to existing data.
01-12-2024 3:31 PM
Thank you Edo!
I did exactly as you posted and it worked to perfection!
10-30-2019 2:24 PM
10-30-2019 2:41 PM