Re: Encode THAI Language into BASE64 Format

Hi  Guru's,
        Have a requirement  to encode particular IDOC text fields which are in  THAI language to BASE64 format . We are able to encode the same for english but not able to do the same for Thai language so can any one help with the coding to create custom UDF  which can convert.
Regards
Sathish Kumar K.C

Hi ,
   Please find below my code...
public class Base64a {
//     Mapping table from 6-bit nibbles to Base64 characters.
private static char[]    map1 = new char[64];
     static {
        int i=0;
        for (char c='A'; c<='Z'; c+) map1[i+] = c;
        for (char c='a'; c<='z'; c+) map1[i+] = c;
        for (char c='0'; c<='9'; c+) map1[i+] = c;
        map1[i+] = ''; map1[i++] = '/'; }
//     Mapping table from Base64 characters to 6-bit nibbles.
private static byte[]    map2 = new byte[128];
     static {
        for (int i=0; i<map2.length; i++) map2<i> = -1;
        for (int i=0; i<64; i++) map2[map1<i>] = (byte)i; }
Encodes a string into Base64 format.
No blanks or line breaks are inserted.
@param s  a String to be encoded.
@return   A String with the Base64 encoded data.
public static String encode (String s) {
     return new String(encode(s.getBytes())); }
Encodes a byte array into Base64 format.
No blanks or line breaks are inserted.
@param in  an array containing the data bytes to be encoded.
@return    A character array with the Base64 encoded data.
public static char[] encode (byte[] in) {
     int iLen = in.length;
     int oDataLen = (iLen*4+2)/3;       // output length without padding
     int oLen = ((iLen+2)/3)*4;         // output length including padding
     char[] out = new char[oLen];
     int ip = 0;
     int op = 0;
     while (ip < iLen) {
        int i0 = in[ip++] & 0xff;
        int i1 = ip < iLen ? in[ip++] & 0xff : 0;
        int i2 = ip < iLen ? in[ip++] & 0xff : 0;
        int o0 = i0 >>> 2;
        int o1 = ((i0 &   3) << 4) | (i1 >>> 4);
        int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
        int o3 = i2 & 0x3F;
        out[op++] = map1[o0];
        out[op++] = map1[o1];
        out[op] = op < oDataLen ? map1[o2] : '='; op++;
        out[op] = op < oDataLen ? map1[o3] : '='; op++; }
     return out; }
Regards
Sathish Kumar

Similar Messages

  • Encode a PDF into base64 xml

    Hi Pal,
    There is a requirement to generate an Adobe Form using SAP Interactive forms, and then, send this PDF to a non-SAP system using Base-64 encoding. The receiving system will decode this file.
    I have heard that this could be done in the PI layer, using the Conversion Agent.
    Another approach which I can think of is convert PDF to binary and then use the cl_http_utility=>encode_base64 to convert binary to base64. howvere, I am unaware of how to convert PDF to binary.
    Could someone guide me thorugh this please?
    Thanks,
    Preethi.

    To convert a spool into a binary table, take a look here:
    http://wiki.sdn.sap.com/wiki/display/Snippets/Convert%20Smartform%20to%20PDF%20format?bc=true
    I've done a similar scenario, and i've developed the conversion on Abap side, with cl_http_utility=>encode_base64 method into an xstring field.
    In your case, there's the Adobe I Form, than you need to save PDF file in a system's directory, you need to read the generated file, encode, and than send out.
    You can also use Conversion Agent, and do the conversion in PI system.

  • Converting Smartform in Crycllic languages into PDF format

    Hi All,
    I have a smart form that needs to be converted into PDF and  sent by mail as an attachment.
    I have a problem with Cyrillic Languages (Bulgarian).
    When i use FM convert OTF to PDF its giving some garbage characters insteading of printing cyrillic letters.
    The output is correct when I see the print preview of the smartform.
    Please can anyone suggest me in this regard.
    I appreciate any help.
    Regards,
    Abha

    Before doing the conversion OTF -> PDF you should provide proper printing device . Only then you can assure the correctness of conversion to different lanuguages.
    data: ls_output_options      type ssfcompop,
          ls_control_parameters  type ssfctrlop,
          l_devtype              type rspoptype.
    translate language to upper case.
    ls_control_parameters-langu = language.
    ls_control_parameters-no_dialog = 'X'.
    ls_control_parameters-getotf    = 'X'.
    " get device type from language
      call function 'SSF_GET_DEVICE_TYPE'
        exporting
          i_language                   = language
        importing
          e_devtype                    = l_devtype
        exceptions
          no_language                  = 1
          language_not_installed       = 2
          no_devtype_found             = 3
          system_error                 = 4
          others                       = 5.
    " set device type in output options
      ls_output_options-tdprinter = l_devtype.
      call function l_sf_function_module
           exporting
                      control_parameters   = ls_control_parameters
                      output_options       = ls_output_options
                      user_settings        = space
           importing
                      job_output_info      = ls_output_data.
    Regards
    Marcin

  • Thai language Problem with Labelshop start (External design program)

    Hi all,
    In my project, we have designed form vai Labelshop start and then import it to SAPscript.
    Now we're facing the problem about Thai language when we test running. Thai language in ASCII format is not correct.
    Anyone please advice the possible solution for this problem. If this problem is about font in Labelshop start program, please advice how to import new font to Labelshop.
    Thank you very much,
    Anek.

    DiskStudio - Create or remove a partition without reformatting your hard drive.
    http://www.micromat.com/index.php?option=content&task=view&id=33
    With DiskStudio you can:
    * Add new partitions to your hard drive.
    * Delete partitions previously created by Apple's Disk Utility or DiskStudio.
    * Erase and reformat existing partitions in a number of standard formats.
    * Completely erase and repartition an entire hard disk.
    Use DiskStudio to:
    * Install a new copy of Mac OS X, but keep your original copy intact.
    * Install a completely different operating system, such as Mac OS 9, on a new partition.
    * Create a partition to hold special projects, such as audio or video files.
    * Create a partition to hold scratch space for programs such as Adobe Photoshop.
    When a hard drive is first set up for use, it is partitioned into one or more logical volumes. These appear on your desktop as though they were separate drives. Using the standard disk tools that come with the Macintosh, there is no way to change this partitioning scheme without completely erasing the entire drive and starting over. With DiskStudio, this is no longer necessary.
    DiskStudio provides the tools you need to control how information is stored on your hard drive. An easy to use, non-destructive disk partitioner has been requested by more of our customers than any other type of utility. DiskStudio fills this important need for Mac OS X. With DiskStudio you will be able to quickly and easily change the way information is stored on your hard drives as your needs change over time.
    System Requirements:
    * PowerPC G3 or better. (Beige G3 machines not supported)
    * Mac OS X 10.3 or greater.
    * CD-ROM or DVD-ROM.
    * 256 Megabytes RAM or higher.
    Cost is $50.
    Check this site for battery part numbers and sources. Mac PRAM, NVRAM, CUDA/PMU & Battery Tutorial
    Cheers, Tom

  • I want to convert the day into THAI language

    Hi All,
          I write a simple query using date conversion for THAI language. But the NLS_CALENDAR does not convert the DAY to Thai language but month and year shows in THAI only
    Please give the date format for THAI language.
    Query
    select
    DECODE (:p_language_id,
                   'th', TO_CHAR (sysdate,
                                  'DAY MONTH YYYY',
                                  'NLS_CALENDAR=''THAI BUDDHA'''
                   TO_CHAR (sysdate, 'Day MONTHYYYY') ) dates from dual
    Output:
    FRIDAY    สิงหาคม    2556

    Try this
    alter session set nls_language = 'THAI';
    select to_char (sysdate,'DAY MONTH YYYY')
      from dual;
    NLS_LANGUAGE
    Edit.. Perhaps NLS_DATE_LANGUAGE is much suited for your requirement. Check Hoek's solution.
    Message was edited by: Karthick_Arp

  • HT1351 I've encoded a vinyl LP record into digital format and recorded it onto an usb as MP3 file. But when I tried to copy it onto my ipod classic, I get a message stating "was not copied to the ipod because it cannot be played on this ipod". Why?

    I've encoded a vinyl LP record into digital format and recorded it onto an usb as MP3 file. But when I tried to copy it onto my ipod classic, I get a message stating "was not copied to the ipod because it cannot be played on this ipod". Why?

    I was refering to the "sample rate", normally 44.1 KHz, the iPod might not be able to play tracks with a non-standard rate. Otherwise I'm not sure what the issue might be.
    tt2

  • PDF is converting the Thai Language characters into Junk Characters

    Hi,
    While converting the SAP Script form to PDF, it is converting the Thai Language characters into Junk Characters. But it is showing correctly if we issue it to a printer. Also it is showing correctly in print preview.
    Urgent Help is needed.
    Thanks,
    srini.

    Cross post:
    Re: PDF is converting the Thai Language characters into Junk Characters

  • Thai Language Encoding with TIS-620

    Hi All,
    I have a file which has few Thai language words.I need to decode with TIS-620 charset.
    I have tried with a standalone program.When I run the program and try to print the local lang program..it simply prints ??? in Eclipse console......When I try to print the Byte Array with the charset Name=TIS-620, it gives me..[B@7d772e  and when I try to print it after decode the array of bytes with given char set as ISO8859_1..it prints some garbage characters....��������
    I am attaching the java code I have been trying and also the file which I am trying to read.
    {code}import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStreamReader;
    public class te {     
         private static final String ISO = "ISO8859_1";
         private static String charsetTobeChanged="TIS-620";
         public static void main(String args[]) throws Exception{
         BufferedReader brFile;
         String inFileName=null ;
         String inLine,inLine_BENE_NAME,decode_LL_BENE_NAME ;
         inLine_BENE_NAME="test";
         FileOutputStream fos2=new FileOutputStream("C:\\Documents and Settings\\Desktop\\asPerBaseFile.dat");
         DataOutputStream output = new DataOutputStream (fos2);
         final String NEXT_LINE = "\n";
         inFileName= "C:\\Documents and Settings\\D150911\\Desktop\\latestBaseFile.dat" ;
         String newStrLine,newDecodedBeneName;
         try{
              brFile = new BufferedReader(new InputStreamReader(new FileInputStream(inFileName), "UTF-8"));
              while ((inLine = brFile.readLine()) != null) {
                   try{
                        inLine_BENE_NAME = getField(inLine, inLine.length(), 78, 128).trim();
                        if (inLine_BENE_NAME!=null && inLine_BENE_NAME.length()>0)
                                       decode_LL_BENE_NAME = decode(inLine_BENE_NAME.getBytes(charsetTobeChanged),ISO);
                                       newDecodedBeneName= fillSpace(decode_LL_BENE_NAME,50);
                                       newStrLine=inLine.substring(0, 78).concat(newDecodedBeneName).concat(inLine.substring(128));
                                       output.writeBytes(newStrLine);
                                       output.writeBytes(NEXT_LINE);
                        else
                             output.writeBytes(inLine);
                   }//end try
                   catch (Exception encodeE)
                                  System.out.println(" exception in Encoding=="+encodeE);
              }//end while
         }//end of try
         catch(Exception e)
                   System.out.println("File not found= or any other exception ==="+e);
         //getField
         public static String getField(String lineString, int lineLength, int startPos, int endPos) throws Exception {
              String outString;
              try {
                   if (lineLength >= endPos) {
                        outString = lineString.substring(startPos, endPos);
                   } else
                        if (lineLength >= startPos) {
                             outString = lineString.substring(startPos, lineLength);
                        } else {
                             outString = "";
                   return(outString);
              catch (Exception ex) {
                   throw ex;
         public static String decode(byte[] pvBytes, String pvTargetCodePage) throws Exception
         if(pvBytes == null)
         return "";
         return new String(pvBytes, pvTargetCodePage);
         public static String fillSpace(String field_value, int number_of_digit)
         String add_space = "";
         if (field_value.length() < number_of_digit) {
         for (int j=0; j<(number_of_digit - field_value.length()); j++) {
         add_space = add_space + " ";
         field_value = field_value + add_space;
         return field_value;
    } // fillSpace
    }//end class
    And the file which I am trying to read is following..please copy and paste as a file...
    000001 7441 7454797 2721001477 000000050030932 080429 0190014754              &#3612;&#3641;&#3657;&#3592;&#3633;&#3604;&#3585;&#3634;&#3619;&#3650;&#3619;&#3591;&#3648;&#3619;&#3637;&#3618;&#3609;&#3617;&#3633;&#3608;&#3618;&#3617;&#3623;&#3636;&#3592;&#3633;&#3618;&#3619;&#3632;&#3648;&#3610;&#3637;&#3618;&#3610;&#3648;&#3585;&#3603;&#3601;&#3660;&#3604;&#3657;&#3634;&#3609;&#3604;&#3639;&#3657;&#3629;&#3604;&#3639;&#3593;                            
    000002 7441 7454797 1681016631 000000057153890 080429 0190014757              &#3624;&#3638;&#3585;&#3625;&#3634;&#3604;&#3639;&#3657;&#3629;&#3604;&#3639;&#3657;&#3629;&#3604;&#3639;&#3657;&#3629;&#3604;&#3639;&#3657;&#3629;&#3604;&#3639;&#3657;&#3629;&#3604;&#3639;&#3657;&#3629;&#3604;&#3639;&#3657;&#3629;&#3604;&#3639;&#3657;&#3629;&#3594;&#3656;&#3629;&#3591;&#3623;&#3636;&#3607;&#3618;&#3634;&#3594;&#3609;&#3593;&#3633;                                
    000003 7441 7454797 4162503389 000000090107942 080429 0190014762              &#3612;&#3641;&#3657;&#3592;&#3633;&#3604;&#3585;&#3634;&#3619;&#3650;&#3619;&#3591;&#3648;&#3619;&#3637;&#3618;&#3609;&#3617;&#3633;&#3608;&#3618;&#3617;&#3623;&#3636;&#3592;&#3633;&#3618;&#3619;&#3632;&#3648;&#3610;&#3637;&#3618;&#3610;&#3648;&#3585;&#3603;&#3601;&#3660;&#3604;&#3657;&#3634;&#3609;&#3604;&#3639;&#3657;&#3629;&#3604;&#3639;&#3593;                           
    000004 9100 7454797 0000000000 000000197292764 000000                                                                          
    ==============================================
    The above line is just a seperator...It can be noticed in the given file above the 3rd last line after LL has a Thai word which needs to be encoded....
    I mean ,I want to decode it with Char set TIS-620 so that when I open it in IE..Thai language can be viewed by Thai encoding.
    Please help.
    Edited by: InfoRequired on Jul 11, 2008 1:11 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Thank you for the help!.
    True, I read the article you provided but it was a bit confusing if I read for the first time.
    anyways, you summarised well.I tried with following,read the file,did string manipulation then simplay wrote to a file with require character encoding.
    Preview:
    import java.io.BufferedReader;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    public class forumHelp {     
         private static String  charsetTobeChanged="TIS-620";
         public static void main(String args[]) throws Exception{
         BufferedReader brFile;
         //OutputStreamWriter f1;
         String inFileName=null ;
         //String outFileName=null;
         String inLine,inLine_BENE_NAME;
         inLine_BENE_NAME="test";
         //ouput stream writer
         FileOutputStream fileOut = new FileOutputStream ("C:\\Documents and Settings\\Desktop\\forumHelp2.dat",true);
         OutputStreamWriter out1;
         out1 = new OutputStreamWriter (fileOut, charsetTobeChanged);
         out1.flush();
         final String NEXT_LINE = "\n";
         inFileName= "C:\\Documents and Settings\\Desktop\\latestBaseFile.dat" ;
         String newStrLine,newDecodedBeneName;
         try{
              brFile         = new BufferedReader(new InputStreamReader(new FileInputStream(inFileName), "UTF-8"));
              //f1         =new OutputStreamWriter(new FileOutputStream(outFileName), charsetTobeChanged);
              while ((inLine = brFile.readLine()) != null) {
                   try{
                        inLine_BENE_NAME      = getField(inLine, inLine.length(),  78, 128).trim();
                        if (inLine_BENE_NAME!=null && inLine_BENE_NAME.length()>0)
                                       newDecodedBeneName= fillSpace(inLine_BENE_NAME,50);
                                       newStrLine=inLine.substring(0, 78).concat(newDecodedBeneName).concat(inLine.substring(128));
                                       out1.write(newStrLine);
                                       out1.write(NEXT_LINE);
                        else
                             out1.write(inLine);
                   }//end try
                   catch (Exception encodeE)
                                  System.out.println(" exception in Encoding=="+encodeE);
              }//end while
         }//end of try
         catch(Exception e)
                   System.out.println("File not found= or any other exception ==="+e);
         out1.close();     
         //getField
         public static String getField(String lineString, int lineLength, int startPos, int endPos) throws Exception {
              String outString;
              try {
                   if (lineLength >= endPos) {
                        outString = lineString.substring(startPos, endPos);
                   } else
                        if (lineLength >= startPos) {
                             outString = lineString.substring(startPos, lineLength);
                        } else {
                             outString = "";
                   return(outString);
              catch (Exception ex) {
                   throw ex;
         public static String fillSpace(String field_value, int number_of_digit)
                        String add_space = "";
                      if (field_value.length() < number_of_digit) {
                              for (int j=0; j<(number_of_digit - field_value.length()); j++) {
                                      add_space = add_space + " ";
                      field_value = field_value + add_space;
                      return field_value;
         }  // fillSpace
    }//end classThank you all again!

  • Does UTF-8 encoding support Thai language in Endeca Search?

    Hi,
    We have a requirement to configure Endeca search in Thai language. Does UTF-8 encoding on all the configuration files and for incoming data (Record Adapter) create issues with Thai character set? If yes, then please let us know which type of encoding will fix the issue? I am using the Endeca 6.4.0 for search configuration.

    Hi
    You should use the OLT analyzer as the Latin-1 analyzer doesn't support all the character codes used by the Thai language. Some words do not use these unsupported character codes, but many words will (any that contain tone marks), and searches for these will not return the correct results. Also the Thai language doesn't use whitespace segmentation so multi-term searches will not work correctly. Finally for ongoing support your best bet would be to use the officially recommended analyzer for this language, which is the OLT one.
    In terms of the unavailability of certain features, is there any one of those features that you require? Note diacritic folding is (I believe) scheduled to be added in the next release, however this shouldn't be required in Thai to the best of my knowledge as the diacritics are integral to the language. If you need one or more of the other features then I'd recommend raising an SR as the more customers require this for OLT analyzer languages the greater the likelihood that support will be added for this.
    Thanks
    Michael

  • Does Adove FrameMaker 7.0 support Thai language?

    Hello,
    after creating a sample document with some Thai text, I save it as MIF 7.0 . There is a prompt saying that saving in this format will cause loss of information related to new features. Then, after reopening the file in FrameMaker instead of Thai characters i get question marks.
    I'm using Adobe FrameMaker v10 , Thai Kedmanee keyboards, my text is written using font that supports Thai characters (Angsana New) .
    So, ladies and gentlemen - is there anything i can do with this or FrameMaker 7.0 just does not support Thai language?
    Thanks in advance,
    Chris

    Your Angsana New is likely a Unicode font. When you type Thai characters in it, what goes into the document is 3-byte UTF8 from the U+0E00 codepoint block. These are completely different binary values vs. the 8-bit code page 874 legacy encoding for Thai overlay fonts, and may not even have the same ordering of glyphs in the block.
    You're going to need a legacy 8-bit Thai font, possibly Angsana code page 874, and you'll need to know the mapping. On Windows, you'll might even have to type them as Alt sequences, based on the {128-255 decimal?) values of the code points. Alternatively, Windows will have a keyboard mapping for code page 874.
    ISO/IEC 8859-11:2001, code page 874 is apparently not the same as TIS-620, if that matters.
    Now entering the Unicode parking lot.
    Do not back up.
    Severe text damage may result.

  • Thai Language displaying in '#' in print preview

    Hi experts,
    By use of smartform, I am printing the address by fetching datas from tables which are of Thai language.
    But in print preview, I am getting '#' characters instead of thai characters.
    FYI: I used the Thai lang paragraph format only.
    While debugging I can see thai language format correctly but only displaying print preview I am getting
    the '#' characters instead of thai characters.
    FYI:
    I installed thai languages and also my system supports thai lang.
    Kindly help  me in this regard.

    Hi,
    If you are able to print it properly and not able to view it in print preview or not even able to print it, then you need to do some addition of adding them in the UNIX server i guess, usually basis people will know about this.
    Another possibility could be, UNICODE issue. Let's say if you are using any OPEN DATASET commands, check the ENCODING used, whether it supports these characters or not.
    Regards,
    Santhosh.

  • I finished making an animated .gif image in FireWorks. My question is, how do I convert it into video so that when I edit video, that every video editing program recognizes it? Long story short, How do I convert animated .gif files into video formats?

    I worked in Adobe FireWorks to make the animated .gif. What program do I use to convert the file from .gif to any video format: .mp4, .m4v, .avi, .wmv, etc. I want to convert it into video format, so that QuickTime Player plays the video, I can insert it into iMovie '11 and edit, and also insert it into Final Cut Pro X and edit video.

    Thanks for getting back with me so promptly.  It has taken me this time to connect with the proper people to find out the information you requested.
    The camera used to film the class was a Panasonic AG-HMC40P, owned by a local cable TV station; they use Kodak video encoding software, and a SD card was used to store the video.   The file extension is .mts, and the mime file is MPEG 2 transport.  He said I probably need an AVCHD converter, and the Mac app store lists 8 of those options, 4 free and 4 for up to $9.99.  He said I'll also need a converter for later plans of posting on YouTube or on the website, and while some of those in the app store might work for the later needs, he knows one app called "Compressor" that would work for the uploading later.  He also suggested I could try renaming the .mts file to .MP2T, but he wasn't sure that would work.
    They don't work with Macs at the studio, but I had thought I could have some lessons there in editing, and apply what I learned to my iMac and iMovie.
    First, though, I have to be able to see it and review it!
    Thanks again!

  • How to convert Classical Report into PDF format..........

    Hi Experts,
    I have written a classical report with write statements and when i am downloading in excel the format is mismatching and now i want to convert into PDF format.
    How to convert into PDF format from Classical report ?
    Yusuf

    Hi yusuf,
    please find the below report,,
    please make two include programs before executing it,
    there codes are pasted below,
    INCLUDE zimpr_data_declaration.
    INCLUDE zimpr_performs_wrap.
    REPORT  zimpr_word_wrap NO STANDARD PAGE HEADING LINE-SIZE 115..
                INCLUDE for DATA DECLARATION                               *
    INCLUDE zimpr_data_declaration.
                INCLUDE for all performs.                                  *
    INCLUDE zimpr_performs_wrap.
    TOP-OF-PAGE--
    TOP-OF-PAGE.
      PERFORM f_top_page.                     "TOP OF THE REPORT PAGE,I.E. HEADER.
    START-OF-SELECTION.
      SET PF-STATUS 'SEL_SCREEN'.             "PF-STATUS OF THE SELECTION SCREEN.
      PERFORM f_data_retrieval.               "PERFORM FOR ALL SELECT STATEMENTS.
      PERFORM f_report_display.               "REPORT DISPLAY,WRITE STATEMENTS.
    --Define the actions to be performed for pf-status-----
    AT USER-COMMAND.
      wf_ok_code = sy-ucomm.
      wf_save_ok = wf_ok_code.
      CLEAR wf_ok_code.
      CASE wf_save_ok.
        WHEN 'PDF'.          "WHEN PDF ICON IS CLICKED,REPORT WILL CONVERT INTO PDF.
          loc_repid  = sy-repid.   "PROGRAM NAME
    --THIS FM SETS  THE PARAMETERS FOR LAYOUT OF PDF OUTPUT--
          CALL FUNCTION 'GET_PRINT_PARAMETERS'
            EXPORTING
              layout                 = loc_paart             "LANDSCAPE LAYOUT
              line_size              = loc_linsz                  "CHARACTER WIDTH OF REPORT
              no_dialog              = 'X'
              user                   = sy-uname              "USERNAME
            IMPORTING
              out_parameters         = loc_print_parms        "OUTPUT PARAMETERS WILL BE COLLECTED HERE.
              valid                  = loc_valid
            EXCEPTIONS
              archive_info_not_found = 1
              invalid_print_params   = 2
              invalid_archive_params = 3
              OTHERS                 = 4.
    --FOR GENERATING THE SPOOL NUMBER--
          NEW-PAGE PRINT ON NO DIALOG PARAMETERS loc_print_parms.                        " This allocates the spool no
          "to the screen without the dialog screen.
          PERFORM f_top_page.
          PERFORM f_report_display.
          NEW-PAGE PRINT OFF.                                                      "This marks the end of the screen for which the spool no was generated.
          wf_id = sy-spono.                                                      " This assign the spool no of the screen to the variable.
    --PERFORM FOR GETTING THE PDF OUTPUT--
          PERFORM f_pdf_display.
    --PERFORM FOR DOWLOADING FILE TO A LOCAL DISK--
          PERFORM f_download_local.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    include data declaration----
    *&  Include           ZIMPR_DATA_DECLARATION
    TYPE-POOLS : shlp.
    DATA : wf_ordert TYPE aufk-auart.                      "ORDER TYPE
    DATA : wf_order TYPE aufk-aufnr.                       "ORDER NUMBER
    DATA : wf_bdate TYPE afko-gstrp.                       "BASIC START DATE
    DATA : wf_status(4) TYPE c ."rihea-i_astatin.                 "STATUS
    DATA : wf_objnr TYPE jest-objnr VALUE 'OR%'.           "Object number
    DATA : wf_aufnr TYPE aufk-aufnr.
    DATA : wf_name TYPE thead-tdname.                      "NAME TO PASS IN FM READ_TEXT
    DATA : wf_date1(12) TYPE c.                            "DATE
    DATA : wf_i1(3) TYPE n,wc_i1(3) TYPE n VALUE '1'.      "COUNTERS FOR REPORT DISPLAY
    DATA : wf_i2(3) TYPE n,wc_i2(3) TYPE n VALUE '1'.
    DATA : wf_kopf TYPE tdid VALUE 'KOPF',wf_aufk TYPE tdobject VALUE 'AUFK'.
    DATA : wf_save_ok TYPE sy-ucomm ,wf_ok_code TYPE sy-ucomm.
    DATA: wf_id TYPE tsp01-rqident ,                         " For storing Spool request number
          wf_bytes TYPE i .                                  " For storing the bytes of data to be converted to PDF.
    DATA : wf_langu(2) TYPE c VALUE 'EN'.
    DATA: wf_pripar TYPE pri_params,                         " Structure for Passing Print Parameters
          wf_rcpar TYPE arc_params.                          " ImageLink structure
    DATA : wf_statu TYPE dfies-fieldname VALUE 'STATUS',
           wf_field TYPE help_info-dynprofld VALUE 'S_STATUS'.
    &--SELECTION SCREEN--
    SELECTION-SCREEN BEGIN OF BLOCK b_1 WITH FRAME TITLE text-000.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS:  s_ordert FOR wf_ordert .                  "ORDER TYPE
    SELECT-OPTIONS:  s_order FOR wf_order OBLIGATORY.          "ORDER NUMBER
    SELECT-OPTIONS:  s_bdate FOR wf_bdate.                      "BASIC START DATE
    SELECT-OPTIONS:  s_status FOR wf_status matchcode object zei_sys .  "SYSTEM STATUS
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN END OF BLOCK b_1.
    *--INTERNAL TABLES--
    TYPES : BEGIN OF ty_aufk,
          aufnr TYPE aufk-aufnr,              "OREDR NUMBER
          auart TYPE aufk-auart,              "ORDER TYPE
          objnr TYPE aufk-objnr,              "OBJECT NUMBER
          ktext type aufk-ktext,              "SHORT TEXT
          gstrp TYPE afko-gstrp,              "BASIC START DATE
          END OF ty_aufk.
    TYPES : BEGIN OF ty_tj02t,
          objnr TYPE aufk-objnr,              "OBJECT NUMBER
          txt04 TYPE tj02t-txt04,             "STATUS
          istat TYPE tj02t-istat,             "Object status
          spras TYPE tj02t-spras,             "LANGUAGE KEY
          END OF ty_tj02t.
    TYPES : BEGIN OF ty_temp,
          objnr TYPE aufk-objnr,
          status(300) TYPE c,
           END OF ty_temp.
    TYPES : BEGIN OF ty_wrap,
           line(54) TYPE c,                     "LONG TEXT
           END OF ty_wrap.
    TYPES : BEGIN OF ty_wrap2,
           line(25) TYPE c,                     "STATUS
           END OF ty_wrap2.
    TYPES : BEGIN OF ty_f4,
            txt04 TYPE tj02t-txt04,
            txt30 TYPE tj02t-txt30,
            END OF ty_f4.
    types :  begin of ty_sta,
            istat type tj02t-istat,
            objnr type jest-objnr,
            end of ty_sta.
    data : int_sta type table of ty_sta with header line.
    DATA : int_f4 TYPE TABLE OF ty_f4 WITH HEADER LINE.
    DATA: int_pdf TYPE TABLE OF tline WITH HEADER LINE.            "TABLE FOR PDF CONVERSION
    DATA: int_wrap TYPE TABLE OF ty_wrap WITH HEADER LINE.         "TABLE FOR LONGTEXT
    DATA: int_wrap2 TYPE TABLE OF ty_wrap2 WITH HEADER LINE.       "TABLE FOR STATUS
    DATA: int_temp TYPE TABLE OF ty_temp WITH HEADER LINE.         "Table for concatenation of system status.
    DATA: int_aufk TYPE TABLE OF ty_aufk WITH HEADER LINE.
    DATA: int_tj02t TYPE TABLE OF ty_tj02t WITH HEADER LINE.
    DATA: int_tline TYPE STANDARD TABLE OF tline WITH HEADER LINE. "TABLE FOR READ_TEXT.
    DATA : int_fld TYPE TABLE OF dfies ,wa_fld LIKE LINE OF int_fld.                     " Field Type for FM for F4 help
    DATA :int_return   TYPE TABLE OF ddshretval WITH HEADER LINE .
    DATA:
      loc_print_parms LIKE pri_params,          "PRINT PARAMETERS
      loc_valid(1)      TYPE c,
      loc_file type SDOK_CHTRD,
      loc_bytecount     TYPE i,                 "NUMBER OF BYTES TRANSFERRED
      loc_length        TYPE i,                 "LINE-LENGTH
      loc_rqident       LIKE tsp01-rqident,     "SPOOL NUMBER
      loc_rq2name(12)   TYPE c.
    DATA: loc_filename LIKE rlgrap-filename.     "FILENAME
    DATA:loc_repid LIKE sy-repid,                    " Report to execute
         loc_linsz LIKE sy-linsz VALUE 115,          " Line size
         loc_paart LIKE sy-paart VALUE 'X_65_132'.   " Paper Format
    Include           ZIMPR_PERFORMS_WRAP----
    *&  Include           ZIMPR_PERFORMS_WRAP
    *&      Form  f_top_page
         top-of the page
    -->  p1        text
    <--  p2        text
    FORM f_top_page .
    *--HEADER--
      FORMAT COLOR 1 .
      WRITE : text-010.
      FORMAT COLOR 1 OFF.
      WRITE : / text-011,sy-datum NO-GAP.
      WRITE : / text-012,sy-uzeit NO-GAP,90 text-013,101 sy-uname.
      ULINE .
      FORMAT COLOR 1 INTENSIFIED OFF .
      WRITE : 1 sy-vline,                "HEADINGS
      2 text-014 NO-GAP,
      7 sy-vline,
      8 text-015 NO-GAP,
      20 sy-vline,
      21 text-016 NO-GAP,
      76 sy-vline,
      77 text-017 NO-GAP,
      88 sy-vline,
       89 text-018  NO-GAP,
      115 sy-vline.
      WRITE : /1 sy-vline,
        2 text-019 NO-GAP,7 sy-vline,
        20 sy-vline,76 sy-vline,77 text-020 NO-GAP,88 sy-vline,115 sy-vline.
      ULINE.
      FORMAT COLOR 1 OFF.
    ENDFORM.                    " f_top_page
    *&      Form  f_data_retrieval
         select statements
    -->  p1        text
    <--  p2        text
    FORM f_data_retrieval .
    SELECTING ORDER TYPE,ORDER NO.,OBJECT NO. AND BASIC START DATE
      SELECT  p~aufnr
               p~auart
               p~objnr
               p~ktext
               r~gstrp
               FROM  ( aufk AS p INNER JOIN afko AS r ON raufnr = paufnr )
               INTO TABLE int_aufk
               WHERE p~aufnr IN s_order AND
                     p~auart IN s_ordert AND
                     r~gstrp IN  s_bdate AND
                     p~objnr LIKE wf_objnr.
      IF sy-subrc <> 0.
        MESSAGE s101(zipm).                "no values found for selection criteria.
        STOP.
      ENDIF.
      SORT int_aufk BY aufnr.
      DELETE ADJACENT DUPLICATES FROM int_aufk.
      SELECT q~istat
           p~objnr
           FROM ( jest AS p INNER JOIN tj02t AS q ON pstat = qistat )
           INTO TABLE int_sta
           FOR ALL ENTRIES IN int_aufk
           WHERE p~objnr = int_aufk-objnr
                 AND q~txt04 IN s_status and
                 q~spras = wf_langu and
                 p~inact = ''.
      IF sy-subrc <> 0.
        MESSAGE s101(zipm).                "no values found for selection criteria.
        STOP.
      ENDIF.
      SORT int_sta BY objnr.
      DELETE ADJACENT DUPLICATES FROM int_sta.
    *--SELECTING OBJECT NO.,STATUS AND LANGUAGE--
      IF int_sta[] IS NOT INITIAL.
        SELECT p~objnr
               q~txt04
               q~istat
               q~spras
               FROM ( jest AS p INNER JOIN tj02t AS q ON pstat = qistat )
               INTO TABLE int_tj02t
               FOR ALL ENTRIES IN int_sta
               WHERE p~inact = '' AND
                     p~objnr = int_sta-objnr AND
                     q~spras = wf_langu AND
                    q~txt04 IN s_status AND
                     p~objnr LIKE wf_objnr.
        IF sy-subrc <> 0.
          MESSAGE s101(zipm).               "no values found for selection criteria.
          STOP.
        ENDIF.
      ENDIF.
    ENDFORM.                    " f_data_retrieval
    *&      Form  f_report_display
          report display
    -->  p1        text
    <--  p2        text
    FORM f_report_display .
      LOOP AT int_tj02t.              "concatenating the status into a internal table
        AT NEW objnr.
          CLEAR int_temp-status.
        ENDAT.
        CONCATENATE int_temp-status int_tj02t-txt04 INTO int_temp-status SEPARATED BY space.
        AT END OF objnr.
          int_temp-objnr = int_tj02t-objnr.       "key field.
          APPEND int_temp.
          CLEAR int_temp.
        ENDAT.
        CLEAR int_tj02t.
      ENDLOOP.
      LOOP AT int_aufk.
        CONCATENATE sy-mandt int_aufk-aufnr INTO wf_name .    "concatenating client number and order number
    *--THIS FM CAPTURES THE LONG TEXT AND STORES IT IN INTERNAL TABLE--
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
            id                      = wf_kopf         "TEXT ID
            language                = sy-langu       "LANGUAGE
            name                    = wf_name        "TEXT NAME
            object                  = wf_aufk         "TEXT OBJECT
          TABLES
            lines                   = int_tline      "LINES OF LONG TEXT.
          EXCEPTIONS
            id                      = 1
            language                = 2
            name                    = 3
            not_found               = 4
            object                  = 5
            reference_check         = 6
            wrong_access_to_archive = 7
            OTHERS                  = 8.
        IF sy-subrc <> 0.
          int_tline-tdline = int_aufk-ktext.
          APPEND int_tline.
          CLEAR :int_tline.
        ENDIF.
        LOOP AT int_tline.
    *--THIS FM WRAPS THE LONG TEXT INTO 54 CHARACTERS EACH--
          CALL FUNCTION 'RKD_WORD_WRAP'
            EXPORTING
              textline            = int_tline-tdline          "LONG TEXT LINE
              outputlen           = 54                        "OUTPUT LENGTH
            TABLES
              out_lines           = int_wrap                  "INTERNAL TABLE
            EXCEPTIONS
              outputlen_too_large = 1
              OTHERS              = 2.
          IF sy-subrc <> 0.
            CLEAR :int_tline.
          ENDIF.
        ENDLOOP.
    *-- THIS FM WRAPS THE STATUS INTO 25 CHARACTERS EACH--
        READ TABLE int_temp WITH KEY objnr = int_aufk-objnr.
        CALL FUNCTION 'RKD_WORD_WRAP'
          EXPORTING
            textline            = int_temp-status
            outputlen           = 25
          TABLES
            out_lines           = int_wrap2
          EXCEPTIONS
            outputlen_too_large = 1
            OTHERS              = 2.
        IF sy-subrc <> 0.
         CONTINUE.
        ENDIF.
        IF NOT int_wrap2[] IS INITIAL.
          ULINE AT (115).
        ENDIF.
        DESCRIBE TABLE int_wrap LINES wf_i2.         "COUNTING THE NO. OF LINES FOR TABLE INT_WRAP
        DESCRIBE TABLE int_wrap2 LINES wf_i1.        "COUNTING THE NO. OF LINES FOR TABLE INT_WRAP2
        WHILE ( wc_i1 LE wf_i1 OR wc_i2 LE wf_i2 ).
          IF ( wc_i2 LE wf_i2 ).
            READ TABLE int_wrap INDEX wc_i2 .        "READING THE INTERNAL TABLE INT_WRAP WITH INDEX
            wc_i2 = wc_i2 + 1.
          ENDIF.
          IF ( wc_i1 LE wf_i1 ).
            READ TABLE int_wrap2 INDEX wc_i1 .       "READING THE INTERNAL TABLE INT_WRAP2 WITH INDEX
            wc_i1 = wc_i1 + 1.
          ENDIF.
    *--THIS FM CONVERTS THE DATE FROM SYSTEM FORMAT TO OUTPUT FORMAT--
          CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
            EXPORTING
              input  = int_aufk-gstrp
            IMPORTING
              output = wf_date1.
          IF NOT int_wrap2[] IS INITIAL .
    *--REPORT DISPLAY--
            WRITE : /1 sy-vline, 2 int_aufk-auart COLOR = 4 INTENSIFIED OFF NO-GAP ,
                    7 sy-vline ,8 int_aufk-aufnr COLOR = 4 INTENSIFIED OFF NO-GAP,
                    20 sy-vline,21 int_wrap-line,
                    76 sy-vline ,77  wf_date1 ,
                    88 sy-vline ,89 int_wrap2-line,
                    115 sy-vline.
    *--CLEARING THE VARIABLES--
            wf_date1 = ''.
            CLEAR: int_aufk,int_temp,int_wrap2-line,int_wrap-line.
          ENDIF.
        ENDWHILE.
        wc_i1 = 1.
        wc_i2 = 1.
        CLEAR :int_wrap,int_wrap2.
        REFRESH : int_wrap,int_wrap2,int_tline.
      ENDLOOP.
      ULINE AT (115).
    ENDFORM.                    " f_report_display
    *&      Form  F_PDF_DISPLAY
         pdf conversion
    -->  p1        text
    <--  p2        text
    FORM f_pdf_display .
    *--THIS FM CONVERTS THE SPOOL REQUEST INTO PDF REPORT--
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid              = wf_id                 "SPOOL NUMBER
          no_dialog                = space
          pdf_destination          = 'X'
        IMPORTING
          pdf_bytecount            = loc_bytecount        "NUMBER OF BYTES TRANSFERRED
        TABLES
          pdf                      = int_pdf                                  "TABLE FOR PDF REPORT
        EXCEPTIONS
          err_no_abap_spooljob     = 1
          err_no_spooljob          = 2
          err_no_permission        = 3
          err_conv_not_possible    = 4
          err_bad_destdevice       = 5
          user_cancelled           = 6
          err_spoolerror           = 7
          err_temseerror           = 8
          err_btcjob_open_failed   = 9
          err_btcjob_submit_failed = 10
          err_btcjob_close_failed  = 11
          OTHERS                   = 12.
    ENDFORM.                    " F_PDF_DISPLAY
    *&      Form  f_download_local
         download to local system
    -->  p1        text
    <--  p2        text
    FORM f_download_local .
    ---------------------THIS FM DOWNLOADS THE PDF REPORT INTO LOCAL MACHINE
    data  loc_ret TYPE iwerrormsg.
      CALL FUNCTION 'IW_C_GET_SAPWORKDIR'
       IMPORTING
         SAPWORKDIR       = loc_file
        ERROR_MSG        =  loc_ret
      loc_filename = loc_file.
      if loc_ret is initial.
      concatenate loc_filename '\work order header long text_  ' sy-timlo '.pdf' into loc_filename.
      endif.
      CALL FUNCTION 'DOWNLOAD'
        EXPORTING
          bin_filesize = loc_bytecount      "NO. OF BYTES
          filename     = loc_filename       "DEFAULT FILE NAME
          filetype     = 'BIN'
        IMPORTING
          act_filename = loc_filename
        TABLES
          data_tab     = int_pdf.
    ENDFORM.                    " f_download_local
    if you have any doubts,,
    please revert
    Regards,
    Talwinder

  • How to convert BLOB data into string format.

    Hi,
    I have problem while converting blob data into string format.
    for example,
    Select dbms_lob.substr(c.shape.Get_wkb(),4000,1) from geotable c
    will get me the first 4000 byte of BLOB .
    When i using SQL as i did above,the max length is 4000, but i can get 32K using plsql as below:
    declare
    my_var CLOB;
    BEGIN
    for x in (Select X from T)
    loop
    my_var:=dbms_lob.substr(x.X,32767,1)
    end loop
    return my_var;
    I comfortably convert 32k BLOB field to string.
    My problem is how to convert blob to varchar having size more than 32K.
    Please help me to resolve this,
    Thanx in advance for the support,
    Nilesh

    Nilesh,
    . . . .The result of get_wkb() will not be human readable (all values are encoded into some binary format).
    SELECT utl_raw.cast_to_varchar2(tbl.geometry.get_wkt()) from FeatureTable tbl;
    -- resulting string:
        ☺AW(⌂özßHAA
    Å\(÷. . . .You may also want to have a look at { dbms_lob | http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#i1015792 } "The DBMS_LOB package provides subprograms to operate on BLOBs, CLOBs, NCLOBs, BFILEs, and temporary LOBs."
    Regards,
    Noel

  • Could anyone help me test about 'Thai' language support

    Hi, I would like to ask anyone who owned new iPod touch to help me test if its support Thai language for web browsing and audio files.
    Please open this website / play this audio files and take some photos for me.
    http://manager.co.th (this page should all in Thai)
    http://zickr.com (also in Thai, but with utf-8 encoding)
    http://download.yousendit.com/108FB2EB0D2E6427 (this m4a file contains Thai song title, I would like to check if its display in new touch correctly)
    Thanks a lot!

    To leave your comments and feedback for suture enhancements to the ipod touch it is best to leave your feedback at the link below.
    http://www.apple.com/feedback/ipod.html
    That link is where apple will read your comments.
    GFF

Maybe you are looking for