ManyToOne relationship with extra field in the joinTable

Hi,
I wanted to make a ManyToMany unidirectional relationship using these two entities.
Invoice (id)
Product (id, price)
The problem is that I want in the resulting joinTable another field named QUANTITY
I don’t think there is a way to obtain a join table with an extra field from a ManyToMany relationship, am I right ?
Si I decided to add an InvoiceLine table
With Invoice and InvoiceLine tables having a OneToMany unidirectional relationship.
And InvoiceLine and Product tables having a ManyToOne unidirectional relationship.
This is the code I made
import java.util.Set;
import java.util.HashSet;
import javax.persistence.*;
@Entity
public class Invoice implements java.io.Serializable {
     private long id;
     private Set<InvoiceLine> InvoiceLines = new HashSet<InvoiceLine>();
     @Id
     @GeneratedValue
     public long getId() {
          return id;
     public void setId(long id) {
          this.id = id;
     @OneToMany(cascade={CascadeType.ALL})
     @JoinColumn(name="INVOICE_ID")
     public Set<InvoiceLine> getInvoiceLines() {
          return InvoiceLines;
     public void setInvoiceLines(Set<InvoiceLine> InvoiceLines) {
          this.InvoiceLines = InvoiceLines;
import javax.persistence.*;
@Entity
public class InvoiceLine implements java.io.Serializable {
     private long id;
     private Product product;
     private int quantity;
     @Id
     @GeneratedValue
     public long getId() {
          return id;
     public void setId(long id) {
          this.id = id;
     @ManyToOne
     public Product getProduct() {
          return product;
     public void setProduct(Product product) {
          this.product = product;
     public int getQuantity() {
          return quantity;
     public void setQuantity(int quantity) {
          this.quantity = quantity;
import javax.persistence.*;
@Entity
public class Product implements java.io.Serializable {
     private long id;
     private double price;
     public Product() {
     public Product(double price) {
          this.price = price;
     @Id
     @GeneratedValue
     public long getId() {
          return id;
     public void setId(long id) {
          this.id = id;
     public double getPrice() {
          return price;
     public void setPrice(double price) {
          this.price = price;
}The problem is that I want the InvoiceLine table to have a composite primary key (from the two foreign keys in the table invoice_id and product_id).
Can anyone tell me how I can do this.
Thanks.
Edited by: Exhortae on Jun 23, 2009 4:59 PM
Edited by: Exhortae on Jun 23, 2009 5:01 PM

Hello,
If we create a Z report for this program, can anyone please tell me where can I find the function "REUSE_ALV_GRID_DISPLAY" in the given program so that I can add my fields along with the default filelds displayed...
Thanks
~Him

Similar Messages

  • Query : Addition of extra fields in the User Registration page of portal.

    Hi All,
    I have a query, about adding extra fields in the new user registration page of portal.
    If you can suggest the required source files in details,inorder to incorporate two more fields.
    Say, AGE and COMPANY,with the existing fields in the same page.
    Along with this,can you please send the details of retrieving those information from backend and the backend functionalities associated with the SUBMIT button on the registration page.
    Regards,
    Sudeep

    Hi,
    Your query is divided into two parts.
    The first part is adding new fields into existing form. This feature comes under Branding of portal. Plz use the link below understanding the same and related help :
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/79/affe402a5ff223e10000000a155106/frameset.htm
    The second part is retrieving the values from backend.Here it will be the UME database. You need to develop a logon.par file and replace the same in your portal.
    Happy Customizing.
    Sukanta Rudra

  • Extra field in the WOrklist

    Hi Specialist
    I would like to ask about add one extra field in the layout of the worlikst.
    there is a field: VERZN  --> Days in Arrears by Net Due Date that I would like to add in my layout.
    I check by the standard way using the "change layout" but the field doesnt appear.
    How can I add the field in my worklist?
    thank you

    Heya,
    This is indeed possible with a few changes to the structures used. The structure UDM_S_WORKLIST_ITEM_ATTR_C will need to have the customer include (CI_WORKLIST_ITEM_ATTR) implemented to add any new fields to the worklist.
    Similarily the table UDM_WL_ITEM needs to have the customer include (CI_WORKLIST_ITEM) implemented with the same fields.
    Once this is completed the BAdI UDM_WL_ITEM_DISP_C will need to be implemented to fill the data in the new fields added.
    Once you have done that it should be able to be shown within the worklist.
    Hope that helps,
    Brenton.

  • How do I convert mail merge documents to individual pdf docs and save each with a field in the merge?

    How do I convert mail merge documents to individual pdf docs and save each with a field in the merge?

    Is this an actual field, or just some piece of static text somewhere? Either way, you can't do it using the Split Document command. You'll need to use a custom-made script to read the value of this "field" and use it when extracting pages from the file.

  • Column Headings in the report and adding an extra field to the report

    Hi All.
    I had an issue like i need to put column headings for a report and I want to add an extra field to the report.
    The problem here is that the report was actually cloned from a Query.At the time of cloning,they forgot to add the column headings.
    Now we need to add the column headings for the same.How can we proceed for this and where we need to add our code?
    How to add an extra field  to the existing report?
    Any pointers will be very much helpful.
    Regards,
    SSR.

    Hi,
    you can get this done in 2 ways:
    1 - Change the query to add another column and the re-generate the report
    2 - If changing query is not possible, you can change the report it self for adding extra field. If you look at the code, it will be more like normal ABAP code. you can easily modify it (If you are ABAPer) for your additional requirements.
    thnx,
    ags.
    Edited by: Agasti Kale on Jun 12, 2008 6:26 PM

  • Adding extra fields to the SOA composite from OIM

    Hi All
    I want to to add extra fields to the input XML file to custom SOA approval composite.
    Where I suppose to control the parameter going from the OIM request to the SOA composite ?
    Thanks
    Edited by: 599647 on Jan 27, 2012 9:28 AM

    http://bbagaria.blogspot.com/2011/08/how-to-extend-payload-from-oim-to-soa.html
    -Bikash

  • How  to add an extra field in the output of a predefined report

    Hi everybody,
    I have to add an extra  field  by name  "DAYS"(VTBFHAPO-ATAGE) in the output of a predefined report" RFTMBL01".
    please provide me the code and where to add in the predefined report

    Hi  Pasquale Isolato
    the predefined alv report name is "RFTMBL01" . If u r  with system  please check the code and the field name i have to add ids"DAYS'.
      if u are not with  system please reply me so that i will sen the code also
    Thanks in advance

  • Include structure and extra fields in the same Internal Table

    Hi developers,
    im trying to declare an internal table with include structure and extra fields,
    something like this:
    data: BEGIN OF it_loans occurs 0,
          include structure zthrca006,   
          status(10),
          pernr   like pa0001-pernr,
          sname   like pa0001-pernr,
          tipomov(20),
          monto   like zthrca006-monto,
    data: END of it_loans.
    zthrca006 is huge so i dont want to type everithing.

    What is the issue?
    data: BEGIN OF it_loans occurs 0.
                 include structure zthrca006.
    data :     status(10),
    data :     pernr like pa0001-pernr.
    data :     sname like pa0001-pernr.
    data :     tipomov(20).
    data :     monto like zthrca006-monto,.
    data:  END of it_loans.
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • 2 Classic Reports with edit fields on the same page

    Hi All, need your help.
    I am trying to have 2 classic reports on one page with edit fields like date, list values, text
    I have noticed that the element indexes are the same f01_0001 have both first elements from both reports.
    This is making my code go crazy.
    Also i have a problem with Date Picker, if i select it as a column type for a first element in second report the icon shows up in the first report.
    I think this is because of indexing, but... Classic Date Picker put the icon on second report but when i select the date, the values is populated to first column in first report
    Does anyone have a solution for this problem! (for example change the indexing for second report)
    DB is 11.2g
    Apex is 4.2.0.00.27
    Thank you,
    Andrei
    Edited by: aracila on Feb 20, 2013 9:03 AM

    Are these tabular forms, ie updteable.
    If so, you can only have one per page
    Gus

  • Problem in updating FPLT Table with custom fields of the billing plan

    Hi Guys
    I have a requirement to add 2 custom fieldd in the billing plan tab of sales order and I could not find any screen exit for that. However I got access key and added those 2 fields on the screen but I am not able to uodate table FPLT from there.
    I can see exits to pass the value but because there is no screen exit, the program cant retain the values keyed given by use on the screen.
    I really dont know where do I need to write the code and how to make screen fields read by the program.
    Please please help.
    Thanks a lot

    Hi,
    Probably too late, but here's the solution:
    - Transaction SE51 program: SAPLV60F and dynpro number: 0030
    - Goto 'Logical execution' or something like that (i'm connected in french)
    -  Modify standard code line 75: here I have added the field 'LIBEL'
        FIELD:
          FPLT-FAKSP,
          FPLT-FAREG MODULE FPLT-FAREG_PRUEFEN ON REQUEST,
    *{   REPLACE        DTAK910958                                        1
    *\      FPLT-FPTTP.
          FPLT-FPTTP,
          FPLT-LIBEL.
    *}   REPLACE
        CHAIN.
    Il means that field LIBEL will be checked with field FPTTP.
    regards.

  • Similar report as MI20 tcode but with extra field

    Hi Friends,
    I need to create a report with similar functionality as MI20 and that report should have additional field in the selection screen of the report.
    Please suggest me is there any way to do that..

    hi
    thanx for ur reply.
    i think the select-options is the best way to get more then one currency values.
    but i need to know what code i have to write for display of this day.
    in the standard report MCTA there he is using only one currency. similarly i need to add 2 more columns for each currency in that same report o/p.
    how to do that can any body help me
    regards,
    maqsood

  • Adding  extra  fields to the Product search display

    Hi all,
        I have a  requirement where the std Product search needs to be modified wherein i need to add a price field for some materials whcih i will maintain in a  Z table(custom table for the materials and its price).
        Now my problem is that the o/p structure is taking the fields from the view BBPV_F4PR_GEN (where i dont have nay price field!)...When i pass my structure to the Dispaly FM "F4UT_RESULTS_MAP" it doesnt consider my custom structure for display....
      is it possible to change the o/p structure for the Product search display???Has anybody tried thsi before???
      Any help is  appreciated.
    Thanks & regards,
    Disha.

    AFAIK, the only way to do this is to write a system modifcation.
    The BADI is executed only once at startup of the session, so that makes it merely static. (A strange point in time, I discussed it with SAP and they just shook their heads)
    I had the same problem with some other F4-Helps and it was a big hazzle. From my experience, no straight answer.

  • Report Painter Library: troubles with new field in the additional structure

    Hi, ALL!
    I'm  creating a new field in the Report Painter table  GLFUNCT. Do do it I created my field in the additional structure GLDBZ  for GLFUNCT and create an row in the T804C table for new field.
    Who has expirience in customizing using T804* tables? What tables should be used and how? I have the following troubles:
    - I do not see the new field as characteristic in the library - I don't know the customizing table to set fields from additional structure as characteristic
    - in the generated Report Painter program  my new field exists  but call of filler routine is always disabled
    Thanks
    Tatiana

    Hi Shabitha,
    just wondering if you ever found an answer to this, as i'm searching for info on same matter.
    Thanks, Regards,
    Okan Yarligan

  • Problem with a field in the account management tab

    Hi,
    I have IDM 2005Q3. I configured IDM so that it can creates valid portal account by adding objectclasses to the portal user profile.
    Now I have a problem when I want to edit this user profile in IDM. Instead of showing the classes in a "multi value" field, it shows them in text field. And this keeps you from saving the changes because this would corrupt the ldap.
    I know I only need to change the type of the field but I don't know how to do that.
    If someone already did that change, I would like to know how you did it.
    thanks

    Ben78,
    If you are using the tabbed user form, then there is a <FormRef> to 'MissingFields'. This special form will build a text box and label for each Left-hand side schema attribute for every assigned resource, if that attribute is not already represented by a field on the form.... got all that?
    So, if you create a new field on the form, Missing fields will not create a text box.
    Check the sample/forms directory for examples of Multiselect fields.

  • Add columns with custom fields in the table control of MIGO

    Hi,
    I have to add custom fields in the table control view of item in the MIGO.  I have added the fields in the GOITEM structure and i am able to display it in the item details tab.  I want the same fields to be visible as columns in the table control view of the items.
    I found that TV_GOITEM is the control in SAPLMIGO program referring to the table control of items but it is referring only to the standard fields available in Screen 200.
    Please let me know if there is any screen exit or option to add the custom fields in the control TV_GOITEM.
    Thanks.

    Hi,
    Thanks for your reply.  I have added the custom fields in the item detail.  But the customer wants the custom fields in the table view also.
    Is there any screen exit available to modify the table control of MIGO?
    Thanks.

Maybe you are looking for

  • External mail sent as CC

    Hi My SAP program will send an email to a Lotus inbox when triggered. But the mail received is addressed in 'CC'. When calling function module SO_NEW_DOCUMENT_ATT_SEND_API1, I have set the copy field to '' and express field to 'X'. Upon changing the

  • Can't backup Blackberry

    I plugged my Curve into my desktop today to back up my files, pictures, etc that are on my Blackberry. Normally, I get a message on the face of the Blackberry asking me if I want to have it in "mass storage" mode, or something like that. I didn't get

  • I cant log in and my mom is still paying for it

    Im crying  i cant log in i no my U.N but not my Pass!!!! I changed it and now i cant log in on my ipod!!! not my mom is wasting her money on something dumb and pointless cause i cant even get in!!!!!!!!!!!! HELPPPPPPPPPPPP   Spoiler (Highlight to rea

  • [ERROR:INF] : ConnectionServer Down...

    Post Author: ribeiro_pires CA Forum: Administration Hi. When we open a DeskI Document in Infoview we get the error message "ERROR: INF", and the report is not displayed. One detail is that we have ConnectionServer down (and all others up) and we are

  • Cannot change desktop image

    Yeah. I changed it before by going under the apple (top, left), clicking system prefs, and then going clicking 'desktop images and screen saver.' But now I can't change my desktop image because when I attempt that process of clicking the apple and cl