Convert EBCDIC to ASCII and ASCII to EBCDIC in PI7.0 SP14

Wea re going to be implementing PI7.0 SP14.
I am writing the technical specification for an inbound/outbound interface into/out of ECC 6.0!
I need to convert the File that is created out of SAP into EBCDIC in PI and for the inbound convert the file from EBCDIC into ASCII for import into ECC.
I have more than one way to this...
The ways I have found so far are:
Use MessageTransformBean, use TextCodepageConversionBean, XmlAnonymizerBean, using the File Encoding field on the File/FTP Adapter, XSLT mapping or Java mapping!
I have checked the OSS Note 821267, but this doesn't help.
I am sure all these methods have pros and cons...
What would be the most efficient method of changing this?  It will be running hourly and have upto 6000 entries an hour - each way!

Hi Barry,
I think the most efficient way in my thinking is XSLT and Java mapping.
For java mapping u just need to get thye jar file.I believe that the encoding cp285 / cp500 is EBCIDIC. Try printing
byte [] msg = .. // whatever
System.out.println(new String(msg, "cp285"));
if you get an exception saying Cp285 is unknown you may need an international version of the JRE, depends on the version you're using.
Also u can use this in reverse.
Please see this post:
Re: Handling Packed decimals in XI
regards
Aashish Sinha
Edited by: Aashish Sinha on Mar 25, 2008 6:07 PM

Similar Messages

  • Unicode and ascii conversion help needed

    I am trying to read passwords from a foxpro .dbf. The encrpytion of the password is crude, it takes the ascii value of each char entered and adds an integer value to it, then stores the complete password to the table. So to decode, just subtract same integer value from each chars retieved from .dbf. pretty simple.
    The problem is that java chars and strings are unicode, so when my java applet retrieves these ascii values from the .dbf they are treated as unicode chars, if the ascii value is over 127 I have problems.
    The question. how can i retrieve these ascii values as ascii values in java?
    Should I use an InputStream like:
    InputStream is=rs.getAsciiStream("password");
    Is there a way to convert from unicode to extended ascii?
    Some examples would be helpful, Thanks in advance.

    version 1
    import java.nio.charset.Charset;
    import java.nio.ByteBuffer;
    import java.nio.CharBuffer;
    class Test {
        static char[] asciiToChar(byte[] b) {
            Charset cs = Charset.forName("ASCII");
            ByteBuffer bbuf = ByteBuffer.wrap(b);
            CharBuffer cbuf = cs.decode(bbuf);
            return cbuf.array();
        static byte[] charToAscii(char[] c) {
            Charset cs = Charset.forName("ASCII");
            CharBuffer cbuf = CharBuffer.wrap(c);
            ByteBuffer bbuf = cs.encode(cbuf);
            return bbuf.array();
    }version 2
    import java.io.*;
    import java.nio.charset.Charset;
    class Test {
        static char[] asciiToChar(byte[] b) throws IOException {
            Charset cs = Charset.forName("ASCII");
            ByteArrayInputStream bis = new ByteArrayInputStream(b);
            InputStreamReader isr = new InputStreamReader(bis, cs);
            char[] c = new char[b.length];
            isr.read(c, 0, c.length);
            return c;
        static byte[] charToAscii(char[] c) throws IOException {
            Charset cs = Charset.forName("ASCII");
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            OutputStreamWriter osw = new OutputStreamWriter(bos, cs);
            osw.write(c, 0, c.length);
            osw.flush();
            byte[] b = bos.toByteArray();
            return b;
    }

  • Reading a fle format thats part ascii and part binary

    Hey
    I'm trying to write a importer for the PLY filke format. That file format starts of with a header in ascii and then continues with either the data in ascii or in binary. When the data is in ascii I have no problem reading the file but when the data is in binary I'm noth quite sure how I should do it. Right now I do something like this:
    BufferedInputStream stream = new BufferedInputStream(new FileInputStream(file)); // I first create this
    BufferedReader reader = new BufferedReader(new InputStreamReader(stream));  // then this is for reader ascii
    DataInputStream dataInputStream = new DataInputStream(stream); // And this is for reading binaryThen I read the ascii header with the BuffereReader and then wheter I turns out that the data is in ascii I countine reading with the reader, otherwise I start reading with the DataInputStream. But the data from the DataInputStream is not the same as I get from the BufferedReader. I try it on these files that are in diffrent endians and either ascii ot binary
    http://www.cs.ucl.ac.uk/staff/Joao.Oliveira/ply.html in the Nbunny.zip.
    Anyone that can help me with this? Or know about a PLY file reader in java already?
    Discordia
    Message was edited by:
    Discordia

    DataInputStream is NOT the right class to use for general binary input. It is used only for the specific purpose of reading Java primitives. The input obviously needs to be in the right format for that to work, i.e. it needs to be written using a DataOutputStream.
    I would read everything using an InputStream, not a reader. Store the bytes of the header until you reach the end of the header (not sure how to determine that since I don't know the fileformat). Then convert those bytes into a String using the proper charset ("US-ASCII" in this case, if by "ascii" you really mean ASCII).
    Then just continue reading the binary data.

  • Regarding the xif adapter and ascii adapter

    Dear experts
    I have a requirement where i have to connect the crm system to non sap systems using the xif adapter and ascii adapter could you tell me  what are the configurations steps to be followed for this.
    Thanks & Regards
    Rao

    1)  Don't use the ASCII adapter
    2)  Use the LSMW with the XIF adapter instead
    As the previous posters said, it depends on what you want to convert, which will determine how to use this.  A quick example of the XIF adapter with the LSMW is located in my blog here:
    /people/stephen.johannes/blog/2005/08/18/external-data-loads-for-crm-40-using-xif-adapter
    Plus do a search on this forum for more information on using the XIF adapter.
    Take care,
    Stephen

  • Convert billing output to an ASCII format

    Dear Gurus,
    We have set up a new printer to convert billing output to an ASCII format.
    It's working fine except
    The formatting is not as we would expect, and we are missing some data.
    Can you please help me out what settings need to look out that can be changed.
    It would be a great help.
    Regards,
    Sandeep

    please go through the following two links this will provide u the necessary information
    http://help.sap.com/saphelp_45b/helpdata/en/d6/0dbadd494511d182b70000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/EN/d9/4a933c51ea11d189570000e829fbbd/content.htm
    Please do check the necessary settings mentioned in these links
    hope this will help u out

  • Applescript for converting UTF-8 (styled )to ASCII

    Does anyone know of an applescript built to change text encoding from UTF-8 to standard ASCII 7 bit?
    I found something called TEC_OSAX1.3.3 on the macscripter forum but was unable to get it to work (I think because it is a classic application). Any help on this would be appreciated as well (can't open the readme file).
    I have a standard UTF-8 XML file that I want to prepare to upload to a web site but I need all the extended UTF-8 characters converted into the standard ASCII characters.
    I have enough applescript experience to do very basic operations but not enought to build something more complex like this.
    Any help would be appreciated.
    Thanks
    Jesse
    Mac book pro   Mac OS X (10.4.2)  
    I-Mac G5   Mac OS X (10.4.2)  
    I-Mac G5   Mac OS X (10.4.2)  

    I have a standard UTF-8 XML file that I want to
    prepare to upload to a web site but I need all the
    extended UTF-8 characters converted into the standard
    ASCII characters.
    There's no way to convert "extended" UTF-8 into ASCII, since the latter doesn't contain the required characters. Unless you are talking about converting them into NCR's like & #1234;. If that's the idea, there's an app called UnicodeChecker which can do it.
    Sometimes UTF-8 can be converted to ISO-8859-1. Is that what's required?
    Why exactly do you need to do this? Is your server one those few which are (mis)configured to only support Latin-1? If so, this can usually be fixed by other means, like an .htaccess file in your web space.
    If you are just talking about one or a few files, you can simply open with TextEdit set to UTF-8 and then save in the new encoding.

  • What is the diffrence between ASCII and BIN mode

    Hello All,
    What is the diffrence between ASCII and BIN mode
    Regards,
    Lisa.

    'ASC' :
    ASCII format. The table is transferred as text. The conversion exits are
    carried out. The output format additionally depends on the parameters
    CODEPAGE, TRUNC_TRAILING_BLANKS, and TRUNC_TRAILING_BLANKS_EOL.
    'IBM' :
    ASCII format with IBM codepage conversion (DOS). This format correspond
    to the 'ASC' format when using target codepage 1103. This codepage is
    often used for data exchange by disc.
    'DAT' :
    Column-by-column transfer. With this format, the data is transferred as
    with ASC text. However, no conversion exists are carried out and the
    columns are separated by tab characters. This format creates files that
    can be uploaded again with gui_upload or ws_upload.
    'DBF' :
    The data is downloaded in dBase format. Because in this format the file
    types of the individual columns are included, import problems, for
    example, into Microsoft Excel can be avoided, especially when
    interpreting numeric values.
    'WK1' :
    The data is downloaded in Lotus 1-2-3 format.
    'BIN' :
    Binary format. The data is transferred in binary format. There is no
    formatting and no codepage conversion. The data is interpreted row by
    row and not formatted in columns. Specify the length of the data in
    parameter BIN_FILESIZE. The table should consist of a column of type X,
    because especially in Unicode systems the conversion of structured data
    into binary data leads to errors.

  • Need your suggestions - how to display large file in ASCII and HEX

    Hello,
    I want to create an application which can read in a large file and switch between displaying ASCII and HEX (formatted a particular way). There are two problems here that I'm not quite sure how to solve.
    1. How to switch dynamically between ASCII and HEX. Should the HEX formatter be in the document of the JTextArea(or equivalent), or somewhere in the view? If it's in the view then where? I'd rather not read in the file more than once.
    2. How to do some kind of paging scheme for huge files. I'd like to read in part of the file and display it, then when the user scrolls to another area, read in that part of the file.
    Thanks!
    Jeff

    Hello,
    I want to create an application which can read in a
    large file and switch between displaying ASCII and
    HEX (formatted a particular way). There are two
    problems here that I'm not quite sure how to solve.
    1. How to switch dynamically between ASCII and HEX.
    Should the HEX formatter be in the document of the
    e JTextArea(or equivalent), or somewhere in the view?
    If it's in the view then where? I'd rather not read
    d in the file more than once.You can iterate over all the characters in the String using String.charAt, cast the chars to ints, and call Integer.toHexValue(...)
    >
    2. How to do some kind of paging scheme for huge
    files. I'd like to read in part of the file and
    display it, then when the user scrolls to another
    area, read in that part of the file.
    Thanks!
    Jeff

  • Read binary and ascii values from input stream

    Hi All
    I want to read a stream that consist both binary values and ascii values. Length of the stream cannot anticipate. Can you help me?
    Thanks

    Sameera wrote:
    Hi All
    I want to read a stream that consist both binary values and ascii values. Length of the stream cannot anticipate. Can you help me?
    ThanksHave a look at this:
    Character and Byte Streams
    http://java.sun.com/docs/books/tutorial/i18n/text/stream.html

  • Ascii and asciistr

    when i am using function    select asciistr('abcd') ,asciistr('?lp') from dual;
    its not working and it displays as
    ASCIISTR('DEFG') ASCIISTR('?X!')
    DEFG             ?x!            
    whereas when i am using
    select ascii('abcd'),ascii('?lp') from dual;
    i am getting the following output
    ASCII('DEFG') ASCII('?X!')
               68           63
    what is the difference between the two?
    why asciistr not working? and ascii is showing that output which asciistr should have shown

    Hi,
    Both functions are working correctly.
    Why do you think ASCIISTR is not working?  Why do you think ASCII is wron
    Look up each function in the SQL Language manual if you're confused about what they are supposed to do.
      ASCII returns a NUMBER, depending on the 1st character of the arguemnt only.
      ASCIISTR   returns a string, depending on the entire argument.

  • Incrementing Ascii and integer loop

    Hi there,
    Just wondering if anybody can help me with this little problem that I have... I'm trying to write a loop that increments ascii and integers. It should look something like this:
    0 1 2 3 4 5 6 7 8 9 A B C D ..... X Y Z 00 01 02..... 0A 0B 0C .... 0Z 10 11 .... ABCD1 and so on...
    I got the loop bits but I don't know what I can do to combine the 2...
             for (char x= 'A'; x <= 'Z'; x++)
                   System.out.println("Count is:" + x);
             for(int i=1; i<11; i++){
                   System.out.println("Count is: " + i);Can anybody give me some tips please? Thanks in advance!

    you can do this you know
    for(int i=0,char a='a';i<11,a<='z';i++,z++)and then print whatever you want to

  • After I connected my hard disk to a friend's windows system all my files have been converted to .ink files and do not open....what do i do? They had important content

    after connecting my hard disk to a windows laptop all my files have somehow converted to .ink files and are not accessible.....what do i do?

    What do you mean by "all files", surely only one category of files got their default open program changed.
    Choose the affected files, right click on an individual file, and "open with",...change to default program.
    For a group, right click > show info > open with > change ALL
    If more than one group of files has had its default opening program changed, a time machine roll-back would be the easy option. Do you have a TM backup?

  • My .jpg's have ALL suddenly been converted to .pdf's and I am unable to open them

    Using Windows 8.1, when I went to view some jpg's earlier today, I found they now show as "Adobe Acrobat Documents." When I try to open one, I get the error message that they are jpg's and Adobe is unable to open a jpg.???

    And it was easy -- once I went to "Properties" in Windows Explorer. That was the tough part -- finding where to make the change.
    Thank you for your help.
    Bob Slone
    [privated information removed by moderator]
          From: ~graffiti <[email protected]>
    To: Robert Slone <[email protected]>
    Sent: Wednesday, January 7, 2015 4:09 PM
    Subject:  My .jpg's have ALL suddenly been converted to .pdf's and I am unable to open them
    My .jpg's have ALL suddenly been converted to .pdf's and I am unable to open them
    created by ~graffiti in Adobe Reader - View the full discussionEasy enough to fix. You need to change your system file associations to whatever program you used in the past to open .jpg files. Here's how -
    > Choose the apps Windows uses by default - Windows Help If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7075247#7075247 and clicking ‘Correct’ below the answer Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7075247#7075247 To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"  Start a new discussion in Adobe Reader by email or at Adobe Community For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624.

  • I want to remove the monitor from my 17" Macbook Pro 2008 to use as an external for my Macbook Pro 15" 2012. How can I convert lvds to Thunderbolt and power the monitor?

    I want to remove the monitor from my 17" Macbook Pro 2008 to use as an external for my Macbook Pro 15" 2012. How can I convert lvds to Thunderbolt and power the monitor?

    It's almost impossible.  The new iMacs have a Target Display Mode, but it's built to do that.  Without ripping your screen out, finding an acceptable power supply, frame, and whatever electronics to convert a Thunderbolt signal to the screen, the cost will be much larger than buying a cheaper HiDef monitor that runs with an HDMI to Thunderbolt cable to your MacBook 15.  In fact, you can sell your 17" MBP for a lot of money, unless it's broken or something, buying you a really sweet monitor.
    By the way, I found your answer by searching this forum.  I would suggest using the search function here in the futuere.

  • ALV output converted into PDF format and send that PDF to user through mail

    Hi Experts,
    I have report earlier its output was in alv grid.
    Now i want that ALV output converted into PDF format.And that PDF output send to user through mail.
    Can u please tell how to do?
    My code is here(output is displaying in ALV grid).
    INCLUDE <icon>.
    TYPE-POOLS: slis, kkblo.
    TABLES : zmsd_freight_hdr, zmsd_freight_det, zmsd_blinfo, zmsd_diheader.
    TABLES : lfa1.
    DATA : t_hdr   LIKE   zmsd_freight_hdr   OCCURS 0 WITH HEADER LINE,
           T_DET   LIKE   ZMSD_FREIGHT_DET   OCCURS 0 WITH HEADER LINE,
           t_bl    LIKE   zmsd_blinfo        OCCURS 0 WITH HEADER LINE,
           t_di    LIKE   zmsd_diheader      OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF t_det OCCURS 0.
            INCLUDE STRUCTURE zmsd_freight_det.
    DATA    type(30).
    DATA: END OF t_det.
    DATA: v_target2(30),
          v_zsammg LIKE t_det-zsammg,
          v_gsttotal LIKE t_det-zamount.
    DATA : BEGIN OF t_data OCCURS 0,
             zsammg       LIKE  zmsd_freight_hdr-zsammg,
             zdidbl       LIKE  zmsd_freight_hdr-zdidbl,
             zvkorg       LIKE  zmsd_freight_hdr-zvkorg,
             zinvno       LIKE  zmsd_freight_hdr-zinvno,
             zttlamt      LIKE  zmsd_freight_hdr-zttlamt,
             zstatus      LIKE  zmsd_freight_hdr-zstatus,
             ztype        LIKE  zmsd_freight_hdr-ztype,
             zconfirm     LIKE  zmsd_freight_hdr-zconfirm,
             zconfirmdate LIKE  zmsd_freight_hdr-zconfirmdate,
             erdat        LIKE  zmsd_freight_hdr-erdat,
             ernam        LIKE  zmsd_freight_hdr-ernam,
             erzet        LIKE  zmsd_freight_hdr-erzet,
             aedat(10),
             aenam        LIKE  zmsd_freight_hdr-aenam,
             aezet        LIKE  zmsd_freight_hdr-aezet,
             zline        LIKE  zmsd_freight_det-zline,
             zfptype      LIKE  zmsd_freight_det-zfptype,
             zchrcode     LIKE  zmsd_freight_det-zchrcode,
             zcurcode     LIKE  zmsd_freight_det-zcurcode,
             zqty         LIKE  zmsd_freight_det-zqty,
             zuom         LIKE  zmsd_freight_det-zuom,
             zrate        LIKE  zmsd_freight_det-zrate,
             zamount      LIKE  zmsd_freight_det-zamount,
             zexrate      LIKE  zmsd_freight_det-zexrate,
           zccode       LIKE  zmsd_blinfo-zccode,      "MADK991565
             zccode       like  ZMSD_FREIGHT_HDR-zfcode, "MADK991565
             zbldate(10),
             zbl          LIKE  zmsd_blinfo-zbl,
             type(3),
             waerk        LIKE  zmsd_freight_det-zcurcode,
             zamountl     LIKE  zmsd_freight_det-zamount,
           END OF t_data.
    DATA : w_layout      TYPE   slis_layout_alv,
           w_catalog     TYPE   slis_fieldcat_alv,
           t_catalog     TYPE   slis_t_fieldcat_alv,
           w_sort        TYPE   slis_sortinfo_alv,
           t_sort        TYPE   slis_t_sortinfo_alv.
    DATA   V_ZINVNO    like   T_HDR-ZINVNO.                   "MADK991565
    DATA : v_count  TYPE  i.
    SELECTION-SCREEN BEGIN OF BLOCK a0 WITH FRAME TITLE text-001.
    PARAMETERS     :  p_zvkorg LIKE zmsd_freight_hdr-zvkorg  OBLIGATORY .
    SELECT-OPTIONS :  s_zdidbl FOR  zmsd_freight_hdr-zdidbl             ,
                      s_zccode FOR  lfa1-lifnr                          ,
                      s_status FOR  zmsd_freight_hdr-zstatus            ,
                      s_ztype  FOR  zmsd_freight_hdr-ztype              ,
                      s_erdat  FOR  zmsd_freight_hdr-erdat              ,
                      s_ernam  FOR  zmsd_freight_hdr-ernam              ,
                      s_zconfd FOR  zmsd_freight_hdr-zconfirmdate       .
    PARAMETERS     :  p_zconf  AS   CHECKBOX                            .
    SELECTION-SCREEN END OF BLOCK a0.
    SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-002.
    PARAMETERS     :  p_hdr    RADIOBUTTON GROUP rad DEFAULT 'X'        ,
                      p_det    RADIOBUTTON GROUP rad                    .
    SELECTION-SCREEN END OF BLOCK a1.
    INITIALIZATION.
    AT SELECTION-SCREEN.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM process.
      PERFORM display.
    END-OF-SELECTION.
      PERFORM fm_get_num_pages.
    AT USER-COMMAND.
    AT LINE-SELECTION.
    TOP-OF-PAGE.
      PERFORM fm_top_of_page USING '7010' sy-title space.
    FORM get_data.
      SELECT   *
        FROM   zmsd_freight_hdr
        INTO   TABLE t_hdr
       WHERE   zvkorg        EQ  p_zvkorg
         AND   zdidbl        IN  s_zdidbl
         AND   zstatus       IN  s_status
         AND   ztype         IN  s_ztype
         AND   erdat         IN  s_erdat
         AND   ernam         IN  s_ernam
         AND   zconfirmdate  IN  s_zconfd
         AND   ZFCODE        IN  S_ZCCODE.                      "MADK991565
      IF p_zconf = 'X'.
        DELETE t_hdr WHERE zconfirm NE 'C'.
      ENDIF.
      CHECK NOT t_hdr[] IS INITIAL.
      SELECT   *
        FROM   zmsd_blinfo
        INTO   TABLE t_bl
         FOR   ALL ENTRIES IN t_hdr
       WHERE   zsammg = t_hdr-zsammg.
      SORT t_bl BY zsammg.
      SELECT   *
        FROM   zmsd_diheader
        INTO   TABLE t_di
         FOR   ALL ENTRIES IN t_hdr
       WHERE   zsammg = t_hdr-zsammg.
      SORT t_di BY zsammg.
    IF P_DET = 'X'. "MADK933361
      SELECT   *
        FROM   zmsd_freight_det
        INTO   TABLE t_det
         FOR   ALL ENTRIES IN t_hdr
       WHERE   zsammg  =  t_hdr-zsammg
       AND ZINVNO =  T_HDR-ZINVNO .                           "MADK991565
    SORT t_det BY zsammg zline.                            "MADK991565
       SORT T_DET BY ZSAMMG ZINVNO ZLINE.                     "MADK991565
    ENDIF. "MADK933361
    ENDFORM.
    FORM process.
      REFRESH t_data.
      CLEAR v_gsttotal.                                         "MADK933361
      LOOP AT t_hdr.
    Start of MADK933361
        CLEAR: v_target2.
        v_zsammg = t_hdr-zsammg.
        V_ZINVNO = T_HDR-ZINVNO.                                "MADK991565
       AT NEW zsammg.                                         "MADK991565
         AT NEW ZINVNO.                                         "MADK991565
          PERFORM get_gst_value.
        ENDAT.
    End of MADK933361
        PERFORM move_header.
        CHECK t_data-zccode IN s_zccode.
        IF p_det = 'X'.
    CSF Project Changes Starts   DEV34    MADK985782
        LOOP AT T_DET WHERE ZSAMMG = T_HDR-ZSAMMG..
          LOOP AT t_det WHERE zsammg = t_hdr-zsammg AND
                              zinvno = t_hdr-zinvno.
    CSF Project Changes Ends     DEV34    MADK985782
            PERFORM move_header.
            CHECK t_data-zccode IN s_zccode.
            MOVE-CORRESPONDING t_det TO t_data.
            t_data-zamountl = t_data-zamount * t_data-zexrate.
            APPEND t_data.
            CLEAR t_data.
          ENDLOOP.
        ELSE.
          APPEND t_data.
          CLEAR t_data.
        ENDIF.
        AT END OF zsammg.
          CLEAR v_gsttotal.
        ENDAT.
    *Start of changes for  IS090901289-PIA MADK991565
        AT END OF ZINVNO.
          CLEAR V_GSTTOTAL.
        ENDAT.
    *End of changes for  IS090901289-PIA MADK991565
      ENDLOOP.
    ENDFORM.
    FORM move_header.
      MOVE-CORRESPONDING t_hdr TO t_data.
      t_data-zttlamt = t_data-zttlamt + v_gsttotal.             "MADK933361
      t_data-waerk = 'SGD'.
      IF NOT t_hdr-aedat IS INITIAL.
        WRITE: t_hdr-aedat TO t_data-aedat.
      ELSE.
        CLEAR : t_data-aedat.
      ENDIF.
      READ TABLE t_bl WITH KEY zsammg = t_hdr-zsammg BINARY SEARCH.
      IF sy-subrc EQ 0.
      t_data-zccode  = t_bl-zccode.   "MADK991565
        T_DATA-ZCCODE = T_HDR-ZFCODE.   "MADK991565     
        IF NOT t_bl-zbldate IS INITIAL.
          WRITE: t_bl-zbldate TO t_data-zbldate.
        ENDIF.
        t_data-zbl     = t_bl-zbl.
        t_data-type    = 'DBL'.
      ELSE.
        READ TABLE t_di WITH KEY zsammg = t_hdr-zsammg BINARY SEARCH.
        IF sy-subrc EQ 0.
        t_data-zccode  = t_di-zdiforcode.     "MADK991565
          T_DATA-ZCCODE = T_HDR-ZFCODE.         "MADK991565
          t_data-type    = 'DI'.
        ENDIF.
      ENDIF.
    ENDFORM.
    FORM display.
      IF t_data[] IS INITIAL.
        MESSAGE s398(00) WITH 'No Data Selected'.
        EXIT.
      ENDIF.
      DATA : l_repid LIKE sy-repid.
      l_repid = sy-repid.
      REFRESH t_catalog.
      CLEAR   t_catalog.
      w_layout-cell_merge = 'X'.
      PERFORM map_fields.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = l_repid
                i_callback_user_command = 'ALV_USER_COMMAND'
                is_layout               = w_layout
                it_fieldcat             = t_catalog[]
                i_grid_title            = sy-title
                i_save                  = 'A'
                it_sort                 = t_sort[]
           TABLES
                t_outtab                = t_data
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.
    FORM map_fields.
    Sort Order
      CLEAR v_count.
      PERFORM sf USING 'ZDIDBL'   'X'  'X'.
    Fields to be displayed
      CLEAR v_count.
      IF p_hdr = 'X'.
        PERFORM af USING :
       DESCRIPTION       FIELD        LEN   RTABLE             RFIELD
        'DI/DBL         ' 'ZDIDBL'     '14' '                ' '        ',
        'Type           ' 'TYPE'       '04' '                ' '        ',
        'Forwarder Code ' 'ZCCODE'     '14' '                ' '        ',
        'BL Number      ' 'ZBL'        '14' '                ' '        ',
        'BL Date        ' 'ZBLDATE'    '10' '                ' '        ',
        'Invoice Number ' 'ZINVNO'     '15' '                ' '        ',
        'Extraction     ' 'ZSTATUS'    '05' 'ZMSD_FREIGHT_HDR' 'ZSTATUS ',
        'Freight Type   ' 'ZTYPE'      '05' 'ZMSD_FREIGHT_HDR' 'ZTYPE   ',
        'Confirmation   ' 'ZCONFIRM'   '05' 'ZMSD_FREIGHT_HDR' 'ZCONFIRM',
        'Confirm Date   ' 'ZCONFIRMDATE' '10' 'ZMSD_FREIGHT_HDR'
    'ZCONFIRMDATE',
        'Total Amount   ' 'ZTTLAMT'    '18' '                ' '        ',
        'Created On     ' 'ERDAT'      '10' '                ' '        ',
        'Created By     ' 'ERNAM'      '10' '                ' '        ',
        'Changed On     ' 'AEDAT'      '10' '                ' '        ',
        'Changed By     ' 'AENAM'      '10' '                ' '        '.
      ELSE.
        PERFORM af USING :
       DESCRIPTION         FIELD     LEN   RTABLE             RFIELD
        'DI/DBL           ' 'ZDIDBL'   '14' '                ' '        ',
        'Type             ' 'TYPE'     '04' '                ' '        ',
        'Forwarder Code   ' 'ZCCODE'   '14' '                ' '        ',
        'BL Number        ' 'ZBL'      '14' '                ' '        ',
        'BL Date          ' 'ZBLDATE'  '10' '                ' '        ',
        'Invoice Number   ' 'ZINVNO'   '15' '                ' '        ',
        'Extraction       ' 'ZSTATUS'  '05' 'ZMSD_FREIGHT_HDR' 'ZSTATUS ',
        'Freight Type     ' 'ZTYPE'    '05' 'ZMSD_FREIGHT_HDR' 'ZTYPE   ',
        'Confirmation     ' 'ZCONFIRM' '05' 'ZMSD_FREIGHT_HDR' 'ZCONFIRM',
        'Confirm Date     ' 'ZCONFIRMDATE' '10' 'ZMSD_FREIGHT_HDR'
    'ZCONFIRMDATE',
        'Total Amount     ' 'ZTTLAMT'  '18' '                ' '        ',
        'Freight Payment  ' 'ZFPTYPE'  '14' '                ' '        ',
        'Charge Code      ' 'ZCHRCODE' '10' '                ' '        ',
        'Currency         ' 'ZCURCODE' '08' '                ' '        ',
        'Quantity         ' 'ZQTY'     '13' '                ' '        ',
        'UoM              ' 'ZUOM'     '04' '                ' '        ',
        'Rate             ' 'ZRATE'    '15' '                ' '        ',
        'Amt(Foreign Curr)' 'ZAMOUNT'  '16' '                ' '        ',
        'Exchange Rate    ' 'ZEXRATE'  '13' '                ' '        ',
        'Amt(Local Curr)  ' 'ZAMOUNTL' '16' '                ' '        ',
        'Created On       ' 'ERDAT'    '10' '                ' '        ',
        'Created By       ' 'ERNAM'    '10' '                ' '        ',
        'Changed On       ' 'AEDAT'    '10' '                ' '        ',
        'Changed By       ' 'AENAM'    '10' '                ' '        '.
      ENDIF.
    ENDFORM.
    FORM af USING text
                  field
                  len
                  table
                  reffield.
      v_count = v_count + 1.
      w_catalog-col_pos       = v_count.
      w_catalog-fieldname     = field.
      w_catalog-ref_tabname   = table.
      w_catalog-ref_fieldname = reffield.
      w_catalog-seltext_s     = text.
      w_catalog-seltext_m     = text.
      w_catalog-seltext_l     = text.
      w_catalog-outputlen     = len.
      IF field = 'ZTTLAMT' OR field = 'ZAMOUNTL'.
        w_catalog-no_zero     = 'X'.
        w_catalog-cfieldname  = 'WAERK'.
        w_catalog-datatype    = 'CURR'.
      ENDIF.
    IF FIELD = 'ZRATE' OR FIELD = 'ZAMOUNT'.
      IF field = 'ZAMOUNT'.
        w_catalog-no_zero     = 'X'.
        w_catalog-cfieldname  = 'ZCURCODE'.
        w_catalog-datatype    = 'CURR'.
      ENDIF.
      IF field = 'ZQTY' OR field = 'ZRATE'.
        w_catalog-no_zero     = 'X'.
        w_catalog-datatype  =  'DEC'.
      ENDIF.
      APPEND w_catalog TO t_catalog.
      CLEAR  w_catalog.
    ENDFORM.
    FORM sf    USING   fieldname  sortup  group.
      v_count = v_count + 1.
      CLEAR w_sort.
      w_sort-fieldname = fieldname.
      w_sort-spos      = v_count.
      w_sort-up        = sortup.
      w_sort-group     = group.
      APPEND w_sort TO t_sort.
    ENDFORM.
    FORM alv_user_command USING  in_ucomm    LIKE sy-ucomm
                                 in_selfield TYPE slis_selfield.
      DATA: lfs_data LIKE t_data.
      IF in_ucomm = '&IC1'.
        READ TABLE t_data INDEX in_selfield-tabindex INTO lfs_data.
        CHECK NOT lfs_data-zdidbl IS INITIAL.
        IF lfs_data-type = 'DBL'.
          DATA: l_zdbl LIKE zmsd_diheader-zdinum.
          l_zdbl = in_selfield-value.
          EXPORT l_zdbl TO MEMORY ID 'VBL'.
          CALL TRANSACTION 'ZMSD_BL01'.
        ENDIF.
        IF lfs_data-type = 'DI'.
          DATA: v_dinum LIKE zmsd_diheader-zdinum.
          v_dinum = in_selfield-value.
          EXPORT v_dinum TO MEMORY ID 'VDI'.
          CALL TRANSACTION 'ZMSD_DI01'.
        ENDIF.
      ENDIF.
    ENDFORM.
    FORM get_gst_value.
      LOOP AT t_det WHERE zsammg = v_zsammg
         AND ZINVNO = V_ZINVNO.                              "MADK991565
        CHECK t_data-zccode IN s_zccode.
        t_det-zamount  = t_det-zamount * t_det-zexrate.
        SELECT SINGLE  y0mmtarget2
                INTO   v_target2
                FROM   y0mmipstranslate
                WHERE  y0mmdatatype = '70' AND
                       y0mmsource = t_det-zchrcode.
        SELECT SINGLE y0mmtarget1
               INTO   t_det-type
               FROM   y0mmipstranslate
               WHERE  y0mmdatatype = '76' AND
                      y0mmsource = v_target2.
        IF t_det-type NE '3Z'.
          v_gsttotal    = v_gsttotal +
                               ( t_det-zamount * 5 / 100 ).
        ENDIF.
      ENDLOOP.
    Regards,
    Raj.

    Hello,
    Following is the procedure to convert alv output to spool and then it to PDF Format.
    After we display the ALV, we can check whether it is running in the background using system field u2018sy-batchu2018. Then,we call an function module named u2018GET_JOB_RUNTIME_INFOu2019 to get the current job information. Then go to spool request table tbtcp to get the spool id.
    Get current job details
      CALL FUNCTION u2018GET_JOB_RUNTIME_INFOu2019
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                               AND jobcount = gd_jobcount
                               AND stepcount = gd_stepcount
                               AND listident <> u20180000000000u2032
                               ORDER BY   jobname
                                                   jobcount
                                                   stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
    Finally, we can call function module u2018CONVERT_ABAPSPOOLJOB_2_PDFu2018 to convert spool reqeust(which is stored in OTF format) to PDF format. Then we can call either function module u2018SO_DOCUMENT_SEND_API1u2032 or SAP BCS (Business Communication Service) to send the pdf as an email attachment.
    CALL FUNCTION u2018CONVERT_ABAPSPOOLJOB_2_PDFu2019
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount = gd_bytecount
           TABLES
                pdf = it_pdf_output
           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.
    Regards,
    Sayali
    Edited by: Sayali Paradkar on Apr 20, 2010 12:51 PM

Maybe you are looking for

  • Training Coordinator for Org Unit

    Hi How can we assign training coordinator to Org unit ?? Regards Ammad

  • How to make JDev aware of the xmldb API

    Hi everybody, I am a real beginner in Jdev, and I have to develop a Java Application using Oracle Java developer, against an XML-native database called eXist. I'll have to use a java API called xmldb supported by eXist in order to interact with the d

  • CRM - Lead Status in BI Report not loading

    Need to do reporting on CRM Customer Leads Management. (for reference we are using BI 7 and CRM 5) In the CRM system I have a field called status (with the data element being CRM_J_STATUS) and it has 6 different status values. E.g. Open, Assigned , i

  • Please let me know the sample format of the standard time characterstics..

    Hi Please let me know the sample format of the standard time characterstics.. Calendar Day-0CALDAY--> Calendar Year/Month--> Calendar month--> Quarter  --> Calendar year/quarter--> Calendar Year/Week--> Calendar Year--> Fiscal year / period--> Postin

  • Hierarchy with postable node -- data will be displayed on leaves only

    Hello, I have programmed a generic data source for hierarchy of BOM which should display CO-PCP data along the BOM hierarchy, comparable to transaction CK13N on R/3. The hierarchy is loaded successfully, having the following info objects: 0SOURSYSTEM