Displaying table using DBMS_OUTPUT using OWA
Dear All,
I have created a procedure to display a table in DBMS_OUTPUT (Thanks to Michaels) using OWA package.
PROCEDURE showtable (tablename VARCHAR2)
AS
b BOOLEAN;
OUT CLOB;
irows INTEGER := 1;
BEGIN
OWA.cgi_var_name (1) := 1;
OWA.init_cgi_env (OWA.cgi_var_name);
HTP.adddefaulthtmlhdr (FALSE);
b :=
OWA_UTIL.tableprint (ctable => tablename,
cattributes => 'border=1',
ntable_type => OWA_UTIL.pre_table
WHILE irows > 0
LOOP
OUT := OWA.get_line (irows);
IF RTRIM (OUT, CHR (10)) NOT IN ('<PRE>', '</PRE>')
THEN
DBMS_OUTPUT.put_line (OUT);
END IF;
END LOOP;
END;
This procedure displays proper tabular output.
But in few cases it shows tabular output along with <PRE> </PRE> tags.
Also in few cases it inserts unnecessary carriage returns in the output and therefore the rows in output gets misaligned.
Is this the problem with tool that displays output?
I have tested it with SQL * Plus, Toad, Oracle SQL Developer but it displays same output in each case.
Please help me in improving this procedure.
Thanks in advance.
-Sameer
You can try this. It displays fine (in the spool file) even for very wide tables as long as the overall output size does not exceed 32767 (limitation of dbms_output):
SQL> declare
2 b boolean;
3 out clob;
4 irows integer := 1;
5 offset integer := 1;
6 amt integer := 255;
7 tablename varchar2 (40) := 'flows_030000.wwv_flows';
8 i integer := 1;
9 begin
10 owa.cgi_var_name (1) := 1;
11 owa.init_cgi_env (owa.cgi_var_name);
12 htp.adddefaulthtmlhdr (false);
13 b := owa_util.tableprint (ctable => tablename,
14 cattributes => 'border=1',
15 ntable_type => owa_util.pre_table,
16 nrow_max => 3
17 );
18
19 while irows > 0
20 loop
21 out := out || replace (replace (owa.get_line (irows), '<PRE>' || chr (10)), '</PRE>' || chr (10));
22 end loop;
23
24 while dbms_lob.substr (out, amt, offset) is not null
25 loop
26 dbms_output.put (dbms_lob.substr (out, amt, offset));
27 offset := offset + amt;
28 end loop;
29
30 dbms_output.new_line;
31 end;
32 /
| ID | SECURITY_GROUP_ID | GLOBAL_ID | ALIAS | DISPLAY_ID | OWNER | NAME | DEFAULT_PAGE_TEMPLATE | HOME_LINK | BOX_WIDTH | WEBDB_LOGGING | PRINTER_FRIENDLY_TEMPLATE | DEFAULT_REGION_TEMPLATE | DEFAULT_LABEL_TEMPLATE | DEFAULT_REPORT_TEMPLATE | DEFAULT_LIST_TEMPLATE | DEFAULT_MENU_TEMPLATE | DEFAULT_BUTTON_TEMPLATE | DEFAULT_CALENDAR_TEMPLATE | ERROR_TEMPLATE | FLOW_LANGUAGE | FLOW_LANGUAGE_DERIVED_FROM | CHARSET | FLOW_IMAGE_PREFIX | AUTHENTICATION | LOGIN_URL | LOGOUT_URL | LOGO_IMAGE | LOGO_IMAGE_ATTRIBUTES | PUBLIC_URL_PREFIX | PUBLIC_USER | DBAUTH_URL_PREFIX | PROXY_SERVER | CUSTOM_AUTHENTICATION_PROCESS | CUSTOM_AUTHENTICATION_PAGE | CUSTOM_AUTH_LOGIN_URL | FLOW_VERSION | FLOW_STATUS | FLOW_UNAVAILABLE_TEXT | RESTRICT_TO_USER_LIST | APPLICATION_TAB_SET | EXACT_SUBSTITUTIONS_ONLY | CSV_ENCODING | BUILD_STATUS | VPD | SECURITY_SCHEME | REJOIN_EXISTING_SESSIONS | CHECKSUM_SALT | CHECKSUM_SALT_LAST_RESET | SUBSTITUTION_STRING_01 | SUBSTITUTION_VALUE_01 | SUBSTITUTION_STRING_02 | SUBSTITUTION_VALUE_02 | SUBSTITUTION_STRING_03 | SUBSTITUTION_VALUE_03 | SUBSTITUTION_STRING_04 | SUBSTITUTION_VALUE_04 | SUBSTITUTION_STRING_05 | SUBSTITUTION_VALUE_05 | SUBSTITUTION_STRING_06 | SUBSTITUTION_VALUE_06 | SUBSTITUTION_STRING_07 | SUBSTITUTION_VALUE_07 | SUBSTITUTION_STRING_08 | SUBSTITUTION_VALUE_08 | SUBSTITUTION_STRING_09 | SUBSTITUTION_VALUE_09 | SUBSTITUTION_STRING_10 | SUBSTITUTION_VALUE_10 | SUBSTITUTION_STRING_11 | SUBSTITUTION_VALUE_11 | SUBSTITUTION_STRING_12 | SUBSTITUTION_VALUE_12 | SUBSTITUTION_STRING_13 | SUBSTITUTION_VALUE_13 | SUBSTITUTION_STRING_14 | SUBSTITUTION_VALUE_14 | SUBSTITUTION_STRING_15 | SUBSTITUTION_VALUE_15 | SUBSTITUTION_STRING_16 | SUBSTITUTION_VALUE_16 | SUBSTITUTION_STRING_17 | SUBSTITUTION_VALUE_17 | SUBSTITUTION_STRING_18 | SUBSTITUTION_VALUE_18 | SUBSTITUTION_STRING_19 | SUBSTITUTION_VALUE_19 | SUBSTITUTION_STRING_20 | SUBSTITUTION_VALUE_20 | LAST_UPDATED_BY | LAST_UPDATED_ON | DEFAULT_CHART_TEMPLATE | DEFAULT_REPORTR_TEMPLATE | DEFAULT_FORM_TEMPLATE | DEFAULT_WIZARD_TEMPLATE | DEFAULT_TABFORM_TEMPLATE | DEFAULT_MENUR_TEMPLATE | DEFAULT_LISTR_TEMPLATE | THEME_ID | GLOBAL_NOTIFICATION | PAGE_PROTECTION_ENABLED_Y_N |
| 4411 | 10 | 26203551107945 | 4411 | 4411 | FLOWS_030000 | APEX - System Messages | 36912332266496846 | f?p=4411:1:&SESSION. | 98% | YES | 36911425616496846 | 36915002366496846 | 36912920899496846 | | 36916121240496847 | 36916209479496847 | | | 36911425616496846 | en-us | BROWSER | utf-8 | /i/ | COOKIE | | | | | | APEX_PUBLIC_USER | | | | | | &PRODUCT_NAME. 3.0.1.00.07 | AVAILABLE_W_EDIT_LINK | This application is currently unavailable. | | 1 | Y | | RUN_AND_BUILD | | | N | | 18-AUG-07 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 18-AUG-07 | | | | | | | | 101 | | |
| 4000 | 10 | 26616754121304 | BUILDER | 4000 | FLOWS_030000 | APEX - Application Builder | 3181227431044578 | f?p=4000:1:&SESSION. | 98% | YES | 7403029749876837 | 344742548 | 93372822814585113 | 6600628282501516 | 35066701739635046 | 13734421012904391 | 18498019930416612 | | 7403029749876837 | en-us | BROWSER | utf-8 | /i/ | CUSTOM2 | | wwv_flow_custom_auth_std.logout?p_this_flow=&FLOW_ID.&p_next_flow_page_sess=4550:8:&SESSION. | #IMAGE_PREFIX#htmldb/apex_logo.gif | width="300" height="30" alt="&PRODUCT_NAME." | | APEX_PUBLIC_USER | | | .60856310633085148. | | | &PRODUCT_NAME. 3.0.1.00.07 | AVAILABLE_W_EDIT_LINK | This application is currently unavailable at this time. | | 1 | N | Y | RUN_AND_BUILD | | FLOW: EDIT | | | 18-AUG-07 | LOGOUT | Logout | PRODUCT_NAME | Application Express | MSG_COMPANY | Workspace: &COMPANY. | MSG_LANGUAGE | Language | MSG_COPYRIGHT | Copyright © 1999, 2007, Oracle. All rights reserved. | MSG_USER | User | MSG_JSCRIPT | You must run this product with JavaScript enabled. | MSG_TBL_SUMMARY | Page Layout Table | EDIT | Edit | DONE | Done | TOP | Top | CLOSE | Close | CONFIRM | Confirm | DATE_FORMAT | mm/dd/yyyy | LONG_DATE_FORMAT | fmDay, Month dd, yyyy | TIME_FORMAT | hh:mi:ss AM | DATE_TIME_FORMAT | mm/dd/yyyy hh:mi:ss AM | RETURN_TO_APP | Return to Application | DELETE_MSG | Would you like to perform this delete action? | PAGE | Page | | 18-AUG-07 | 61427218674569660 | 61427218674569660 | 61427218674569660 | 91980429263284255 | 61427218674569660 | | 61427218674569660 | 3 | | N |
| 4350 | 10 | 683611196230867 | HTMLDB_HOME | 4350 | FLOWS_030000 | APEX - Workspace Admin | 6322904659084760 | f?p=4500:1000:&SESSION. | 98% | YES | 6322904659084760 | 60932116232746047 | 107534131274292840 | 6659715068668103 | 77000120193659142 | | 153893729392735447 | | 6322904659084760 | en-us | BROWSER | utf-8 | /i/ | CUSTOM2 | development_service_home_login | wwv_flow_custom_auth_std.logout?p_this_flow=&FLOW_ID.&p_next_flow_page_sess=4550:8:&SESSION. | #IMAGE_PREFIX#htmldb/apex_logo.gif | width="300" height="30" alt="&PRODUCT_NAME." | | APEX_PUBLIC_USER | | | .60874129745270430. | | | &PRODUCT_NAME. 3.0.1.00.07 | AVAILABLE_W_EDIT_LINK | This application is currently unavailable. | | 1 | Y | Y | RUN_AND_BUILD | | | | | 18-AUG-07 | LOGOUT | Logout | PRODUCT_NAME | Application Express | MSG_COMPANY | Workspace: &COMPANY. | MSG_LANGUAGE | Language | MSG_COPYRIGHT | Copyright © 1999, 2007, Oracle. All rights reserved. | MSG_USER | User | MSG_JSCRIPT | You must run this product with JavaScript enabled. | MSG_TBL_SUMMARY | Page Layout Table | DONE | Done | TOP | Top | CLOSE | Close | EDIT | Edit | DATE_FORMAT | mm/dd/yyyy | LONG_DATE_FORMAT | fmDay, Month dd, yyyy | TIME_FORMAT | hh:mi:ss AM | DATE_TIME_FORMAT | mm/dd/yyyy hh:mi:ss AM | DELETE_MSG | Would you like to perform this delete action? | | | | | | | | 18-AUG-07 | | | | | | | | 3 | | N |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Sorry for the wide display, but thats what I wanted to demonstrate anyway ;-)
Similar Messages
-
How to display table data without using ALV and table element.
Hi,
Its possible to display table data without using ALV and table element.
Every time i am fetching data based on (customer,status) fields and displaying these data in my output using alv
(every time i am fetching single row data ),
But problem is alv occupying more space in the output , i want to display data part only i dont want field names,
settings and header data etc..things.
Give solution to display data part..
Regards,
Rakhi.Hi,
Does you mean that you need ALV without default Function Toolbar...? If this is the case, the easy solution would have been to use Table Element rather. But, if you need to use ALV only without Function Toolbar, you can do away with that as well.
In that case, after calling GET_MODEL, you need to add few more lines of codes to achieve your goal. Those lines are --
DATA LV_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
LV_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
* Standard Filter Function setting to FALSE
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_SORT_COMPLEX_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_FILTER_COMPLEX_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_FILTER_FILTERLINE_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_DISPLAY_SETTINGS_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_VIEW_LIST_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_SORT_HEADERCLICK_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_HIERARCHY_ALLOWED( ABAP_FALSE ).
* Standard Filter Function setting to FALSE Ends
Here as you can easily notice that LV_VALUE is instantiated on CL_SALV_WD_CONFIG_TABLE. Now, using this LV_VALUE, you set standard functions as False to dis-allow their display.
Hope this answers your query.
Thanks.
Kumar Saurav. -
How to display table field data using checkbox
Dear sir,
I have created PR using ME51N. Our PR datas in EKPO table.
I have created select-option with prdat and Checkbox for to view PR open or closed status.
I want check PR status details from date to date using check box.
I have created the following code, but i will not generate output
DATA: BEGIN OF leban OCCURS 0.
INCLUDE STRUCTURE ekpo.
DATA END OF leban.
DATA new(1).
SELECT-OPTIONS ldat FOR sy-datum. "NO-DISPLAY.
parameters lopen like new AS CHECKBOX USER-COMMAND opn.
parameters lclose like new as checkbox user-command cls.
at selection-screen.
if ldat is initial.
message 'Enter a value' type 'W'.
endif.
case sy-ucomm.
when 'opn'.
perform getpr.
perform findopenpr tables leban.
endcase.
form getpr.
select * from ekpo into leban where PRDAT in ldat.
append leban.
endselect.
endform.
form findopenpr tables ekpo.
IF LOPEN = 'X'.
select single * from ekpo into leban where PRDAT IN LDAT AND banfn = lopen.
SORT leban BY bnfpo.
CLEAR leban.
if not sy-subrc = 0.
message 'PR OPEN' type 'S'.
ENDIF.
WRITE: / LEBAN-BANFN.
ENDIF.
endform.
With Regards,
BaskaranHi,
Try this way,
You shouldnt be writing two select statements into the same internal table. Also i dont see any use of perform getpr. so remove that and try
DATA: BEGIN OF leban OCCURS 0.
INCLUDE STRUCTURE ekpo.
DATA END OF leban.
DATA: BEGIN OF leban1 OCCURS 0.
INCLUDE STRUCTURE ekpo.
DATA END OF leban1.
DATA new(1).
SELECT-OPTIONS ldat FOR sy-datum. "NO-DISPLAY.
parameters lopen like new AS CHECKBOX USER-COMMAND opn.
parameters lclose like new as checkbox user-command cls.
at selection-screen.
if ldat is initial.
message 'Enter a value' type 'W'.
endif.
IF LOPEN = 'X'.
select single * from ekpo into leban where PRDAT IN LDAT AND banfn = lopen.
if sy-subrc = 0.
message 'PR OPEN' type 'S'.
ENDIF.
WRITE: / LEBAN-BANFN.
endif.
if LCLOSE = 'X'.
select single * from ekpo into leban1 where PRDAT IN LDAT AND banfn eq space.
if sy-subrc = 0.
message 'PR CLOSE' type 'S'.
ENDIF.
WRITE: / LEBAN1-BANFN.
ENDIF.
Regards,
Vik
Edited by: vikred on Aug 7, 2009 6:55 PM
Edited by: vikred on Aug 7, 2009 7:23 PM -
Unwanted spce when displaying tables in html using servlets
hi everybody,
i have noticed a strange behaviour. i have written servlets tht retrive values from a table based on a query. i retirive all the values using rs.getString() in the while rs.next() loop. next i try to display the values retried into strings in n html table. but when the html outputisgenerated lot of space is left blank in the output....the user hs to scroll a bit to view the output. why is this blank space left?????
this is how i display the html table:
while(rs.next())
air=rs.getString("AIR");
dd=rs.getString("DD");
jces=rs.getString("JCES");
System.out.println(jces);
army=rs.getString("ARMY");
navy=rs.getString("NAVY");
iaf=rs.getString("IAF");
dot=rs.getString("DOT");
pol=rs.getString("POL");
rly=rs.getString("RLY");
aai=rs.getString("AAI");
lhl=rs.getString("LHL");
vsnl=rs.getString("VSNL");
imd=rs.getString("IMD");
dos=rs.getString("DOS");
ongc=rs.getString("ONGC");
nic=rs.getString("NIC");
sac_com=rs.getString("SAC_COM");
app_com=rs.getString("APP_COM");
doe=rs.getString("DOE");
mhq=rs.getString("MHQ");
=================================
out.println("<table width=90% bgcolor=orange cellspacing=0 cellpadding=10 border=1>");
out.println("<th align=center>SACFA Member</th><th>Comment Status</th>");
out.println("<tr>");
out.println("<td>AIR</td>"+"<td>"+air+"</td>");
out.print("<br>");
out.println("</tr><tr>");out.println( "<td>DD</td>"+"<TD>"+dd+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>JCES</td>"+"<TD>"+jces+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>ARMY</td>"+"<TD>"+army+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>NAVY</td>"+"<TD>"+navy+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>IAF</td>"+"<TD>"+iaf+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>DOT</td>"+"<TD>"+dot+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>POL</td>"+"<TD>"+pol+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>RLY</td>"+"<TD>"+rly+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>AAI</td>"+"<TD>"+aai+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>LHL</td>"+"<TD>"+lhl+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>VSNL</td>"+"<TD>"+vsnl+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>IMD</td>"+"<TD>"+imd+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>DOS</td>"+"<TD>"+dos+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>ONGC</td>"+"<TD>"+ongc+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>NIC</td>"+"<TD>"+nic+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>SACFA COMMENT</td>"+"<TD>"+sac_com+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>APPLICATION COMMENT</td>"+"<TD>"+app_com+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>DOE</td>"+"<TD>"+doe+"</TD>");out.print("<br>");
out.println("</tr><tr>"); out.println( "<td>MHQ</td>"+"<TD>"+mhq+"</TD>");out.print("<br>");
out.println("</tr>");
out.println("</table>");
wht cud be wrong? pls help.
thanx,
ashnathe reason i know is because i ran into this problem myself when converting '\r\n' to <br>. it just seems this is the way IE (and maybe netscape) handle html. if you do a 'view source' on the page you would see all the <br>'s and say "where did those come from?", then after looking at your code you would see it.
i am not sure 100% as to why they do it, but I have theories as to why (i.e. table isn't done and that text isn't formatted correctly, so just spit stuff out - then print table when closed)
so basically, the problem was with the html and not the servlet writing. -
Display Table contents using HTMLB...Urgent Help Plz...
Hello All,
Im working on EP SP14 and SQL Server 2000.
I have successfully established database connection.
I want to know <b>how can I display Table contents using TableViewModel in HTMLB</b>.
Please help.
Its urgent.
Awaiting Reply.
Thanks in advance,
Uday<b></b>See /thread/80270 [original link is broken]
(please stop crossposting every question into two forums; thanks in advance) -
How to display multiple tables from database using netbeans swing gui
plz reply asap on how to display multiple tables from database using netbeans swing gui into the same project
Layered Pane with JTables or you can easily to it with a little scripting and HTML.
plzzzzzzzzzzzzzzzzz, do not use SMS speak when posting. -
I want to display the Employee details in table format without using iGrid
Hi all,
Can anybody help me that I want to display the Employee details return by transaction in table format without using iGrid.Hi, view the link below.
http://help.sap.com/saphelp_xmii115/helpdata/en/Advanced_Topics/Customizing_Output/Customizing_Output.htm
Hope this help.
Danilo Santos -
Hi,
when i rendering large HTML table from Ajax using jquery , table not displaying in browser why ? but visible in chrome and mozilla.Hi,
Post questions about html, css and scripting for website developers to the IE Web Development forum.
http://social.msdn.microsoft.com/Forums/ie/en-US/home?forum=iewebdevelopment
Include with your question a link to your website or a mashup that shows the issue.
If you are using the file: protocol.... MSIE browsers have security restriction for running active content from the file system.
Regards.
Questions regarding Internet Explorer 8, 9 and 10 and Internet Explorer 11 for the IT Pro Audience. Topics covered are: Installation, Deployment, Configuration, Security, Group Policy, Management questions. If you are a consumer looking for answers or to
raise a question, it's highly recommended you head on over to http://answers.microsoft.com/en-us
Rob^_^ -
Using dbms_output in Trigger
hi
I asked my question previous;y but couldnt get an exact answer for my question
I have three table grade
grade(studentno,courseno,grade)
courses(courseno,coursename)
prerequisite(courseno,prereqcourseno)
prereq(courseno) is foreign key on courses(courseno)
I want to make I trigger that when one try to add a course in grade table
the trigger will check the prerequisite of that course
and if the course is not exist in grade table( which means student has not take the prereq before)
the trigger will give an error and will report the prerequisites that the student need for that course;
The problem is I cant show the prerequisite courses that the student need, when I insert a course without prerequisite.
for example let say prereq of course C is A and B
so when I try to insert A into grade, the trigger should say that u cant do it, because u nedd A and B
thanks in advanceI agree totally with Kamal Kishores opinion. even i discourage my friends , the usage of DBMS_OUTPUT package.
It should be used more or less as a tool for debugging. As a beginner it may be advantageous and easy to learn abt the
stored procedure programming. But keeping in view that PL/SQL is more used in the backend processing. Just keep in view that
we are using a front end tool and we are writing our programs in back end (PL/SQL) then the use of DBMS_OUTPUT package and
dependency on that is waste of efforts. infact the point of DBMS_OUTPUT using to output a big chunk of varchar2 string to the
client SQL*PLUS window may / may not be advantageous.
coz if we are using Windows client and using the DBMS_OUTPUT put display the message on the screen then we may not be seeing
the messages immediately on the screen unless the execution of the program is completed. For that we are using our debugging in a separate way.
Suppose if i want to know what is the program doing at the current instance of time , then it may not be possible using DBMS_OUTPUT package.
my debugging style is in this way. I have created a procedure with AUTONOMOUS TRANSACTION with a single arguement of VARCHAR2;
CREATE OR REPLACE PROCEDURE SEND_MES(MES VARCHAR2) IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO DEBUG_TRAP VALUES(MES,TO_CHAR(SYSDATE,'HH24-MI-SS'));
COMMIT;
end;
EVEN THOUGH IT MAY BE AN OVER HEAD but it is very very advantageous to findout how the program is behaving and
where the current control is in the program. i monitor the values inputted in the table DEBUG_TRAP using another session. which makes me easily understandable where my program is
and gives me idea how to improve / tune my program .
prakash -
Column Heading are not displayed in ALV Report using CL_SALV_DISPLAY?
Hi,
I am using CL_SALV_DISPLAY class to display data. I Created an Internal Table Dynamically based fieldcatalog which was prepared based data at run time. When i displayed data using CL_SALC_DISPALY data is display in output but column headings are not displayed.
can anyone suggest me how to display heading in ALV using CL_SALV_DISPLAY class, My code is
CLASS lcl_report DEFINITION
CLASS lcl_report DEFINITION.
PUBLIC SECTION.
METHODS:
display IMPORTING l_table TYPE string
l_fcat TYPE string.
ENDCLASS. "lcl_report DEFINITION
CLASS lcl_report IMPLEMENTATION
CLASS lcl_report IMPLEMENTATION.
METHOD display.
DATA: gr_table TYPE REF TO cl_salv_table.
DATA: gr_columns TYPE REF TO cl_salv_columns_table,
gr_column TYPE REF TO cl_salv_column_table,
ls_fcat TYPE slis_fieldcat_alv.
DATA: gr_display TYPE REF TO cl_salv_display_settings.
DATA: l_o_functions TYPE REF TO cl_salv_functions_list,
l_field TYPE string.
FIELD-SYMBOLS : <fs_table> TYPE STANDARD TABLE,
<ft_fcat> TYPE STANDARD TABLE.
Get the ALV object refering to the output table
ASSIGN (l_table) TO <fs_table>.
ASSIGN (l_fcat) TO <ft_fcat>.
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = <fs_table> ).
CATCH cx_salv_msg. "#EC NO_HANDLER
ENDTRY.
Add basic default functionality in the ALV report
Functions
l_o_functions = gr_table->get_functions( ).
l_o_functions->set_all( abap_true ).
gr_columns = gr_table->get_columns( ).
gr_columns->set_headers_visible( abap_true ).
Display the list
gr_table->display( ).
ENDMETHOD. "extract
ENDCLASS. "lcl_report IMPLEMENTATION
*& start-of-selection declaration
START-OF-SELECTION.
PERFORM :
get store codes
get_storecodes USING p_stfile
CHANGING it_t001w,
fetching mard data
read_mard_data,
preparing fieldcatalog for Final Data
create_filedcat USING it_t001w
it_site
CHANGING it_fieldcat,
preparing structure & internal table for Final Data
create_final_table_structure USING it_fieldcat,
prepare output data
prepare_final_data.
*& end-of-selection declaration
END-OF-SELECTION.
PERFORM :
display data
display_data USING l_table
l_fcat.
*& Form get_storecodes
FORM get_storecodes USING p_p_stfile
CHANGING p_it_t001w LIKE it_t001w[].
DATA :
internal table for RAW
lt_raw TYPE truxs_t_text_data,
rs_site LIKE LINE OF rt_site,
l_index LIKE sy-tabix.
FIELD-SYMBOLS :
field symbol for it_t001w
<fs_t001w> LIKE LINE OF p_it_t001w.
calling function module to get Stores Data from File
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_line_header = 'X'
i_tab_raw_data = lt_raw
i_filename = p_p_stfile
TABLES
i_tab_converted_data = p_it_t001w[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
EXIT.
ENDIF.
SORT p_it_t001w BY werks.
CLEAR rs_site.
rs_site-sign = 'I'.
rs_site-option = 'EQ'.
rs_site-low = p_dccode.
APPEND rs_site TO rt_site.
IF it_t001w[] IS NOT INITIAL.
LOOP AT p_it_t001w ASSIGNING <fs_t001w>.
l_index = sy-tabix.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = <fs_t001w>-werks
IMPORTING
output = <fs_t001w>-werks.
MODIFY p_it_t001w FROM <fs_t001w> INDEX l_index.
IF <fs_t001w>-werks GE s_site-low AND <fs_t001w>-werks LE s_site-high.
append site to ranges
CLEAR rs_site.
rs_site-sign = 'I'.
rs_site-option = 'EQ'.
rs_site-low = <fs_t001w>-werks.
APPEND rs_site TO rt_site.
CONTINUE.
ENDIF.
ENDLOOP.
SORT p_it_t001w BY werks.
SORT rt_site.
ENDIF.
ENDFORM. " get_storecodes
*& Form create_final_table_structure
FORM create_filedcat USING p_it_t001w LIKE it_t001w[]
p_it_site LIKE it_site[]
CHANGING p_it_fieldcat LIKE it_fieldcat[].
FIELD-SYMBOLS :
field symbol for p_it_t001w
<fs_t001w> LIKE LINE OF p_it_t001w,
field symbol for p_it_site
<fs_site> LIKE LINE OF p_it_site.
DATA :
fieldname
l_fieldname TYPE slis_fieldname,
workarea for site ranges
rs_site LIKE LINE OF rt_site.
CLEAR : l_fieldname, rs_site.
l_fieldname = p_dccode.
PERFORM
prepare fieldcatalog
build_fieldcatalog USING : 'MTART' 'CHAR' '5' ,
'MTBEZ' 'CHAR' '25' ,
'MATKL' 'CHAR' '6' ,
'WGBEZ' 'CHAR' '20' ,
'MATNR' 'CHAR' '18' ,
'MAKTX' 'CHAR' '30' ,
l_fieldname 'CHAR' '17' .
create header for excel
PERFORM create_excel_header USING : 'Division',
'Divsion Description',
'MC Code',
'MC Description',
'Article',
'Article Description',
l_fieldname.
loop for creating fieldcatalog
LOOP AT it_site ASSIGNING <fs_site>.
READ TABLE it_t001w ASSIGNING <fs_t001w> WITH KEY werks = <fs_site>-werks
BINARY SEARCH.
IF sy-subrc = 0 AND <fs_t001w> IS ASSIGNED AND
<fs_site> IS ASSIGNED AND <fs_site>-stock GT 0.
CLEAR : l_fieldname, rs_site.
l_fieldname = <fs_site>-werks.
prepare fieldcatalog
PERFORM build_fieldcatalog USING : l_fieldname 'CHAR' '17'.
create header for excel
PERFORM create_excel_header USING l_fieldname .
CONTINUE.
ENDIF.
ENDLOOP.
l_fcat = 'it_fieldcat[]'.
ENDFORM. " create_final_table_structure
*& Form build_fieldcatalog
FORM build_fieldcatalog USING p_fieldname TYPE slis_fieldname
p_datatype TYPE datatype_d
p_length TYPE intlen.
DATA : ls_fieldcat LIKE LINE OF it_fieldcat.
CLEAR : ls_fieldcat.
ls_fieldcat-fieldname = p_fieldname.
ls_fieldcat-datatype = p_datatype.
ls_fieldcat-intlen = p_length.
APPEND ls_fieldcat TO it_fieldcat.
ENDFORM. " build_fieldcatalog
*& Form create_final_table_structure
FORM create_final_table_structure USING p_it_fieldcat.
Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = t_table.
ASSIGN t_table->* TO <ft_final>.
ENDFORM. " create_final_table_structure
*& Form create_excel_header
FORM create_excel_header USING p_p_fieldname.
DATA : ls_header LIKE LINE OF it_header.
CLEAR ls_header.
ls_header-col_name = p_p_fieldname.
APPEND ls_header TO it_header.
ENDFORM. " create_excel_header
*& Form prepare_final_data
FORM prepare_final_data .
DATA : l_matnr LIKE g_matnr,
l_werks LIKE g_werks,
l_index LIKE sy-tabix.
FIELD-SYMBOLS : <fs_mard> LIKE LINE OF it_mard.
Getting No. of Lines in IT_MARD internal table
DESCRIBE TABLE it_mard LINES g_lines.
LOOP AT it_mard ASSIGNING <fs_mard>.
l_index = sy-tabix.
IF l_matnr IS INITIAL.
l_matnr = <fs_mard>-matnr.
CLEAR : l_werks.
l_werks = <fs_mard>-werks.
UNASSIGN : <fs_value>, <fs_final>.
Create dynamic work area and assign to FS
CREATE DATA t_line LIKE LINE OF <ft_final>.
ASSIGN t_line->* TO <fs_final>.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_mard>-matnr.
ASSIGN COMPONENT l_werks OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_value> + <fs_mard>-labst.
getting Article Type,MC & its Descriptions
PERFORM get_other_data USING l_matnr
l_werks.
ELSEIF l_matnr <> <fs_mard>-matnr.
APPEND <fs_final> TO <ft_final>.
CLEAR l_matnr.
l_matnr = <fs_mard>-matnr.
CLEAR : l_werks.
l_werks = <fs_mard>-werks.
UNASSIGN : <fs_value>, <fs_final>.
Create dynamic work area and assign to FS
CREATE DATA t_line LIKE LINE OF <ft_final>.
ASSIGN t_line->* TO <fs_final>.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_mard>-matnr.
ASSIGN COMPONENT l_werks OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_value> + <fs_mard>-labst.
getting Article Type,MC & its Descriptions
PERFORM get_other_data USING l_matnr
l_werks.
ELSE.
CLEAR : l_werks.
l_werks = <fs_mard>-werks.
ASSIGN COMPONENT l_werks OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_value> + <fs_mard>-labst.
ENDIF.
IF l_index = g_lines.
APPEND <fs_final> TO <ft_final>.
ENDIF.
ENDLOOP.
l_table = '<ft_final>[]'.
ENDFORM. " prepare_final_data
*& Form get_other_data
FORM get_other_data USING p_l_matnr
p_l_werks.
FIELD-SYMBOLS : <fs_mara> LIKE LINE OF it_mara,
<fs_t023t> LIKE LINE OF it_t023t,
<fs_t134t> LIKE LINE OF it_t134t,
<fs_makt> LIKE LINE OF it_makt.
READ TABLE it_mara ASSIGNING <fs_mara> WITH KEY matnr = p_l_matnr. " BINARY SEARCH.
IF sy-subrc = 0 AND <fs_mara> IS ASSIGNED.
ASSIGN COMPONENT 'MTART' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_mara>-mtart.
ASSIGN COMPONENT 'MATKL' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_mara>-matkl.
READ TABLE it_makt ASSIGNING <fs_makt> WITH KEY matnr = <fs_mara>-matnr BINARY SEARCH.
IF sy-subrc = 0 AND <fs_makt> IS ASSIGNED.
ASSIGN COMPONENT 'MAKTX' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_makt>-maktx.
ENDIF.
READ TABLE it_t023t ASSIGNING <fs_t023t> WITH KEY matkl = <fs_mara>-matkl BINARY SEARCH.
IF sy-subrc = 0 AND <fs_t023t> IS ASSIGNED.
ASSIGN COMPONENT 'WGBEZ' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_t023t>-wgbez.
ENDIF.
READ TABLE it_t134t ASSIGNING <fs_t134t> WITH KEY mtart = <fs_mara>-mtart BINARY SEARCH.
IF sy-subrc = 0 AND <fs_t134t> IS ASSIGNED.
ASSIGN COMPONENT 'MTBEZ' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_t134t>-mtbez.
ENDIF.
ENDIF.
ENDFORM. " get_other_data
*& Form display_data
text
FORM display_data USING p_l_table
p_l_fcat.
DATA:
Variable for Object Creation
o_report TYPE REF TO lcl_report.
CREATE OBJECT o_report.
o_report->display( EXPORTING l_table = p_l_table
l_fcat = p_l_fcat ).
ENDFORM. " display_dataI don't know how to read the code you pasted or I would have checked this myself.
Do your fields in the internal table reference dictionary objects or elementary types? If not using dictionary types, the column names will be blank by default. If you can't change your fields to be dictionary types, you can try this to change the column names:
I made a method inside my local class to add the names:
call method set_colname
EXPORTING iv_tab = alv_tab
iv_colid = 'xxxx' "fieldname from the table
iv_stxt = text-t54
iv_mtxt = text-t55
iv_ltxt = text-t55.
METHOD set_colname .
data:
alv_cols type REF TO cl_salv_columns_table,
alv_col type REF TO cl_salv_column.
TRY .
*... Change fieldnames
call METHOD iv_tab->get_columns RECEIVING value = alv_cols.
call method alv_cols->get_column EXPORTING columnname = iv_colid RECEIVING value = alv_col.
IF iv_stxt <> ''.
CALL METHOD alv_col->set_short_text EXPORTING value = iv_stxt.
ENDIF.
IF iv_mtxt <> ''.
CALL METHOD alv_col->set_medium_text EXPORTING value = iv_mtxt.
ENDIF.
IF iv_ltxt <> ''.
CALL METHOD alv_col->set_long_text EXPORTING value = iv_ltxt.
ENDIF.
CATCH cx_salv_not_found.
ENDTRY.
ENDMETHOD. "set_colname -
Display data in smartforms using report
hi,
i want to display data from smartform using report.
i have a preview buttons in report when i select preview buttons displays in smarts
regards
amitdesign the smartform as per ur need and get the function module generated by smartform and pass it to ur report programas below..
case sy-ucomm.
when 'smartform'.
pass the f.m that is generated by system in smartforms
CALL FUNCTION '/1BCDWB/SF00000265'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
DATE_L = s_fkdat-low
DATE_H = s_fkdat-high
PLANT_L = s_werks-low
PLANT_H = s_werks-high
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
IFINAL = ifinal1[]
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endcase. -
How to populate one internal table from another using field symbols
Hi Gurus,
I have a problem. I have to populate one internal table (sructure t_otput) from another internal table (sructure t_from) using field symbol.
Structure for from table.
types: begin of t_from,
year(4) type c,
ww(2) type c,
site type marc-werks,
demand type i,
end of t_from.
Structure for output table.
types: begin of t_display,
title(30),
WW1(10),
WW2(10),
WW3(10),
end of t_display.
The from table looks like this:
Year | WW | Site | Demand
2005 | 1 | OR1 | 12.00
2005 | 2 | OR1 | 13.00
2005 | 3 | OR1 | 14.00
The display table which has to be populated should look like this:
Title | WW1 | WW2 | WW3
OR1 | | |
Demand | 12.00 | 13.00 | 14.00
How to populate display table using field symbol?
Please give code snippets
Thanks,
GopalGopal,
Here is the code, however I am not vary clear about the ORG1 and Demand display that you have shown in the display. I am sure with this code it should not be a big deal to tweak in whatever manner you want.
TABLES : marc.
TYPES: BEGIN OF type_display,
title(30),
ww1(10),
ww2(10),
ww3(10),
END OF type_display.
TYPES: BEGIN OF type_from,
year(4) TYPE c,
ww(2) TYPE c,
site TYPE marc-werks,
demand TYPE i,
END OF type_from.
data : t_from type table of type_from,
t_display type table of type_display.
field-symbols : <fs_from> type type_from,
<fs_display> type type_display.
data : wa_from type type_From,
wa_display type type_display.
wa_from-year = '2005'.
wa_from-ww = '1'.
wa_from-site = 'OR1'.
wa_from-demand = '12.00'.
insert wa_from into table t_from.
wa_from-year = '2005'.
wa_from-ww = '2'.
wa_from-site = 'OR1'.
wa_from-demand = '13.00'.
insert wa_from into table t_from.
wa_from-year = '2005'.
wa_from-ww = '3'.
wa_from-site = 'OR1'.
wa_from-demand = '14.00'.
insert wa_from into table t_from.
data : variable(3) type c.
field-symbols : <fs_any> type any.
break-point.
Loop at t_from assigning <fs_from>.
variable = 'WW'.
wa_display-title = <fs_from>-site.
concatenate variable <fs_from>-ww into variable.
assign component variable of structure wa_display to <fs_any>.
<fs_any> = <fs_from>-demand.
endloop.
append wa_display to t_display.
clear wa_display.
loop at t_display assigning <Fs_display>.
write :/ <fs_display>.
endloop.
Note : Please award points if this helps you.
Regards,
Ravi -
How to Download displayed output to Excel Using Bsp Application
Hi Experts,
please give me some idea because I am New In BSP.
How to Download displayed output to Excel Using Bsp Application.
If any sample code please do send me.
In my condition I am getting data in 2-3 table view formats on one page and i want download that in Excel.
please help me.
Regards & Thanks,
YogeshHi,
This is more a question for the BSP forum.
Anyway, as such it's realy easy since you can use HTML in order to import to Excel. All you need to do is add
runtime->server->response->set_header_field( name = 'Contnet-Type'
value = 'application/vnd.ms-excel' ).
runtime->server->response->delete_header_field( name = 'Cache-Control' ).
runtime->server->response->delete_header_field( name = 'Expires' ).
runtime->server->response->delete_header_field( name = 'Pragma' ).
Also check threads like
Download BSP data into Excel
export bsp-table to excel
Export BSP Table to Excel
Eddy
PS. Reward useful answers and earn points yourself -
Hi
how to create a external content type for Read and Update data from two tables in sqlserver using sharepoint designer 2010
i created a bcs service using centraladministration site
i have two tables in sqlserver
1)Employee
-empno
-firstname
-lastname
2)EmpDepartment
-empno
-deptno
-location
i want to just create a list to display employee details from two tables
empid firstname deptno location
and same time update in two tables
adilWhen I try to create an external content type based on a view (AdventureWorks2012.vSalesPerson) - I can display the data in an external list. When I attempt to edit it, I get an error:
External List fails when attached to a SQL view
Sorry, something went wrong
Failed to update a list item for this external list based on the Entity (External Content Type) 'SalesForce' in EntityNamespace 'http://xxxxxxxx'. Details: The query against the database caused an error.
I can edit the view in SQL Manager, so it seems strange that it fails.
Any advice would be greatly GREATLY appreciated.
Thanks,
Randy -
Displaying BLOB image by using ADF Faces
Hi all,
I digged the forum but couldn't find any satisfied answer about displaying BLOB images by using ADF Faces.
I have insterted POJO object to Oracle database but couldn't find any way to display blob (in java byte [] ) data in POJO.
I have read the POJO object from database which contains two field; one of them is id field and other is BLOB data which holds GIF or JPG image and I want to display this image another page which contains also other fields / records ...
thanks for your answers
regards...
--barisThis thread at Sun : http://forum.java.sun.com/thread.jspa?threadID=513804&messageID=2445090
talks about two options for creating a graphicImage jsf tag. (img tag)
1. Make the img tag url refer to a servlet (instead of a static image file)
2. Embed the image into the tag as inline base64 encoded data.
2a. Use an <Object> tag with inline data.
1. Looks a bit complex for a simple problem.
2 and 2a don't work with some browsers.
- And I've not yet figured out how to hook into the ADF Faces table-rendering logic to get it to add my image column. My table binds to a collection DataControl, [which in turn retrieves from a findAllItems call on a session facade, which uses my domain model, and wraps up access to a TopLink pesistence layer]. The framework just ignores my byte[] attribute when creating the jsf table from the DataControl. All string, int etc. attributes get represented correctly in the jsf table output.
Maybe you are looking for
-
Changing invite to another calendar requires follow up to accept again in the new calendar.
Here's the scenario... I have several calendars created in iCal. When I get an invite I will change the calendar to which I want it to apply. I'll hit accept and the invite will close. However, when I go to the relevant calendar, the invite does not
-
In the course of migration MacBook switched off due to low battery. After recharging the progress bar doesn't move. How to continue the migration?
-
How to apply new templates to legacy FrameMaker documents?
I have to update the overall style of a large number of legacy FrameMaker 6/7/8 documents. These documents implement a set of legacy FrameMaker templates. I'd like to know how can I apply a new FrameMaker template to a legacy document, so that the st
-
I want to download Mountain Lion but keep getting "the product distribution file could not be verified. It may be damaged or was not signed. What do I do?
-
IPod stops in the middle of songs
This is a new problem, just started after updating to the new Itunes firmware. I have tried resetting and wiping my entire ipod, upgrading to the newest firmware, etc but my ipod randomly stops during a song. Sometimes its a few minutes, sometimes it