Insert the values form one table to another

Hi.,
I am using jdev11.1.5
I had created a reaadonly VO using the follwing querry
select distinct fp_bu,fp_year,fp_period, decode(gdh_status,'R','Yes','No') distribution,decode (aj_status ,'N','Yes','No') Recursion,
decode(RSUPHD_STATUS,'P','Yes','No') Supplier,decode(RCDOC_STATUS,'P','Yes','No') Customer
from gl_dist_hd,fin_periods,appl_journals,rec_suplr_doc_hd,rec_cust_doc_hd
where fp_bu = gdh_bu(+) and
gdh_bu = aj_bu(+) and
aj_bu = RSUPHD_BU(+) and
RSUPHD_BU = RCDOC_BU(+) and
fp_year = gdh_year(+) and
gdh_year = aj_year(+) and
aj_year = RSUPHD_DOC_YEAR(+) and
RSUPHD_DOC_YEAR = RCDOC_DOC_YEAR(+) and
fp_period = gdh_period(+) and
gdh_period = aj_period(+) and
aj_period = RSUPHD_DOC_PERIOD(+) and
RSUPHD_DOC_PERIOD = RCDOC_DOC_PERIOD(+)
ORDER BY fp_period asci had created a button [post]
when the user clicks the button it must insert the values of table CursorC1 into GlJrnlHd
i had tried a querry in AMImpl
        ViewObjectImpl vo = this.getGlJrnlHd1();
        Row newRow = vo.createRow();
        ViewObjectImpl c1 = this.getCursorC1_1();
        Row cr1 = c1.getCurrentRow();
           newRow.setAttribute("GjhBu", cr1.getAttribute("GrhBu"));
       newRow.setAttribute("GjhPlant", cr1.getAttribute("GrhPlant"));
      newRow.setAttribute("GjhJrnlType", cr1.getAttribute("GrvlJrnlType"));
       newRow.setAttribute("GjhJrnlNo", cr1.getAttribute("GrvlJrnlNo"));
       newRow.setAttribute("GjhJrnlSfx", cr1.getAttribute("GrhJrnlSfx"));
       newRow.setAttribute("GjhJrnlDate", "Null");
       newRow.setAttribute("GjhYear", cr1.getAttribute("GrvlYear"));
       newRow.setAttribute("GjhPeriod", cr1.getAttribute("GrvlPeriod"));
       newRow.setAttribute("GjhDesc", cr1.getAttribute("GrhDesc"));
       newRow.setAttribute("GjhAppl", "GLM");
       newRow.setAttribute("GjhReversal", "N");
       newRow.setAttribute("GjhStatus","N");
       newRow.setAttribute("GjhCreBy", "NULL");
       newRow.setAttribute("GjhCreDate", "NULL");
       newRow.setAttribute("GjhUpdBy", "NULL");
       newRow.setAttribute("GjhUpdDate", "NULL");
       this.getTransaction().commit();i am getting null pointer exception at this line
newRow.setAttribute("GjhBu", cr1.getAttribute("GrhBu"));could anyone please help me to resolve this error

Hi,
give a NPE check
ViewObjectImpl vo = this.getGlJrnlHd1();
        Row newRow = vo.createRow();
        ViewObjectImpl c1 = this.getCursorC1_1();
        Row cr1 = c1.getCurrentRow();
        if (cr1 != null){
        newRow.setAttribute("GjhBu", cr1.getAttribute("GrhBu"));
       newRow.setAttribute("GjhPlant", cr1.getAttribute("GrhPlant"));
      newRow.setAttribute("GjhJrnlType", cr1.getAttribute("GrvlJrnlType"));
       newRow.setAttribute("GjhJrnlNo", cr1.getAttribute("GrvlJrnlNo"));
       newRow.setAttribute("GjhJrnlSfx", cr1.getAttribute("GrhJrnlSfx"));
       newRow.setAttribute("GjhJrnlDate", "Null");
       newRow.setAttribute("GjhYear", cr1.getAttribute("GrvlYear"));
       newRow.setAttribute("GjhPeriod", cr1.getAttribute("GrvlPeriod"));
       newRow.setAttribute("GjhDesc", cr1.getAttribute("GrhDesc"));
       newRow.setAttribute("GjhAppl", "GLM");
       newRow.setAttribute("GjhReversal", "N");
       newRow.setAttribute("GjhStatus","N");
       newRow.setAttribute("GjhCreBy", "NULL");
       newRow.setAttribute("GjhCreDate", "NULL");
       newRow.setAttribute("GjhUpdBy", "NULL");
       newRow.setAttribute("GjhUpdDate", "NULL");
       this.getTransaction().commit();
}

Similar Messages

  • Want to copy the data form one table to another.

    I have two tables named COMP_TRAINING_T and TRNG_CMTS_COMMENTS.
    Now i feel the TRNG_CMTS_COMMENTS is needed so i am moving a column from this table to COMP_TRAINING_T.
    I already have some data in both tables. I have add the column in COMP_TRAINING_T and want to update this table as follows
    update COMP_TRAINING_T a
    SET COMP_TRNG_COMMENTS=
    ( Select COMP_TRNG_CMTS_COMMENTS from comp_trng_cmts_t b
    where a.comp_trng_finance_nbr= b.comp_trng_cmts_finance_nbr and
    a.comp_trng_audit_userid=b.comp_trng_cmts_audit_userid and
    a.comp_trng_date= b.comp_trng_cmts_date and
    a.comp_trng_userid= b.comp_trng_cmts_userid)
    but it is updating the rows correctly for the data it found from the COMP_TRNG_CMTS_COMMENTS table but for other rows it is setting it as Null value.
    How to rewrite this sql.
    Thanks

    Hi,
    Welcome to the forum!
    You're doing an UPDATE statement without a WHERE clause, so every row in the destination table will be updated. If the correlated sib-query doesn't find any matching rows in the source table, there's no error, but NULL is returned, so some rows in the destination table may get set to NULL.
    To avoid that, you can use MERGE:
    MERGE INTO     comp_training_t     a
    USING (
          SELECT     comp_trng_cmts_comments
          ,          comp_trng_cmts_finance_nbr
          ,          comp_trng_cmts_audit_userid
          ,          comp_trng_cmts_date
          ,          comp_trng_cmts_userid
          FROM     comp_trng_cmts_t
          )  b
    ON    (          a.comp_trng_finance_nbr      = b.comp_trng_cmts_finance_nbr
          AND     a.comp_trng_audit_userid = b.comp_trng_cmts_audit_userid
          AND     a.comp_trng_date      = b.comp_trng_cmts_date
          AND     a.comp_trng_userid      = b.comp_trng_cmts_userid
    WHEN MATCHED THEN UPDATE
    SET   a.comp_trng_comments     = b.comp_trng_cmts_comments
    ;MERGE tests (using the ON conditions) whether or not ther is a match between the destination table and the source sub-query.
    If there is a match, it can do an UPDATE.
    If there is no match, it can do an INSERT. In this case, we don't want to insert any new rows, so we just omit the WHEN NOT MATCHED clause.
    Notice that the USING sub-query returns all the columns from the source table that play any role in this job.
    The ON clause contains all the correlation conditions that were in your original statement.
    The alternatives, using UPDATE are:
    (a) Update all rows, but use NVL to set values to themselves if the sub-query returns NULL
    (b) Add a WHERE clause that repeats the correlated sub-query.
    Neither is efficient, and (b) is a maintenance problem, too: if tyou ever change the conditions, you have to make the same change in two places.
    By the way, this site compresses whitespace by default.
    if you need to post formatted code or output, then type these 6 characters:
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Passing the values from one pgm to another pgm (Calling pgm has no sel scr)

    Hi gurus,
    In my requirement i need to pass the values from one program to another program.
    I am using SUBMIT statement . But , the program which i am calling has no selection screen.
    So how can i pass the values?
    Please help me ASAP.
    Regards,
    Bhanu.R

    Export your internal tables or work areas to a memory id in ur program before u use submit.
    Then in second pgm you have to import from memory id given above.
    example.
    EXPORT gs_header FROM gs_header to memory id 'HEADER'.
    EXPORT gt_item FROM gt_item to memory id 'ITEM'.
    SUBMIT YFIIN_DISHC_MAILREPORT EXPORTING LIST TO MEMORY AND RETURN.
    In your second pgm you can write
    import gs_header TO gs_header from MEMORY id 'HEADER'.
    import gt_item TO gt_item from MEMORY id 'ITEM'.

  • How we can get the values  from one screen to another screen?

    hi guru's.
         how we can get the values  from one screen to another screen?
              we get values where cusor is placed but in my requirement i want to get to field values from one screen to another screen.
    regards.
      satheesh.

    Just think of dynpros as windows into the global memory of your program... so if you want the value of a field on dynpro 1234 to appear on dynpro 2345, then just pop the value into a global variable (i.e. one defined in your top include), and you will be able to see it in your second dynpro (assuming you make the field formats etc the same on both screens!).

  • How do the copy the Recording form one client to another client.

    Hi all
    I have one scenario like
    We need to process the sales documents which are not process to output(means send the document to printer) .
    For that I have to write a BDC program,
    In that program we  need to list out the all the documents which are not process .
    Then we need to do the Recording for VA02.
    NAVIGATION IS LIKE : va02 --> enter the doc No --> go the Extract(main menu) --> output --> Header --> Edit --> select the output type -->Save --> go the Sales Document(in main menu option) --> issue output --> print.
    But what my quarry is we have  to do Record that T-Code (VA02)  client 040 but we don’t have any test data (any entries),
    We have another client 093, in this client we don’t have authorization properly, means I able to Record but I am unable to create the program after recording why becace we don't ahve authorization for SE38.
    Please tell me is there any possible Export the Record form one  client and Import to another client.

    Hi Amjad,
    Yes we can transfer from one client to another client.
    to copy client from 901 to 903. if you have created a recording in client 901, go to transactions SHDB, double click on the specific recording, it will open the recording. there got to menu path: recording->export. export to a text file.
    in client 903 create a sample recording. open the recording in change mode, delete all lines. then go to menu path Recording->import, import the text file.
    it will works fine.
    Regards
    Krishnendu

  • Passing the values from one application to another application using mvc

    Hi sdn,
    Iam new to bsp.i created one application zappl1 in that i created one controller and one view.in that view i created 2 input fields.and also  created another application zappl2 in that also created one controller and one view. wai i want to enter in the inputfileds of first application view that values will be display in second application view.Please help out of this.

    Hi,
    I can see 2 ways of doing. Either you use parameters in the URL from the first application to the second, as any web application would do.
    Or, you can think of using the Web Application Server let :
    - the first application store the values
    - for the second application to retrieve
    Personnally, I would tend to suggest the first solution as it allows both applications to be replaced later on.
    Best regards,
    Guillaume

  • How to pass the values from one screen to another

    HI,
    consider me21n,
    po is created with the item category L,so components tab is enabled.that u all know.
    i have added the custom tab in the item details with netwt,gross wt,no of pieces and one more field.
    those fields are also in component structure of material data.
    i need to pass the matnr,maktx,quantity,ntwt,grosswt from the component to be displayed in  the subscreen.
    i used import mdpm to xmdpm from memory id 'subcon',  where it is exported from the function module 'me_components-maintain'.
    how to pass  all the values from component of structure MDPM to the subscreen of custom tab in the item details.
    help me pls........................'

    hi everyone,
    MODULE status_0111 OUTPUT.
    data : fill type i.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.,
      DESCRIBE TABLE lt_zzmm_po_comp LINES fill.
      ctrl_0111-lines = fill.
    ENDMODULE.                 " STATUS_0111  OUTPUT
    MODULE fetch_data OUTPUT.
      ctrl_0111-lines = 2.
    import xmdpm to lt_xmdpm from memory id 'SUBCON'.
    IF not sy-subrc eq 0.
        CLEAR lt_zzmm_po_comp[].
        LOOP AT lt_xmdpm.
          MOVE-CORRESPONDING lt_xmdpm TO lt_zzmm_po_comp.
          APPEND lt_zzmm_po_comp.
        ENDLOOP.
    MOVE-CORRESPONDING lt_zzmm_po_comp TO ctrl_0111.
      read table ctrl_0111-cols into col where index = 3.
      ENDIF.
    ENDMODULE.                 " FETCH_DATA  OUTPUT
    MODULE pass_line OUTPUT.
      READ TABLE lt_zzmm_po_comp INDEX ctrl_0111-current_line.
      MOVE-CORRESPONDING lt_zzmm_po_comp TO ctrl_0111.
    ENDMODULE.                 " PASS_LINE  OUTPUT
    flow logic
    PROCESS BEFORE OUTPUT.
    MODULE status_0111.
    MODULE FETCH_DATA.
    loop at lt_zzmm_po_comp WITH CONTROL ctrl_0111 cursor
    ctrl_0111-current_line.
       module pass_line.
    endloop.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0111.
    loop.
    *module read_data.
    endloop.
    but i cant see my fields in the table control .....i dont know y it is  not coming?can anyone help me with code...

  • Unable to pass the values from one report to another using navigation links

    Hi All,
    I am facing a strange issue where I have to pass a column value from one report to other.
    I have kept navigation link in the 1st report and 'is prompted' option in the 2nd report
    Issue was , I'm not getting the filtered result in the 2nd report (all the records are being displayed)
    Can anyone advice where I was going wrong
    Thank you,
    AO

    Hi,
    The column which you have given navigation link and 'is prompted' column should same and exist in both the reports.You have to give the guided navigation in the value interaction of the column in the report1.
    mark if helpful/correct.........
    thanks,
    prasanna

  • How to pass the value from one page to another page

    Dear Gaurav
    I have three pages
    1-creation page
    2-search page
    3-creation page
    in first creation page I have column name user write a% and submit to that search for that name.
    it is going to second page (search page)name a% is passed and search that corresponding value,the corresponding values are not there user will call third creation page and enter the details and save and click back to first page the value is not calling passing from third page to first page I submit the button in 3rd page the error is coming like this.
    The requested page contains stale data. This error could have been caused through the use of the browser's navigation buttons (the browser Back button, for example). If the browser's navigation buttons were not used, this error could have been caused by coding mistakes in application code. Please check Supporting the Browser Back Button developer guide - View Object Primary Key Comparison section to review the primary causes of this error and correct the coding mistakes.
    Cause:
    The view object xxcrmleadmgmtAM.xxcrmleadmgmtVO contained no record. The displayed records may have been deleted, or the current record for the view object may not have been properly initialized.
    in first page column name I removed view instance and view attribute the value is passing from third page to first page
    my requirement is the value call from 3 to 1 and user will enter remaining fields in 1st page and save the records.
    Regards
    Mahesh

    Hi Mahesh,
    Use
    OA.jsp?page=/oracle/apps/................&retainAM=Y).
    Thanks
    Jegan

  • Copy the value from one item into another

    Hi,
    I have a page with 2 items on it: Field1 and Field2. When the user enters a value in Field1 and tabs out, I want to copy the value to Field2.
    I have changed the setField1 method in the VORowImpl to call setField2 passing in the same value.
    In the JHeadstart definition file I have set the Depends On Item property of Field2 to be Field1.
    When I run the page and put a value in Field1 the page autosubmits as expected and the setField1 method runs. Unfortunately, the value does not appear in Field2.
    Any ideas?
    Thanks,
    Gavin

    Hi Steven,
    Checking the box does indeed get the value from Field1 into Field2.
    What I want to do, though, is to populate Field2 from Field1 only if Field2 is empty. Unfortunately, Field2 is now cleared before the setter of Field1 executes and so it always overwrites Field2.
    Any ideas?
    Thanks,
    Gavin

  • How to take value from one table to another table?

    Hi,
    My requirement is,I have two tables those are Document and Transaction both having one common column "Docseriescode"
    in Document table already having different records with "Docseriescode".
    when i am going  to transaction table for adding records,  in "docseriescode" column automatically generate perticular Docseriescode
    eg:
    i have one "Cargo" record in Document Table with code CCN
    when i am going to Transactional table for inserting in this Docseriescode columns automatically get "CCN" code and get a drop down value
    anybody help me?

    Your use case is a simple master detail relation between two tables. If you don't have foreign keys in the db you can build the associations and links yourself in jdev. Doing this enables you to create  detail rows from a master row where the pk of the master is automatically set in the fk of the detail.
    Here you find more info http://docs.oracle.com/cd/E35521_01/web.111230/e16182/bcquerying.htm#ADFFD292 and Displaying Master-Detail Data - 11g Release 2 (11.1.2.3.0)
    and a sample Master Detail Insert/Delete Sample | JDev & ADF Goodies
    Timo
    Message was edited by: TimoHahn

  • How to Insert the value in oitm table

    Dear Members,
       In Item Master, i have created a combobox next to Price List through SDK. if i select a particular value in the combobox and click Add Button in itemMaster, the selected value has to go to oitm table. i dont want to put separate table for that.any body can help me in this regard.
    Thanks in Advance

    hi,
    for eg create a field in OITM table as UDF
    TOOLS >>> UserDefinedFields >>> Manage User Fields >>> Master Data >>> Items >>> Items
    create UDF Field so that a field UDF will be created in the table OITM (Table for ItemMaster).
    Use the Following Code in ItemEvent.
    If pVal.FormType = 150 pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
                    Try
                       Dim oitem As SAPbouiCOM.Item = SBO_Application.Forms.Item(pVal.FormUID).Items.Item("214")
                Dim oitem2 As SAPbouiCOM.Item = SBO_Application.Forms.Item(pVal.FormUID).Items.Item("107")
                Dim oitem1 As SAPbouiCOM.Item = SBO_Application.Forms.Item(pVal.FormUID).Items.Add("UserItem", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
                oitem1.Left = oitem2.Left
                oitem1.Width = oitem2.Width
                oitem1.Top = oitem.Top
                oitem1.Height = oitem.Height
                oitem1.LinkTo = "215"
                oitem1.Visible = True
                oitem1.DisplayDesc = True
                Dim oCombo As SAPbouiCOM.ComboBox = oitem1.Specific
                oCombo.DataBind.SetBound(True, "OITM", "U_UDF")
                oCombo.ValidValues.Add("M", "M")
                oCombo.ValidValues.Add("L", "L")
                oCombo.ValidValues.Add("E", "E")
                    Catch ex As Exception
                        SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                    End Try
                End If
    after binding UDF field to Combobox it adds to database automatically on clicking add.
    regards,
    varma

  • How to insert a value  in a table using another table

    My table is like this
    col1 col2 col3
    india
    Pakistan
    my doubt is if i insert India in a table it will automatically insert India Id or code into another table
    output i want is like this
    col1 col2
    10
    20
    please give the exact query.

    u will have to use triggers to achieve the functionality..

  • How can i get the values from one JSP to another JSP

    Hi All,
    I am very new to JSP technology, I have one jsp having radio button, i want to accecc the state of this radio button to another JSP page, How can i do this.
    Could anybody help me.
    with Regards
    Suresh

    Try page import <%@ page import ="index.jsp" %> or include <%@include file="index.jsp" %> methods perhaps they might work.

  • How to pass the value from one level to another level

    Example :
    we have secnario for leave process
    initiall the user enters the name in first action the personal number should pick from first action to background RFC CO to pick the Payroll admin from R/3
    i designed the first data input form.... i want to pick the personal number and pass that one to next action in background mode.
    thanks in advance
    sukumar

    Hi,
    If you want to execute the step in background then you can use the callable object of type "Background Execution" or if you want to do any user interaction on that step then you can go for web dynpro callable object. Here is the link for Background Execution callable object.
    http://help.sap.com/saphelp_nw70/helpdata/en/9a/e8934258a5ca6ae10000000a155106/frameset.htm
    Here is also link for Web Dynpro Callable Object
    http://help.sap.com/saphelp_nw70/helpdata/en/de/8976417f2d5558e10000000a1550b0/frameset.htm
    If you have any conficution please let me know.
    Thanks
    Chandan

Maybe you are looking for

  • I'm trying to install iTunes 10.5 and I get an error message.

    The error says, "There is a problem with this Windows Installer package. A program required for this install to comeplete could not be run. Contact your support personnel or package vendor."

  • CFOLDERS - CFX_HISTORY table giving me problems in ABAP

    We are going to use CFolders in our environment.   I have an issue with the CFX_HISTORY table when I try and use it in a ABAP report.   I get the following message when I try and include it in a ABAP program: "CFX_HISTORY" must be a flat structure. Y

  • Dreamweaver CS5 E-Commerce Book/Resources

    Hi, I have recently completed my Adobe Dreamweaver and Flash CS5 certificate but the course only covers the basics for an information based website. I would like to learn about databases i.e for logins etc where people can add their details to the da

  • Cluster Database Connect Works Only in stand-alone OEM

    When I connect to OEM standalone, I can connect to the cluster database with no problem. When I try to connect with the management server, it gives me the ORA-12514 error. The service name works both in SQLplus and in stand-alone mode. My console is

  • MySQL RDBMS site in Data Modeler

    Hi, I want to make e relational model for a MySQL database. It will be converted by another software to java classes. The RDBMS type and site for the model must be mysql. Data Modeler has defined RDBMS sites for Oracle, DB2 and SQL Server. You can ad