Need output in tabluar format
Hi All,
I have a requiremnet in which i am supposed th print the incoming string in following format
input string :aaaa,bbbb,cccc,dddd,eeee,ffff,gggg,hhhh,iiiiii,jjjj
output format
aaaa bbbb cccc dddd
eeee ffff gggg hhhh
iiii jjjj
input string will be comma seprated
the output should be printed in tabular format..with evry fifth word printing in new line.
Please let me know if any on has solution for this.
Thanks,
Seshu
Hi,
Here's one way:
VARIABLE input_string VARCHAR2 (4000)
EXEC :input_string := 'aaaa,bbbb,cccc,dddd,eeee,ffff,gggg,hhhh,iiiiii,jjjj';
WITH got_sub_string AS
SELECT CEIL (LEVEL / 4) AS r_num
, MOD (LEVEL, 4) + 1 AS c_num
, REGEXP_SUBSTR ( :input_string
, '[^,]+'
, 1
, LEVEL
) AS sub_string
FROM dual
CONNECT BY LEVEL <= 1 + LENGTH ( :input_string)
- LENGTH ( REPLACE ( :input_string
SELECT MIN (CASE WHEN c_num = 1 THEN sub_string END) AS col_1
, MIN (CASE WHEN c_num = 2 THEN sub_string END) AS col_2
, MIN (CASE WHEN c_num = 3 THEN sub_string END) AS col_3
, MIN (CASE WHEN c_num = 4 THEN sub_string END) AS col_4
FROM got_sub_string
GROUP BY r_num
ORDER BY r_num
;I assumed seeral things, such as your version of Oracle. This works in Oracle 10 (and up), but could be simplified some in Oracle 11.
Similar Messages
-
Problem with concatenation, need output in a desired format
Hi all,
I have a weird problem with concatenation.
I should get an output in such a way that the result would be
Put C:\TEMP\test20090210.xml /FOLDER1/test20090210.xml
For this first to get C:\TEMP\test20090210.xml format I said
CONCATENATE 'C:\TEMP\test' sy-datum '.XML' INTO filepath.
For this secondly to get /FOLDER1/test20090210.xml format I said
CONCATENATE '/FOLDER1/test' sy-datum '.XML' INTO filepath1.
Now I need to get the format
Put C:\TEMP\test20090210.xml /FOLDER1/test20090210.xml
And to get this I said
CONCATENATE 'put' filepath INTO filepath SEPARATED BY space.
And the output for filepath was Put C:\TEMP\test20090210.xml.
But I want u2026u2026u2026.Put C:\TEMP\test20090210.xml /FOLDER1/test20090210.xml.
How can I achieve this?
If I say
CONCATENATE filepath INTO filepath1 SEPARATED BY space. It throws a syntax error saying
u201CUnable to interpret filepathu201D
Please help me..i am dying to figure out how to concatenate and get the required output.
My filepath contains u2026 Put C:\TEMP\test20090210.xml
My filepath1 contains u2026/FOLDER1/test20090210.xml
I need final output asu2026u2026u2026u2026.
Put C:\TEMP\test20090210.xml /FOLDER1/test20090210.xml
How to attain this..please helpu2026where I am going wrong..i declared filepath and filepath1 as STRINGHi all,
Thanks for immediate reply...now it works..
but i also need to put a counter like thing to distinguish my files.
for my filepath....
i want it as C:\TEMP\test20090210110146 so i said....
CONCATENATE ' C:\TEMP\test' sy-datum s y-uzeit '.XML'.
Actually i am generating XML files and naming them as testsystemdatesystemtime.
But i am concerend that my filed might be overwrriten if a file gets generated in a fraction of a millisecond..so to avoid that now i want to put a counter.
i.e my filepath should now be as follows each time loop executes...
C:\TEMP\test20090210110146_1
C:\TEMP\test20090210110147 _2
C:\TEMP\test20090210110148 _3.........and son on how can i do it
i.e testsystemdatesystemtime+ a counter(which tells how many times loop executed)
Once again thanks to all for immediate help... -
Need output format for trigger program
Hello everyone ;
https://forums.oracle.com/message/11078921#11078921
Above link is reference . It's also my own thread related to this discussion.
SQL> desc user_login
Name Null? Type
USERNAME VARCHAR2(30)
ISDBA VARCHAR2(20)
LOGIN_DATE DATE
LOGIN_TIME VARCHAR2(15)
LOGOUT_TIME VARCHAR2(15)
EXTERNAL_NAME VARCHAR2(30)
AUTHENTICATION_TYPE VARCHAR2(30)
HOST VARCHAR2(20)
Program for tracing user logon/logoff details
SQL> create or replace trigger tri_logon
AFTER LOGON ON DATABASE
BEGIN
INSERT INTO user_login (username, isdba, external_name,
authentication_type, HOST, login_date , login_time)
SELECT SYS_CONTEXT ('USERENV', 'SESSION_USER'),
SYS_CONTEXT ('USERENV', 'ISDBA'),
SYS_CONTEXT ('USERENV', 'EXTERNAL_NAME'),
SYS_CONTEXT ('USERENV', 'AUTHENTICATION_TYPE'),
SYS_CONTEXT ('USERENV', 'host'),
SYSDATE, TO_CHAR (SYSDATE, 'HH24:MI:SS') FROM DUAL;
END;
Trigger created.
SQL> create or replace trigger tri_audit1
2 BEFORE LOGOFf on database
3 BEGIN
4 insert into user_login (username, logout_time)
5 (select user, TO_CHAR(SYSDATE, 'HH24:MM:SS') from dual);
6 end;
6 /
Trigger created.
I got following output . Here i cannot insert logout_time on logout_time column.
logout_time is dispalyed seperately please see last two output values (CST01 , 02:06:16) and user_name also displayed twice. (don't need )
USERNAME ISDBA LOGIN_DAT LOGIN_TIME LOGOUT_TIME EXTERNAL_NAME AUTHENTICATION_TYPE HOST
CST01 FALSE 21-JUN-13 02:06:11 oracle DATABASE linuxserver CST01 02:06:16
I want output following below format
Expecting output logout time on LOGOUT_TIME column and user_name should be displayed once.
USERNAME ISDBA LOGIN_DAT LOGIN_TIME LOGOUT_TIME EXTERNAL_NAME AUTHENTICATION_TYPE HOST
CST01 FALSE 20-JUN-13 13:06:34 oracle DATABASE LINUXSERVER
thanks in advance ..8f953842-815b-4d8c-833d-f2a3dd51e602 wrote:
Hello everyone ;
https://forums.oracle.com/message/11078921#11078921
Above link is reference . It's also my own thread related to this discussion.
SQL> desc user_login
Name Null? Type
USERNAME VARCHAR2(30)
ISDBA VARCHAR2(20)
LOGIN_DATE DATE
LOGIN_TIME VARCHAR2(15)
LOGOUT_TIME VARCHAR2(15)
EXTERNAL_NAME VARCHAR2(30)
AUTHENTICATION_TYPE VARCHAR2(30)
HOST VARCHAR2(20)
In addition to the myriad of other issues pointed out in this and your other -- essentially duplicate -- thread, why do you have separate columns for login_date and login_time? A DATE datatype (which you have correctly defined for LOGIN_DATE carries both date and time elements. You only need one column -- LOGIN_TIME -- populated with SYSDATE when the user logs in. And LOGOUT_TIME should also be a DATE, populated with SYSDATE. This alone points to several design flaws.
1) DATE and TIME are not seperate elements. In this application, the concept of 'time' has no meaning apart from the date, and a DATE data type, by definition, stores both date and time.
2) keeping either date OR time in a varchar is asking for trouble. Comparisons and math simply do not work as you expect.
3) You don't have a date for LOGOUT, but suppose the user logs on at 2330 on Tuesday, and logs out at 0030 on Wednesday..
Properly, you should only have two columns for this .. LOGON_TIME, defined as a DATE, and LOGOUT_TIME, defined as a date.
Or possibly separate rows, one for LOGON and one for LOGOUT, both with a sessid to join them.
Or better, and as I mentioned earlier, don't reinvent what AUDIT already does. How much time have you spent on this (how much of your employers MONEY has been spent) when you could have solved the whole thing in 5 minutes with AUDIT?
Program for tracing user logon/logoff details
SQL> create or replace trigger tri_logon
AFTER LOGON ON DATABASE
BEGIN
INSERT INTO user_login (username, isdba, external_name,
authentication_type, HOST, login_date , login_time)
SELECT SYS_CONTEXT ('USERENV', 'SESSION_USER'),
SYS_CONTEXT ('USERENV', 'ISDBA'),
SYS_CONTEXT ('USERENV', 'EXTERNAL_NAME'),
SYS_CONTEXT ('USERENV', 'AUTHENTICATION_TYPE'),
SYS_CONTEXT ('USERENV', 'host'),
SYSDATE, TO_CHAR (SYSDATE, 'HH24:MI:SS') FROM DUAL;
END;
Trigger created.
SQL> create or replace trigger tri_audit1
2 BEFORE LOGOFf on database
3 BEGIN
4 insert into user_login (username, logout_time)
5 (select user, TO_CHAR(SYSDATE, 'HH24:MM:SS') from dual);
6 end;
6 /
Trigger created.
I got following output . Here i cannot insert logout_time on logout_time column.
logout_time is dispalyed seperately please see last two output values (CST01 , 02:06:16) and user_name also displayed twice. (don't need )
USERNAME ISDBA LOGIN_DAT LOGIN_TIME LOGOUT_TIME EXTERNAL_NAME AUTHENTICATION_TYPE HOST
CST01 FALSE 21-JUN-13 02:06:11 oracle DATABASE linuxserver CST01 02:06:16
I want output following below format
Expecting output logout time on LOGOUT_TIME column and user_name should be displayed once.
USERNAME ISDBA LOGIN_DAT LOGIN_TIME LOGOUT_TIME EXTERNAL_NAME AUTHENTICATION_TYPE HOST
CST01 FALSE 20-JUN-13 13:06:34 oracle DATABASE LINUXSERVER
thanks in advance .. -
Need output like below mentioned format
Hi,
By using below query , iam getting output in the below formate as metioned
select
m.year "Year",
--decode(m.year,like '200%','a') "DG",
--decode(instr(m.year,'200'),0,Null,'Shallow Water <1000 Feet') "DG",
--decode(substr('Shallow Water <1000 Feet',1,1),'S','Shallow Water <1000 Feet') "DG1",
'Shallow Water <1000 Feet' as "Depth Group",
'Deep Water 1000-5000 Feet' as "Depth Group",
'Ultra Deep Water > 5000 Feet' as "Depth Group",
sum(decode(M.FLUID,'O',nvl(M.YEAR_TO_DATE,0))) "Ytd Oil" ,
from pden_monthly_prod m,pi_pden_well w,pden p
--- Make sure all necessary Table joins are done
where P.ENTITY=M.ENTITY
and p.entity = w.entity
---- define limitations by column values
and m.year between 2000 and 2012
and ((p.entity_type in ('LEASE','WELL') and p.province_state not in ('17','42') and p.pi_situation_cd <> 'F')
or (p.entity_type = 'ALLOCATED' and p.province_state in ('17','42') and p.pi_situation_cd <> 'F')
or (p.entity_type = 'WELL' and p.province_state = '42' and p.pi_situation_cd <> 'F')
or(p.pi_situation_cd = 'F'))
and m.fluid in ('O','CN','G','CG','OW','GW','LW','FW')
and nvl(w.water_depth,'0') <1000
--or w.water_depth between 1000 and 5000
--or w.water_depth >5000
--for Federal state only (FOS)
and P.PI_SITUATION_CD IN ('F','S')
and p.province_state in ('17','42','60','01')
group by m.year
,'Shallow Water <1000 Feet'
,'Deep Water 1000-5000 Feet'
,'Ultra Deep Water > 5000 Feet'
order by m.year
i am getting output is
Year Depth Group Depth Group Depth Group Ytd Oil
2000 a b c 200
2001 a b c 150
2002 a b c 110
2003 a b c 100
but i need output like the below format
Year Depth Group Ytd Oil
2000 a 200
2000 b 200
2000 c 200
2000Total 600
2001 a 150
2001 b 150
2001 c 150
2001Total 450
2002 a 110
2002 b 110
2002 c 110
2002Total 330
2003 a 100
2003 b 100
2003 c 100
2003Total 300
could you please help on this ?UNPIVOT is equal to:
with t1 as (select 'a' f1, 1 f2, 2 f3, 3 f4 from dual union all
select 'b', 4, 5, 6 from dual union all
select 'c', 7, 8, 9 from dual union all
select 'd', 10, 11, 12 from dual)
select a.f1, b.f,
case b.f
when 'F2' then a.f2
when 'F3' then a.f3
when 'F4' then a.f4
end res
from t1 a, (select 'F2' f from dual union all
select 'F3' f from dual union all
select 'F4' f from dual) b
order by 1, 2 -
How to change the output as text format in Apps R12.1.3
Hi All,
Currently iam trying to modify the Java Concurrent Program (FDExtractAndFormatting) in Batch Payment Process. This Program is generated in text format in 11i APPS. Now we are upgrading to R12.1.3. In R12.1.3 output is coming as PDF format. Here my requirement is how to change the output as text format in R12.1.3 also.
Please do the needful and suggest me.
Regards,
Jagadeesh1. It is seeded java concurrent program. Some attributes are missing from 11i to R12. In 11i it is a text format.So i have to investgate on how to retrive those attributes in R12. What is the concurrent program name?
Have you tried to change the output and submit the request?
2. Once all are attributes are coming in PDF format. Client wants to open same output in text format as it is 11i (In R12 it is generated in PDF format).If the above does not help, please log a SR.
Thanks,
Hussein -
Printing report output in PDF format
Hi,
I want to know what are the settings needed to print a report output in PDF format, while executing the report from Oracle applications (Ver 11.5.6).
Report is executed as a concurrent request from Oracle applications.
Normally when we run the report from Oracle applications, output will be opened in a internet browser(IE) in HTML format. But I want the output to be opened in PDF format instead of HTML.
OS: Sun Solaris 2.8.
Thanks & Regards,
SarishHi Sarish
Please contact Oracle Support for an answer or to customise your application so that it prints a report output in PDF Format.
To get PDF output you must run report/job with DESFORMAT=PDF in the command line instead of DESFORMAT=HTML/HTMLCSS.
Regards
Sripathy -
PDF format of script output in irregular format
Hi All,
I am getting script output in OTF format in 'CLOSE_FORM'
of standard sales order script.
This,I am able to send in PDF format as mail attachment by using function module 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
But the alignment and format of data in the attachment doesn't exactly match with original script output.
Can anyone help me in this regard? Thanks in advance
- jawaharHi,
disregard my earlier mail.
fill itcpo structure and try
<b> itcpo-tdgetotf = 'X'.
xdevice = 'PRINTER'. </b>
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = TNAPR-FONAM
LANGUAGE = NAST-SPRAS
<b> OPTIONS = ITCPO</b>
ARCHIVE_INDEX = TOA_DARA
ARCHIVE_PARAMS = ARC_PARAMS
DEVICE = XDEVICE
DIALOG = ' '
IMPORTING
RESULT = ITCPP
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'PDF'
DEVTYPE = 'HPLJ5SI'
TABLES
CONTENT_IN = CONTENT_IN
CONTENT_OUT = CONTENT_OUT
EXCEPTIONS
ERR_CONV_FAILED = 1
OTHERS = 2.
OBJBIN[] = CONTENT_OUT[].
endif.
DOC_CHNG-OBJ_NAME = TEXT-003.
doc_chng-obj_descr = text-001.
CONCATENATE TEXT-002 VBDKR-VBELN "zinvoice14-vessel
INTO DOC_CHNG-OBJ_DESCR SEPARATED BY SPACE.
IF SY-SYSID NE 'S4P'.
CONCATENATE DOC_CHNG-OBJ_DESCR TEXT-004 INTO DOC_CHNG-OBJ_DESCR
SEPARATED BY SPACE.
ENDIF.
OBJTXT = 'This is an example of a Sapscript emailed out of SAP'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Fill the fields of the packing_list for the main document:
It is a text document
CLEAR OBJPACK-TRANSF_BIN.
The document needs no header (head_num = 0)
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
but it has a body
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
of type RAW
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Create the attachment (the list itself)
IF NAST-KSCHL NE 'ZSTT'.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
Fill the fields of the packing_list for the attachment:
It is binary document
OBJPACK-TRANSF_BIN = 'X'.
we need no header
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
but a body
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
of type ALI
IF NAST-KSCHL NE 'ZSTT'.
OBJPACK-DOC_TYPE = 'PDF'.
OBJPACK-OBJ_NAME = 'Attachment'.
OBJPACK-OBJ_DESCR = 'PDF file'.
READ TABLE OBJBIN INDEX TAB_LINES.
DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJBIN ).
OBJPACK-DOC_SIZE = DOC_SIZE.
APPEND OBJPACK.
ENDIF.
get E-mail address
loop at t_tvbdkr. "S4DK966284
w_name = t_tvbdkr-tdname. "S4DK966284
W_NAME = VBDKR-TDNAME. "S4DK966284
IF NAST-KSCHL EQ 'ZLEE'." or nast-kschl eq 'ZPRE'.
PERFORM READ_TEXT USING W_NAME 'Z555' 'VBBK'.
ENDIF.
IF SY-SUBRC EQ 0.
DELETE TDLINES WHERE TDFORMAT EQ '/*'
OR TDLINE EQ SPACE.
LOOP AT TDLINES.
RECIPIENT_INT-ADDRESS = TDLINES-TDLINE.
RECLIST-RECEIVER = RECIPIENT_INT.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
ENDLOOP.
if sy-subrc eq 0. "S4DK966284
exit. "S4DK966284
endif. "S4DK966284
ENDIF.
endloop.
LOOP AT T_TVBDPR.
CHECK T_TVBDPR-TDNAME+0(10) = VBDKR-TDNAME. "S4DK966284
W_NAME = T_TVBDPR-TDNAME.
IF NAST-KSCHL EQ 'ZLEE'.
PERFORM READ_TEXT USING W_NAME 'Z558' 'VBBP'.
ENDIF.
IF SY-SUBRC EQ 0.
DELETE TDLINES WHERE TDFORMAT EQ '/*'
OR TDLINE EQ SPACE.
LOOP AT TDLINES.
RECIPIENT_INT-ADDRESS = TDLINES-TDLINE.
RECLIST-RECEIVER = RECIPIENT_INT.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
ENDLOOP.
if sy-subrc eq 0. "S4DK966284
exit. "S4DK966284
endif. "S4DK966284
ENDIF.
ENDLOOP.
SEND THE DOCUMENT BY CALLING THE SAPOFFICE API1 MODULE
FOR SENDING DOCUMENTS WITH ATTACHMENTS
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
IMPORTING
SENT_TO_ALL = SENT_TO_ALL
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
Regards
amole -
Converting sap script output into pdf format?
Hi all,
I have modified the standard purchase order script form MEDRUCK . Now i need to generate the output into pdf format.
This is not only limited to spool requests , But also when the user creates the purchase order and clicks on print or print preview the output should be in pdf format.
Please help on where and what code has to be written for this requirement?
Thanks,
Aravind.Hi
I don't know which is your release, but I don't think it's possible to create a preview in pdf format, but u can create a pdf file instead of the spool and then open it automatically, this is an example:
- A) Open form
IF P_PDF = 'X'.
XDEVICE = 'PRINTER'.
* Get OTF
ITCPO-TDGETOTF = 'X'.
ENDIF.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = XDEVICE
DIALOG = 'X'
FORM = 'ZFI_CL_EC_MOVI'
OPTIONS = ITCPO
MAIL_SENDER = LVS_SENDER
MAIL_RECIPIENT = LVS_RECIPIENT
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
OTHERS = 11.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
B) Close FORM
CALL FUNCTION 'CLOSE_FORM'
TABLES
OTFDATA = T_OTF
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore chiusura stampa'(A02).
ELSE.
PERFORM DOWNLOAD_PDF.
ENDIF.
C) Create PDF and open it:
FORM DOWNLOAD_PDF.
DATA: BIN_FILESIZE TYPE I.
DATA: T_FILE_PDF TYPE STANDARD TABLE OF TLINE,
DOCTAB_ARCHIVE TYPE STANDARD TABLE OF DOCS.
DATA: FILE_TABLE TYPE FILETABLE WITH HEADER LINE.
DATA: RC TYPE I,
USER_ACTION TYPE I.
DATA: TITLE TYPE STRING,
FILENAME TYPE STRING.
CHECK P_PDF = 'X'.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
BIN_FILESIZE = BIN_FILESIZE
TABLES
OTF = T_OTF
DOCTAB_ARCHIVE = DOCTAB_ARCHIVE
LINES = T_FILE_PDF
EXCEPTIONS
ERR_CONV_NOT_POSSIBLE = 1
ERR_OTF_MC_NOENDMARKER = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore conversione PDF'(A03).
EXIT.
ENDIF.
TITLE = 'Creare File'(T02).
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = TITLE
DEFAULT_EXTENSION = '*.pdf'
CHANGING
FILE_TABLE = FILE_TABLE[]
RC = RC
USER_ACTION = USER_ACTION
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore creazione PDF'(A04).
EXIT.
ELSE.
IF USER_ACTION = 9. EXIT. ENDIF.
IF RC = 1.
READ TABLE FILE_TABLE INDEX 1.
ENDIF.
ENDIF.
MOVE FILE_TABLE-FILENAME TO FILENAME.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
FILENAME = FILENAME
FILETYPE = 'BIN'
CHANGING
DATA_TAB = T_FILE_PDF
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore creazione PDF'(A04).
EXIT.
ELSE.
MESSAGE S208(00) WITH 'File creato con successo'(S01).
ENDIF.
CHECK P_OPEN = 'X'.
CALL FUNCTION 'CALL_BROWSER'
EXPORTING
URL = FILE_TABLE-FILENAME
EXCEPTIONS
FRONTEND_NOT_SUPPORTED = 1
FRONTEND_ERROR = 2
PROG_NOT_FOUND = 3
NO_BATCH = 4
UNSPECIFIED_ERROR = 5
OTHERS = 6.
IF SY-SUBRC <> 0.
MESSAGE S208(00) WITH 'Impossibile aprire file'(A05).
ENDIF.
ENDFORM. " DOWNLOAD_PDF
Max -
Procedure/sample code to download alv output in HTM format & mail to user.
Hello Experts,
I've a requirement to run the Alv report at background. But i need to download the alv output in HTM fomat because it has subtotal values & look wise downloaded HTM format will be same as that of ALV output. Then send the attachment through mail to users. I'm not intersted in downloading internal table dierctly to HTM format.
Will the code for alv display & downloading in HTM format & forwarding via email is all done in one single program or in 2 differnt programs . pls guide me on this.
I'm using FM REUSE_ALV_GRID_DISPLAY to display output with subtotals.
Pls anyone there suggest me the steps to download ALV output in HTM format & the forward the same to user ID through Lotus notes.
Regards
Devika.SHi,
This can be achieved without coding .
Fore ground Scenario:
1. Downloading as HTM . In foreground you can do this by using Export---> Local file
option in ALV grid.
Background Scenario:
2. In background while sending mail , You have to achieve the same through customisation settings as wexplained below.
In SM36 -- > Spool List Recipient, give the reciepient id and click on copy. Now when the Background job will be finished,
the reciepient mentioned above will recieve the mail , but in ALI format.
To convert the same to HTM format, you need to do customisation changes in SCOT
goto SCOT>Expant the node INT>Double click on Email-->Beside Internet we have SET tab , click on that -->
select the radio button " all formats except the following ">In the near by box type ALI>then click on the tick Mark.
Then go to SCOT>Settings>Conversion Rules-->there
create a new row with, Format->ALI , To Format->HTM , Ranking 1, FM -> SX_OBJECT_CONVERT_ALI_HTM.
Now when the mail will be sent, it will not go in ALI, but in HTM format.
Hope this helps you out. -
Hi Experts,
My requriement is I have to send a mail with report output in excel format as an attachment.
I wrote the below subroutine for building excel sheet but I am getting output in the single row. I am using version 4.6
Please help me regarding this. ASAP
FORM BUILD_XLS_DATA .
CONSTANTS: CON_CRET TYPE STRING VALUE '0D', "OK for non Unicode
CON_TAB TYPE STRING VALUE '09'. "OK for non Unicode
CONCATENATE 'Vendor' 'Country' 'Name'
INTO IATTACH SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IATTACH INTO IATTACH.
APPEND IATTACH.
LOOP AT IT_lfa1.
CONCATENATE IT_lfa1-lifnr IT_lfa1-land1 IT_lfa1-name1 INTO IATTACH
SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IATTACH INTO IATTACH.
APPEND IATTACH.
ENDLOOP.
ENDFORM. "build_xls_data
Thanx,
SudhaHi Sudha,
I am sending the standard format of sending a mail along with an attachment in .xls format.
Try this code.
form sendmail.
CLEAR GV_DELIMIT.
GV_DELIMIT = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
TEMPREAD = LV_LNCNT1.
REFRESH OBJTXT.
CONCATENATE 'The no. of error records are : ' TEMPREAD
INTO OBJTXT-LINE.
APPEND OBJTXT.
CLEAR OBJPACK. REFRESH OBJPACK.
CONCATENATE C_CODE
C_CMMT
C_COMMENT1
INTO OBJTXT-LINE SEPARATED BY GV_DELIMIT.
APPEND OBJTXT.
LOOP AT IT_DATA INTO WA_DATA.
CONCATENATE WA_DATA-ZCODE
WA_DATA-ZCOMMENT
WA_DATA-ZREASON
INTO OBJTXT-LINE SEPARATED BY GV_DELIMIT.
APPEND OBJTXT.
ENDLOOP.
CLEAR GV_DELIMIT.
CLEAR OBJPACK. REFRESH OBJPACK.
CLEAR DOC_CHNG.
TAB_LINES = 0.
OBJHEAD = REJFILE. APPEND OBJHEAD.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-OBJ_NAME = REJFILE.
MOVE TEXT-006 TO
DOC_CHNG-OBJ_DESCR.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = 1. " 3.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
FOR ASCII TO BINARY OBJECT FUNCTION
TOTLINEXFER = 0.
TOTXFER = 0.
BINMAXLEN = 255.
REFRESH OBJBIN.
LV_CR = CL_ABAP_CHAR_UTILITIES=>CR_LF.
TGTMAXLEN = BINMAXLEN.
TGTLEN = 0.
LOOP AT OBJTXT FROM 2.
IF NOT OBJTXT-LINE CP 'The no. of records are '." AND
CONCATENATE OBJTXT-LINE LV_CR INTO BUFFER.
SRCOBJLEN = STRLEN( BUFFER ).
SRCOBJPTR = 0.
WHILE SRCOBJLEN > 0 .
XFERLEN = TGTMAXLEN - TGTLEN.
IF XFERLEN > SRCOBJLEN.
XFERLEN = SRCOBJLEN.
MOVE BUFFERSRCOBJPTR TO OBJBIN-LINETGTLEN.
TGTLEN = TGTLEN + SRCOBJLEN.
SRCOBJLEN = 0.
CLEAR BUFFER.
ELSE.
MOVE BUFFER+SRCOBJPTR(XFERLEN) TO
OBJBIN-LINE+TGTLEN(XFERLEN).
APPEND OBJBIN.
CLEAR OBJBIN-LINE.
TGTLEN = 0.
SRCOBJLEN = SRCOBJLEN - XFERLEN.
SRCOBJPTR = SRCOBJPTR + XFERLEN.
TOTLINEXFER = TOTLINEXFER + 1.
ENDIF.
TOTXFER = TOTXFER + XFERLEN.
ENDWHILE.
ENDIF.
ENDLOOP.
IF TGTLEN > 0.
APPEND OBJBIN.
TOTLINEXFER = TOTLINEXFER + 1.
ENDIF.
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TOTLINEXFER.
OBJPACK-DOC_TYPE = 'XLS'.
OBJPACK-OBJ_NAME = REJFILE.
OBJPACK-OBJ_DESCR = 'Rejected Entries File'.
OBJPACK-DOC_SIZE = TOTXFER.
APPEND OBJPACK.
REFRESH RECLIST.
MAIL1 = Recepient Mail Id
RECLIST-RECEIVER = MAIL1.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
Hope this is helpful to you. If you need further information, revert back.
Reward all the helpful answers.
Regards
Nagaraj T -
Smartforms output in XML format
Hi everyone,
I am very new for smartforms and my requirement to convrt given smartform in XML format, I am going through
Form Attributes -> output options -> output format -> XSF output , then I am giving proper value in output mode & in Output Device but not getting proper output, can You please tell me what i have to do (in Detail ) ?
Thanks & Regards,
Vimarsh B.Hi Abhinay
I have billing order invoice, client is getting its output in standard format but now he needs the output of that form has to come in XML format, if we are using standard output format in form attributes, its showing output but when we are chenging its option we are not getting any output, only one spool create, and we are not able to understand what exactly output will come, it will come same like standard format or only spool will create and if only spool create then how we can send it to our client. please solve this issue, thanks for ur support.
Thanks & Regards,
Vimarsh B. -
Smartforms output in Powerpoint format
Hi ,
I am an ABAPER working in CRM Module .Also working in PCUI . I got a requirement for CRM Portal where I need to display the Smartforms output in Powerpoint format when user clicks on Print button. Previously there are in PDF Format.Can anyone help on this ?? Please..Hey Anil
Your requirement is not specific ,weder you want the output saved in XLS format in the smartform....or u want to download the data in XLS format?
1. Function Module 'SAP_CONVERT_TO_XLS_FORMAT' : from internal table to Excel file .
2. FM ''SO_DOCUMENT_REPOSITORY_MANAGER' : To attach this file as an attachment in a mail in this pass the file and other details of sender and receiver.
Regards
Swapnil
Edited by: swapnil kamble on Sep 11, 2009 2:12 PM -
Transaction CJI3 AND - batch job and output in excel format
We are trying to schedule a batch job and would like to have the output in an excel file. Is there a way to enhance CJI3 and FMEDDW to have the output in a excel file. I've looked at the Layout for creating the disvariant and I know you can have the output in excel format in the foreground, but I'm looking to put an excel file on the SAP DIRECTORY.
Has anyone done this?
Thank you.
LindaTalking about Enhancement Options, I believe you can achieve it using Enhancement Implementation. There must be one towards the end of the program just before the ALV is displayed. You can create an implementation of the implicit enhacement spot and output the file to a location maintained in some VAR (to keep the output location dynamic as we don't have it on the select screen).
My reply is not to the point but I hope you find a way using enhancement spots.
Should you need any help with enhancement implementation, following blog is good enough:
Blog - [Enhancement Framework|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417800%29ID1759109750DB10206591421434314571End?blog=/pub/wlg/3595]
or you can ask back here.
regards,
Aabhas
Edited by: Aabhas K Vishnoi on Sep 24, 2009 10:40 AM -
Date Format (Need result in date format)
Dear ,
i have worked on this query which produce result in error, infact i need result in date format and this format 'MON-YY'. :
select to_date( EFFECTIVE_DATE,'MON-YY' ) as MON_YY FROM GL_JE_LINES
but now EFFECTIVE_DATE is like this format '12/31/2008'I tell again: a date has no internal format.
There is only a default output-format for date-objects wich is used as default output format and for implicit date conversions.
If you want to know the actual nls_date_format for your session you can use:
select * from nls_session_parameters where parameter='NLS_DATE_FORMAT';You can change it for your session with:
alter session set nls_date_format='<your_new_date_format>';Please take a look at:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams122.htm
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#sthref405
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements003.htm#BABGIGCJ
The internal storage of a date-object does not depend on the actual value of NLS_DATE_FORMAT.
This will only used for output and for implicit conversions e.g. with to_date or to_char without explicit format.
To select a date from a table is also an implicit conversion to character, because you want to see characters on your screen.
Edited by: hm on 29.12.2010 04:20 -
How to regenerate output in XML format after having assigned RTF Template
1. I created a concurrent request to get the output in XML data format
2. Having created RTF File and assigned Data Definition and Template through XML Administartor Responsibility
3. Now I want to make changes in Data Definition XML File, However I need to get the output file in XML data format, However Concurrent Request is not allowing me to get the XML output because Template is already assigned for the output and not able to de-assign template file from concurrent request.
For some reason in XML publisher, the end date for Template is disable, I am not able to update end date for template.
Is there any way to create an output in XML format through concurrent request after Template File is assigned to create an output? I will appreciate your help.This is for people who want to know more in detail. Problem is if you put end date then you have to recreate an entry and then have to go through the same process. However I have found a way to use the same file,
Get the template_id by running the following query
select * from xdo_templates_b
where template_code = 'TEMPLATE_CODE'
Run the following query to update the end_date to some previous date value
update xdo_templates_b
set end_date = to_date('6/9/2011','mm/dd/yyyy')
where template_id = 162
After that when you run request through concurrent request, it will not show the default template assigned to concurrent request. Run the request, output will be created in XML format.
Run the following query to use the template again
update xdo_templates_b
set end_date = null
where template_id = 162
Edited by: user9941374 on Jun 10, 2011 9:20 AM
Maybe you are looking for
-
How do I revert to a previous version of Flash Player?
While we always recommend using the latest version of Flash Player, sometimes problems are encountered in a new release that were not present in a previous release. If you are unable to work around these problems and they block functionality you rel
-
Can't open an application in another users profile
I installed the Corel painter into my Macbook pro it works fine in my profile but when my little brother logs in his, it wont open. A pop up box comes out saying the application has been modify to install from original CD. I try installing it on his
-
[JS] Anchor object to overset text
Is there any way to anchor a graphicLine or textFrame to overset text without using app.cut() and app.paste()?
-
Use of "VERSION" in BPS (Business Planning)
Hi Expert, Can you please explain "VERSION" field in BPS - Business Planing while enterning plan data. If you can exaplain by example using business perspective it will be great. Thanks Ajay Kumar
-
Hi All, Can anyone explain me the difference between "List of Unposted Items" and "Clarification Cases" in Payment or Return Lot. I have posted one return lot and the item is transferred to both "List of Unposted Items" and "Clarification Cases". Tha