Quantcast
Channel: SCN : All Content - All Communities
Viewing all 8608 articles
Browse latest View live

Handling Code page, Character encoding in SAP PI / PO

$
0
0

     As a middle-ware SAP PI / PO integrates SAP / non-SAP systems, which use different formats (text(XML, CSV...), binary) to represent data. Sometimes they even encode text in different formats OR use different code-pages. This document helps to understand and handle those situations.

     Code-page is a table, assigning a number for each character. Example 'A' is 65, 'a' is 97 and 'b' is 98 and so on.

     Click on image to expand. Please take a screenshot, if you want constant picture. ASCII, ISO 8859-1, CP-1252 and Unicode.

Code page.gif

     'A' is 65. 65 = 10 0001 (64*1 32*0 16*0 8*0 4*0 2*0 1*1). Representing code-page number in 0's and 1's is encoding.

     10 0001 is 65. Lookup 65 in code-page, it is 'A'. Looking up code-page number is decoding.

     Some encodings are fixed length. Example ASCII, ISO 8859-1, cp1252, UTF-32 and ISO 8859-1 and cp1252 have to use 1 byte to represent code-page number. ASCII has to use 1 byte (it actually use only 7 bites, 1st bit is ignored). UTF-32 has to use 4 bytes.

     Some encodings are variable length. Example UTF-8 and UTF-16. UTF-8 will start with 1 byte, if code-page number is too big to be represented in 1 byte, it can use 2 or 3 or 4 bytes. UTF-16 will start with 2 bytes, if needed it will use 4 bytes (i.e., 2 bytes or 4 bytes).

UTF-8: - UTF-8 is the preferred encoding on internet. HTML, XML, JSON ... are encoded in UTF-8 by default.

Understand UTF-8, BOM, endian. FYI..Characters, Symbols and the Unicode Miracle - Computerphile - YouTube, Characters in a computer - Unicode Tutorial UTF-8 - YouTube

     Byte Order Mark (BOM):- It's a heads-up notice to target system about encoding. Some Microsoft Windows applications require BOM to properly decode UTF text. This is how BOM works. If we are sending UTF-8 encoded text, then we prefix that text stream with binary form of EF BB BF (hex). Then target system reads these characters and understands "This text stream starts with EF BB BF, then this text must be UTF-8 and I should use UTF-8 decode logic". It will not display EF BB BF. If we are sending UTF-16 Big-Endian, then we will prefix that text stream with FE FF (hex). Then target system reads these characters and understands "This text stream starts with FE FF, then this text must be UTF-16 BE".

     If target program does not understand BOM heads-up notice, i.e., when it sees EF BB BF (hex) at starting of text stream and it is not programmed to understand it. It may interpret it as cp1252 characters . If you see any error or display starting with  OR þÿ OR ÿþ. It means that, target program is not decoding data properly.

                                                                 Click on image to expand.

BOM.gif

     To test whether source, PI/PO and target system are using proper encoding or not. You can request source system to send Euro sign € in one of data elements. If target system does not decode € properly, then there is issue with code-page / encoding.

Notepad.gif

Why Euro sign € is displayed as €?

€ -> U+20AC (hex) -> 0010 0000 1010 1100 -> 11100010 10000010 10101100 -> E2 82 AC -> €

 

Please go through How to Work with Character Encodings in Process Integration.

Here are some points to note from above document.

     When reading XML, SAP recommend to "File Type" as 'Binary'. As XML prolog has encoding details <?xml version="1.0" encoding="utf-8"?>. SAP note 821267.

     You can use below adapter modules to change encoding.

     MessageTransformationBean: Transfer.ContentType = text/xml;charset="cp1252"

     TextCodepageConvertionBean: Conversion.charset = "utf-8"

     XMLAnonymizerBean: anonymizer.encoding = "utf-8"

     FYI. cp1252 is superset to ASCII and ISO 8859-1. UTF-8 is superset of cp1252, but number of bytes used may vary.

 

Lets handle issues mentioned section 5 and 6 in How to Work with Character Encodings in Process Integration.

 

1) Java mapping to change code-page/encoding. Supported Encodings.

package com.map;
import com.sap.aii.mapping.api.*;
import java.io.*;
public class ChangeEncoding_JavaMapping extends AbstractTransformation {    @Override    public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException {        try {            InputStream inputStream = transformationInput.getInputPayload().getInputStream();            OutputStream outputStream = transformationOutput.getOutputPayload().getOutputStream();            //Read input as cp1252 and write output as UTF-8.            byte[] b = new byte[inputStream.available()];            inputStream.read(b);            String inS = new String(b, "Cp1252");            outputStream.write(inS.getBytes("UTF-8"));        } catch (Exception ex) {            getTrace().addDebugMessage(ex.getMessage());            throw new StreamTransformationException(ex.toString());        }    }
}

Result: -

1JavaMapping.PNG

 

2) Java mapping to handle Quoted-Printable input.

package com.map;
import com.sap.aii.mapping.api.*;
import java.io.*;
public class QuotedPrintable_JavaMapping extends AbstractTransformation {    @Override    public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException {        try {            InputStream inputStream = transformationInput.getInputPayload().getInputStream();            OutputStream outputStream = transformationOutput.getOutputPayload().getOutputStream();            //Convert quoted-printable to unicode output. Add JAX-WS library when compiling.            inputStream = javax.mail.internet.MimeUtility.decode(inputStream, "quoted-printable");            //Copy Input content to Output content.            byte[] b = new byte[inputStream.available()];            inputStream.read(b);            outputStream.write(b);        } catch (Exception ex) {            getTrace().addDebugMessage(ex.getMessage());            throw new StreamTransformationException(ex.toString());        }    }
}

Result: -

2JavaMapping.PNG

3) Java mapping to handle Base64 input.

package com.map;
import com.sap.aii.mapping.api.*;
import java.io.*;
public class Base64_JavaMapping extends AbstractTransformation {    @Override    public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException {        try {            InputStream inputStream = transformationInput.getInputPayload().getInputStream();            OutputStream outputStream = transformationOutput.getOutputPayload().getOutputStream();            //Decode Base64 Input content to Output content. FYI. Java 8 has java.util.Base64.            byte[] b = new sun.misc.BASE64Decoder().decodeBuffer(inputStream);          //Above class is internal class. As an alternative you can use below line, which ever works for you.          //byte[] b = javax.xml.blind.DatatypeConverter().decodeBuffer(inputStream);                  outputStream.write(b);        } catch (Exception ex) {            getTrace().addDebugMessage(ex.getMessage());            throw new StreamTransformationException(ex.toString());        }    }
}

Result: -

3JavaMapping.PNG

4) Java mapping to add BOM.

package com.map;
import com.sap.aii.mapping.api.*;
import java.io.*;
public class BOM_JavaMapping extends AbstractTransformation {    @Override    public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException {        try {            InputStream inputStream = transformationInput.getInputPayload().getInputStream();            OutputStream outputStream = transformationOutput.getOutputPayload().getOutputStream();            //Copy Input content to Output content.            byte[] b = new byte[inputStream.available()];            inputStream.read(b);            //Prefix BOM. For UTF-8 use "0xEF,0xBB,0xBF". For UTF-16BE use "0xFE,0xFF". For UTF-16LE use "0xFF,0xFE".            outputStream.write(0xEF);  outputStream.write(0xBB);  outputStream.write(0xBF);            outputStream.write(b);        } catch (Exception ex) {            getTrace().addDebugMessage(ex.getMessage());            throw new StreamTransformationException(ex.toString());        }    }
}

Result: - BOM characters will not be displayed.

4JavaMapping.PNG

5) Java mapping to handle XML Escape Sequence.

Not well-formed XML - & issue

 

FYI...How to create Java mapping.

How to create Java Mapping in SAP PI / PO


How to increase the number of simultaneous(concurrent) connections to the Sybase IQ

$
0
0

Hi All,

 

I am very new to Sybase IQ and this is the first time we have using the product.

 

We are getting an error when we have more than 10 connections to the Sybase IQ DB. is there a way to increase this number of connections ? We are using a fully licensed version of Sybase IQ 15.4.

 

Same Error appears when we connect via SAP BusinessObjects and InfiniteInsight to the DB.

 

Please see attached screenshot for the error on InfiniteInsight.

 

Thank you,

Shanka

Regarding service sales order

$
0
0

Hi All,

While creating service  sales order price field is grayed out i can’t able to enter price kindly update me any setting need to active for this.


 

Ramesherror.jpg

How to add customer master data to vehicle master

$
0
0

Hi Techies,

 

I want to through a question we are a vehicle management company and about to implement sap B1 so I want to know how can we add a vehicle master data to a customer master data. So that when we search for a vehicle it displays the customer it belongs to also when we search customer it shows all vehicles belongs to customer.

Trex configuration and troubleshooting.

$
0
0

Hi,

 

I have installed Trex 7.1 and did the post installation. and did the necessary configuration on ABAP Engine. but still i am unable to search txt in TX: cv04n...

 

when i execute trexadmin.exe, I that the trex is running.

I have created all the RFC connections to My ABAP engine.

but still unable to search txt in TX: cv04n.

 

m i missing something,

 

Please help me to troubleshoot.

 

 

Thanks in advance.

Date to convert to MM/DD/YYYY

$
0
0

Hi,

 

I have Character Field contains value = 2015.02.23 (sysdate()).

 

I want output as 02/23/2015.

 

I coded as to_date(<field>, 'MM/DD/YYYY')

 

I have got error as 15 can not be converted to month.

 

Could you please help me what expression I need to use?.

 

Regards.

Question about Translation date type setup in OB22

$
0
0

Hello guys,

 

can you please let me know if we can see somewhere the setup of Type of Translation Date in Additional Local Currencies for Company Code - OB22? There are 3 - Document date, Posting date and Translation date

can we access the set up via some transaction/table or is it hard coded in SAP?

 

thanks a lot for letting me know

 

Hana

SQL Query OITM description of field SVolUnit

$
0
0

Hello,

 

In the OITM Table there are fields where the UOM is displayed, eg SVolUnit

 

When I use this field in a query i get a numbercode instead of a description.

 

How Can I get the full description of SVolUnit in a query like:

 

select T0[ItemCode], T0.[SVolUnit] from OITM T0 where...t0[ItemCode] >= '[%0]'

 

Thanks in advance Jos Dielemans


SQL Query how to combine two fields Year and Month to one field Period

$
0
0

Hello,

 

I have the following Query:

 

SELECT t0.[Docnum], t0.[docdate],  (Datepart(Year,T0.[DocDate])) , (Datepart(Month,T0.[DocDate])), t0.[doctotal] FROM OINV T0 where t0.[docdate] >= '20140101'

 

This results in a list of AR/Invoices with Docnum, Docdate, Year, Month, Doctotal in a separate columns.

 

I would like to combine the two columns "Year" and "Month" in one column "Period" which is written as follows:

 

2014-01

2014-02

.....

2014-09

2014-10

2014-11

2014-12

2015-01

 

The zero at the months lower than 10 is essential because of sorting issues.

 

what statement do i have to use to realise this ?

 

Who can help me with this ? - Thanks in advance

document type in purchase order replaced

$
0
0

hi gurus,

 

I have found that PO document type in all purchasing documents have been replaced with a single document type which belongs to RFQ document type, both PO and RFQ are having "Z" doc type. could you please clarify the route cause of this and how to trace the transaction and user id who has done this.

 

thanks

Data preview problem in Attribute view

$
0
0

Hi Experts,

 

I am using SAP Hana cloud trial version. After creating hello world application, I am going forward to create attribute view and so on. Created few tables and inserted data in my schema. Then created attribute view on a table, validated and activated. All went nicely till that point. The problem is when I am trying to preview data.

 

1.png

 

1_1.png

 

After reading some blogs executed below things.

 

2.png

Then

 

3.png

 

Please help me to resolve the above issue.

 

Thanks,

Kazi

when do we use module programming instead of report ?

$
0
0

Hi ! this is Roshan Naik.

A very warm greetings to all of you.

 

My question is :

1. Why do we use module pool programming?

2. When do we use module pool programming  instead of report?

                               OR

   Why would you go for module pool programming when you can retrieve data from database using report programming too?

 

 

Thnak you to all of you in advance.

2EETW169 no connect possible: "DBMS = ORACLE --- dbs_ora_tnsname = '***'"

$
0
0

Hello,

 

We are  performing an upgrade+migration to HDB using the DMO option(Oracle to HANA).

We are getting below error in the phase - PREP_INPUT/DBCONNCHK_INI

 

 

 

Entered(oracle) System password

image001.jpg

image002.JPEG

 

Output of DBCONNCHK.OUT as below-

 

2EETW169 no connect possible: "DBMS = ORACLE                           --- dbs_ora_tnsname = 'DTG'"

D:\tmp\sum12\SUM\abap\exe\R3trans.EXE finished (0012).

SAPup> Process with PID 1168 terminated with status 12 at 20150224213259!

 

Could you please assist?

Regards

Sury

How to generate consolidated reports from multiple SBO databases

$
0
0

Hi,

 

I need to generate various reports across 3 databases in Sap Business One. All databases are in the same database server.

 

Is it possible to specify the database name using Query Generator / SQL and simply do UNION for 3 databases? If yes, what is the syntax? Any one example will be appreciated, say a consolidated list of all Business Partners across 3 databases.

 

If not possible using Query Generator, what are the other options without use of SDK?

 

Thanks.

How to execute "Lock Cells" button through VBA Macro?

$
0
0

Dear all,

 

The requirement is to lock input-ready cells on a Excel button click. We don't want to use the standard "Lock Cells" button provided in Planning Ribbon.

 

Button functionality is implemented in VBA Macro, But i am not able to find any information on How to trigget the AFO "Lock Cells" there. An option of Excel Locking is possible, but it only works when we protect the whole worksheet and in our case it is useless.

 

Any ideas?

 

Thanks & Regards,

vamsi.


Sales Profit Percentage

$
0
0

Hello All

I need a query to check all sales order and display the below

 

Sales Order#

Customer

Posting Date

DocDue Date

Total

Gross Profit

Profit %

Doc Status

 

I have written the query, my problem is how do I get it to display the profit percentage as below

 

25-02-2015 1-53-58 PM.png

 

The query I have written is below

 

SELECT T0.[DocNum],

T0.[CardName],

T0.[DocDate],

T0.[U_Desc],

T0.[DocStatus],

(To.[DocTotal]+T0.[DiscSum]-T0.[VatSum]) as 'Total',

T0.[GrosProfSy],

Need the query to display the Profit % here

FROM ORDR T0

 

Thanks and Kind Regards

Rahul

Depreciation not posted in a certain period

$
0
0

Hi,

We have posted depreciation for Period 1 in 2015, after this we are not able to post depreciation in period.  The system shows posting period 3 in planned posting but not period 2.  Is this a system error, should i raise OSS note with SAP for this issue.

 

Regards,

Sathesh

Data Product for Cross selling & Shopping Basket Analysis

$
0
0

I am sharing a data product http://ohrivikas.weebly.com/forecasting.html(select Market basket analysis option) for doing Shopping basket analysis.

This application suggests items for cross selling when a user selects any item from the buy or shopping items as part of order,  as shown in following image.

Image1.PNG

 

By default it is using Groceries data set containing 30 days of real-world point-of-sale transaction data from a typical local grocery outlet with the items that are aggregated to 169 categories.

 

Item suggested is based on likely hood of possible based on what product is currently in the order and previous history of orders.

 

Choosing Item associations tab, one can view all the possible item suggestions learned from historical sales transactions, indicating strength of relation between buying of certain items leading to purchase of subsequent items. These can be analysed &  filtered narrowed by appropriate confidence, support and lift factors as shown in following image.

 

Image2.PNG

 

It can accept  user input data two column file in XLSX format as well as new data to create item association rules for shopping basket analysis and cross selling suggestions. For a SAP system it can be easily created by downloading Sales Items from table VBAP using Order Number as unique Transaction ID and Material as the Transaction Item two columns as shown in the image below.


 

OrderProduct
5728R-1001        
5728R-1111       
6727R-1120      
6730R-1130      
6730R-1140        

 

This endeavor to build this appication started quite a while ago when i developed HANA based application available at https://s1hanaxs.hanatrial.ondemand.com/p202072trial/ohri/PAL_01_settings/ to do Market or shopping basket analysis, using HANA Predictive Analysis library Apriori functions & SAPUI5 framework. Some of the background information on this application including explanation of terms confidence, support & lift and shopping basket analysis is shared in my earlier earlier post Cross Selling and Shopping Basket Analysis - HANA Cloud Platform Predictive Application.

It's logical to bundle this application as data product for end user . Since SAP HANA XS Administrator access for free trial version is unavailable to setup SQLCC, connection configuration so I had too ask for user's SCN or SAP ID and used it to add to list of authenticated users who could use this application  and for any other user of the application, it errors out for lack of valid authorizations.

Also sometime earlier i's able to connect to HANA cloud trial version using JDBC connection as shared in my post R Integration with HANA with JDBC - Test of "Outside In Approach" - Part 2 giving me idea to build data product using a different interactive graphics framework using javascript  libraries like HighCharts, morris, nvd3, polycharts ,dimple & even open map leaflet libraries. Incidentally SAPUI5 is built over some of these same libraries. Further this approach opens up more possibilities for data (including big data)  analysis and machine learning with ERP Business data. Little digression of thoughts ,In my opinion big data term is often understood with data of large or high volume scale , though true as it warrants then distributed & parallel computing platforms, but big data applications may include "small" data as well , term big is relative , data that can not be easily comprehensively dealt with in given computing resources can be regarded big either due to its underlying structure and or speed at which it changes.

 

Which are most frequent or least selling items can be analysed interactively by selecting Frequently Sold Items tab as shown in image below.

 

Image3.PNG

Data product for shopping basket analysis is now easily available for end user by clicking Market Basket option at http://ohrivikas.weebly.com/forecasting.html

Grant privilege to Select on a view

$
0
0

Hello,

 

I have created a view with the following SQL Statement:

 

Set Schema "TEST_SCHEMA";

Drop view AN_LAST_PRICE;

Create view AN_LAST_PRICE AS ...

 

I can do the following:

Select * from AN_LAST_PRICE;

 

Now my colleage didn't have the permissions to select on my view. But he could do the following as well:

 

Set Schema "TEST_SCHEMA";

Drop view AN_LAST_PRICE2;

Create view AN_LAST_PRICE2 AS ...

With the same sub query I have used.

 

Now I wanted to grant him the select privilege to my view:

 

GRANT SELECT ON "TEST_SCHEMA"."AN_LAST_PRICE" to S000XXXXXX;

 

This results in:

 

Could not execute 'GRANT SELECT ON "TEST_SCHEMA"."AN_LAST_PRICE" to S000XXXXXX' in 1.234 seconds .

SAP DBTech JDBC: [258] (at 36): insufficient privilege: Not authorized to grant the privilege on the view: line 1 col 37 (at pos 36)

 

Do you know which privilege I miss?

Or how I can grant the privilege to select on my view to another user?

Production Order Operation Release BAPI

$
0
0

Hi PP Gurus,

 

Is there a Standard BAPI available to "Release' Operations individually( Based on input file).

 

Production order Release BAPI is availabe , but that will release all Operation & we have long routing which requires phased release

 

Thank you much in advance,

 

Regards,

Jatin

Viewing all 8608 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>