Spool to Excel or Text Conversion thru ABAP
Dear All,
Is it possible to convert a spool into Excel file or Text Format thru ABAP?
Hi!
The function modules CONVERT_ABAPSPOOLJOB_2_PDF, CONVERT_OTFSPOOLJOB_2_PDF are converting spool to PDF.
HTH
Peter
Similar Messages
-
Spool to Excel or Text Conversion
Dear All,
Is it possible to convert a spool into Excel file or Text Format?Hi
Check the below links. They wil help you in converting spool to text format.
[http://www.sap-basis-abap.com/sapac016.htm]
[http://help.sap.com/saphelp_nw70/helpdata/en/30/cc154219fce12ce10000000a1550b0/content.htm]
Thanks,
Jyothi -
Send email with spool in excel attachment
Hi,
I have this function:
CALL FUNCTION 'Z_SEND_EMAIL_SPOOL_PDF'
EXPORTING
application = 'EMAIL'
emailtitle = texttitle
recextnam = email
src_spoolid = tsp01-rqident
TABLES
texttab = body.
And code:
FUNCTION z_send_email_spool_pdf .
*"*"Interfase local
*" IMPORTING
*" REFERENCE(APPLICATION) LIKE SOOD1-OBJNAM DEFAULT 'EMAIL'
*" REFERENCE(EMAILTITLE) LIKE SOOD1-OBJDES
*" VALUE(RECEXTNAM) LIKE SOOS1-RECEXTNAM
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" TABLES
*" TEXTTAB STRUCTURE SOLI
*- local data declaration
DATA: ohd LIKE sood1,
oid LIKE soodk,
to_all LIKE sonv-flag,
okey LIKE swotobjid-objkey.
DATA: g_document LIKE sood4,
g_header_data LIKE sood2,
g_authority LIKE sofa-usracc,
lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE,
l_folder_id LIKE sofdk,
l_objcont LIKE soli OCCURS 0 WITH HEADER LINE,
i_bin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
l_objhead LIKE soli OCCURS 0 WITH HEADER LINE,
folder_id LIKE soodk,
object_id LIKE soodk,
link_folder_id LIKE soodk,
hd_dat LIKE sood1.
DATA: desired_type LIKE sood-objtp,
real_type LIKE sood-objtp,
attach_type LIKE sood-objtp,
otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
ali LIKE sood-objtp VALUE 'ALI', " ABAP lists
pdf LIKE sood-objtp VALUE 'PDF', "PDF format
pbyte TYPE i,
t_pdf LIKE tline OCCURS 0 WITH HEADER LINE,
objtype LIKE rststype-type,
type LIKE rststype-type.
CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
c_objtp LIKE g_document-objtp VALUE 'RAW',
c_file_ext LIKE g_document-file_ext VALUE 'PDF'.
DATA: BEGIN OF receivers OCCURS 0.
INCLUDE STRUCTURE soos1.
DATA: END OF receivers.
* Fist part: Verify if the spool really exists
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
CHECK sy-subrc = 0.
*- fill odh
CLEAR ohd.
ohd-objla = sy-langu.
ohd-objnam = application.
ohd-objdes = emailtitle.
ohd-objpri = 3.
ohd-objsns = 'F'.
ohd-ownnam = sy-uname.
*- send Email
CONDENSE recextnam NO-GAPS.
CHECK recextnam <> space AND recextnam CS '@'.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = tsp01-rqclient
name = tsp01-rqo1name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
attach_type = c_objtp.
desired_type = pdf.
IF objtype(3) = 'OTF'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = src_spoolid
IMPORTING
pdf_bytecount = pbyte
TABLES
pdf = t_pdf.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = src_spoolid
IMPORTING
pdf_bytecount = pbyte
TABLES
pdf = t_pdf.
ENDIF.
PERFORM convertir_tabla_pdf_2 TABLES t_pdf l_objcont.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
* fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = emailtitle.
g_document-file_ext = c_file_ext.
g_header_data-objdes = emailtitle.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
objcont = texttab
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
hd_dat-file_ext = pdf.
hd_dat-objdes = emailtitle.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
* FORM SO_OBJECT_SEND_REC *
FORM so_object_send_rec
TABLES objcont STRUCTURE soli
receivers STRUCTURE soos1
USING object_hd STRUCTURE sood1
folder_id
object_id
link_folder_id.
DATA: oid LIKE soodk,
to_all LIKE sonv-flag,
okey LIKE swotobjid-objkey.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
extern_address = 'X'
* object_hd_change = object_hd
* object_type = 'RAW'
outbox_flag = 'X'
sender = sy-uname
owner = sy-uname
folder_id = folder_id
object_id = object_id
store_flag = 'X'
link_folder_id = link_folder_id
IMPORTING
object_id_new = oid
sent_to_all = to_all
office_object_key = okey
TABLES
objcont = objcont
receivers = receivers
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
x_error = 20
OTHERS = 21.
IF sy-subrc <> 0.
RAISE others.
ENDIF.
ENDFORM.
* FORM INIT_REC *
FORM init_rec TABLES receivers STRUCTURE soos1.
CLEAR receivers.
REFRESH receivers.
MOVE sy-datum TO receivers-rcdat .
MOVE sy-uzeit TO receivers-rctim.
MOVE '1' TO receivers-sndpri.
MOVE 'X' TO receivers-sndex.
MOVE 'U-' TO receivers-recnam.
MOVE 'U' TO receivers-recesc.
MOVE 'INT' TO receivers-sndart.
MOVE '5' TO receivers-sortclass.
APPEND receivers.
ENDFORM.
With this function I can send a spool in pdf format by email. But, now I need send a spool in Excel (xls) format by email. I try to disconnect 'CONVERT_OTFSPOOLJOB_2_PDF' and 'CONVERT_ABAPSPOOLJOB_2_PDF' but doesnt work.
Can you help me?
A lot of thanks in advance.
Best regards.Hi.
I do not think it is feasible to create a worthwhile Excel file from a SAP spool file.
I have reports that send output as Excel attachments to email, but the code (including function modules etc) is too much to post here.
You can use OLE to create an Excel file, but this will not generally work when the report is run in the background.
So my approach is to make the report write an Excel XML file (that's just text after all), and send that as an XLS email attachment. When the email receiver double-clicks on the attachment, it fires up Excel and brings in the data. Most users would not realise that it's not a native Excel file.
One nice touch is to have two sheets in the Excel file, one with the main report and the other with the selection criteria.
Of course there is a lot of work getting started with this.
John -
Why do texts come thru as my Apple ID rather than the name my contact is saved as in the recipient's phone? Can this be changed?
Check Settings>Messages>Send & Receive to make sure your phone number is listed and checked under "Start new conversations from". That was cause your iMessages to be addressed from your phone number rather than an email address. If the recipient has your number in their contacts, it will show as being from your name.
-
How to prepare the Format of Flat file(Excel or Text file) for sales order
Hi All,
My requirement is to prepare the Flat File formats(Excel or Text file) for sales order Conversion using BAPI by COB.
Needed Sample Excel or Text flat file .
Thanks for all.
Regards,
Chowdary
Moderator message : Search for available information. Thread locked.
Your similiar question [Flat files formats|Flat files formats] has been already locked for similiar reason. Read forum rules before posting.
Edited by: Vinod Kumar on Jul 8, 2011 9:36 AMHi,
You can use something like this:
switch(cell.getCellType()) {
case Cell.CELL_TYPE_STRING:
System.out.println(cell.getRichStringCellValue().getString());
break;
case Cell.CELL_TYPE_NUMERIC:
if(DateUtil.isCellDateFormatted(cell)) {
System.out.println(cell.getDateCellValue());
else {
System.out.println(cell.getNumericCellValue());
break;
case Cell.CELL_TYPE_BOOLEAN:
System.out.println(cell.getBooleanCellValue());
break;
case Cell.CELL_TYPE_FORMULA:
System.out.println(cell.getCellFormula());
break;
default:
System.out.println();
Hope it helps,
Daniel -
Hi
I want to know what are the conversions and what are the different types of conversions in abap
Regards
PavanHi
A conversion means data that is converted from one format to another format and from one system to another. So when you first implement SAP, you are actually replacing some of your legacy systems, but you are not completely trashing the data. You still need some of that data from the systems that are being replaced. So you pull the data out of your legacy systems and put them on some files. You then want to load that data into your new SAP system. That is when you write some programs which will read that data and load it into SAP. Imagine you had a home grown purchasing system. You are now replacing all that with SAP. But until SAP goes live, you want to keep using your home grown purchasing system. So during go live, you want to transfer the POs from your legacy system to SAP. Now a PO in your legacy system may not have the same fields as a PO in SAP. So you convert the data.
from sap help....
Conversion Rules for Elementary Data Types
There are ten predefined ABAP data types. There are 100 possible type combinations between these elementary data types. ABAP supports automatic type conversion and length adjustment for all of them except type D (date) and type T (time) fields which cannot be converted into each other.
The following conversion tables define the rules for converting elementary data types for all possible combinations of source and target fields.
C D F I N P STRING T X XSTRING
Source Type Character
Conversion table for source type C
Target
Conversion
C
The target field is filled from left to right. If it is too long, it is filled with blanks from the right. If it is too short, the contents are truncated from the right.
D
The character field must contain an 8-character date in the format YYYYMMDD .
F
The contents of the source field must be a valid representation of a type F field as described in Literals.
N
Only the digits in the source field are copied. The field is right-justified and filled with trailing zeros.
I, P
The source field must contain the representation of a decimal number, that is, a sequence of digits with an optional sign and no more than one decimal point. The source field can contain blanks. If the target field is too short, an overflow may occur. This may cause the system to terminate the program.
STRING
The occupied length of the source field is copied. All trailing spaces are truncated.
T
The character field must contain a six-character time in HHMMSS format.
X
Since the character field must contain a hexadecimal string, the only valid characters are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. This string is packed as a hexadecimal number, transported left-justified, and filled with zeros or truncated on the right.
XSTRING
As for fields of type X, except that the target field is not filled with zeros.
Source Type Date
Conversion table for source type D
Target
Conversion
C
The date is transported left-justified without conversion.
D
Transport without conversion.
F
The date is converted into a packed number. The packed number is then converted into a floating point number (see corresponding table).
N
The date is transported left-justified without conversion and, if necessary, filled with zeros on the right.
I, P
The date is converted to the number of days since 01.01.0001.
STRING
The date is converted to a character field, which is then converted to a character string.
T
Not supported. Results in an error message during the syntax check or in a runtime error.
X
The date is converted to the number of days since 01.01.0001 in hexadecimal format.
XSTRING
As for fields of type X, except that only significant bytes are copied.
Source Type Floating Point Number
Conversion table for source type F
Target
Conversion
C
The floating point number is converted to the <mantissa>E<exponent> format and transported to the character field. The value of the mantissa lies between 1 and 10 unless the number is zero. The exponent is always signed. If the target field is too short, the mantissa is rounded. The length of the character field must be at least 6 bytes.
D
The source field is converted into a packed number. The packed number is then converted into a date field (see corresponding table).
F
Transport without conversion.
N
The source field is converted into a packed number. The packed number is then converted into a numeric text field (see corresponding table).
I, P
The floating point number is converted to an integer or fixed point value and, if necessary, rounded.
STRING
As for fields of type C, except that the maximum number of places is used for the mantissa (maximum precision). Despite this, different signs or exponents can lead to different string lengths.
T
The source field is converted into a packed number. The packed number is then converted into a time field (see corresponding table).
X
The source field is converted into a packed number. The packed number is then converted into a hexadecimal number (see corresponding table).
XSTRING
As for fields of type X, except that leading zeros are not copied.
Source Type Integer
Type I is always treated in the same way as type P without decimal places. Wherever type P is mentioned, the same applies to type I fields.
Source Type Numeric Text
Conversion table for source type N
Target
Conversion
C
The numeric field is treated like a character field. Leading zeros are retained.
D
The numeric field is converted into a character field. The character field is then converted into a date field (see corresponding table).
F
The numeric field is converted into a packed number. The packed number is then converted into a floating point number (see corresponding table).
N
The numeric field is transported right-justified and filled with zeros or truncated on the left.
I, P
The numeric field is interpreted as a number, and transferred to the target field, where it is right-justified, and adopts a plus sign. If the target field is too short, the program may be terminated.
STRING
As for fields of type C. The length of the character string matches the length of the numeric text.
T
The numeric field is converted into a character field. The character field is then converted into a time field (see corresponding table).
X
The numeric field is converted into a packed number. The packed number is then converted into a hexadecimal number (see corresponding table).
XSTRING
As for fields of type X, except that leading zeros are not copied.
Source Type Packed Number
If the program attribute Fixed point arithmetic is set, the system rounds type P fields according to the number of decimal places or fills them out with zeros.
Conversion table for source type P
Target
Conversion
C
The packed field is transported right-justified to the character field, if required with a decimal point. The last position is reserved for the sign. Leading zeros appear as blanks. If the target field is too short, the sign is omitted for positive numbers. If this is still not sufficient, the field is truncated on the left. ABAP indicates the truncation with an asterisk (*). If you want the leading zeros to appear in the character field, use UNPACK instead of MOVE.
D
The packed field value represents the number of days since 01.01.0001 and is converted to a date in YYYYMMDD format.
F
The packed field is accepted and transported as a floating point number.
N
The packed field is rounded if necessary, unpacked, and then transported right-justified. The sign is omitted. If required, the target field is filled with zeros on the left.
I, P
A packed field is converted to type I. The resulting four bytes are placed into the target field right-justified. If the target field is too short, an overflow occurs. If the target field is longer, it is filled with zeros on the left.
STRING
As for fields of type C, except that leading zeros are not generated.
T
The packed field value represents the number of seconds since midnight and is converted to a time in HHMMSS format.
X
A packed field is converted to type I. The resulting four bytes are placed into the target field right-justified and in big-endian format. If the target field is too short, it is truncated from the left. If the target field is longer than 4, it is filled with zeros on the left. Negative numbers are represented by the two's complement (= bit complement +1).
XSTRING
As for fields of type X, except that leading zeros are not generated.
Source Type String
Conversion table for source type STRING
Target
Conversion
C
The target field is filled from left to right. If it is longer than the string, it is filled with trailing spaces. If it is too short, the contents are truncated from the right.
D
The string must contain an 8-character date in the format YYYYMMDD .
F
The contents of the string must be a valid representation of a type F field as described in Literals.
N
Only digits in the string are copied. The field is right-justified and filled with trailing zeros. If the target field is too short, it is truncated from the left.
I, P
The string must contain the representation of a decimal number, that is, a sequence of digits with an optional sign and no more than one decimal point. The source field can contain blanks. If the target field is too short, an overflow may occur. This may cause the system to terminate the program.
STRING
The source string is copied to the target string unconverted.
T
The string must contain a six-character time in HHMMSS format.
X
Since the character field must contain a hexadecimal-character string, the only valid characters are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. This character string is packed as a hexadecimal number, transported left-justified, and filled with zeros or truncated on the right.
XSTRING
As for target fields of type X, except that the field is not filled with zeros.
Source Type Time
Conversion table for source type T
Target
Conversion
C
The source field is transported left-justified without conversion.
D
Not supported. Results in an error message during the syntax check or in a runtime error.
F
The source field is converted into a packed number. The packed number is then converted into a floating point number (see corresponding table).
N
The date is converted into a character field. The character field is then converted into a numeric text field (see corresponding table).
I, P
The date is converted to the number of seconds since midnight.
STRING
The time is converted to a character field, which is then converted to a character string.
T
The date is transported left-justified without conversion and, if necessary, filled with zeros on the right.
X
The date is converted to the number of seconds since midnight in hexadecimal format.
XSTRING
As for fields of type X, except that only significant bytes are copied.
Source Type Hexadecimal Field
Conversion table for source type X
Target
Conversion
C
The value in the hexadecimal field is converted to a hexadecimal character string, transported left-justified to the target field, and filled with zeros.
D
The source field value represents the number of days since 01.01.0001 and is converted to a date in YYYYMMDD format.
F
The source field is converted into a packed number. The packed number is then converted into a floating point number (see corresponding table).
N
The source field is converted into a packed number. The packed number is then converted into a numeric text field (see corresponding table).
I, P
The value of the source field is interpreted as a hexadecimal number. It is converted to a packed decimal number and transported right-justified to the target field. If the hexadecimal field is longer than 4 bytes, only the last four bytes are converted. If it is too short, a runtime error may occur.
STRING
As for target fields of type C, except that the field is not filled with zeros. The length of the string is twice the length of the hexadecimal field.
T
The source field value represents the number of seconds since midnight and is converted to a time in HHMMSS format.
X
The value is transported left-justified and filled with X'00' on the right, if necessary.
XSTRING
The hexadecimal field is copied completely that is, trailing zeros are not truncated.
Source Type Byte Sequence
Conversion table for source type XSTRING
Target
Conversion
C
The value in the byte sequence is converted to a hexadecimal character string, transported left-justified to the target field, and filled with zeros.
D
The byte sequence value represents the number of days since 01.01.0001 and is converted to a date in YYYYMMDD format.
F
The content of the byte sequence is converted into a packed number. The packed number is then converted into a floating point number (see corresponding table).
N
The content of the byte sequence is converted into a packed number. The packed number is then converted into a numeric text field (see corresponding table).
I, P
The content of the byte sequence is interpreted as a hexadecimal number. It is converted to a packed decimal number and transported right-justified to the target field. If the byte sequence is longer than 4 bytes, only the last four bytes are converted. If it is too short, a runtime error may occur.
STRING
As for target fields of type C, except that the field is not filled with zeros. The length of the string is twice the length of the byte sequence.
T
The byte sequence value represents the number of seconds since midnight and is converted to a time in HHMMSS format.
X
The byte sequence is transported left-justified and filled with X'00' on the right, if necessary.
XSTRING
The source byte sequence is copied to the target byte sequence unconverted.
Conversion Rules for Internal Tables
Internal tables can only be converted into other internal tables. You cannot convert them into structures or elementary fields.
Internal tables are convertible if their line types are convertible. The convertibility of internal tables does not depend on the number of lines.
Conversion rules for internal tables:
Internal tables which have internal tables as their line type are convertible if the internal tables which define the line types are convertible.
Internal tables which have line types that are structures with internal tables as components are convertible according to the conversion rules for structures if the structures are compatible.
Conversion Rules for Structures
ABAP has one rule for converting structures that do not contain internal tables as components. There are no conversion rules for structures that contain internal tables. You can only make assignments between structures that are compatible.
You can combine convertible structures in the following combinations:
Converting a structure into a non-compatible structure
Converting elementary fields into structures
Converting structures into elementary fields
In each case, the system first converts all the structures concerned to type C fields and then performs the conversion between the two resulting elementary fields. The length of the type C fields is the sum of the lengths of the structure components. This rule applies to all operations using structures that do not contain internal tables.
If a structure is aligned, the filler fields are also added to the length of the type C field.
A non-aligned structure without filler fields:
If you convert a structure into a shorter structure, the original structure is truncated. If you convert a structure into a longer one, the parts at the end are not initialized according to their type, but filled with blanks.
It can make sense to assign a structure to another, incompatible, structure if, for example, the target structure is shorter than the source, and both structures have the same construction over the length of the shorter structure. However, numeric components of structures that are filled in incompatible assignments may contain nonsensical or invalid values that may cause runtime errors.
DATA: BEGIN OF FS1,
INT TYPE I VALUE 5,
PACK TYPE P DECIMALS 2 VALUE 2.26,
TEXT(10) TYPE C VALUE Fine text,
FLOAT TYPE F VALUE 1.234e+05,
DATA TYPE D VALUE 19950916,
END OF FS1.
DATA: BEGIN OF FS2,
INT TYPE I VALUE 3,
PACK TYPE P DECIMALS 2 VALUE 72.34,
TEXT(5) TYPE C VALUE Hello,
END OF FS2.
WRITE: / FS1-INT, FS1-PACK; FS1-TEXT, FS1-FLOAT, FS1-DATE.
WRITE: / FS2-INT, FS2-PACK, FS2-TEXT.
MOVE FS1 TO FS2.
WRITE: / FS2-INT, FS2-PACK, FS2-TEXT.
Don't forget to reward if useful... -
How to comment in smartform for text value in abap
how to comment in smartform for text value in abap.
i want to comment text value which is coming in output
From drag and drop option i had dropped an item text in text window and now i dont want to delete it i just want to comment it so can any one help me in commenting the text value.
Advance Thanks for your helphi
open the text element in the smartform.
on the left corner, we have text editor button.
open that and change the editor (goto-->change editor)
on the new line, give the format as comment line /*. and you can write the comments as required.
such lines doesnt reflect in the output layout.
thanks
pavan -
Is there a way of printing a text conversation
can a text conversation be uploaded onto the computer and printed? so you can see the times/dates etc?
i've seen people saying to take screen shots and print as picture but im wanting to know if a long period of conversation can be printed
thanksDo you have a Mac computer by any chance?
-
Issue in Excel to XML Conversion
Hi Gurus,
I am creating a custom java module in sap nwds 7.3 for Excel to XML Conversion. But I am getting following error
Classpath dependency validator message.
Classpath entry will not be exported or published. Runtime ClassNotFoundExceptions may result.
I imported the Jars from a different PI system and i am using NWDS in local PC with creating a separate folder with all JARs and also imported them using build path option.
This issue is occuring for all the jars imported.
I am using following code.
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.AbstractTrace;
import java.util.HashMap;
import jxl.Cell;
import jxl.Workbook;
public class JavaMappingExcelToXML implements StreamTransformation{
private Map map = null;
private AbstractTrace trace = null;
public void setParameter(Map arg0) {
map = arg0; // Store reference to the mapping parameters
if (map == null) {
this.map = new HashMap();
public static void main(String args[]) { //FOR EXTERNAL STANDALONE TESTING
try {
FileInputStream fin = new FileInputStream ("c:/ashu.xls"); //INPUT FILE (PAYLOAD)
FileOutputStream fout = new FileOutputStream ("C:/Users/ashutosh.a.upadhyay/My Documents/ashuXML2.xml"); //OUTPUT FILE (PAYLOAD)
JavaMappingXLStoXML mapping = new JavaMappingXLStoXML ();
mapping.execute(fin, fout);
catch (Exception e1) {
e1.printStackTrace();
public void execute(InputStream inputstream, OutputStream outputstream) {
String msgType = "Message Type name will come here";
String nameSpace = "Namespace Name will come here";
String xmldata = "";
try {
Workbook wb = Workbook.getWorkbook(inputstream);
xmldata ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+ "<ns0:"+msgType+" "+"xmlns:ns0=\""+nameSpace+"\n">";
Cell[] cells ;
Cell[] cellNames ;
cellNames = wb.getSheet(0).getRow(0);
for(int j=1;j<wb.getSheet(0).getRows();j++){
xmldata = xmldata+"\n<Record>\n";
cells = wb.getSheet(0).getRow(j);
for(int i=0;i<wb.getSheet(0).getColumns();i++){
xmldata = xmldata+"\t<"+cellNames[i].getContents()+">"+cells[i].getContents()+"</"+cellNames[i].getContents()+">\n";
xmldata = xmldata+"</Record>";
xmldata = xmldata+"\n</ns0:"+msgType+">";
System.out.print(xmldata);
xmldata.getBytes();
wb.close();
byte by[] = xmldata.getBytes();
outputstream.write(by);
inputstream.close();
outputstream.close();
System.out.println("\n"+"File processed");
catch (Exception e) {
e.printStackTrace();
Request you to guide how to resolve this issue.
Thanks in advanceThanks Anand,
PDF shared by you was extremely helpful. Now I have successfully developed and deployed the adapter. But while using it in Communication Channel I am getting following error.
Error: com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name localejbs/ExcelToXML, cannot resolve object reference. [Root exception is javax.naming.NamingException: Error occurs while the EJB Object Factory trying to resolve JNDI reference Reference Class Name: Type: clientAppName Content: sap.com/SAP_Exel_To_XMLEAR Type: interfaceType Content: local Type: ejb-link Content: Excel_To_XML Type: jndi-name Content: ExcelToXML Type: local-home Content: sap.com.excelToXML.Excel_To_XMLLocalHome Type: local Content: sap.com.excelToXML.Excel_To_XMLLocal com.sap.engine.services.ejb3.runtime.impl.refmatcher.EJBResolvingException: Cannot start applicationsap.com/SAP_Exel_To_XMLEAR; nested exception is: java.rmi.RemoteException: [ERROR CODE DPL.DS.6125] Error occurred while starting application locally and wait.; nested exception is: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: [ERROR CODE DPL.DS.5029] Exception in operation [startApp] with application [sap.com/SAP_Exel_To_XMLEAR]. at com.sap.engine.services.ejb3.runtime.impl.DefaultContainerRepository.startApp(DefaultContainerRepository.java:398) at com.sap.engine.services.ejb3.runtime.impl.DefaultContainerRepository.getEnterpriseBeanContainer(DefaultContainerRepository.java:182) at com.sap.engine.services.ejb3.runtime.impl.DefaultRemoteObjectFactory.resolveReference(DefaultRemoteObjectFactory.java:55) at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:144) at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:63) at com.sap.engine.system.naming.provider.ObjectFactoryBuilderImpl._getObjectInstance(ObjectFactoryBuilderImpl.java:76) at com.sap.engine.system.naming.provider.ObjectFactoryBuilderImpl.access$100(ObjectFactoryBuilderImpl.java:33) at com.sap.engine.system.naming.provider.ObjectFactoryBuilderImpl$DispatchObjectFactory.getObjectInstance(ObjectFactoryBuilderImpl.java:226) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:283) at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:434) at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:223) at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:242) at javax.naming.InitialContext.lookup(InitialContext.java:351) at javax.naming.InitialContext.lookup(InitialContext.java:351) at com.sap.aii.af.lib.util.ejb.FastEjbFactory.createEjbInstance(FastEjbFactory.java:69) at com.sap.aii.af.lib.util.ejb.FastEjbFactory.createEjbInstance(FastEjbFactory.java:50) at com.sap.aii.af.app.mp.ejb.ModuleProcessorBean.getModuleLocal(ModuleProcessorBean.java:419) at com.sap.aii.af.app.mp.ejb.ModuleProcessorBean.process(ModuleProcessorBean.java:287) at sun.reflect.GeneratedMethodAccessor946.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:46) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:74) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:191) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:23) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133) at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164) at com.sun.proxy.$Proxy3299.process(Unknown Source) at com.sap.aii.adapter.file.File2XI.send(File2XI.java:3605) at com.sap.aii.adapter.file.File2XI.processFileList(File2XI.java:1374) at com.sap.aii.adapter.file.File2XI.invoke(File2XI.java:669) at com.sap.aii.af.lib.scheduler.JobBroker$Worker.run(JobBroker.java:534) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:182) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:280) ]
pl
please help -
How to create a job thru ABAP program for calling a program with variant???
Hello experts,
can u give me step wise procedure to create jobs for a program with a variant name thru ABAP???
Also, can a transaction can be scheduled as a job to run in background with a variant name???
Edited by: SAP USER on Jul 22, 2008 6:08 AMHi,
To create a job through ABAP program you can do the following.
Go to Menu bar.
In there, go to SYTSTEM> SERVICES> JOBS--> DEFINE JOB.
Then give the JOB NAME and CLASS in the screen that comes up.
This is how we schedule a program.
Now, to create a variant for a program -
First activate your program in SE38. Then execute it .
Now, click on SAVE button. It will open up the variant creation screen. Give the details there like variant name and value for the fields. Save and come back.
Hope this helps.
Regards,
Hari Kiran -
How to download data from spool to excel file
Hi,
I have requirement like....i need to download data from spool to excel file.
Please let me know the process how to download...
<removed by moderator>
<removed by moderator>
Thanks,
Khasimsa
Moderator message: please (re)search yourself before asking, do not assign priorities, do not offer re-ward
locked by: Thomas Zloch on Sep 8, 2010 1:18 PMHi try this way..
*FM called that returns the Spool Request Number data into and internal table
CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
EXPORTING
rqident = p_spool "Spool Request Number
first_line = 1
TABLES
buffer = it_spool_xls "Internal table that will have the Spool Request No data
EXCEPTIONS
no_such_job = 1
not_abap_list = 2
job_contains_no_data = 3
selection_empty = 4
no_permission = 5
can_not_access = 6
read_error = 7
OTHERS = 8.
*To convert the spool data into excel format
CALL FUNCTION 'SO_RAW_TO_RTF'
TABLES
objcont_old = it_spool_xls "Internal table having spool data
objcont_new = it_xls_spool. "Int table having Excel format data converted from Spool data
"call GUI down Load by passing it_xls_spool
Prabhudas -
Patching ST_PI, open conversions in ABAP dictionary
Hello
during a patching of ST-21 2008 the tool stops at CHECK_REQUIREMENTS phase with the screen:
open conversions in ABAP dictionary
Some open conversion requests still exist in the ABAP Dictionary for the
following ABAP Dictionary objects. To avoid inconsistencies and loss of
data, you must process these conversions first.
Proceed as follows:
- Open a new session.
- Start the Database Utility (transaction SE14).
- Correct the inconsistencies for the specified objects.
- Repeat the import phase. If no more inconsistencies are found, the
import continues.
INDEX GLPCA-Z01
Now , no index exists in dictionary and database but in the past probably it existed and was cancelled . Anyway the table GLPCA is consistent in database and like runtime object.
I've activated it again but the problem is always the same
any idea?
thanks
Nicola- start transaction SE14
- use the menue to "DB Requests - Created with import"
Check if there are any outstanding conversions.
Markus -
Creating a custom java module for excel to xml conversion.
Hi Gurus,
I am creating a custom java module in sap nwds 7.3 for Excel to XML Conversion. But I am getting following error
Classpath dependency validator message.
Classpath entry will not be exported or published. Runtime ClassNotFoundExceptions may result.
I imported the Jars from a different PI system and i am using NWDS in local PC with creating a separate folder with all JARs and also imported them using build path option.
This issue is occuring for all the jars imported.
I am using following code.
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.AbstractTrace;
import java.util.HashMap;
import jxl.Cell;
import jxl.Workbook;
public class JavaMappingExcelToXML implements StreamTransformation{
private Map map = null;
private AbstractTrace trace = null;
public void setParameter(Map arg0) {
map = arg0; // Store reference to the mapping parameters
if (map == null) {
this.map = new HashMap();
public static void main(String args[]) { //FOR EXTERNAL STANDALONE TESTING
try {
FileInputStream fin = new FileInputStream ("c:/ashu.xls"); //INPUT FILE (PAYLOAD)
FileOutputStream fout = new FileOutputStream ("C:/Users/ashutosh.a.upadhyay/My Documents/ashuXML2.xml"); //OUTPUT FILE (PAYLOAD)
JavaMappingXLStoXML mapping = new JavaMappingXLStoXML ();
mapping.execute(fin, fout);
catch (Exception e1) {
e1.printStackTrace();
public void execute(InputStream inputstream, OutputStream outputstream) {
String msgType = "Message Type name will come here";
String nameSpace = "Namespace Name will come here";
String xmldata = "";
try {
Workbook wb = Workbook.getWorkbook(inputstream);
xmldata ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+ "<ns0:"+msgType+" "+"xmlns:ns0=\""+nameSpace+"\n">";
Cell[] cells ;
Cell[] cellNames ;
cellNames = wb.getSheet(0).getRow(0);
for(int j=1;j<wb.getSheet(0).getRows();j++){
xmldata = xmldata+"\n<Record>\n";
cells = wb.getSheet(0).getRow(j);
for(int i=0;i<wb.getSheet(0).getColumns();i++){
xmldata = xmldata+"\t<"+cellNames[i].getContents()+">"+cells[i].getContents()+"</"+cellNames[i].getContents()+">\n";
xmldata = xmldata+"</Record>";
xmldata = xmldata+"\n</ns0:"+msgType+">";
System.out.print(xmldata);
xmldata.getBytes();
wb.close();
byte by[] = xmldata.getBytes();
outputstream.write(by);
inputstream.close();
outputstream.close();
System.out.println("\n"+"File processed");
catch (Exception e) {
e.printStackTrace();
Request you to guide how to resolve this issue.
Thanks in advanceHi Gurus,
I am creating a custom java module in sap nwds 7.3 for Excel to XML Conversion. But I am getting following error
Classpath dependency validator message.
Classpath entry will not be exported or published. Runtime ClassNotFoundExceptions may result.
I imported the Jars from a different PI system and i am using NWDS in local PC with creating a separate folder with all JARs and also imported them using build path option.
This issue is occuring for all the jars imported.
I am using following code.
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.AbstractTrace;
import java.util.HashMap;
import jxl.Cell;
import jxl.Workbook;
public class JavaMappingExcelToXML implements StreamTransformation{
private Map map = null;
private AbstractTrace trace = null;
public void setParameter(Map arg0) {
map = arg0; // Store reference to the mapping parameters
if (map == null) {
this.map = new HashMap();
public static void main(String args[]) { //FOR EXTERNAL STANDALONE TESTING
try {
FileInputStream fin = new FileInputStream ("c:/ashu.xls"); //INPUT FILE (PAYLOAD)
FileOutputStream fout = new FileOutputStream ("C:/Users/ashutosh.a.upadhyay/My Documents/ashuXML2.xml"); //OUTPUT FILE (PAYLOAD)
JavaMappingXLStoXML mapping = new JavaMappingXLStoXML ();
mapping.execute(fin, fout);
catch (Exception e1) {
e1.printStackTrace();
public void execute(InputStream inputstream, OutputStream outputstream) {
String msgType = "Message Type name will come here";
String nameSpace = "Namespace Name will come here";
String xmldata = "";
try {
Workbook wb = Workbook.getWorkbook(inputstream);
xmldata ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+ "<ns0:"+msgType+" "+"xmlns:ns0=\""+nameSpace+"\n">";
Cell[] cells ;
Cell[] cellNames ;
cellNames = wb.getSheet(0).getRow(0);
for(int j=1;j<wb.getSheet(0).getRows();j++){
xmldata = xmldata+"\n<Record>\n";
cells = wb.getSheet(0).getRow(j);
for(int i=0;i<wb.getSheet(0).getColumns();i++){
xmldata = xmldata+"\t<"+cellNames[i].getContents()+">"+cells[i].getContents()+"</"+cellNames[i].getContents()+">\n";
xmldata = xmldata+"</Record>";
xmldata = xmldata+"\n</ns0:"+msgType+">";
System.out.print(xmldata);
xmldata.getBytes();
wb.close();
byte by[] = xmldata.getBytes();
outputstream.write(by);
inputstream.close();
outputstream.close();
System.out.println("\n"+"File processed");
catch (Exception e) {
e.printStackTrace();
Request you to guide how to resolve this issue.
Thanks in advance -
How to read a mail from sap inbox thru abap code?
how to read a mail from sap INBOX thru abap code? can anyone tell me the technical approach? I NEED TO READ A MAIL and then need to pass the parameters to a bapi.
Message was edited by:
shahid mohammed syedHi SSM,
Did you manage to have your program working? I also have same requirement. I tried standard FM and BAPI but I always encounter authorization error when I tried accessing other user's mail. Thanks.
Regards,
Ryan -
Messy format exporting to excel and text/html
Need help please....i'm in the middle of problems, i'm developing application that can exporting reports to some formats like pdf, excel, and text/html. it is become a problem when i exporting it to excel or text/html, the format are so messy... I'm using POI library 2.0 when exporting to excel. My codes are simply like this :
try {
response.setContentType(type);
if ("application/vnd.ms-excel".equals(type)) {
exporter = new JRXlsExporter();
exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT,jasperPrint);
exporter.setParameter(JRXlsExporterParameter.OUTPUT_STREAM,response.getOutputStream());
else if ("text/html".equals(type)) {
exporter = new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT,
jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER,response.getWriter());
is it just because the library? or i have to add some additional code before jasper reports execute it? thanks a lot for the answers....
Message was edited by:
darma_sadha
Message was edited by:
darma_sadha
Message was edited by:
darma_sadhaFirst, you forgot to tell what the problem is. Second: this is not a Jakarta product support forum. POI has a mailing list of its own. Go ask them.
Maybe you are looking for
-
Can I install Mountain Lion in my Mac Pro
Can I install Mountain Lion in my Mac Pro? This is my main computer and i only wnt to move forward if I know that it is 100% compatible with OS 10.8. They tell you to look to see when it was built but there is no date that I can see. I'm pretty sur
-
4 TB Hitachi drives won't fit in 2008 Mac Pro
I just purchased 2x 4 TB Hitachi drives for my 2008 (3,1) Mac Pro. When I went to install them, they would not fit. I mounted the drives to the sleds, and tried to slide them in. They would only go about 95% of the way, and I could see that the SATA
-
SCCM collection report for software NOT on a workstation
One of the default reports in SCCM generates a report on the number of software titles in a collection using 2 prompts(Collections, Software Title) SELECT DisplayName0, Count(ProdID0) AS 'Green', Publisher0, Version0, @CollID as CollectionID FROM v_A
-
Anyone having issues enabling Character Count in ios6?
I noticed today on my iPhone 5 when I enable character count, Settings-Messages-Character Count (ON), it doesn't work? Anyone notice this? Bug?
-
Although I'm using Group Policies to restrict my Drives access from group policies, still Firefox exposing my Drives content when I type C:\. This is creating us very big problem. How to disable it. I made some changes in Browser.js file in past but