XSTRING to PrintPreview
Hello Guru's
i got a little Question: I created multiple PDF-Forms with Adobe Interactive Forms. After that i merged them to 1 Single PDF with PDFTK. Right now i got the merged PDF type XSTRING as return value.
Now i want this XSTRING to be displayed in the PrintPreview INSTEAD of the multiple single PDF Pages.
Any ideas?
Regards Oli
SOLVED.
Did it like Described here: [Solution|XSTRING to PDF ? AIF.;
Similar Messages
-
Open Adobe Print Form from ALV Int. Rprt using the XSTRING already present
Hello Friends,
I have a typicall issue that how to open a Adobe Print Form when a user double clicks in the ALV Report. Here when the user double clicks in the ALV Interactive Report using the unique ID I am getting the Adobe Form from a FTP location in the Form of XSTRING, now using the ABAP ADOBE PRINT FORM not using WebDynpro Application, I need to process this XSTRING and show up the Adobe Print Form.
OR
Is there a way to send the XSTRING to the Output Device or Printer to Display the PDF Form.
Friends please help me in solving this issue.
Thanks and Regards
Pradeep Goli
Edited by: Pradeep Goli on Mar 19, 2009 1:49 PM
Edited by: Pradeep Goli on Mar 19, 2009 2:51 PMHi Pradeep Goli,
it is possible to show PDF in SAP GUI.
Michal
REPORT ZTEST_DISPLAY_PDF.
* You must create dynpro 500 with custom control named HTML.
* In this custom control will be displayed PDF.
DATA: g_pdf TYPE xstring,
pdf_my_container TYPE REF TO cl_gui_custom_container,
pdf_html_control TYPE REF TO cl_gui_html_viewer.
START-OF-SELECTION.
PERFORM create_and_display.
FORM create_and_display.
*** Your code fo filling g_pdf
CALL SCREEN '500'.
ENDFORM.
* PDF preview in HTML control
module html_control output.
perform pbo_html_control.
endmodule.
module html_control input.
perform pai_html_control.
endmodule.
* PAI
FORM pai_html_control.
SET SCREEN '0'.
ENDFORM.
* Showing of PDF
FORM pbo_html_control.
DATA: l_pdf_alignment TYPE i,
l_count TYPE i,
l_noprint TYPE fpboolean,
l_noarc TYPE fpboolean,
l_noprintarc TYPE fpboolean.
* CLEAR: fcode.
SET PF-STATUS 'VIEW_PDF'.
* container
IF pdf_my_container IS INITIAL.
CREATE OBJECT pdf_my_container
EXPORTING
container_name = 'HTML'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE e150(FPRUNX).
RETURN.
ENDIF.
ENDIF.
* html control
IF pdf_html_control IS INITIAL.
CREATE OBJECT pdf_html_control
EXPORTING
parent = pdf_my_container
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE e150(FPRUNX).
RETURN.
ENDIF.
* alignment
l_pdf_alignment = pdf_html_control->align_at_left +
pdf_html_control->align_at_right +
pdf_html_control->align_at_top +
pdf_html_control->align_at_bottom.
CALL METHOD pdf_html_control->set_alignment
EXPORTING
alignment = l_pdf_alignment
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE e150(FPRUNX).
RETURN.
ENDIF.
ENDIF.
PERFORM pdf_show USING g_pdf.
ENDFORM.
FORM pdf_show USING p_pdf_data TYPE xstring.
STATICS: ls_url TYPE i.
TYPES: lt_pdf_table(1000) TYPE x.
DATA: l_myurl(80) TYPE c,
l_url(80) TYPE c,
l_pdf_data TYPE STANDARD TABLE OF lt_pdf_table,
l_pdf_size TYPE i,
l_pdf_line TYPE lt_pdf_table,
l_offset TYPE i,
l_len TYPE i.
l_pdf_size = XSTRLEN( p_pdf_data ).
l_len = l_pdf_size.
WHILE l_len >= 1000.
l_pdf_line = p_pdf_data+l_offset(1000).
APPEND l_pdf_line TO l_pdf_data.
ADD 1000 TO l_offset.
SUBTRACT 1000 FROM l_len.
ENDWHILE.
IF l_len > 0.
l_pdf_line = p_pdf_data+l_offset(l_len).
APPEND l_pdf_line TO l_pdf_data.
ENDIF.
ADD 1 TO ls_url.
l_myurl(8) = ls_url.
CONCATENATE l_myurl '.pdf' INTO l_myurl.
SHIFT l_myurl LEFT DELETING LEADING space.
CALL METHOD pdf_html_control->load_data
EXPORTING
url = l_myurl
size = l_pdf_size
type = 'application' "#EC NOTEXT
subtype = 'pdf' "#EC NOTEXT
IMPORTING
assigned_url = l_url
CHANGING
data_table = l_pdf_data
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE e152(FPRUNX).
RETURN.
ENDIF.
* show data
CALL METHOD pdf_html_control->show_data
EXPORTING
url = l_url
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE e152(FPRUNX).
RETURN.
ENDIF.
ENDFORM. -
Fm to convert XSTRING TO STRING in SRM 7.0
HI All ,
i have created a web dynpro application for Uploading excel . Now i am not getting any workaround to convert X STRING to STRING . In SAP there is a FM HR_KR_XSTRING_TO_STRING but its not there in SRM so when i tried to copy the same in SRM and try to convert its getting converted in Junk characters . Please help me out in this .
Regards
ShankarHI Nilema ,
I have tried ur code also but still the same result .
METHOD onactionon_upload .
TYPES :
BEGIN OF str_itab,
name(10) TYPE c,
age(10) TYPE c,
END OF str_itab.
DATA : t_table1 TYPE STANDARD TABLE OF str_itab,
i_data TYPE STANDARD TABLE OF string,
lo_nd_sflight TYPE REF TO if_wd_context_node,
lo_el_sflight TYPE REF TO if_wd_context_element,
l_string TYPE string,
fs_table TYPE str_itab,
l_xstring TYPE xstring,
fields TYPE string_table,
lv_field TYPE string,
lv_codepage TYPE CPCODEPAGE.
DATA : t_table TYPE if_main=>element_datatab,
data_table TYPE if_main=>element_datatab.
get single attribute
break akedia.
wd_context->get_attribute(
EXPORTING
name = `DATASOURCE`
IMPORTING
value = l_xstring ).
CALL FUNCTION 'SCP_CODEPAGE_BY_EXTERNAL_NAME'
EXPORTING
external_name = 'ISO-8859-1'
KIND = 'H'
IMPORTING
SAP_CODEPAGE = lv_codepage
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
IF sy-subrc <> 0.
lv_codepage = '1100'.
ENDIF.
CALL FUNCTION 'LXE_COMMON_XSTRING_TO_STRING'
EXPORTING
in_xstring = l_xstring
IN_CODEPAGE = lv_codepage
EX_CODEPAGE = '0000'
UNMASK_CRLF = ''
IMPORTING
EX_STRING = l_string
EXCEPTIONS
ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE i_data.
Bind With table Element.
LOOP AT i_data INTO l_string.
SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
READ TABLE fields INTO lv_field INDEX 1.
fs_table-name = lv_field.
READ TABLE fields INTO lv_field INDEX 2.
fs_table-age = lv_field.
APPEND fs_table TO t_table1.
ENDLOOP.
lo_nd_sflight = wd_context->get_child_node( 'DATATAB' ).
lo_nd_sflight->bind_table( t_table1 ).
ENDMETHOD. -
Excise duty @10% not displaying in printpreview----SAP INVOICE
Dear experts,
Here in Sap invoice Excise duty @10% is not displaying in the printpreview. I tried debugging in Report program, but couldn't able to find the solution. so please give me the solution with step by step, Because am new to this one.
Thanks & regards,
selvakumar.Hi ravi,
Yes ofcourse am using smartform, Here in billing document(invoice) printpreview. there are some excise columns like edu cess,vat and all. The same ''excise duty @10%'' and the value of the excise duty also not displaying in the billing document printpreview.....I have debugged smartform nothing wrong with smartform. So there amy be some problem with the abap editor.
I have the conditions like Wa_final-exp ne intial
Wa_final-fkart ne 'yrmf'
Wa_final-fkart ne 'yctf''.
please let me know what is the problem in it.
Thanks & regards,
selva.................... -
Adobe Forms function module - downloading the xstring output in PDF file
Hi Guys,
I'm using Adobe forms and fetching its output in an XSTRING PDF format. How can I download this XSTRING output to a PDF file and store on the local file system?
I'm using the following approach to getting a PDF output:
ls_outputparams-getpdf = 'X'.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = ls_outputparams.
* Get the name of the generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'ZADOBEFORM'
IMPORTING
e_funcname = lv_fmname.
IF sy-subrc <> 0.
ELSE.
* Call the Adobe Form function module
CALL FUNCTION lv_fmname
EXPORTING
/1bcdwb/docparams = ls_docparams
IMPORTING
/1bcdwb/formoutput = ls_form_output
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
* Close the spool job
CALL FUNCTION 'FP_JOB_CLOSE'.
Now, the variable LS_FORM_OUTPUT-PDF contains the PDF output in XSTRING. My question is how can I download this as a PDF file to my local machine.
Kind Regards,
Shailesh.hi guys,
im using all FM to download my PDF adobe but in this part :
ls_spfli-carrid = 'AA'.
ls_spfli-connid = '0017'.
APPEND ls_spfli TO it_spfli.
flag = 'X'.
is_address_type = '1'.
is_address_number = '22515'.
is_person_number = '22517'.
is_country = 'IN'.
*&--- Call the generated function module
CALL FUNCTION '/1BCDWB/SM00000200'
EXPORTING
* /1BCDWB/DOCPARAMS =
it_spfli = it_spfli
flag = flag
is_address_type = is_address_type
is_address_number = is_address_number
is_person_number = is_person_number
is_country = is_country
IMPORTING
/1bcdwb/formoutput = fp_formoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4
I have usage_error knowing that the execution of the function module in SE37 pass successfuly and also the execution of the forms .
in your opinion what can be the problem?
Kind Regards, -
PrintPreview for a GridControl ?
Hello guys,
I like to show a PrintPreview of a
GridControl. So user could see the style of
GridControl before printing.
I found a peace of code as a class that
we can instantiate it to view a printPreviw
of a "JTable". It works fine when I pass
JTable as a Printable job to the
my PrintPreview class.
That's a valuable code which every body can use it(I paste it below).
But I could not Print Preview a GridControl.
My question is "How can I use this peace of code to Print Preview a GridControl".
// Print Preview class for JTable
package Tree;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.print.*;
import javax.swing.border.*;
public class MyPrintPreview extends JFrame {
BorderLayout borderLayout1 = new BorderLayout();
JPanel jPanel1 = new JPanel();
protected int m_wPage;
protected int m_hPage;
protected Printable m_target;
protected JComboBox m_cbScale;
protected PreviewContainer m_preview;
public MyPrintPreview(Printable target) {
this(target, "Print Preview");
public MyPrintPreview(Printable target, String title) {
super(title);
setSize(600, 400);
m_target = target;
JToolBar tb = new JToolBar();
JButton bt = new JButton("Print", new ImageIcon("print.gif"));
ActionListener lst = new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
// Use default printer, no dialog
PrinterJob prnJob = PrinterJob.getPrinterJob();
prnJob.setPrintable(m_target);
setCursor( Cursor.getPredefinedCursor(
Cursor.WAIT_CURSOR));
prnJob.print();
setCursor( Cursor.getPredefinedCursor(
Cursor.DEFAULT_CURSOR));
dispose();
catch (PrinterException ex) {
ex.printStackTrace();
System.err.println("Printing error: "+ex.toString());
bt.addActionListener(lst);
bt.setAlignmentY(0.5f);
bt.setMargin(new Insets(4,6,4,6));
tb.add(bt);
bt = new JButton("Close");
lst = new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
bt.addActionListener(lst);
bt.setAlignmentY(0.5f);
bt.setMargin(new Insets(2,6,2,6));
tb.add(bt);
String[] scales = { "10 %", "25 %", "50 %", "100 %" };
m_cbScale = new JComboBox(scales);
lst = new ActionListener() {
public void actionPerformed(ActionEvent e) {
Thread runner = new Thread() {
public void run() {
String str = m_cbScale.getSelectedItem().
toString();
if (str.endsWith("%"))
str = str.substring(0, str.length()-1);
str = str.trim();
int scale = 0;
try { scale = Integer.parseInt(str); }
catch (NumberFormatException ex) { return; }
int w = (int)(m_wPage*scale/100);
int h = (int)(m_hPage*scale/100);
Component[] comps = m_preview.getComponents();
for (int k=0; k<comps.length; k++) {
if (!(comps[k] instanceof PagePreview))
continue;
PagePreview pp = (PagePreview)comps[k];
pp.setScaledSize(w, h);
m_preview.doLayout();
m_preview.getParent().getParent().validate();
runner.start();
m_cbScale.addActionListener(lst);
m_cbScale.setMaximumSize(m_cbScale.getPreferredSize());
m_cbScale.setEditable(true);
tb.addSeparator();
tb.add(m_cbScale);
getContentPane().add(tb, BorderLayout.NORTH);
m_preview = new PreviewContainer();
PrinterJob prnJob = PrinterJob.getPrinterJob();
PageFormat pageFormat = prnJob.defaultPage();
if (pageFormat.getHeight()==0 | | pageFormat.getWidth()==0) {
System.err.println("Unable to determine default page size");
return;
m_wPage = (int)(pageFormat.getWidth());
m_hPage = (int)(pageFormat.getHeight());
int scale = 10;
int w = (int)(m_wPage*scale/100);
int h = (int)(m_hPage*scale/100);
int pageIndex = 0;
try {
while (true) {
BufferedImage img = new BufferedImage(m_wPage,
m_hPage, BufferedImage.TYPE_INT_RGB);
Graphics g = img.getGraphics();
g.setColor(Color.white);
g.fillRect(0, 0, m_wPage, m_hPage);
if (target.print(g, pageFormat, pageIndex) !=
Printable.PAGE_EXISTS)
break;
PagePreview pp = new PagePreview(w, h, img);
m_preview.add(pp);
pageIndex++;
ca tch (PrinterException e) {
e.printStackTrace();
System.err.println("Printing error: "+e.toString());
JScrollPane ps = new JScrollPane(m_preview);
getContentPane().add(ps, BorderLayout.CENTER);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setVisible(true);
class PreviewContainer extends JPanel
protected int H_GAP = 16;
protected int V_GAP = 10;
public Dimension getPreferredSize() {
int n = getComponentCount();
if (n == 0)
return new Dimension(H_GAP, V_GAP);
Component comp = getComponent(0);
Dimension dc = comp.getPreferredSize();
int w = dc.width;
int h = dc.height;
Dimension dp = getParent().getSize();
int nCol = Math.max((dp.width-H_GAP)/(w+H_GAP), 1);
int nRow = n/nCol;
if (nRow*nCol < n)
nRow++;
int ww = nCol*(w+H_GAP) + H_GAP;
int hh = nRow*(h+V_GAP) + V_GAP;
Insets ins = getInsets();
return new Dimension(ww+ins.left+ins.right,
hh+ins.top+ins.bottom);
public Dimension getMaximumSize() {
return getPreferredSize();
public Dimension getMinimumSize() {
return getPreferredSize();
public void doLayout() {
Insets ins = getInsets();
int x = ins.left + H_GAP;
int y = ins.top + V_GAP;
int n = getComponentCount();
if (n == 0)
return;
Component comp = getComponent(0);
Dimension dc = comp.getPreferredSize();
int w = dc.width;
int h = dc.height;
Dimension dp = getParent().getSize();
int nCol = Math.max((dp.width-H_GAP)/(w+H_GAP), 1);
int nRow = n/nCol;
if (nRow*nCol < n)
nRow++;
int index = 0;
for (int k = 0; k<nRow; k++) {
for (int m = 0; m<nCol; m++) {
if (index >= n)
return;
comp = getComponent(index++);
comp.setBounds(x, y, w, h);
x += w+H_GAP;
y += h+V_GAP;
x = ins.left + H_GAP;
class PagePreview extends JPanel
protected int m_w;
protected int m_h;
protected Image m_source;
protected Image m_img;
public PagePreview(int w, int h, Image source) {
m_w = w;
m_h = h;
m_source= source;
m_img = m_source.getScaledInstance(m_w, m_h,
Image.SCALE_SMOOTH);
m_img.flush();
setBackground(Color.white);
setBorder(new MatteBorder(1, 1, 2, 2, Color.black));
public void setScaledSize(int w, int h) {
m_w = w;
m_h = h;
m_img = m_source.getScaledInstance(m_w, m_h,
Image.SCALE_SMOOTH);
repaint();
public Dimension getPreferredSize() {
Insets ins = getInsets();
return new Dimension(m_w+ins.left+ins.right,
m_h+ins.top+ins.bottom);
public Dimension getMaximumSize() {
return getPreferredSize();
public Dimension getMinimumSize() {
return getPreferredSize();
public void paint(Graphics g) {
g.setColor(getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
g.drawImage(m_img, 0, 0, this);
paintBorder(g);
}// end of myPrintPreview class
// Add below code to your Applet/Application
// first add a item menu on your menu
MenuFilePrintPreview.setText("Print Preview");
MenuFile.add(MenuFilePrintPreview);
ActionListener lstPreview = new ActionListener() {
public void actionPerformed(ActionEvent e) {
Thread runner = new Thread() {
public void run() {
setCursor(Cursor.getPredefinedCursor(
Cursor.WAIT_CURSOR));
try{
new MyPrintPreview(this ,"My Print Preview");
}catch(Exception e){
e.printStackTrace();
System.err.println("Printer Error: "+e.toString());
setCursor(Cursor.getPredefinedCursor(
Cursor.DEFAULT_CURSOR));
runner.start();
MenuFilePrintPreview.addActionListener(lstPreview);
nullAli,
The piece you are missing is the code to get the JTable that is underlying your GridControl. You do this as follows:
JTable tableView = myGridControl.getTable();
Blaise
null -
How can I extract the data from Xstring .
Hi Gurus ,
How can I extract the data from a XSTRING .
I have to get the data which is filled in the survey form the data is getting saved in form of xstring .
Someone told me that there is a standard FM for that . but I am not able to find .
Please reply with the FM in case some one knows about it .
Thanks in advance .The following code works as of 7.0 (in any SAP system):
FORM XSTRING_TO_STRING USING input TYPE xstring CHANGING output TYPE string.
TYPES : BEGIN OF ty_struc,
line TYPE c LENGTH 100,
END OF ty_struc.
DATA lt_char TYPE TABLE OF ty_struc.
DATA length TYPE i.
length = xstrlen( input ) / cl_abap_char_utilities=>charsize.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = input
tables
binary_tab = lt_char.
CONCATENATE LINES OF lt_char INTO output RESPECTING BLANKS.
output = output(length).
ENDFORM.
Edited by: Sandra Rossi on Mar 30, 2010 12:24 AM -
Convert XString to String and String to IWDResource
Hi everybody,
we want to open a PDF-Document from Backend in Web Dynpro. For the communication we use a Web Service.
In Backend we have a PDF-Document with data type XSTRING.
1. In Backend we convert the PDF-Document from XSTRING to STRING in order to send it via Web Service
2. Then we call the Web Service and pass by the STRING param
3. In Web Dynpro we convert the value from STRING to Bytes, like below:
IWDResource resource = WDResourceFactory.createResource( myPDFStringFromWS.getBytes(), "Doc1", WDWebResourceType.PDF);
4. We bind the Resource to a FileDownload-UI.
Unfortunately we get the error message: Document is not a valid PDF
How can we convert a String to IWDResource? Could the problem be in our first step, where we convert the XSTRING into STRING?
regards,
SidHello Sid,
IWDResource resource = WDResourceFactory.createCachedResource(new ByteArrayInputStream(wdContext.currentFileElement().getString()),"PDF",WDWebResourceType.PDF,true);
IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.toString(),"PDF");
window.show();
Can you try this and let us know.
Regards
Nizamudeen SM -
Create image of XSTRING data and display it in Web Dynpro
Hello,
I am trying to dynamically display an image in a Web Dynpro ABAP Image-Control. The problem is that the data is stored in the DB as XSTRING and I can't find a Method for example to create a new object in the MIME-Repository of the data which is read out of the DB at runtime.
I have already converted the XSTRING into w3mime-Format with the function module RSFO_XSTRING_TO_MIME, but the Control needs a string of a url to display the image (for example to a MIME-Object of the component or a link to a file on the ITS).
Is there somehow a possibility to do this?
Thanks for your help,
Kolja
Solved this way: See /people/brian.mckellar/blog/2003/09/30/bsp-in-depth-writing-an-http-handler
Message was edited by: Kolja EweringHi you may go through the below post to find what could be a better way to do that.
http://forum.java.sun.com/thread.jspa?threadID=5163829
REGARDS,
RaHuL -
Hi All,
I need to convert the XSTRING to STRING and i need a FM or method which converts all the special characters like Å, ö, ä, å, ü as it is.
Im getting the xstring value from excel sheet using file upload in WEB UI.
The class used is CL_HTMLB_FILEUPLOAD and the attribute is FILE_CONTENT which is of type XSTRING.
I have few special characters in the excel sheet which i need as string.
I have modified this FM CRM_IC_XML_XSTRING2STRING to convert the Xstrin gto string... but stilll the replacement is not working.
Can anyone suggest me...Any different solution i can use to get the file upload in string. Or get the characters from Xstring
Useful answers are much apprieciated.
Thanx in advance
Siva.Hey,
Why dont you check this method
ECATT_CONV_STRING_TO_XSTRING. Not sure whether it supports special characters or not
Regards,
Vinay -
Messy code problem while translating XString to String in OfficeControl
Hi Expert,
I have messy code problem while translating XString to String in XML-Format Word Doc in OfficeControl.
I upload an XML-Format template Word Doc to server as a MIME Object.
When OfficeControl is started in Web Dynpro, OfficeControl automatically open the XML-Format template.
For the first time, I get the XString-type Context attribute bind to the content of the Word Doc,
then translate it to string, I got the XML-format content, it's great!
However, after the first time, when I input any new contents in MS Word in Web Dynpro,
no matter I execute "Ctrl + S" or click the "savedocument" button,
when I translate the XString Context attribute to String, I got messy code. (but the first time, it is good plain text)
I use the function module: ECATT_CONV_XSTRING_TO_STRING (good for first time, dump after first time),
SCMS_XSTRING_TO_BINARY, SCMS_BINARY_TO_STRING (good for first time, messy code after first time).
My Demo source code is in: (system) SMV --> (local object) zhaode --> (Dynpro Component) ztest_office_control
core source code is as:
clear itab.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = lv_datas
IMPORTING
OUTPUT_LENGTH = lv_length
TABLES
binary_tab = itab.
CALL FUNCTION 'SCMS_BINARY_TO_STRING'
EXPORTING
input_length = lv_length
mimetype = 'text/plain; charset=utf-8'
IMPORTING
text_buffer = lv_datas_string
output_length = lv_data_len
TABLES
binary_tab = itab.
Can you give me some advice?
Many thanks in advance.
Best Regards,You have already posted this same question several times (and some very similiar questions) within the forum. Please do NOT multiple post your questions. This is against the forum rules of engagement. SAP employee or not, you will find yourself banned from the forums if you don't follow the rules.
-
Error converting XSTRING to STRING (unicode, codepage)
Hi all,
I have a problem converting data from an external file into SAP.
The file is uploaded via an application created in web dynpro, where I use the upload functionality. This returns the file in the XSTRING format, and then use the following to convert (where l_xstring is the file and l_string is how I want the file):
l_string TYPE string,
l_xstring TYPE xstring,
convt = cl_abap_conv_in_ce=>create( input = l_xstring ).
convt->read( IMPORTING data = l_string ).
This worked perfectly - until I recieved a file containing russian characters
The SAP system (BI) is in Unicode, so this should be ok.
I get a:
CONVT_CODEPAGE
CX_SY_CONVERSION_CODEPAGE
Error, when trying to run it.
Also the following migth be helpful:
At the conversion of a text from codepage '4110' to codepage '4102':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
The running ABAP program 'CL_ABAP_CONV_IN_CE============CP' had to be
terminated as the conversion
would have produced incorrect data.
The number of characters that could not be displayed (and therefore not
be converted), is 18141. If this number is 0, the second error case, as
mentioned above, has occurred.
I have tried setting the codepage parameter of the READ method, but to no success.
Anyone ??
-TonniFriend,
Call the FM like below....
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
IM_XSTRING = x
IM_ENCODING = 'UTF-8'
IMPORTING
EX_STRING = x. -
Xstring to string for ms_excel
Hi ALL,
I am using OFFICE CONTROL UI ELEMENT for displaying iternal table data into EXCEL OFFICE CONTROL UI .
i am displaying data into OFFICE CONTROL UI EXCEL, then i will update excel of office control and then i will save,when i save that updated data need to send one internal table .
DATA :OUT_STRING1 TYPE STRING,
CONTENTXMLSOURCE TYPE XSTRING.
WD_CONTEXT->GET_ATTRIBUTE( EXPORTING NAME = 'DATAS' IMPORTING VALUE = CONTENTXMLSOURCE ).
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
FROM_CODEPAGE = '8500'
IN_XSTRING = CONTENTXMLSOURCE
OUT_LEN =
IMPORTING
OUT_STRING = OUT_STRING1.
data lr_conv type ref to cl_abap_conv_in_ce.
lr_conv = cl_abap_conv_in_ce=>create( ).
lr_conv->convert( exporting input = xstring importing data = string ).
NOT FOR LIKE Excel file (like Tab Delimited, CVS, XML, etc). Only for ms_excel.
the above mention two concepts are not working to convert from xstring to string ,is there any concept ms_excel format xstring to string?
THANKS,
RAMA
Edited by: Ramakullay Challa on Sep 25, 2009 2:03 PM
Edited by: Ramakullay Challa on Sep 25, 2009 2:06 PMHi Lekha,
When i am activating one method , insede this method i am calling one c lass.
data: DATASOURCE type ref to CL_WD_OFFICE_CONTROL,
content type xstring.
TRY.
DATASOURCE = cl_wd_office_control=>GET_DATA_SOURCE( VALUE = CONTENT ).
CATCH CX_WD_ACF_EXCEPTION.
ENDTRY.
error .any idea lekha.
*you can use only use "class=>method" with static methos.*
data: DATASOURCE type ref to CL_WD_OFFICE_CONTROL,
content type xstring.
CONTENT = DATASOURCE->GET_DATA_SOURCE( ).
no error.
thanks.
thanks,
rama
Edited by: Ramakullay Challa on Sep 28, 2009 7:08 AM
Edited by: Ramakullay Challa on Sep 28, 2009 7:09 AM
Edited by: Ramakullay Challa on Sep 28, 2009 11:26 AM -
Need a function module to convert xstring to string in web dynpro applicati
hi,
need a function module to convert xstring to string in web dynpro application other than HR_KR_XSTRING_TO_STRING.
Moderator message: please (re)search yourself first.
Edited by: Thomas Zloch on Nov 17, 2010 5:31 PMHi,
Check the following link:
FM to convert XString to String
Regards,
Bhaskar -
FM to convert XString to String
I am developing an simple application to upload an excel file and display its contents in a table in Solution manager using Web dynpro.
But 'HR_KR_XSTRING_TO_STRING' is not avaiable in DS1.
Can you help me find a replacement for this function module.
TYPES :
BEGIN OF str_itab,
name(10) TYPE c,
age(10) TYPE c,
END OF str_itab.
DATA : t_table1 TYPE STANDARD TABLE OF str_itab,
i_data TYPE STANDARD TABLE OF string,
lo_nd_sflight TYPE REF TO if_wd_context_node,
lo_el_sflight TYPE REF TO if_wd_context_element,
l_string TYPE char200,
fs_table TYPE str_itab,
l_xstring TYPE char200,
fields TYPE string_table,
lv_field TYPE string.
DATA : t_table TYPE if_main=>elements_data_tab,
data_table TYPE if_main=>elements_data_tab.
get single attribute
wd_context->get_attribute(
EXPORTING name = `DATASOURCE`
IMPORTING value = l_xstring ).
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = l_xstring
IMPORTING
out_string = l_string.
SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE i_data.
Bind With table Element.
LOOP AT i_data INTO l_string.
SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields. READ TABLE fields INTO lv_field INDEX 1.
fs_table-name = lv_field. READ TABLE fields INTO lv_field INDEX 2.
fs_table-age = lv_field. APPEND fs_table TO t_table1.
ENDLOOP.
lo_nd_sflight = wd_context->get_child_node( 'DATA_TAB' ).
lo_nd_sflight->bind_table( t_table1 ).
Thanks in advance
AkshathaIt is not appropriate to ask general ABAP questions such as this in the Web Dynpro ABAP Forum. As your punishment I will help with your question.
In this sample buffer is the XSTRING, text_buffer is the string. You have to supply an encoding to tell the system what codepage/unicode type the XSTRING is.
data: convin type ref to cl_abap_conv_in_ce,
call method cl_abap_conv_in_ce=>create
exporting
encoding = encoding
input = buffer
receiving
conv = convin.
call method convin->read
importing
data = text_buffer.
Maybe you are looking for
-
How to report that itune billed me twice in one app
I had to purchased app and istore billed me twice how should i do ?? i just checked the receipt it show like this Item Developer Type Unit Price Learn Spanish - MindSnacks, 50 Spanish Lessons Report a Problem MindSnacks In App Purchase $4.99 Learn Sp
-
Hello , may i ask for a advice . I am on 10.2.0.4 on linux I did a level 0 backup on 14.09.2009 using this command : RMAN> backup as COMPRESSED BACKUPSET incremental level 0 database plus archivelog delete input;After a week i did level 1 backup wit
-
Why are the icons no longer on tabs?
In previous versions of Firefox the icon from the website, e.g. eBay, Craigslist, Amazon, Gmail, and others, would show up on the left side of the tabs. Now it will show the icons for one or two of these websites but the rest will be like blank docum
-
Adobe Premiere Elements Won't Start A New Project?
When I open up Premiere Elements and try to start a new project, all it shows is a black and purple line, then it just stops. I have already tried updating QuickTime, Windows 7, Nvidia Drivers, and Uninstalling and then Reinstalling Premiere elements
-
I purchased from MicroTek but cannot locate the download of version 10. Is there a download link for older versions?