Page 1 of 1

Create Unicode file for SAP Bapi RFM

Posted: Tue Nov 02, 2010 8:38 pm
by swades
Hello,
I have created a DataStage job to extract data from SAP R/3 using Functional Module (RFM) for that I have used SAP BAPI stage. Functional Module has import parameters to pass. As per the SAP Stage guide line, I can pass parameters from input file (Path of the file specified within the stage).
File has to be Unicode file (Because we have SAP system Unicode and DataStage too). for now, I have created flat file in Windows (using notepad and saved as Unicode) and put it Unix and it is working fine. i.e. I am getting data as expected.
But actual requirement is I should be able to pass parameters during run time to extract data. so My idea is to create required file using those run time parameters and use that file for BAPI stage. but now, question is that file has to be Unicode.
So My question is. How can I created Unicode file in DataStage?
Our DataStage Environment is NLS enabled. I have tried with to create file with UTF-8 as NLS map but it not working.

Or any other idea to pass required parameters to BAPI Stage?

Thanks

Posted: Wed Nov 03, 2010 1:51 am
by ArndW
In your output sequential file stage, go to the Stage -> NLS Map tab and enter your file's map.

Posted: Wed Nov 03, 2010 7:19 am
by swades
I have created file with UTF-8 but that file is not being recognized by BAPI Stage.
It says:
No byte order mark found. Expecting input file to be in system byte order.
and it is not passing parameter properly and not returning data. -- Job is success full though.

Posted: Wed Nov 03, 2010 7:47 am
by ArndW
What sort of a machine is your SAP installed on - could it have a different byte ordering from your DataStage server machine?

Posted: Wed Nov 03, 2010 8:22 am
by swades
I have checked on both LANG on both the server by command: env | grep LANG
It is UTF-8

But I wandered is. it is working with the file I created from Windows (and saved as Unicode) and dropped on Unix. so how can we create same file using DataStage?

Posted: Wed Nov 03, 2010 10:18 am
by ray.wurlod
Looks like Arnd might be on to something with his question about opposite-Endian. How did you "drop" the file on UNIX?

Posted: Wed Nov 03, 2010 11:51 am
by mhester
BOM or Byte Order Mark will be added by default when using Notepad and writing UTF-8. No such behavior is present with Unix since files in Unix can be multi purpose and the BOM may interfere with processing correctness.

The BOM is usually at the beginning of the stream to let the receiving appliation know the "endianness" of the data. UTF-8 does not really require it as well as UTF-32.

So if you moved the file from Windoze as binary I would think that the BOM should have been preserved.

If you did move as binary then I might suggest creating the file as UTF-16.

Let us know