Converting number into letters ...
Is there in Oracle ( or in Forms ) a function that allow the conversion from a number (ex. 1523) to
letters ( One thousand Five hundred twenty three ) ???
Tx in advance
Xavier.
Hi,
i think the following code will take care ofall cases - i have tried it and am using this.
FUNCTION CHK_AMT (v_chk_amt IN NUMBER)
RETURN VARCHAR2 IS chk_amt_word VARCHAR2(32767);
v_period NUMBER(11,0);
v_tot_len NUMBER(11,0);
v_paise NUMBER(11,0);
v_paise_len NUMBER(11,0);
v_paise_diff NUMBER(11,0);
v_Rs NUMBER(11,0);
v_Rs_len NUMBER(11,0);
v_ten NUMBER(11,0);
v_hund NUMBER(11,0);
v_thous NUMBER(11,0);
v_hund_thous NUMBER(11,0);
v_million NUMBER(11,0);
v_amt_char VARCHAR2(14);
v_m_word VARCHAR2(35);
v_ht_word VARCHAR2(35);
v_t_word VARCHAR2(35);
v_h_word VARCHAR2(35);
v_ten_word VARCHAR2(35);
v_paise_word VARCHAR2(35);
v_chk_amt_word VARCHAR2(150);
BEGIN
-- ****************** CONVERT TO STRING AND LOCATE THE PERIOD *******
SELECT TO_CHAR(v_chk_amt, '99999999D99') INTO v_amt_char FROM dual;
v_amt_char := LTRIM(v_amt_char);
SELECT INSTR(RTRIM(v_amt_char),'.') INTO v_period FROM dual;
-- ***************************************** DETERMINE PAISES *********
SELECT LENGTH(v_chk_amt) INTO v_tot_len FROM dual;
v_paise_len := v_tot_len - v_period;
IF v_paise_len = 0 THEN
v_paise := 0;
ELSIF v_paise_len = 1 THEN
v_paise := SUBSTR(v_amt_char,v_period + 1, 1)| |'0';
ELSE
v_paise := SUBSTR(v_amt_char,v_period + 1, 2);
END IF;
-- ****************** DETERMINE AMT LENGTH LESS PERIOD AND PAISES *******
IF v_period = 0 THEN
v_Rs_len := v_tot_len;
ELSE
v_Rs_len := v_period - 1;
END IF;
v_Rs:= SUBSTR(v_chk_amt,1,v_Rs_len);
-- **************************** DETERMINE ONE AND TENTH POSTIONS *********
IF v_Rs_len > 0 THEN
IF v_Rs_len = 1 THEN
v_ten := SUBSTR(v_chk_amt,1,1);
ELSE
v_ten := SUBSTR(v_chk_amt,v_Rs_len - 1,2);
END IF;
ELSE
v_ten_word := 'NO ';
v_ten := 0;
END IF;
-- ************************************* DETERMINE HUNDREDTH POSITION *******
IF v_Rs_len > 2 THEN
v_hund := SUBSTR(v_chk_amt,v_Rs_len - 2,1);
ELSE
v_hund := 0;
END IF;
-- ******************** DETERMINE THOUSAND AND TEN THOUSAND POSITIONS ******
IF v_Rs_len > 3 THEN
IF v_Rs_len = 4 THEN
v_thous := SUBSTR(v_chk_amt, 1, 1);
ELSE
v_thous := SUBSTR(v_chk_amt,v_Rs_len - 4,2);
END IF;
ELSE
v_thous := 0;
END IF;
-- ********************************* DETERMINE HUNDRED-THOUSAND POSITION *****
IF v_Rs_len > 5 THEN
v_hund_thous := SUBSTR(v_chk_amt,v_Rs_len - 5,1);
ELSE
v_hund_thous := 0;
END IF;
-- ************************** DETERMINE MILLION AND TEN MILLION POSITIONS ******
IF v_Rs_len > 6 THEN
IF v_Rs_len = 7 THEN
v_million := SUBSTR(v_chk_amt,v_Rs_len - 6,1);
ELSE
v_million := SUBSTR(v_chk_amt,v_Rs_len - 7,2);
END IF;
ELSE
v_million := 0;
END IF;
-- ************************************************************ BUILD WORD *******
IF v_million > 0 THEN
SELECT CHK_AMT_NAME| |' Million '
INTO v_m_word
FROM ESC_CHK_AMT
WHERE chk_amt_nbr = v_million;
END IF;
IF v_hund_thous > 0 THEN
SELECT CHK_AMT_NAME| |' Hundred '
INTO v_ht_word
FROM ESC_CHK_AMT
WHERE chk_amt_nbr = v_hund_thous;
IF v_thous = 0 THEN
v_t_word := 'Thousand ';
END IF;
END IF;
IF v_thous > 0 THEN
SELECT CHK_AMT_NAME| |' Thousand '
INTO v_t_word
FROM ESC_CHK_AMT
WHERE chk_amt_nbr = v_thous;
END IF;
IF v_hund > 0 THEN
SELECT CHK_AMT_NAME| |' Hundred '
INTO v_h_word
FROM ESC_CHK_AMT
WHERE chk_amt_nbr = v_hund;
END IF;
IF v_ten > 0 THEN
SELECT CHK_AMT_NAME
INTO v_ten_word
FROM ESC_CHK_AMT
WHERE chk_amt_nbr = v_ten;
END IF;
IF (v_paise = 0) THEN
v_paise_word := NULL;
v_chk_amt_word := 'Rs. '| |v_m_word| |v_ht_word| |v_t_word| |v_h_word| |v_ten_word| |' Only.';
ELSE
v_paise_word := v_paise| |' paise';
v_chk_amt_word := 'Rs. '| |v_m_word| |v_ht_word| |v_t_word| |v_h_word| |v_ten_word| |
' AND '| |v_paise_word| |' Only.' ;
END IF;
RETURN(v_chk_amt_word);
END;
/*Create table script*/
CREATE TABLE ESC_CHK_AMT(
CHK_AMT_NBR NUMBER(2,0),
CHK_AMT_NAME VARCHAR2(25));
/*Insert Script*/
INSERT INTO ESC_CHK_AMT VALUES (1,'One');
INSERT INTO ESC_CHK_AMT VALUES (2,'Two');
INSERT INTO ESC_CHK_AMT VALUES (3,'Three');
INSERT INTO ESC_CHK_AMT VALUES (4,'Four');
INSERT INTO ESC_CHK_AMT VALUES (5,'Five');
INSERT INTO ESC_CHK_AMT VALUES (6,'Six');
INSERT INTO ESC_CHK_AMT VALUES (7,'Seven');
INSERT INTO ESC_CHK_AMT VALUES (8,'Eight');
INSERT INTO ESC_CHK_AMT VALUES (9,'Nine');
INSERT INTO ESC_CHK_AMT VALUES (10,'Ten');
INSERT INTO ESC_CHK_AMT VALUES (11,'Eleven');
INSERT INTO ESC_CHK_AMT VALUES (12,'Twelve');
INSERT INTO ESC_CHK_AMT VALUES (13,'Thirteen');
INSERT INTO ESC_CHK_AMT VALUES (14,'Fourteen');
INSERT INTO ESC_CHK_AMT VALUES (15,'Fifteen');
INSERT INTO ESC_CHK_AMT VALUES (16,'Sixteen');
INSERT INTO ESC_CHK_AMT VALUES (17,'Seventeen');
INSERT INTO ESC_CHK_AMT VALUES (18,'Eighteen');
INSERT INTO ESC_CHK_AMT VALUES (19,'Nineteen');
INSERT INTO ESC_CHK_AMT VALUES (20,'Twenty');
INSERT INTO ESC_CHK_AMT VALUES (21,'Twenty-One');
INSERT INTO ESC_CHK_AMT VALUES (22,'Twenty-Two');
INSERT INTO ESC_CHK_AMT VALUES (23,'Twenty-Three');
INSERT INTO ESC_CHK_AMT VALUES (24,'Twenty-Four');
INSERT INTO ESC_CHK_AMT VALUES (25,'Twenty-Five');
INSERT INTO ESC_CHK_AMT VALUES (26,'Twenty-Six');
INSERT INTO ESC_CHK_AMT VALUES (27,'Twenty-Seven');
INSERT INTO ESC_CHK_AMT VALUES (28,'Twenty-Eight');
INSERT INTO ESC_CHK_AMT VALUES (29,'Twenty-Nine');
INSERT INTO ESC_CHK_AMT VALUES (30,'Thirty');
INSERT INTO ESC_CHK_AMT VALUES (31,'Thirty-One');
INSERT INTO ESC_CHK_AMT VALUES (32,'Thirty-Two');
INSERT INTO ESC_CHK_AMT VALUES (33,'Thirty-Three');
INSERT INTO ESC_CHK_AMT VALUES (34,'Thirty-Four');
INSERT INTO ESC_CHK_AMT VALUES (35,'Thirty-Five');
INSERT INTO ESC_CHK_AMT VALUES (36,'Thirty-Six');
INSERT INTO ESC_CHK_AMT VALUES (37,'Thirty-Seven');
INSERT INTO ESC_CHK_AMT VALUES (38,'Thirty-Eight');
INSERT INTO ESC_CHK_AMT VALUES (39,'Thirty-Nine');
INSERT INTO ESC_CHK_AMT VALUES (40,'Forty');
INSERT INTO ESC_CHK_AMT VALUES (41,'Forty-One');
INSERT INTO ESC_CHK_AMT VALUES (42,'Forty-Two');
INSERT INTO ESC_CHK_AMT VALUES (43,'Forty-Three');
INSERT INTO ESC_CHK_AMT VALUES (44,'Forty-Four');
INSERT INTO ESC_CHK_AMT VALUES (45,'Forty-Five');
INSERT INTO ESC_CHK_AMT VALUES (46,'Forty-Six');
INSERT INTO ESC_CHK_AMT VALUES (47,'Forty-Seven');
INSERT INTO ESC_CHK_AMT VALUES (48,'Forty-Eight');
INSERT INTO ESC_CHK_AMT VALUES (49,'Forty-Nine');
INSERT INTO ESC_CHK_AMT VALUES (50,'Fifty');
INSERT INTO ESC_CHK_AMT VALUES (51,'Fifty-One');
INSERT INTO ESC_CHK_AMT VALUES (52,'Fifty-Two');
INSERT INTO ESC_CHK_AMT VALUES (53,'Fifty-Three');
INSERT INTO ESC_CHK_AMT VALUES (54,'Fifty-Four');
INSERT INTO ESC_CHK_AMT VALUES (55,'Fifty-Five');
INSERT INTO ESC_CHK_AMT VALUES (56,'Fifty-Six');
INSERT INTO ESC_CHK_AMT VALUES (57,'Fifty-Seven');
INSERT INTO ESC_CHK_AMT VALUES (58,'Fifty-Eight');
INSERT INTO ESC_CHK_AMT VALUES (59,'Fifty-Nine');
INSERT INTO ESC_CHK_AMT VALUES (60,'Sixty');
INSERT INTO ESC_CHK_AMT VALUES (61,'Sixty-One');
INSERT INTO ESC_CHK_AMT VALUES (62,'Sixty-Two');
INSERT INTO ESC_CHK_AMT VALUES (63,'Sixty-Three');
INSERT INTO ESC_CHK_AMT VALUES (64,'Sixty-Four');
INSERT INTO ESC_CHK_AMT VALUES (65,'Sixty-Five');
INSERT INTO ESC_CHK_AMT VALUES (66,'Sixty-Six');
INSERT INTO ESC_CHK_AMT VALUES (67,'Sixty-Seven');
INSERT INTO ESC_CHK_AMT VALUES (68,'Sixty-Eight');
INSERT INTO ESC_CHK_AMT VALUES (69,'Sixty-Nine');
INSERT INTO ESC_CHK_AMT VALUES (70,'Seventy');
INSERT INTO ESC_CHK_AMT VALUES (71,'Seventy-One');
INSERT INTO ESC_CHK_AMT VALUES (72,'Seventy-Two');
INSERT INTO ESC_CHK_AMT VALUES (73,'Seventy-Three');
INSERT INTO ESC_CHK_AMT VALUES (74,'Seventy-Four');
INSERT INTO ESC_CHK_AMT VALUES (75,'Seventy-Five');
INSERT INTO ESC_CHK_AMT VALUES (76,'Seventy-Six');
INSERT INTO ESC_CHK_AMT VALUES (77,'Seventy-Seven');
INSERT INTO ESC_CHK_AMT VALUES (78,'Seventy-Eight');
INSERT INTO ESC_CHK_AMT VALUES (79,'Seventy-Nine');
INSERT INTO ESC_CHK_AMT VALUES (80,'Eighty');
INSERT INTO ESC_CHK_AMT VALUES (81,'Eighty-One');
INSERT INTO ESC_CHK_AMT VALUES (82,'Eighty-Two');
INSERT INTO ESC_CHK_AMT VALUES (83,'Eighty-Three');
INSERT INTO ESC_CHK_AMT VALUES (84,'Eighty-Four');
INSERT INTO ESC_CHK_AMT VALUES (85,'Eighty-Five');
INSERT INTO ESC_CHK_AMT VALUES (86,'Eighty-Six');
INSERT INTO ESC_CHK_AMT VALUES (87,'Eighty-Seven');
INSERT INTO ESC_CHK_AMT VALUES (88,'Eighty-Eight');
INSERT INTO ESC_CHK_AMT VALUES (89,'Eighty-Nine');
INSERT INTO ESC_CHK_AMT VALUES (90,'Ninety');
INSERT INTO ESC_CHK_AMT VALUES (91,'Ninety-One');
INSERT INTO ESC_CHK_AMT VALUES (92,'Ninety-Two');
INSERT INTO ESC_CHK_AMT VALUES (93,'Ninety-Three');
INSERT INTO ESC_CHK_AMT VALUES (94,'Ninety-Four');
INSERT INTO ESC_CHK_AMT VALUES (95,'Ninety-Five');
INSERT INTO ESC_CHK_AMT VALUES (96,'Ninety-Six');
INSERT INTO ESC_CHK_AMT VALUES (97,'Ninety-Seven');
INSERT INTO ESC_CHK_AMT VALUES (98,'Ninety-Eight');
INSERT INTO ESC_CHK_AMT VALUES (99,'Ninety-Nine');
/*Create Index*/
CREATE INDEX ESC_CHK_AMT_INDEX ON ESC_CHK_AMT(CHK_AMT_NBR);
DROP PUBLIC SYNONYM "ESC_CHK_AMT";
CREATE PUBLIC SYNONYM "ESC_CHK_AMT" FOR "ESC_CHK_AMT";
null
Similar Messages
-
Converting Number into words while Display
Hello Sir,
I am working on Project System.
I am getting Field MAT_PSPNR(Valuated Sales Order Stock WBS Element) in MSEG Table.
In table the Corresponding field stored in Numbers while Display its converted into Some other Content Please Explain Me ?.
REPORT zdemo LINE-SIZE 600.
tables: mseg.
select-options: so_mblnr for mseg-mblnr. " Document No
start-of-selection.
select mat_pspnr from mseg into mseg-mat_pspnr " Valuated Sales Order Stock WBS Element
where mblnr in so_mblnr.
check sy-subrc = 0.
write:/01 mseg-mat_pspnr.
endselect.
Table Stored value for MAT_PSPNR = 00000293
Report Display: WSP/RAM/02/03.
Kindly Explain how the Contents has been changed ?.
Regards,
Venkat.Hi Venkat,
please check the Domain of the field you are trying to display .
it will have a conversion routine.
for field MAT_PSPNR domain is PS_POSNR
In the domain definition tab you will have a conversion routine .
because of this conversion routine your data is represented in internal format in the table and external format when displayed.
please read conversion routine documentation.
regards, -
i work on release 11i application and converts some reports to run with xml publisher
i want to convert a total field that exist in po report to words it seems to convert number into words isthat possible i tried to make this in oracle reports and it run successfully but there is a problem when converting that report to run with xml publisher .
any help will be approtiated.Use ap_amount_utilities_pkg.ap_convert_number
E.g.
SQL> select ap_amount_utilities_pkg.ap_convert_number(trunc(12345678)) from dual;
AP_AMOUNT_UTILITIES_PKG.AP_CONVERT_NUMBER(TRUNC(12345678))
Twelve million three hundred forty-five thousand six hundred seventy-eight
Gareth -
Convert number to simplified chinese number (daxie)
I need to print simplified chinese number (daxie). Do SAP have standard function module or BAPI to convert number into simplified chinese number (daxie). for example:
1001 = 壹仟零壹元
111 = 壹佰壹拾壹元
Thanks.Hi,
Use FM :SPELL_AMOUNT -
Hello, I was wondering if you could convert the IMEI # into the serial number using letters and digits?
No the imei from what I understand is a randomly given number. to get serial number you must have it. you can try supportprofile.apple.com and login.
-
While downloading an eBook from internet, I found a book in a folder containing around 123 files, which is equivalent to the number of pages of the book.
My interest is to bring them together in one file so that I can read it at a time. As the interface is not comfortable with html, I also like to convert it into another more suitable file format.Hello djensen1x,
Could you please let me know what version of Acrobat are you using.
Also, tell me your workflow of combining those PDF files?
Please share the screenshot of the error message that you get.
Hope to get your response.
Regards,
Anubha -
Contract number not appearing in PO while converting PR into PO using ME21N
Hi SAP MM Experts,
We are having scenario as Demand PO SOPRHub PO. We are creating demand PO for company code 1700 by setting massage type ZYT1 in that because of which SO got created through Idoc. In that SO, PR is updated. This is the Hub PR which is created automatically for hub plant 4511 & company code 4500. In this PR, on source of supply tab contract & vendor are appearing as required. When I am converting this PR in PO using ME21N the contract number is not fetching into PO though it is there in PR. This is the issue.
I know the source list (ME03) having multiple sources & contracts so that I need to follow 2 steps as:
1) We need to fix the vendor in source list
2) In change mode of PR we need to assign source manually by clicking on u2018Assign source of supplyu2019 button.
But avoiding these two steps, how can it possible to fetch contract number into PO from PR.
Any pointers in this case will be great help for me.
Thanks in advance.
Regards,
Sachin Patildoes the item in your contract have a different item category or accounting category than in your PR/PO?
-
How to convert workflow template number into transation code?
Hi Experts,
We are using WS20000081 Leave request workflow in SAP 4.7.I created one customized workflow according to the client requirement.How can i convert WS99900009 into Transaction?
I created one absence type with workflow template WS99900009.While applying a leave it is showing the erroe as "WS99900009 is unknown" .
Please help me to resolve this problem.
Thanks,
HemalathaHi Arun
WS20000081 and WS04200009 are triggering when i applied a leave.But i need to add some amore task in that.For that i created the Customized workflow.Then we tried to create Rule groups with custom workflow id number in ESS settiongs.It was saying that ws99900009 is unknown.And we tried to replace the WS20000081 by ws99900009.It was alos saying that ws99900009 transaction is unknown.
So pls guide me how to convert ws99900009 into transaction?
Thanks in advance
Regards,
Hemalatha -
Hello everyone!
I am having trouble in converting the variable.
My original variable is as VARCHAR2. It has database value of
100-1050-10101-001. How do I convert this into NUMBER data type?
Thanks,
SonyaSQL> create table test(col1 varchar2(20),col2 number);
Table created.
SQL> insert into test values('100-1050-10101-001',null);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test;
COL1 COL2
100-1050-10101-001
SQL> insert into test select null,replace(col1,'-','') from test;
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test;
COL1 COL2
100-1050-10101-001
100105010101001 -
Convertion of number into sentence
i want to convert the number into sentence. i their is any short cut way to covert the number like 1,400,250 into "I million forty thousand two hundred and fifty"
Hi,
Please have a look on this thread.
Re: Try This Code (Number to Charcter)
Regards -
How to convert number datatype to raw datatype for use in data warehouse?
I am picking up the work of another grad student who assembled the initial data for a data warehouse, mapped out a dimensional dw and then created then initial fact and dimension tables. I am using oracle enterprise 11gR2. The student was new to oracle and used datatypes of NUMBER (without a length - defaulting to number(38) for dimension keys. The dw has 1 fact table and about 20 dimension tables at this point.
Before refining the dw further, I have to translate all these dimension tables and convert all columns of Number and Number(n) (where n=1-38) to raw datatype with a length. The goal is to compact the size of the dw database significantly. With only a few exceptions every number column is a dimension key or attribute.
The entire dw db is now sitting in a datapump dmp file. this has to be imported to the db instance and then somehow converted so all occurrences of a number datatype into raw datatypes. BTW, there are other datatypes present such as varchar2 and date.
I discovered that datapump cannot convert number to raw in an import or export, so the instance tables once loaded using impdp will be the starting point.
I found there is a utl_raw package delivered with oracle to facilitate using the raw datatype. This has a numbertoraw function. Never used it and am unsure how to incorporate this in the table conversions. I also hope to use OWB capabilities at some point but I have never used it and only know that it has a lot of analytical capabilities. As a preliminary step I have done partial imports and determined the max length of every number column so I can alter the present schema number columns tp be an apporpriate max length for each column in each table.
Right now I am not sure what the next step is. Any suggestions for the data conversion steps would be appreciated.Hi there,
The post about "Convert Numbers" might help in your case. You might also interested in "Anydata cast" or transformations.
Thanks, -
Making spool, convert it into PDF and send that PDf throgh EMAIl
Hi,
In my making ALV report. In that i want to make the spool and then convert it into the pdf and send mail to the recepient.
AtulHi,
please try the following code. It works for me.
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
DATA : path LIKE pcfile-path.
DATA : extension(5) TYPE c.
DATA : name(100) TYPE c.
DATA:receiver TYPE somlreci1-receiver ,
p_file LIKE rlgrap-filename.
declarations for PDF convertion
DATA: path1 TYPE string ,
fullpath TYPE string.
DATA :textlines LIKE tline OCCURS 100 WITH HEADER LINE.
DATA otf LIKE itcoo OCCURS 1000 WITH HEADER LINE.
DATA it_lines LIKE tline OCCURS 100 WITH HEADER LINE.
DATA options LIKE itcpo.
DATA header LIKE thead.
DATA result LIKE itcpp.
DATA: bin_filesize TYPE i.
fullpath type string.
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
DATA: filesize TYPE i,
convcount TYPE i,
cancel(1).
textlines-tdformat = '*'.
textlines-tdline = 'Hello Hao'.
APPEND textlines.
options-tdgetotf = 'X'.
options-tdnoprev = 'X'.
CALL FUNCTION 'PRINT_TEXT'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX = ' '
ARCHIVE_PARAMS = ' '
DEVICE = 'PRINTER'
dialog = ' '
header = header
OPTIONS = options
IMPORTING
NEW_ARCHIVE_PARAMS =
RESULT = RESULT
tables
lines = textlines
otfdata = otf
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
UNKNOWN = 6
FORMAT = 7
TEXTFORMAT = 8
COMMUNICATION = 9
BAD_PAGEFORMAT_FOR_PRINT = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = filesize
TABLES
otf = otf
lines = it_lines
EXCEPTIONS
err_conv_not_possible = 1
err_bad_otf = 2.
fullpath = 'C:/foldername/test.pdf'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = fullpath
filetype = 'BIN'
APPEND = ' '
CODEPAGE = ' '
NO_BYTEORDER_MARK = ' '
IMPORTING
FILELENGTH = c
TABLES
data_tab = it_lines
FORMAT_TAB =
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6.
*filename = fullpath.
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = 'Tst'.
docdata-obj_descr = 'Testing'.
reclist-receiver = give the mail id.
reclist-rec_type = 'U'.
APPEND reclist.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = fullpath
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = fullpath.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
extension = extension
name = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
invalid_drive = 1
invalid_extension = 2
invalid_name = 3
invalid_path = 4
OTHERS = 5
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT itab.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
objbin+len = itab(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND objbin.
CLEAR: objbin, len.
IF pos < 134.
objbin = itab+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND objbin.
ENDIF.
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-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 = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
name = extension.
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = name.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = name.
APPEND objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
Keerthi -
I've developed classes to convert amount into it's phrase representation
Hi everybody!
Example:
Number 25 can be converted into the phrase "twenty five"
or even into "twenty five Canadian Dollars" for english language, Canadian currency
This functionality can be supplied for major languages like Russian, German,
Spanish. French, Chinese, Hindi etc. All of these languages might have their
own specifics.
In future end-users will to be able to use this functionality via Web-services.
I also look forward to find reliable web site where We can host this web service and front-end servlet which will show this phrase based on { amount, language, currency } selected. That everybody can recieve it electronically via xml request or just copy result phrase from web page . Please send me a list of companies who potentially interested to host it including detailed info of Company/Persons name and his/her e-mail if possible.
I'm going to post them at apache.org but for now I've attached source code below
for your feedbacks and if somebody wants to join to me to implement some languages like french, spanish etc. Currency feature will be ready when I have more languages supporrt.
Author Igor Artimenko my e-mail is <[email protected]>
package org.apache.bussinessapi.test;
import org.apache.bussinessapi.AmountByWord;
* Test case prototype
* @author Igor Artimenko <[email protected]>
* @version 1.0 Initial draft for review
* Created on Jun 5, 2003
public class TestAmountByWord
public TestAmountByWord()
double array[] = { 123456789777L, -627845, 300.84, 670, 30, -100, -56879, 1008, 37, 205100, 0, 3000.67 };
AmountByWord amountByWord = new AmountByWord();
amountByWord.setLanguage( "en" );
amountByWord.setCurrency( "en" );
for (int i = 0; i < array.length; i++)
System.out.println( array[ i ] );
try {
System.out.println( amountByWord.getAmountByWord( array[ i ] ) );
} catch (Exception e) {
e.printStackTrace();
System.out.println( "---------------------------------" );
public static void main(String[] args)
TestAmountByWord test = new TestAmountByWord();
package org.apache.bussinessapi;
* Usially used class to get string representation of the number
* in the human-readable format
* @author Igor Artimenko <[email protected]>
* @version 1.0 Initial draft for review
* Created on Jun 5, 2003
public class AmountByWord implements IAmountByWord
private String language;
private String currency;
private String amountByWord;
* Constructor AmountByWord
public AmountByWord()
super();
* Method getAmountByWord is the most important method
* @param amount to be represented in the human-readable format
* @return String the phrase representation of number
public String getAmountByWord( double amount ) throws Exception
StringBuffer resultAmount = new StringBuffer();
IAmountByWord amountByWord = null;
// First, create an appropriate instance
try
if ( language == null )
throw new Exception( "Language has not been assigned yet" );
else if ( currency == null )
throw new Exception( "Currency has not been assigned yet" );
Class cl = Class.forName( "org.apache.bussinessapi.AmountByWord".concat( language ) );
try
amountByWord = (IAmountByWord) cl.newInstance();
catch ( InstantiationException e )
throw new Exception( "can not be instantiated" );
} // catch
catch ( IllegalAccessException e )
throw new Exception(
"IllegalAccessException arrised during instantiating of " );
} // catch
} // try
catch ( ClassNotFoundException e )
throw new Exception( "Class could not be found " );
} // catch
// for now the number only
return amountByWord.getAmountByWord( amount );
* Method getMoneyAmountByWord is the most important method
* @param amount to be represented in the human-readable format
* @return String the phrase representation of number
public String getMoneyAmountByWord( double amount ) throws Exception
StringBuffer resultAmount = new StringBuffer();
IAmountByWord amountByWord = null;
// First, create an appropriate instance
try
if ( language == null )
throw new Exception( "Language has not been assigned yet" );
else if ( currency == null )
throw new Exception( "Currency has not been assigned yet" );
Class cl = Class.forName( "org.apache.bussinessapi.AmountByWord".concat( language ) );
try
amountByWord = (IAmountByWord) cl.newInstance();
catch ( InstantiationException e )
throw new Exception( "can not be instantiated" );
} // catch
catch ( IllegalAccessException e )
throw new Exception(
"IllegalAccessException arrised during instantiating of " );
} // catch
} // try
catch ( ClassNotFoundException e )
throw new Exception( "Class could not be found " );
} // catch
// for now the number only
return amountByWord.getMoneyAmountByWord( amount );
* getCurrency Method
* @return To retrieve currency code currently used
public String getCurrency()
return currency;
* getLanguage
* @return To retrieve Language locale code currently used
public String getLanguage()
return language;
* setCurrency
* @return To setup Currency locale code to be used
public void setCurrency( String currency )
this.currency = currency;
* setLanguage
* @return To setup Language locale code to be used
public void setLanguage( String language )
this.language = language;
package org.apache.bussinessapi;
import java.util.Properties;
* The purpose is to return string representation on the number
* in the human-readable format based on English grammar
* Generally you can use this class as a base for your own language
* like Russian, German, Spanish, French etc.
* They must implement IAmountByWord interface
* @author Igor Artimenko <[email protected]>
* @version 1.0 Initial draft for review
* Created on Jun 5, 2003
public class AmountByWorden implements IAmountByWord
final private Properties langTokens = new Properties();
AmountByWorden()
langTokens.put( "0", "zero" );
langTokens.put( "1", "one" );
langTokens.put( "2", "two" );
langTokens.put( "3", "three" );
langTokens.put( "4", "four" );
langTokens.put( "5", "five" );
langTokens.put( "6", "six" );
langTokens.put( "7", "seven" );
langTokens.put( "8", "eight" );
langTokens.put( "9", "nine" );
langTokens.put( "10", "ten" );
langTokens.put( "11", "eleven" );
langTokens.put( "12", "twelve" );
langTokens.put( "13", "thirteen" );
langTokens.put( "14", "fourteen" );
langTokens.put( "15", "fifteen" );
langTokens.put( "16", "sixteen" );
langTokens.put( "17", "seventeen" );
langTokens.put( "18", "eighteen" );
langTokens.put( "19", "nineteen" );
langTokens.put( "20", "twenty" );
langTokens.put( "30", "thirty" );
langTokens.put( "40", "fourty" );
langTokens.put( "50", "fifty" );
langTokens.put( "60", "sixty" );
langTokens.put( "70", "seventy" );
langTokens.put( "80", "eighty" );
langTokens.put( "90", "ninety" );
langTokens.put( "100", "hundred" );
langTokens.put( "1000", "thousand" );
langTokens.put( "1000000", "million" );
langTokens.put( "1000000000", "billion" );
langTokens.put( "1000000000000L", "trillion" );
langTokens.put( "minus", "minus" );
langTokens.put( "and", "and" );
langTokens.put( "point", "point" );
/* (non-Javadoc)
* It does not yet working. Proper implementation coming soon.
* @see org.apache.bussinessapi.IAmountByWord#getAmountByWord(double)
public String getAmountByWord( double amount ) throws Exception
NumberByWord numberByWord = new NumberByWord();
StringBuffer fullNumber = new StringBuffer();
numberByWord.setLanguageTokens( langTokens );
// also should be replaced by full phrase
fullNumber = fullNumber.append(
numberByWord.getNumberByWord( (long) amount ).trim() );
// for now 2 numbers after .
int theRest = (int) ( ( amount - (long) amount ) * 100 );
if ( theRest != 0 )
fullNumber.append( " " ). append( langTokens.get( "point" ) ).
append( " " ).append(
numberByWord.getNumberByWord( (long) theRest ).trim() );
return fullNumber.toString();
/* (non-Javadoc)
* It does not yet working. Proper implementation coming soon.
* @see org.apache.bussinessapi.IAmountByWord#getMoneyAmountByWord(double)
public String getMoneyAmountByWord( double amount ) throws Exception
NumberByWord numberByWord = new NumberByWord();
StringBuffer fullNumber = new StringBuffer();
numberByWord.setLanguageTokens( langTokens );
// also should be replaced by full phrase
fullNumber = fullNumber.append(
numberByWord.getNumberByWord( (long) amount ).trim() );
// for now 2 numbers after .
int theRest = (int) ( ( amount - (long) amount ) * 100 );
if ( theRest != 0 )
fullNumber.append( " " ). append( langTokens.get( "point" ) ).
append( " " ).append(
numberByWord.getNumberByWord( (long) theRest ).trim() );
return fullNumber.toString();
package org.apache.bussinessapi;
* Each class created for the purpose of giving back
* a string representation of the number MUST implement this interface
* @author Igor Artimenko <[email protected]>
* @version 1.0 Initial draft for review
* Created on Jun 5, 2003
public interface IAmountByWord {
* getMoneyAmountByWord The purpose of this method is to return
* string representation on the number in the human-readable format
* in a regular format ( like 25.78
* "twenty five point seventy eight" )
* @param anAmount to be converted into it's string representation
* @return A string representation of the number
* @throws Exception if something went wrong
public String getAmountByWord( double anAmount ) throws Exception;
* getMoneyAmountByWord The purpose of this method is to return
* string representation on the number in the human-readable format
* in a money format like ( 25.78 Can
* "twenty five Canadian Dollars and seventy eight Cents" )
* @param anAmount to be converted into it's string representation
* @return A string representation of the number
* @throws Exception if something went wrong
public String getMoneyAmountByWord( double anAmount )
throws Exception;
package org.apache.bussinessapi;
import java.util.*;
* This class implements generic algoritm of converting a number into
* human-readable format.
* @author Igor Artimenko <[email protected]>
* @version 1.0 Initial draft for review
* Created on Jun 5, 2003
* You can use getNumberByWord method
* if your language fits into this algorithm or
* extend from this class and make some transformations in the child
* method.
* Don't forget to setup language Tokens
* via setLanguageTokens method call first
public class NumberByWord
private Properties langTokens = new Properties();
* Constructor for NumberByWord.
public NumberByWord()
super();
* Method getNumberByWord. The most important method.
* Standard actions are here
* @param amount Accepts only mathematical integer
* @return String representation of this phrase
public String getNumberByWord( long amount )
StringBuffer strNumberByWord = new StringBuffer( "" );
SortedMap smallAmounts = new TreeMap();
String str = new Long( Math.abs( amount ) ).toString();
int currentPosition = str.length();
long currentThousand = 1;
// break by thousands
while ( currentPosition > 0 )
smallAmounts.put( new Long( currentThousand ), new Integer(
str.substring( Math.max( 0, currentPosition - 3 ),
currentPosition ) ) );
strNumberByWord.insert( 0,
getSmallest( (Integer) smallAmounts.get( new Long( currentThousand ) ) ) +
( currentThousand == 1 ? "" : " " +
langTokens.getProperty( new Long( currentThousand ).toString() ) ) );
currentPosition -= 3;
currentThousand *= 1000;
if ( amount == 0 ) {
strNumberByWord.append( langTokens.getProperty( "0" ) );
else if ( amount < 0 )
strNumberByWord.insert( 0, langTokens.getProperty( "minus" ) );
return strNumberByWord.toString().trim();
* @param smallNumber this number must in the range from 0 to 999
* inclusive
* @return String representation of this number
public StringBuffer getSmallest( Integer smallNumber )
StringBuffer smallestNumberByWord = new StringBuffer( "" );
int hundreds = (int) ( smallNumber.intValue() / 100 );
int dozens = (int)( ( smallNumber.intValue() - hundreds * 100 ) / 10 );
int rest = smallNumber.intValue() - hundreds * 100 - dozens * 10;
// using smallNumber create small phrase
// Let's compund the phrase itself
if ( hundreds > 0 ) {
smallestNumberByWord.append( " " ).append(
langTokens.getProperty( new Long( hundreds ).toString() ) ).append( " " ).append(
langTokens.getProperty( new Long( 100 ).toString() ) );
Object obj = langTokens.getProperty( new Long( dozens * 10 + rest ).toString() );
// is atomic like 15 juust substitute
if ( dozens * 10 + rest != 0 )
if ( obj != null )
smallestNumberByWord.append( " " ).append( obj );
else
smallestNumberByWord.append( " " ).append(
langTokens.getProperty( new Long( dozens * 10 ).toString() ) ).
append( " " ).append( langTokens.getProperty( new Long( rest ).
toString() ) );
return smallestNumberByWord;
* setLanguageTokens Use before making call to getNumberByWord
* @param langTokens Properties of language token used by
* particular language
public void setLanguageTokens( Properties langTokens )
this.langTokens = langTokens;
----------------------------------------------------------------------------------Hi Hoos!
I found a host for that project. It's called valia at sourceforge.net.
We have already about 7 developers ( English, Russian, French, German, Italian, Arabic, Hindi, Traditional Chinese ). We are looking for guys with Spanish and Japanese.
Also if you want we can expand our support for Persian you are very welcome to join. It's usially small job, just replace one, two etc by your spoken language plus coding of grammar exceptions.
Withregard of applicability we are making first version to be working for even small j2me. So you can integrate it to everywhere including cell phones. But major goal is for bussiness apps & web services, possibly entertainements.
Would you reply to me if you wanted to join at [email protected]
Have a great day
Igor Artimenko
valia, Project Manager -
HOW TO CONVERT DATE INTO NUMBERS
HI,
what the syntax for converting date into No. Ex from the first date of the month till current date how many days are there, this No of days needs to be divided by the net sale of the month.
i have searched in formulas fields but i am not able to find such option...
please help.
Thanking you,
UMAR NAYAB.Hi,
Stratos and Sastry
the formula given by you shows the variation for the current month of suppose 30 days
but if the month is of 31 days or 28 days (feb) how will the system will able to generate the report accordingly.
i want to make a report in which it should show the net sales by the current month and current date.
so the system should automated by the number of days in a month.
thanking you..
UMAR NAYAB. -
Convert SmartForm into PDF(PDF should be password protected)
Hi Friends,
This is my requirement.
Need to convert SmartForm into PDF and this PDF should be send as an email with attachment and PDF should be password protected.
Can anyone plz help me???Dear Jena,
This is my code.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZBIN_SMARTFORM'
IMPORTING
fm_name = v_fm.
*& ASSIGNING VALUES TO FORM CONTROL STRUCTURE AND FORM COMPOSER
gs_ctrlop-getotf = 'X'.
gs_ctrlop-device = 'PRINTER'.
gs_ctrlop-preview = ' '.
gs_ctrlop-no_dialog = 'X'.
gs_outopt-tddest = 'LOCL'.
* GETTING THE OTF DATA
CALL FUNCTION v_fm
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
control_parameters = gs_ctrlop
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
output_options = gs_outopt
user_settings = ' '
wa_lfa1 = wa_lfa1
wa_t001 = wa_t001
wa_ekko = wa_ekko
wa_adrc = wa_adrc
IMPORTING
* DOCUMENT_OUTPUT_INFO =
job_output_info = gs_otfdata
* JOB_OUTPUT_OPTIONS =
TABLES
it_ekpo = it_ekpo
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.
* ASSIGNING THE OTFDATA TO OTF STRUCTURE TABLE
CLEAR gt_otf.
gt_otf[] = gs_otfdata-otfdata[].
* CONVERTING THE OTFDATA
CLEAR gt_lines.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
* PDF_DELETE_OTFTAB = ' '
* PDF_USERNAME = ' '
* PDF_PREVIEW = ' '
* USE_CASCADING = ' '
IMPORTING
bin_filesize = bin_file
* bin_file = bin_file
TABLES
otf = gt_otf
lines = gt_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 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.
DATA l_file TYPE string .
CONCATENATE 'D:\usr\sap\CID\DVEBMGS00\work' '.PDF' INTO l_file.
OPEN DATASET l_file FOR OUTPUT IN BINARY MODE .
IF sy-subrc = 0 .
LOOP AT gt_lines INTO gs_lines .
TRANSFER gs_lines TO l_file .
ENDLOOP.
CLOSE DATASET l_file .
ELSE.
WRITE : / 'operating system could not open file' .
ENDIF.
* ASSIGNING THE DESCRIPTION OF THE OBJECT SENT IN MAIL
CLEAR gs_docdata.
gs_docdata-obj_name = gc_tst.
gs_docdata-obj_descr = gc_testing.
gs_docdata-obj_langu = sy-langu.
* ASSIGNING THE EMAIL-ID TO STRUCTURE OF API RECIPIENT LIST TABLE
CLEAR : gt_reclist,gs_reclist.
***IF INTERNAL MAIL-ID
* gs_reclist-receiver = sy-uname.
* gs_reclist-rec_type = 'B'.
***IF EXTERNAL MAIL-ID
gs_reclist-receiver = '[email protected]'.
gs_reclist-rec_type = 'U'.
APPEND gs_reclist TO gt_reclist.
* PASSING THE SAP SCRIPT LINES TO SAP OFFICE
CLEAR : gs_objbin,gs_lines.
LOOP AT gt_lines INTO gs_lines.
gv_pos = 255 - gv_len.
IF gv_pos > 134.
gv_pos = 134.
ENDIF.
gs_objbin+gv_len = gs_lines(gv_pos).
gv_len = gv_len + gv_pos.
IF gv_len = 255.
APPEND gs_objbin TO gt_objbin.
CLEAR : gs_objbin,gv_len.
IF gv_pos < 134.
gs_objbin = gs_lines+gv_pos.
gv_len = 134 - gv_pos.
ENDIF.
ENDIF.
ENDLOOP.
IF gv_len > 0.
APPEND gs_objbin TO gt_objbin.
ENDIF.
* FILLING THE DETAILS IN SAP OFFICE
DESCRIBE TABLE gt_objbin LINES gv_tab_lines.
CLEAR gs_objbin.
READ TABLE gt_objbin INTO gs_objbin INDEX gv_tab_lines.
IF sy-subrc = 0.
gs_objpack-doc_size = ( gv_tab_lines - 1 ) * 255 + strlen( gs_objbin ).
gs_objpack-transf_bin = 'X'.
gs_objpack-head_start = 1.
gs_objpack-head_num = 0.
gs_objpack-body_start = 1.
gs_objpack-body_num = gv_tab_lines.
gs_objpack-doc_type = 'PDF'.
gs_objpack-obj_name = 'ATTACHMENT'.
gs_objpack-obj_descr = 'TEST'.
APPEND gs_objpack TO gt_objpack.
ENDIF.
DATA: BEGIN OF command_list OCCURS 0.
INCLUDE STRUCTURE sxpgcolist.
DATA: END OF command_list .
DATA: BEGIN OF exec_protocol OCCURS 0.
INCLUDE STRUCTURE btcxpm.
DATA: END OF exec_protocol.
DATA: status LIKE btcxp3-exitstat,
commandname LIKE sxpgcolist-name VALUE 'ZB_TEST',
sel_no LIKE sy-tabix.
* GET LIST OF EXTERNAL COMMANDS
CALL FUNCTION 'SXPG_COMMAND_LIST_GET'
EXPORTING
commandname = commandname
operatingsystem = sy-opsys
TABLES
command_list = command_list
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'SXPG_COMMAND_CHECK'
EXPORTING
commandname = command_list-name
operatingsystem = sy-opsys
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
x_error = 6
too_many_parameters = 7
parameter_expected = 8
illegal_command = 9
communication_failure = 10
system_failure = 11
OTHERS = 12.
CLEAR command_list.
REFRESH command_list.
DATA: v_dir_input TYPE sxpgcolist-parameters.
DATA: v_dir_input1 TYPE sxpgcolist-parameters.
command_list-name = 'ZB_TEST'.
command_list-opsystem = 'Windows NT'.
DATA : doc TYPE string.
DATA : pass TYPE string ,
name(40).
doc = 'invoice'.
pass = '123456'.
CONCATENATE 'cnd/c d:\pdf\encryptpdf.exe' doc'.PDF' INTO name.
CONCATENATE 'cmd /c d:\pdf\encryptpdf.exe' '-i' name '-o ' name '-u' pass INTO v_dir_input SEPARATED BY space .
READ TABLE command_list INDEX sel_no.
CONCATENATE command_list-opcommand v_dir_input INTO command_list-opcommand SEPARATED BY space.
* CHECK AUTHORIZATION
command_list-addpar = 'X'.
APPEND command_list.
CONSTANTS: c_extcom TYPE sxpgcolist-name VALUE 'ZB_TEST',
c_oper TYPE syopsys VALUE 'Windows NT'.
DATA: t_result TYPE STANDARD TABLE OF btcxpm.
v_dir_input = command_list-opcommand.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = c_extcom
additional_parameters = v_dir_input
operatingsystem = c_oper
TABLES
exec_protocol = t_result
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
OPEN DATASET l_file FOR INPUT IN BINARY MODE.
IF sy-subrc = 0.
READ DATASET l_file INTO itab_attach.
CLOSE DATASET l_file.
ENDIF.
CALL METHOD cl_bcs_convert=>xstring_to_solix
EXPORTING
iv_xstring = itab_attach
RECEIVING
et_solix = t_attachment.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gs_docdata
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
packing_list = gt_objpack
* OBJECT_HEADER =
CONTENTS_BIN = gt_objbin
* CONTENTS_TXT =
CONTENTS_HEX = t_attachment
* OBJECT_PARA =
* OBJECT_PARB =
receivers = gt_reclist
* EXCEPTIONS
* TOO_MANY_RECEIVERS = 1
* DOCUMENT_NOT_SENT = 2
* DOCUMENT_TYPE_NOT_EXIST = 3
* OPERATION_NO_AUTHORIZATION = 4
* PARAMETER_ERROR = 5
* X_ERROR = 6
* ENQUEUE_ERROR = 7
* OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
WRITE 'SENT SUCCESSFULLY'.
ENDIF.
SUBMIT rsconn01 WITH mode EQ 'INT' AND RETURN.
The mail is sent to inbox successfully,but when am opening the attachment am getting the below error as,
---> There was an error while opening this file.The file is damaged and couldnt be repaired.
Maybe you are looking for
-
How to Send Custom Purchase Order Report in PDF format to Supplier through email
Hi, Currently whenever a PO is approved in PO form if Email Option is enabled it is sending the standard report output to the supplier, we need to replace the custom designed report instead of the standard report. How to achieve this, is there any ne
-
So a couple of months ago, I had to restore my new IPOD 5 TOUCH because i had forgotten the password and disabled it, so as you can imagine I am quite familiar with restoring it. (The last time I had synced it was the only time that I had to restore
-
Error When Trying to Schedule Webi report using SAP authentication
Hii, We are trying to Schedule Webi report in CMC for Group of Users using SAP authentication(SSO) ,While Trying this we are geting error Unable to Connect to SAP BW server Incomplete Logon Data ..(IES 10901) . Authorization done at BI side and Its w
-
Delivery Quantity Control at Purchase Organisation Level
Hi All, In this scenario, I would like to have a control on the Delivery quantity by a vendor. Quantity released: 100 pcs for Vendor ABC Total Number of Plants: 3 Out of this 100 pcs, it can be delivered to any of the 3 plants by vendor ABC. Quantity
-
Connecting a Video Monitor to a G5- how?
I need your some help to understand how to CONNECT the following components of my DV system: 1) a Macintosh G5 (the video card has both ADC and DVI connectors) with Final Cut Studio software and a 23" Studio Display (DVI); 2) a Sony Digital Video Cas