How to handle varchar(4000) field in reporting?
Hello,
I am having a Oracle database, the data in tables of which is being stored from a web application. One of the fields of a table is having varchar(4000) datatype.
The data in this field is text which may contain carriage returns also.
I have to create report of this table. How to display this data properly in a report?
I tried few things:
Accessed the table using SQL Developer and pasted the query output in Excel.
As the text contains carriage returns, it is being spread into one or more rows.
How to handle this? What is the proper way to create report for such data?
Please help.
-Sameer
You the following to remove the carriage returns
SQL> select 'a'||chr(10)||'line2
2
SQL> select 'line 1'||chr(10)||'line 2' from dual ;
'LINE1'||CHR(
line 1
line 2
SQL> select replace('line 1'||chr(10)||'line 2',chr(10),'') from dual ;
REPLACE('LIN
line 1line 2
If this is not the soln , can you paste some sample data
Similar Messages
-
How to handle interactive list in alv reports
hi experts.
how to handle interactive list in alv reports.
regards.
subhasisHI Subhasis,
below is the sample code for handling an interactive ALV report, hope this helps you ..
REPORT ZTEST_ALV123.
TYPE-POOLS:SLIS.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
VGBEL LIKE LIPS-VGBEL,
VGPOS LIKE LIPS-VGPOS,
END OF ITAB1.
DATA: IT_LIPS LIKE ITAB1 OCCURS 0 WITH HEADER LINE.
SELECT VBELN
POSNR
FROM VBAP
INTO TABLE ITAB.
IF SY-SUBRC = 0.
SORT ITAB BY VBELN .
SELECT VBELN
POSNR
VGBEL
VGPOS
INTO TABLE ITAB1
FROM LIPS
FOR ALL ENTRIES IN ITAB
WHERE VGBEL = ITAB-VBELN
AND VGPOS = ITAB-POSNR.
ENDIF.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'PFSTATUS'
I_CALLBACK_USER_COMMAND = 'HANDLE_USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC = 0.
ENDIF.
*& Form POPUP
text
-->P_EXTAB text
FORM POPUP USING P_EXTAB TYPE SLIS_T_EXTAB.
"here double click on PFSTATUS and create the status, "activate, before that set PICK for choose(F2).
*- Pf status
SET PF-STATUS 'PFSTATUS'.
ENDFORM. " POPUP
*& Form HANDLE_USER_COMMAND
text
-->R_UCOMM text
-->RS_SELFIELD text
FORM HANDLE_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
IF RS_SELFIELD-FIELDNAME = 'VBELN'.
READ TABLE ITAB INDEX RS_SELFIELD-TABINDEX.
LOOP AT ITAB1 WHERE VGBEL = ITAB-VBELN
AND VGPOS = ITAB-POSNR.
MOVE-CORRESPONDING ITAB1 TO IT_LIPS.
APPEND IT_LIPS.
ENDLOOP.
PERFORM INTERACTIVE_REPORT.
ENDIF.
ENDCASE.
ENDFORM. "HANDLE_USER_COMMAND
*& Form interactive_report
text
FORM INTERACTIVE_REPORT .
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_LIPS'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT1.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'ITEM'.
X_FIELDCAT-TABNAME = 'IT_LIPS'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT1.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'VGBEL'.
X_FIELDCAT-SELTEXT_M = 'SO #'.
X_FIELDCAT-TABNAME = 'IT_LIPS'.
X_FIELDCAT-COL_POS = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT1.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'VGPOS'.
X_FIELDCAT-SELTEXT_M = 'SO ITEM'.
X_FIELDCAT-TABNAME = 'IT_LIPS'.
X_FIELDCAT-COL_POS = 4.
APPEND X_FIELDCAT TO IT_FIELDCAT1.
CLEAR X_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT1
TABLES
T_OUTTAB = IT_LIPS
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC = 0.
ENDIF.
ENDFORM. " interactive_report
Regards,
Ranjita
null -
How to handle currency & unit fields in call transaction?
Hi,
Can any one tell me How to handle currency & unit fields in call transaction? & how to dael with error for this fields? whith some sort of coding.
Thanks In Advance.
PravinHi Pravin,
The same topic has been discussed in the following thread:
How to handle currency & unit fields in BDC recording method?
Regards,
Chandra Sekhar -
How to store bit data in VARCHAR(4000) field?
Hi.
Please help!
We are porting some C/C++ software with embedded SQLs from NT/DB2 to Linux/Oracle.
On NT/DB2 we have some table to store file data in a VARCHAR(4000) blocks.
Table looks like this
CREATE TABLE FileData (filetime as timestamp not null, idx int not null, datablock varchar(4000) FOR BIT DATA not null, primary key (filetime, idx) );
As you can see DB2 has appropriate field modifier - "FOR BIT DATA" which makes DB2 storing data as-is, not converting characters.
I need to know - if it is possible to do the same in Oracle like in DB2?
If Oracle has some kind of field modifier like "FOR BIT DATA" in DB2?
If not, how can I do the same in Oracle?
The current problems are:
1) when application imports the file with some national chars the Oracle stores "?" in a database in place of national chars.
2) another piece of a problem - if file is more than 4000 bytes length, it reports the ORA-01461 error (see it is trying to expand some chars to UTF8 char which is not fit a single char, so finally - not fit the field size).
So, it seems that it cannot proceed national chars at all. :-\
For details please see enclosed [C code|http://dmitry-bond.spaces.live.com/blog/cns!D4095215C101CECE!1606.entry] , there is example how data written to a table.
In other places we also need to read data from FIELDATA table and store back to file (other filename, other location).
Here is summary on a field-datatype variants I have tried for the "datablock" field:
1) VARCHAR2, RAW, LONG RAW, BLOB - does not work! All reports the same error - ORA-01461.
2) CLOB, LONG - both working fine but(!) both still returns "?" instead of national chars on data reading.
Hint: how I did try these field types - I just drop the "FileData" table, created it using different type for "datablock" field and run the same application to test it.
I think I need to explain what the problem - we do not provide direct access to Oracle database, we use a some middle-ware. Middle-ware is a C/C++ software which also has a interface for dynamic SQLs execution. So, exactly this middle-ware (which is typically running on the same server with Oracle) receives the "?" instead of national chars! But we need it to return all data AS-IS(!) without any changes!!! That is wjhy I did ask - if Oracle has any options to store byte-data as-is?
The BIG QUESTION - HOW CAN WE DO THIS?!
Another thing I need to explain - it is ok to use Oracle-specific SQL ONLY IF THERE IS REALLY NO WAY TO ACHIEVE THIS WITH STANDARD SQL! Please.
So, please look on a C code (by link I have posted above) and tell - if it is possible to make working in Oracle the VARCHAR approach we using at the moment?
If not - please describe what options do we have for Oracle?
Regards,
Dmitry.
PS. it is Oracle 11gR2 on CentOS 5.4, all stuff installed with default settings, so Oracle db encoding is "AL32UTF8".
C/C++ application is built as ANSI/ASCII application (non-unicode), so sizeof(char)=1.
The target Oracle db (I mean - the one which will be used on customer site) is Oracle 10g. So, solution need to be working on Oracle 10g.P. Forstmann wrote:
There is some contradiction in your requirements:
- if you want to store data as is without any translation use RAW or BLOB
- if you want to store national character data try to use NVARCHAR2 or NCLOB.Seems you did not understand the problem. Ok, I'll try to explain. Please look on the code sample I provided in original question
(I just added expanded data structures there, sorry I forgot to publish them when post original question):
EXEC SQL BEGIN DECLARE SECTION;
struct {
char timestamp[27];
char station[17];
char filename[33];
char task[17];
char orderno[17];
long filelen;
gFilehead;
struct {
char timestamp[27];
long idx;
struct {
short len;
char arr[4001];
} datablock;
gFiledata;
EXEC SQL END DECLARE SECTION;
#define DATABLOCKSIZE 4000
#ifdef __ORACLE
#define VARCHAR_VAL(vch) vch.arr
#elif __DB2
#endif
short dbWriteFile( char *databytes, long datalen )
short nRc;
long movecount;
long offset = 0;
gFilehead.filelen = gFilehead.filelen + datalen;
while ((datalen + gFiledata.datablock.len) >= DATABLOCKSIZE)
movecount = DATABLOCKSIZE - gFiledata.datablock.len;
memcpy(&VARCHAR_VAL(gFiledata.datablock)[gFiledata.datablock.len], databytes, movecount);
gFiledata.datablock.len = (short)(gFiledata.datablock.len + movecount);
exec sql insert into filedata (recvtime, idx, datablock)
values(
:gFiledata.recvtime type as timestamp,
:gFiledata.idx,
:gFiledata.datablock /* <--- ORA-01461 appears here */
nRc = sqlcode;
switch (nRc)
case SQLERR_OK: break;
default:
LogError(ERR_INSERT, "filedata", IntToStr(nRc), LOG_END);
exit(EXIT_FAILURE);
offset = offset + movecount;
datalen = datalen - movecount;
gFiledata.idx = gFiledata.idx + 1;
memset(&gFiledata.datablock, 0, sizeof(gFiledata.datablock));
databytes = databytes + movecount;
gFiledata.datablock.len = 0;
if (datalen + gFiledata.datablock.len)
memcpy(&VARCHAR_VAL(gFiledata.datablock)[gFiledata.datablock.len], databytes, datalen);
gFiledata.datablock.len = (short)(gFiledata.datablock.len + datalen);
return 0;
}So, the thing we need is - to put some data into the "datablock" field of following structure:
struct {
char timestamp[27];
long idx;
struct {
short len;
char arr[4001];
} datablock;
gFiledata;Then insert it into a database table using static SQL like this:
exec sql insert into filedata (recvtime, idx, datablock)
values(
:gFiledata.recvtime type as timestamp,
:gFiledata.idx,
:gFiledata.datablock /* <--- ORA-01461 appears here */
); And then expect to read exactly the same data back!
The problems are:
1) Oracle make decision to convert the data we are inserting (why? and how to disable converting?!)
2) even if it inserts the data (CLOB and LONG field datatypes are working fine when inserting data with such static SQL + such host variable) then it became not readable! (why?! how to make it readable?!)
P. Forstmann wrote:
ORA-01461 could mean that you have a wrong data type for bind variable variable in your client code:Not me decided that host variable is the "LONG datatype value" - the Oracle make that decision instead of me. And that is the problem!
Looks like Oracle react on any char code >= 0x80.
So, assume if I run the code:
// if Tab1 was created as "CREATE TABLE Tab1 (value VARCHAR(5))" then
char szData[10] = "\x41\x81\x82\x83\x84";
EXEC SQL INSERT INTO Tab1 (value) VALUES (:szData);
Oracle will report the ORA-01461 error!
EXACTLY THIS IS THE PROBLEM I HAVE DESCRIBED IN MY ORIGINAL QUESTION.
So, problem - why Oracle make such decision instead of me?! How we can make Oracle insert data into a table AS-IS?
What other type of host variable we should use to make Oracle think that data is a binary?
void*? unsigned char? Could you please provide any examples?
Ok, you did recommend - "use the RAW datatype". But RAW datatype is limited to size 2000 bytes only - we need 4000! So, it is not match our needs at all.
Also you have mentioned "use BLOB" - but testing shows that Oracle reports the same ORA-01461 error on inserting data into a BLOB field from such host variable! (see the code I posted)
What also we can do?
Change type of host variables? BUT HOW?! -
Retrieving data from a "varchar(4000)" field w/ JDBC
I'm using the Oracle thin JDBC drivers w/ the 1.1.8 JDK. In the past when needing to access "LONG" fields with over 2000 bytes of data I used the "rs.getAsciiStream(xx)" method and read the data from the STREAM. A later version of the thin drivers allowed me to use the straight-forward method of "rs.getString(xx)" and it would return all of the data.
I'm now trying to access an ORACLE database (NT, 8.0.5) with a field defined as "varchar(4000)". Using either of the retrieval methods [getString(), getAsciiStream()], I only get 2000 bytes of data, which is not acceptable. I ran into the same problem when I used the 1.2.2 JDK.
I finally downloaded the thin drivers for ORACLE 8.1.6, and they seem to work against the 1.2.2 JDK, and the ORACLE 8.1.5 drivers work with the 1.1.7 JDK.
My question is, can I "safely" use the 8.1.6 drivers against an 8.0.5 database? If not, is there another way of pulling the data out? [I tried using the "defineColumnType" to "LONGVARCHAR" and that didn't work either].
Any help would be appreciated.
Wayne Johnson
[email protected]Hi,
I entered the SQL statement in transaction MDXTest but it is running since 7 minutes.
>> Transaction MDXTEST has an option to generate a test sequence and is not there to test SQL statements. You need to enter a valid MDX statement.
Function module "/Crystal/MDX_GET_STREAM_INFO" not found
>> then I would suggest you make sure that all the Transports from the SAP Integration Kit have been properly imported - see the Installation Guide for the SAP Integration Kit for details.
Ingo -
How do you call dynamic fields in Report Builder
I have some fields that they were filled in a dynamic way,
and I want to make some calculations using the information that was
populated in this field. When I put the name of the field in my
calculation control, it did not see find the field control.
Does anyone know how can I call the field control? The
information is not part of any particular column of the
query.check out the Oracle Portal Tutorial White Paper (http://technet.oracle.com/docs/products/iportal/listing.htm#tutcase), there is a section where they build a report with repeating fields
-
How to handle empty Dats field received from SAP RFC response
Hi All,
I am invoking a SAP RFC which gives me a Dats field in response.
A valid dats fields is successfully received by my pipelines.
But when an empty Dats field is received, My pipeline fails and i get error.
How to handle the empty Dats field from SAPHi Anant,
This is because the legacy SAP adapter accepted RFC messages with date field empty. In the new version, the same call results in an error. WCF-SAP adapter doesn't allow blank XML nodes.
You need to use the below custom pipeline component as a workaround.
Refer:
Pipeline component for enabling legacy behavior in WCF-SAP adapter.
Rachit
Please mark as answer or vote as helpful if my reply does -
How i can take a field of report for use it in query?
i hve a table where bills of customer are ready i simply take it on report by select statement.all bills are ready for print.now problem is that i need history of bills for every customer at it's own bill.when i give self join for history, it also add other customer history .there is any possible way that take customer id(report field) from report and search it's records . plzzzzzzzzzzzzzz
i hve a table where bills of customer are ready i
simply take it on report by select statement.all
bills are ready for print.now problem is that i need
history of bills for every customer at it's own
bill.when i give self join for history, it also add
other customer history .there is any possible way
that take customer id(report field) from report and
search it's records . plzzzzzzzzzzzzzzmay be you can use a child query and create a data link between
the original query and child query on customer id column.
I mean write a child query for searching records on customer id and then link
this customer id with your already existing query. I think this will solve your problem -
How to handle Events in Blocked ALV report
Hi All,
I have a Blocked ALV report, I have a requirement where if I double click a row in blocked ALV report, it should branch off to MM01 transaction code and the material number and change number should get populated with the material number and change number in my program.
Is there any idea how to do this.
Thanks,
Vishal.hi anil,
I have used user_command1 as the function module however the field details are not getting captured.
How can we use set get parameters in this aspect.
Please elaborate your answer.
Thanks,
Vishal. -
How to Handle PF Status in ALV report ?
Hi friends i wanna handle my own PF Status in my report how can i handle it ?
please help me?
regards
satishcall function module reuse_alv_grid_display.
exporting.
programname = gd_repid.
t_fieldcatalog = d_fieldcat.
set pf_status = 'SET_PF_STATUS'.
importing.
t_outtab = itab.
exceptions.
form set_pf_status using rt_extab type slis_t_extab.
SET PF_STATUS 'NEWSTATUS'.
endform.
double click on NEWSTATUS it will take u to new window where in u can select required icon's which u need to be displayed in output.
otherwise
please see the standard program bcalv_grid_05.
Reward with points if helpful. -
How to handle more column in a report?
<p>Hai,</p><p> How do I handle to create a design which is have more than 10 column in a reports? Currently what I do is I used landscape and page size A3..but its still not enough space (column) that allows the reports to generate the data needs. Any advise? <br /></p><p> </p>
<p>hai..thanks for the response.</p><p>I've chanes my reports using 11 X 17. Unfortunately,it seem different from the current reports. The page ruler at the top only display 17..which is mine is 25. (I used A3, landscape). Is it possible to get the page width something like 30 / 35. Does I need to select a printer type to meet the requirement or something else? Kindly advise. </p>
-
How to handle UMLAUT characters in oracle reports 10g
Hi All,
we are facing issues while developing the report in 10g. There are few hardcoded values which have ä in it. We register these reports into Oracle Applications R12. The report gets completed normal. But in the report output it displays as ö in (ungelöscht) or sometimes a1/2.
Can anybody help in how to resolve this issue?
Thanks
Nikunj.please find the link i already ask this question
[link]http://www.orafaq.com/forum/m/409062/135627/?srch=barcode#msg_409062[link]
Hope its help you
Regards
Shahzaib ismail -
How to handle invalid images in "Image" report item?
I have a report that displays images in Image item (MIMEType image/jpeg) in the table. Images are stored in the database.
Some of the images are, however, not a valid jpeg files (not sure what they are but I saved them as files and they cannot be opened by any graphics editor). When report server tries to display such an image in the report whole report fails.
Similarly, web application that tries to display them on the web page throws an exception. In web application we can catch that exception and show static "IMAGE IS INVALID" bitmap instead.
Is there a way to handle/catch such errors in SSRS? The way it is now is not good because error message doesn't tell you anything specific about error.Enabling SSRS Remote errors
http://technet.microsoft.com/en-us/library/aa337165.aspx
http://www.sharepointjohn.com/sql-reporting-services-2008-r2-enable-remote-errors/
Displaying custom error message
http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/2b891541-836f-4d9d-89f3-d2340319f453/
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to remove Built-in-Fields from Report builder report
I have create SSRS report which is sending email to recipient but at the bottom of report email I am also getting
report accessible address. I don’t want to send that address to recipient. How should I remove from report builder?
The report is accessible at the following address
<<Report address>>
RahulYou have to change the report subscription, and untick the checkbox that says to also send it as a link.
-
How to Edit a single field in Report
Hi Experts,
I am new in ABAP and need your help while creating a report.
My query is, am creating a ALV report and in that report i want only a single field is editable. For example, suppose in sales order report, there is 20 fields but i want to edit only Quantity fields and anyone can change the quantity based on their requirements. I tried but not succeed in this terms.
Waiting your reply.... thanks
Moderator Message: Baisc question. Please search for available information before turning to the forums for help.
Edited by: kishan P on Sep 3, 2010 5:42 PMHi Kumar,
data: ft_cat type lvc_s_fcat. Create field catalog.
If ft_cat-fieldname = 'Quantity fields'.
ft_cat-edit = 'X'
I hope this may helpfull.
Thank You,
Thanks,
AMS
Maybe you are looking for
-
Best practice for remote topic subscription with HA
I'd like to create an orchestrator EJB, in cluster A, that must persist some data to a database of record and then publish a business event to a topic. I have two durable subscribers, MDBs on clusters B & C, that need to receive the events and perfor
-
ZDFInvScanner.exe removal?
We recently rolled out ZAM and therefore disabled the ZFD inventory. For some reason the zfdinvscanner.exe process still runs at startup at each workstation and uses a significant amount of resources (15 - 25 percent cpu). Is there any way to stop th
-
Loss of Music Sound Samples After Recording
After recently recording a track, the sound track information - wave forms - on the track went to a straight line when I stopped recording. The recording was still on the track, but all I could see was a straight line where the wave forms were prev
-
Can't install HP printer 6120 in new computer Windows 7
How do I install HP printer 6120 into new computer when I can't find a place to put adapter. Is there some kind of converter I need to purchase?
-
I use Photoshop to make coloring pages for children. I pick a photo and put a layer on top of it and then trace with the brush tool. Hundreds of times I click shift click to get a short strait line. After an hour or so, the tool goes crazy and dra