How to implement a page showing different database tables
I am wondering what is the best way to implement the following task:
On the left side of a page, there are two Listboxes. On the right side of the page, I want to display different database tables depending on the selected value from those two Listboxes.
I am wondering what is the best way to implement the
following task:
On the left side of a page, there are two Listboxes.
On the right side of the page, I want to display
different database tables depending on the selected
value from those two Listboxes.A Data Table component isn't really designed to dynamically swap which database table you're binding too (and therefore which set of columns you will display) under the covers. Here are a couple of general strategies to consider for accomplishing your functional requirements:
* Create a separate Data Table component for each possible database table, all on the same page, and dynamically set the "rendered" property of the selected Data Table to true, while setting it to false for all other Data Tables. That way, only the corect one will be shown.
* Create a separate page for each Data Table, using a similar look and feel so that it appears to the user like it's all the same page. To save cutting and pasting the list components, put them in a JSP Page Fragment so they can be reused on each page. ((SIDE NOTE: This is a very common technique for simulating what looks like tabbed panes, but where the implementation actually uses separate pages.))
* Use frames so that the left frame (containing the list boxes) stays the same, and the right frame switches to a different page for each of the tables. This is essentially another way to share the list components across the pages.
* Abandon all the ease-of-use stuff Creator provides for binding to data tables, and write code that programmatically erases all the old child components and creates new ones. This is the sort of thing you'd need to do for a "SQL BROWSER" sort of application, where the set of columns is not known ahead of time.
Craig McClanahan
Similar Messages
-
Fetch data from different database tables
Hi...
How can i fetch data from different database tables and put it into a internal table and then display it??? Can provide simple short codes as i'm new to ABAP. Thanks.Hi,
Check this sample code..
TYPE-POOLS: slis.
DATA: BEGIN OF itab OCCURS 0,
vbeln TYPE vbeln,
expand,
END OF itab.
DATA: BEGIN OF itab1 OCCURS 0,
vbeln TYPE vbeln,
posnr TYPE posnr,
matnr TYPE matnr,
netpr TYPE netpr,
END OF itab1.
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'VBELN'.
s_fieldcatalog-tabname = 'ITAB'.
s_fieldcatalog-rollname = 'VBELN'.
s_fieldcatalog-outputlen = '12'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'VBELN'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'VBELN'.
s_fieldcatalog-outputlen = '12'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '2'.
s_fieldcatalog-fieldname = 'POSNR'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'POSNR'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '3'.
s_fieldcatalog-fieldname = 'MATNR'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'MATNR'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '4'.
s_fieldcatalog-fieldname = 'NETPR'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'NETPR'.
s_fieldcatalog-do_sum = 'X'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
DATA: s_layout TYPE slis_layout_alv.
s_layout-subtotals_text = 'SUBTOTAL TEXT'.
s_layout-key_hotspot = 'X'.
s_layout-expand_fieldname = 'EXPAND'.
SELECT vbeln UP TO 100 ROWS
FROM
vbak
INTO TABLE itab.
IF NOT itab[] IS INITIAL.
SELECT vbeln posnr matnr netpr
FROM vbap
INTO TABLE itab1
FOR ALL ENTRIES IN itab
WHERE vbeln = itab-vbeln.
ENDIF.
DATA: v_repid TYPE syrepid.
v_repid = sy-repid.
DATA: s_keyinfo TYPE slis_keyinfo_alv.
s_keyinfo-header01 = 'VBELN'.
s_keyinfo-item01 = 'VBELN'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = s_layout
it_fieldcat = t_fieldcatalog
i_tabname_header = 'ITAB'
i_tabname_item = 'ITAB1'
is_keyinfo = s_keyinfo
TABLES
t_outtab_header = itab
t_outtab_item = itab1
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks
Naren -
Joining Querry to check data in two different database tables
Hi,
I have table employee in sqlserver and oracle database.I have to perform joining based on emp id.I know how to perform join if tables are present in one
database.But for different database tables any one can explainDBLINK AND Understanding Oracle Heterogeneous Services
1) http://docs.oracle.com/cd/B28359_01/gateways.111/b31042/newoverview.htm
2) http://docs.oracle.com/cd/B28359_01/gateways.111/b31042/configodbc.htm
Ramin Hashimzade -
How to update field values in a database table using module pool prg?
hi
how to update field values in a database table using module pool prg?
we created a customized table, and we put 2 push buttons in screen painter update and display.
but update is not working?
data is enter into screen fields and to internal table, but it is not updated in database table.
thanks in adv
vidyaHI,
we already used the update statement. but its not working.
plz check this.
*& Module Pool ZCUST_CALL_REC
PROGRAM ZCUST_CALL_REC.
TABLES: ZCUST_CALL_REC,ZREMARKS.
data: v_kun_low like ZCUST_CALL_REC-kunnr ,
v_kun_high like ZCUST_CALL_REC-kunnr,
v_bud_low like ZCUST_CALL_REC-budat,
v_bud_high like ZCUST_CALL_REC-budat.
ranges r_kunnr for ZCUST_CALL_REC-kunnr .
ranges r_budat for zcust_call_rec-budat.
DATA: ITAB TYPE STANDARD TABLE OF ZCUST_CALL_REC WITH HEADER LINE,
JTAB TYPE STANDARD TABLE OF ZREMARKS WITH HEADER LINE.
*data:begin of itab occurs 0,
MANDT LIKE ZCUST_CALL_REC-MANDT,
kunnr like ZCUST_CALL_REC-kunnr,
budat like ZCUST_CALL_REC-budat,
code like ZCUST_CALL_REC-code,
remarks like ZCUST_CALL_REC-remarks,
end of itab.
*data:begin of Jtab occurs 0,
MANDT LIKE ZCUST_CALL_REC-MANDT,
kunnr like ZCUST_CALL_REC-kunnr,
budat like ZCUST_CALL_REC-budat,
code like ZCUST_CALL_REC-code,
remarks like ZCUST_CALL_REC-remarks,
end of Jtab.
CONTROLS:vcontrol TYPE TABLEVIEW USING SCREEN '9001'.
CONTROLS:vcontrol1 TYPE TABLEVIEW USING SCREEN '9002'.
*start-of-selection.
*& Module USER_COMMAND_9000 INPUT
text
MODULE USER_COMMAND_9000 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
WHEN 'ENQUIRY'.
perform multiple_selection.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9001'.
WHEN 'UPDATE'.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9002'.
perform update on commit.
WHEN 'DELETE'.
perform append_CUSTOMER_code.
PERFORM SELECT_DATA.
call screen '9002'.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Module STATUS_9000 OUTPUT
text
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'ZCUSTOMER'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_9000 OUTPUT
*& Module USER_COMMAND_9001 INPUT
text
MODULE USER_COMMAND_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
endcase.
ENDMODULE. " USER_COMMAND_9001 INPUT
*& Module STATUS_9001 OUTPUT
text
MODULE STATUS_9001 OUTPUT.
SET PF-STATUS 'ZCUSTOMER'.
SET TITLEBAR 'xxx'.
move itab-MANDT to zcust_call_rec-MANDT.
move itab-kunnr to zcust_call_rec-kunnr.
move itab-budat to zcust_call_rec-budat.
move itab-code to zcust_call_rec-code.
move itab-remarks to zcust_call_rec-remarks.
vcontrol-lines = sy-dbcnt.
ENDMODULE. " STATUS_9001 OUTPUT
*& Module USER_COMMAND_9002 INPUT
text
module USER_COMMAND_9002 input.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR sy-ucomm.
WHEN 'UPDATE'.
perform move_data.
UPDATE ZCUST_CALL_REC FROM TABLE ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORDS ARE UPDATED'.
ELSE.
MESSAGE E001(0) WITH 'RECORDS ARE NOT UPDATED'.
ENDIF.
WHEN 'DELETE'.
perform move_data.
DELETE ZCUST_CALL_REC FROM TABLE ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORDS ARE DELETED'.
ELSE.
MESSAGE E001(0) WITH 'RECORDS ARE NOT DELETED'.
ENDIF.
endcase.
endmodule. " USER_COMMAND_9002 INPUT
*& Module STATUS_9002 OUTPUT
text
module STATUS_9002 output.
SET PF-STATUS 'ZCUSTOMER1'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_9002 OUTPUT
*& Module update_table OUTPUT
text
module update_table output.
move itab-MANDT to zcust_call_rec-MANDT.
move itab-kunnr to zcust_call_rec-kunnr.
move itab-budat to zcust_call_rec-budat.
move itab-code to zcust_call_rec-code.
move itab-remarks to zcust_call_rec-remarks.
vcontrol-lines = sy-dbcnt.
endmodule. " update_table OUTPUT
***Selection Data
FORM SELECT_DATA.
SELECT mandt kunnr budat code remarks FROM zcust_call_rec INTO
table itab
WHERE kunnr IN r_kunnr AND BUDAT IN R_BUDAT.
ENDFORM.
****append vendor code
FORM APPEND_CUSTOMER_CODE.
clear r_kunnr.
clear itab.
clear r_budat.
refresh r_kunnr.
refresh itab.
refresh r_kunnr.
IF r_kunnr IS INITIAL
AND NOT v_kun_low IS INITIAL
AND NOT v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_high
IMPORTING
OUTPUT = r_kunnr-high.
r_kunnr-option = 'BT'.
r_kunnr-sign = 'I'.
append r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND NOT v_kun_low IS INITIAL
AND v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
r_kunnr-SIGN = 'I'.
r_kunnr-OPTION = 'EQ'.
APPEND r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND v_kun_low IS INITIAL
AND NOT v_kun_high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kun_low
IMPORTING
OUTPUT = r_kunnr-low.
r_kunnr-SIGN = 'I'.
r_kunnr-OPTION = 'EQ'.
APPEND r_kunnr.
PERFORM V_BUDAT.
ELSEIF r_kunnr IS INITIAL
AND v_kun_low IS INITIAL
AND v_kun_high IS INITIAL.
IF SY-SUBRC = 0.
MESSAGE I003(0) WITH 'ENTER CUSTOMER NUMBER'.
CALL SCREEN '9000'.
ENDIF.
PERFORM V_BUDAT.
ENDIF.
ENDFORM.
FORM V_BUDAT.
IF R_BUDAT IS INITIAL
AND NOT v_BUD_low IS INITIAL
AND NOT v_BUD_high IS INITIAL.
r_budat-low = v_bud_low.
r_budat-high = v_bud_high.
r_budat-option = 'BT'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND NOT v_BUD_low IS INITIAL
AND v_BUD_high IS INITIAL.
r_budat-low = v_bud_low.
r_budat-high = v_bud_high.
r_budat-option = 'EQ'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND v_BUD_low IS INITIAL
AND NOT v_BUD_high IS INITIAL.
r_budat-HIGH = v_bud_HIGH.
r_budat-option = 'EQ'.
r_budat-sign = 'I'.
append r_budat.
ELSEIF R_BUDAT IS INITIAL
AND v_BUD_low IS INITIAL
AND v_BUD_high IS INITIAL.
IF SY-SUBRC = 0.
MESSAGE I002(0) WITH 'ENTER POSTING DATE'.
CALL SCREEN '9000'.
r_budat-low = ''.
r_budat-option = ''.
r_budat-sign = ''.
ENDIF.
ENDIF.
ENDFORM.
*& Form update
text
--> p1 text
<-- p2 text
form update .
commit work.
endform. " update
*& Form move_data
text
--> p1 text
<-- p2 text
form move_data .
clear itab.
refresh itab.
move-corresponding zcust_call_rec to itab.
MOVE ZCUST_CALL_REC-MANDT TO ITAB-MANDT.
MOVE ZCUST_CALL_REC-KUNNR TO ITAB-KUNNR.
MOVE ZCUST_CALL_REC-BUDAT TO ITAB-BUDAT.
MOVE ZCUST_CALL_REC-CODE TO ITAB-CODE.
MOVE ZCUST_CALL_REC-REMARKS TO ITAB-REMARKS.
APPEND ITAB.
delete itab where kunnr is initial.
endform. " move_data
thanks in adv
vidya -
How to implement the shared lock in a table view
Hi,
How to implement the shared lock in a table view.for multiple users to edit on this same table.
Thanks in advance
SwathiHi,
Please refer this link to find solution to your querry.
Hope it helps.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c322c690-0201-0010-fb86-811c52b0acc2.
Regards,
Rahul -
How to tracke the new entries in database table ?
Hi,
How to tracke the new entries in database table ? is there any FM or report is there to check it ?
regards
vishnuHi Vishnu,
u can write a report program for this and in that use the event :
AT NEW <field-name> ( use primary key)
your statements
ENDAT
for eg.
loop at itab ( herfe itab must be of type of table for which u want to track new entries)
at new matnr
write:/ new record
endat
endloop.
schedule this report in background to run in every 5 or 10 mins as per your requirement and hence changes can be tracked.
regards
Vinod -
How to select alternate entries from the database table
Hi Experts,
can u help me, how to select alternate entries from the database table.
ThanksAs there is no concept of sequence (unless there is a field specifically included for the purpose), there is no meaning to "alternate" records.
What table do you have in mind, what data does it hold, and why do you want alternate records?
matt -
How to Insert a record in a database table in debugging mode in production
Hi,
How to Insert a record in a database table in debugging mode in production ?
Waiting for kind response.
Best Regards,
Padhy
Moderator Message : Duplicate post locked.
Moderator message : Warning. Don't create multiple threads for same question.
Edited by: Vinod Kumar on May 12, 2011 11:02 AM
Edited by: Vinod Kumar on May 12, 2011 11:04 AMHi Senthil,
Regards,
Phani Raj Kallur
Message was edited by: Phani Raj Kallur -
How to access previous page in a database
Hi,
I am using struts now and MySQL as my database.
the problem is, I dont know how will I show the first page up to the last page of my database, using previous and next. My database consists of employees details, I want to show 10 rows of employees per page.Maintain the beginRow and endRow concept..
use query the data from beginCounter numbet to EndCounter
I have used the same logic using JSTL <sql> tag
i have also maintain the paging -
How to implement Review Page functionality
Hi,
I developed one custom Page, In that page user will enter data and click on Submit.
Requirement is before submitting, user needs review the data and click on submit.
Please suggest how to implement this functionality.
Thanks in Advance,
Hanimi.So far I have noticed that the best idea will be to recreate and code by
myself. As You probably know each SSHR function ends with review page that shows the changes I just want the same.
So problem that I have is, I need to implement Dynamic Approvals so the
employee should be able to see who is going to approve and add approvers if
neccessary. And I cannot find any information on how to code that.
I jsut want the same functionality as in standard modules. -
How to split one page into different frames in ADF?
Hi,
Can any one please guide me how to split a jspx into different frames.
i.e., left frame contains <af:panelSideBar> which contains multiple <af:commandMenuItem> s. And whenver we click on the one <af:commandMenuItem>, it has to show the corresponing page inside center frame in this page itself. Is it possible in ADF? Which component we need to use?
Can anyone guide me on this?
Thanks in advance,
Regards,
Suresh KethireddyYou can use a combination of the ADF Faces 10.1.3 components like:
af:panelPage
af:panelSideBar
af:panelHorizontal
af:panelGroup
to organize the screen layout, but it is not the interactive splitter that the 11g product provides.
You can all all the 10.1.3 ADF Faces Components here:
http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/imageIndex.html -
How can I connect to a different database schema,other than adobe?
I'm building an application where I want to use a different database for it,for storing additional data for the users(different from "edcprincipaluserentity" table in "adobe" database stores)..How I can connect to my database schema created in MySQL from Workbench,to assign tasks to my users,using the Process Management/Assign Task service?
You can only assign task to user that are known by the LiveCycle User Manager.
When you configure LiveCycle, you can tell it where you want to get the users from. They can be created them locally in the local database, or synchronized from an LDAP directory in which case it'll read the users from LDAP and make a copy of some of the properties to the internal LiveCycle database.
Bottom line, all users have an id (in the edcprincipalentity table) in the adobe database.
If you need your users to come from a different database, then you need to customize the SPI (security provider interface) so that you can synchronize the users coming from your external database. Again, this is a customization since out of the box, we don't synchronize against external database. But it is possible, the API is there and other customers have done it.
I hope this clarifies things a bit.
Jasmin -
Page shows different data when saved after few minutes
Hi,
I have a peculiar problem to describe.
I have a page which contains af:table inside af:panelCollection layout. I use a af:commandLink to drilldown to another page using setCurrentRowWithKey method.
I am able to drill down to the correct data in another page which contains data that is editable. Once after editing the page when i click save button, i am able to save the data. This is working fine.
But the problem is, once i drilled down to this edit page and edit some fields and save it after few minutes, say 5 minutes later, it is not saved. Also, the page is refreshed to bring some random record.
Can anyone let me know why is this happening and how to resolve it?
ThanksHi Timo,
Which jdev version?I am using jdev 11.1.1.3.0.
Is it possible that the data has changed (e.g. by an other user) after you drilled to the one record you want to change?There is a possibility that the data can be changed by other user as well. But, for the time being we have implemented for the single user environment.
When you click save after some time, do you get any error (on the screen or in the logs)?Yes. On the screen, it is displayed as "oracle.jbo.JboException: Document type mismatch (source INVOICE, type Sales)". It is a validation exception thrown at viewRowImpl level by me. But it validates the data perfectly when saved immediately after editing
Which session timeout do you have configured in your web.xml?Session-timeout is given as 240
Have you tried your use case with the HR schema?Yes. when i reproduce the situation in HR schema, it is getting saved perfectly
Regards -
How to handle transactions when two different databases are involved.
consider two tables namely Table-A and Table-B part of two different databases namely ORACLE and MYSQL.
Now the project requirement is updating the Table-A(ORACLE) and Table-B (MYSQL) as one transaction. i.e. either update both the tables or rollback both the tables.
Now my question is how could i handle this situation using JDBC(Type-4) driver.Because i think at a time only one JDBC driver can be loaded into the JVM.NareshAnkuskani wrote:
Now my question is how could i handle this situation using JDBC(Type-4) driver.Because i think at a time only one JDBC driver can be loaded into the JVM.No, that is not true.
But anyway, you need to use distributed (XA) transactions. i believe that the latest version (5.0) of mysql actually has support for XA transactions. you need to use a to setup a distributed transaction and attach the connections for the two databases to that transaction. then it should function as you desire. -
How to host one application using different database connection on OAS?
Hi,
Jdeveloper - 10.1.3.4
Application - ADF/BC
Oracle Application Server - 10.1.3
Above our the specifications for our application,
We have two database schemas different for development and production therfore we have different databse connections for the two,
we have one application which is in production and enhacements on the same application are done by the development team.
Since we have two different schemas for developement and prduction we use different database connections for the application on development and production.
The problem is our Model and View Controller project are same, only the database connection file changes that's why we are able to host only on application at a time on our OAS. This is probably because the URL generated by OAS for developemnt and prodyction application is same.
Is there a way we can host two instances of the same application with two different database connections on the a single OAS.
Thanks & Regards,
RakshaUse different deployment profiles each with a different context root for your application?
See: http://one-size-doesnt-fit-all.blogspot.com/2009/02/configuring-separate-dev-test-prod-urls.html
Maybe you are looking for
-
How to use SAP RDE CRM Users products
Dear Experts Am facing a issue when use SAP RDE CRM Users product as belows: At this time, my customer running with ERP ERP 6.0 EHP4 in three landscapce (server DEV, server TEST and server PROD) And now, my customer want to use SAP RDE CRM Users prod
-
Display PDF in browser not working with Customization Wizard
I used the Customization Wizard to generate a transform. One of the settings I specified was to display the PDF in the browser. The checkbox is checked, both in the Customization Wizard Console and in Acrobat's Preferences dialog after the installati
-
New Project will not save, re-open with accurate or matching audio and video.
I filmed footage last week. Uploaded it into Premiere Elements and edited the footage in Elements, and saved my work as a project. I opened Elements this morning, and upon opening my saved project I was prompted by the program to locate the file. Whe
-
Does the optical audio stream directly to a receiver?
Can you stream music directly through the optical audio out on ATV2 without the tv being on? (similar to airport?)
-
Help! CS3 crashing at launch...Font Explorer X installed
I have gotten myself into a bad situation! I am on an Intel Mac Book Pro, running 10.4.11 and CS3. I downloaded Linotype Font Explorer X 1.2.3. I got that going, everything was running pretty smoothly. Until I did a little reading, and was lead to be