How to send string in RFC by performaned way

Hi *,
I need to create a RFC function and send messages to NON-SAP system, and the message type should be string. I couldn't define string in table parameter. If I define in importing paramter as table type, It will heavily reduce the performance for RFC. Is the only way to spilt string to characters?
Thanks in advance.

Why does it have to be type STRING?
I think you can use type BAPI_MSG as well (or any other character type).
If you want to/have to use type STRING, you can just test the performance using the table type as importing parameter and decide for yourself whether it is too slow. It's not that it's not possible to do it like that.
Reward if helpfull...
Cheers,
Rakesh.

Similar Messages

  • How to send data to RFC Destination(RFC SENDER Adapter)

    Hi ,
    Scenario:  R/3 Backendà RFC Sender Adapterà XIàsome other system.
    I have configured the RFC destination (of the type TCP/IP) at R/3 System and have registered the Program ID (specified in the RFC destination) in the XI server and using it in the configuration parameters of the RFC Sender Adapter.
    Problem: I do not know how I can send data to the RFC destination. (Should I use a report program/ ABAP Function Module?) Can anybody provide me with a sample code of Report Program/Function module (whichever is required), how to send data to the RFC Destination, so that it may be picked up by my RFC Sender Adapter.
    Thanks and Regards,
    Siva Maranani

    I have one query for you that
    I am trying to develop a scenario in SAP XI
    SAP R/3 ( RFC function module) sends a synchronous request to the XI and SAP XI will send this request to a third party web application using HTTP receiver adapter.
    I am able to send the data/message and it is successfully received at the third party web application.
    But I am facing one issue that I am unable to receive any message/data in my RFC module back.i have seen in sxmb_moni that the two messages are displayed in successfuly processed but in SAP R/3 side nothing get happedned
    Can you tell me how to use some waiting mechanism in function module to wait for the response from SAP XI.
    Regards
    Gopesh

  • How to send string data through socket!

    Is there any method to send string data over socket.
    and if client send string data to server,
    How to get that data in server?
    Comments please!

    Thank for your kind answer, stoopidboi.
    I solved the ploblem. ^^;
    I open the source code ^^; wow~~~~~!
    It will useful to many people. I spend almost 3 days to solve this problem.
    The program works like this.
    Client side // string data ------------------------> Server side // saving file
    To
    < Server Side >
    * Server.java
    * Auther : [email protected]
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Server extends JFrame
         private JTextField enter;
         private JTextArea display;
         ObjectInputStream input;
         DataOutputStream output;
         FileOutputStream resultFile;
         DataInputStream inputd;
         public Server(){
              super("Server");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent ev){
                             //None
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display),
                     BorderLayout.CENTER);
              setSize(300, 150);
              show();
         public void runServer(){
              ServerSocket server;
              Socket connection;
              int counter = 1;
              display.setText("");
              try{
                   server = new ServerSocket(8800, 100);
                   while(true){
                        display.append("Waiting for connection\n");
                        connection = server.accept();
                        display.append( counter + " connection is ok.\n");
                        display.append("Connection " + counter +
                             "received from: " + connection.getInetAddress().getHostName());
                        resultFile = new FileOutputStream("hi.txt");
                        output = new DataOutputStream(resultFile);
                        output.flush();
                        inputd = new DataInputStream(
                             connection.getInputStream()
                        display.append("\nGod I/O stream, I/O is opened\n");
                        enter.setEnabled(true);
                        try{
                             while(true){
                                  output.write(inputd.readByte());
                        catch(NullPointerException e){
                             display.append("Null pointer Exception");
                        catch(IOException e){
                             display.append("\nIOException Occured!");
                        if(resultFile != null){
                             resultFile.flush();
                             resultFile.close();
                        display.append("\nUser Terminate connection");
                        enter.setEnabled(false);
                        resultFile.close();
                        inputd.close();
                        output.close();
                        connection.close();
                        ++counter;
              catch(EOFException eof){
                   System.out.println("Client Terminate Connection");
              catch(IOException io){
                   io.printStackTrace();
              display.append("File is created!");
         public static void main(String[] args){
              Server app = new Server();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runServer();
    < Client side >
    * Client.java
    * Auther : [email protected]
    package Client;
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Client extends JFrame
         private JTextField enter;
         private JTextArea display;
         DataOutputStream output;
         String message = "";
         public Client(){
              super("Client");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent e){
                             //None
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display), BorderLayout.CENTER);
              message = message + "TT0102LO12312OB23423PO2323123423423423423" +
                        "MO234234LS2423346234LM2342341234ME23423423RQ12313123213" +
                        "SR234234234234IU234234234234OR12312312WQ123123123XD1231232" +
                   "Addednewlinehere\nwowowowwoww";
              setSize(300, 150);
              show();
         public void runClient(){
              Socket client;
              try{
                   display.setText("Attemption Connection...\n");
                   client = new Socket(InetAddress.getByName("127.0.0.1"), 8800);
                   display.append("Connected to : = " +
                          client.getInetAddress().getHostName());
                   output = new DataOutputStream(
                        client.getOutputStream()
                   output.flush();
                   display.append("\nGot I/O Stream, Stream is opened!\n");
                   enter.setEnabled(true);
                   try{
                        output.writeBytes(message);
                   catch(IOException ev){
                        display.append("\nIOException occured!\n");
                   if(output != null) output.flush();
                   display.append("Closing connection.\n");
                   output.close();
                   client.close();
              catch(IOException ioe){
                   ioe.printStackTrace();
         public static void main(String[] args){
              Client app = new Client();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runClient();

  • Not Sure How To Send String

    I'm totally new to trying to network using Java and extremely poor at networking in general so bear with me here.
    I'm trying to make a top down shooter and currently the application allows the user to either play as host or connect to a host but all the network communication handling I'm doing involves creating strings, sending them along the connection and interpreting the strings on their reciept.
    The problem I'm having is I keep getting an unexpected end of file exception when it tries to read in the string.
    I used a basic IM application as an example of how to connect and send info in Java, which is where I got the idea to use in.readUTF and out.writeUTF to send string information but upon looking into this problem it seems to me that read/writeUTF is not really designed for strings and there should be something else I should use instead but I'm not sure what?
    Also I'm using this to communicate point information of each player and as I understand it I should be using TCP to do this as that was what the example I'm using said it used. Though I think it might be more useful to use UDP as it's faster and it shouldn't matter if I drop a packet or two, though I'm not sure where in my code it specifies a difference between the two and if that really is the best idea.
    Here's a zip of my netbeans project, though be warned it's VERY messy, probably the messiest code I've ever written, not to mention hacky as well: http://rapidshare.com/files/369943023/KerazehDood.zip
    Any help would be great.
    Thanks.
    Edited by: ThePermster on Mar 30, 2010 6:59 AM

    Thanks that seems to make much more sense, still having some troubles though.
    Ok so now the majority of it seems to be working and it seems to be sending the String just fine. And I'm having it send the String to the BufferedWriter "out" and then using the newLine() method to send a carriage return but the BufferedReader on "in" seems to not detect the carriage return.
    I have it doing a readLine() so that (as I understand it) it should be blocking, waiting until an end of line character so I assume each call of newLine() should have it pick up something but a quick breakpoint shows that it never stops blocking on readLine().
    I assume the connection is fine because the application running as server uses the socket object returned by the accept() method.
    Is there something I've perhaps misunderstood about the BufferedReader's readLine() method?
    Here's the new version of my netbeans project:
    http://rapidshare.com/files/371224512/KerazehDood.rar
    Also on a different line of questioning, I'm just wondering about socket convention.
    I was thinking it'd be useful in a game similar to what I'm attempting to make to not only send player position information but also client keypress information, I was just wondering, if you're doing something like that would it be frowned upon to use two separate ports? I think it would make the implementation far more legible and easy to structure but wasn't sure if applications usually try to stick to only one port or not.
    Thanks.
    Edited by: ThePermster on Apr 2, 2010 10:54 AM

  • How to send string with line feed to Agilent 33250A via COM1

    Agilent 33250A is a function generator. In HPERTERMINAL, when "Send line ends with line feeds" is enabled, simple strings make it work well, such as: "APPLQU", "OUTPUT ON", etc...
    But I can't make it work with .vi file. COM setting is correct because 33250A shows "remote" icon immediatly after string sent. It will respon "error" to any mismatched setting (e.g. 9600 vs 115200). So, the connection is there but it just doesn't respond to commands.
    I don't know why. The termination character is enabled in .vi
    I apprecite your help to make the .vi to send string just like the HYPERTERMINAL with 'line feeds'.
    Thank you very much.
    Jian
    Attachments:
    Serial_Communication.vi ‏40 KB
    Write2COM1.vi ‏22 KB

    From what I can see it looks like you are NOT specifying what termination character you want to use when you call the serial port init.
    When not otherwise specified, the port will be configured to use the default termination character which is a "carrige return" HEX 0A.
    Try wiring a "Line Feed" constant to the init VI.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to display String attribute in a Formatted way ?

    Hi all,
    We are using JDev 10.1.3.1, ADF BC + adf faces.
    In our database, there is a varchar column stored as : "070000001", this is a readonly attribute (updated by stored procedure).
    In jspx, we want to display it as : "07/0000001" .
    How can we do that ? (there is no hints for string attribute ?)
    Thank you for your help,
    xtanto

    you can use a SQL-calculated attribute with an appropriate SQL expression -- using SUBSTR() and string contatentation -- or you can use a java-calculated transient attribute.
    the former will allow the user to query on it. The latter wouldn't.

  • JDBC- RFC - JDBC    How to send result set to rfc  ?

    Hi Friends ,
                        I am working on scenario like .
              <b>          I have to read  data from a sql server using select statement and send same   data  to r3 ( using RFC  we are inserting the same as  a copy ) .
                        Then i have have get confirmation from R3 as data inserted succesfully  - Flag  .Then we have to come back to same table and update one field  flag as 'U'.</b>
                      For this I am using JDBC Sender Adapter and RFC Receiver Adapter .Will i use  as Synchronous  Interface ?
                      I think i have to use JDBC  Receiver Adapter    also to Complete the cycle .
                      Can you please clarify  the following....
                       1. how is that whole selected data will send to R3 . If i use Select statement in JDBC Sender Adapter  it will as resultset  .It will contain Multiple Rows right ?  Our RFC Will accept the parameter as string .
                        2. If we use the synchronous Interface will it send row by row from the result send Then  get back the result from R3 and come back again to JDBC ( Database ) and  update the required field ?
                        3. In JDBC Sender Adapter , the Update Parameter doing the Updation  Part  prior to get the status from R3. How to handle this ?
                       4. Do i need to configur teh separate JDBC Receiver adpater for this updation part ? Then We cann't use Synchronous Interface right ?
                     5 . Will JDCB Sender  Adapter get the result set (by select statement )  and send to r3 as row by row and get the confirmation message as inserted  ?
    Best Regards .,
    V.Rangarajan

    Hi Udo ,
                   Thanks for your reply . If i have used the synchronnous RFC Calls  , that RFC will return the flag as 'Y' or 'N'  , for  Either succesfully inserted or Not successful .
                      In this synchronous  how can i use the JDBC Receiver adapter ?
                     If 'Y'  or 'N' I have to update the<b> same table ,same row</b> which have sent to RFC .  My doubt , we are  wrirtng the  SQL  select query as  "  <b>select * from table  name where UpdateStatus is null</b> " .
                     So it will return multiple rows right ?   I have to uses the synchronous response form RFC to update the row of the  same table using JDBC Adapter right ?
                   Can you please explain me little bit more ? I am new to xi .
    Best Regards .,
    V.Rangarajan

  • How we will know whether RFC destinations have been created for sender and

    Hi,
        How we will know whether RFC destinations have been created for sender and XI system.
    Thanks,
    dhanush.

    Hi Dhanush,
    you can check using the TCODE SM59.
    Regards
      Kenny

  • How to send image converted to string to remote pc over tcp/ip

    hi,
              I have couple of questions. I have captured images on firewire cameras through CVS 1456. To send them on host PC i have converted an image to string. Now
    1.  How to send the image  converted to string to Host PC via TCP/IP? Please give some example.
    2.  How to converted these recived strings back to image if  iwant to proess them.
    thanks in advance.
    regards,
    yashpal

    Hi MikeS81 
    i am Prabhu.G from chennai(india). i saw your attached picture. after
    traing this image send through TCP/IP program. but sum errors in
    receiving part. so please check it this one.  i attached this VI &
    (error)picture. please send me the solution of this.
    my mail id:[email protected]  
    Attachments:
    imag send tcp.PNG ‏79 KB
    image tcp.vi ‏30 KB

  • Using the RFC adapter (sender), how do I know which RFC is being sent?

    Hello everyone!
    Has anyone used the RFC adapter (sender) in XI to pick up RFC messages? How would I know which RFC is triggered for example when a user creates a PO (purchase order)?
    Warm Regards,
    Glenn

    Glenn,
    When u are writinfg RFC program, u will have destination right?  There u know u have to give RFC Destination(SM59) while creating RFC destination we will be giving Program ID .
    Similarly in XI while creating Sender RFC u have to give the program id. So with these program id these programs are linked together and triggered from R/3 to the exact Sender adapter.
    Please see Michal weblog for more details
    /people/michal.krawczyk2/blog/2005/03/29/configuring-the-sender-rfc-adapter--step-by-step
    I hope it clears your doubt!!!
    Best regards,
    raj.

  • How to send month as string to date

    Hi
    my input comes as
    month year.( oct 2008 or Nov 2008 etc )
    The target field is a Date.
    I have tried using Date trans but it doesnt accept strings.
    so is there a way send the incoming field  without changing target data to string?
    Regards,
    Venkat.

    I am assuming you can bring in month & year in 2 seperate variable to UDF named as below
    String strMonth & String strYear
    java.text.DateFormat df = new SimpleDateFormat("dd/MON/yyyy");
    java.util.Date today = df.parse("01""/"strMonth"/"strYear);
    Now you have the date object & you can convert the way you need. Please note I am initializing the object to start of the month always.
    Regards
    Unni

  • How do I send strings over a TCP/IP LAN N/W

    I want to send string information over LANs which can be viewed on Hyperterminal in PCs on the N/W
    Pls help me out
    Solved!
    Go to Solution.

    Are you trying to broadcast a message on your LAN? If so you'd need to use UDP (since it's a connectionless protocol) and use the broadcast address for your subnet. You'd have to check with your network admin as to what that is, though it's probably x.x.x.255 or 255.255.255.255. TCP requires a connection so for TCP/IP you'd need to send the message to each individual IP address. Alternatively, if you're on Windows you could use the "net send" command using System Exec.

  • How to send a String value  from Servlet to  Action class in Struts .

    when iam trying to send string value from Servlet to Struts Action class through Http Session, iam getting null value, iam really in big confusion, help me.

    please elaborate clearly or put you code of both action and servlet here
    Are both of them in same web application

  • How to send a file from FTP to external server

    My requirement is to send a file from FTP to D3(External) server.
    Now I am able to store the file in Appln server.
    I want to send the file created by the program thru FTP to D3 server.
    I know the username,Password,HostID,RFC destination details.
    How to send the file from FTP to D3.
    If u have any program,Plz send it...
    I dont want the function modules name...I want the example code ....
    Thanks in advance.

    Hi Sumi,
    You could do it so that you create a .bat or .cmd script to your server which does your ftp transfer.
    To do this you must use sm69 to create a external operating system command which you can call from FM SXPG_COMMAND_EXECUTE. To SXPG_COMMAND_EXECUTE you the file you need to transfer as a parameter.
    What happens is that your abap program passes the file to windows batch script (.bat .cmd) which will then do the transfer for you.
    Here's a sample of ftp-script for windows:
    echo open IP_ADDRESS_TO_YOUR_SERVER > c:zftp_transfer.ftp
    echo USERNAME>> c:zftp_transfer.ftp
    echo PASSWORD>> c:zftp_transfer.ftp
    echo put YOUR_FILE>> c:zftp_transfer.ftp
    echo quit>> c:zftp_transfer.ftp
    ftp -s:c:zftp_transfer.ftp
    also take a look here for more details:
    http://support.microsoft.com/?kbid=96269
    Ok, this might be a bit trivial but if your server is unix/aix etc.. Instead of using batch script you must do a shell script.
    Regards,
    Ville

  • How to Send Internal table to SAP Spool using Function Modules or Methods?

    Hi Experts,
    How to Send Internal table to SAP Spool using Function Modules or Methods?
    Thanks ,
    Kiran

    This is my code.
    I still get the no ABAP list data for the spool, even tho I can see it sp01?
    REPORT  Z_MAIL_PAYSLIP.
    * Declaration Part *
    tables: PERNR, PV000, T549Q, V_T514D, HRPY_RGDIR.
    infotypes: 0000, 0001, 0105, 0655.
    data: begin of ITAB occurs 0,
      MTEXT(25) type C,
      PERNR like PA0001-PERNR,
      ABKRS like PA0001-ABKRS,
      ENAME like PA0001-ENAME,
      USRID_LONG like PA0105-USRID_LONG,
    end of ITAB.
    data: W_BEGDA like HRPY_RGDIR-FPBEG,
          W_ENDDA like HRPY_RGDIR-FPEND.
    data: RETURN like BAPIRETURN1 occurs 0 with header line.
    data: P_INFO like PC407,
          P_FORM like PC408 occurs 0 with header line.
    data: P_IDX type I,
          MY_MONTH type T549Q-PABRP,
          STR_MY_MONTH(2) type C,
          MY_YEAR type T549Q-PABRJ,
          STR_MY_YEAR(4) type C,
          CRLF(2) type x value '0D0A'.
    data: W_CMONTH(10) type C.
    data: TAB_LINES type I,
          ATT_TYPE like SOODK-OBJTP.
    data: begin of P_INDEX occurs 0,
            INDEX type I,
    end of P_INDEX.
    constants: begin of F__LTYPE, "type of line
       CMD like PC408-LTYPE value '/:',  "command
       TXT like PC408-LTYPE value 's',   "textline
    end of F__LTYPE.
    constants: begin of F__CMD, "commands
      NEWPAGE like PC408-LINDA value '',
    end of F__CMD.
    data: P_LIST like ABAPLIST occurs 1 with header line.
    *data: OBJBIN like SOLISTI1 occurs 10 with header line,
    data: OBJBIN like  LVC_S_1022 occurs 10 with header line,
          DOCDATA like SODOCCHGI1,
          OBJTXT like SOLISTI1 occurs 10 with header line,
          OBJPACK like SOPCKLSTI1 occurs 1 with header line,
          RECLIST like SOMLRECI1 occurs 1 with header line,
          OBJHEAD like SOLISTI1 occurs 1 with header line,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_buffer type string,
          l_no_of_bytes TYPE i,
          l_pdf_spoolid LIKE tsp01-rqident,
          l_jobname     LIKE tbtcjob-jobname.
    data: file_length  type int4,
          spool_id     type rspoid,
          line_cnt     type i.
    *-------------------------------------------------------------------* * INITIALIZATION *
    OBJBIN = ' | '.
    append OBJBIN.
    OBJPACK-HEAD_START = 1.
    data: S_ABKRS like PV000-ABKRS.
    data: S_PABRP like T549Q-PABRP.
    data: S_PABRJ like T549Q-PABRJ.
    * SELECTION SCREEN                                                  *
    selection-screen begin of block BL1.
    parameters: PAY_VAR like BAPI7004-PAYSLIP_VARIANT default 'ESS_PAYSLIPS' obligatory.
    selection-screen end of block BL1.
    START-OF-SELECTION.
      s_ABKRS = PNPXABKR.
      S_PABRP = PNPPABRP.
      s_pabrj = PNPPABRJ.
      w_begda = PN-BEGDA.
      w_endda = PN-ENDDA.
    get pernr.
    *                                 "Check active employees
      rp-provide-from-last p0000 space pn-begda  pn-endda.
      CHECK P0000-STAT2 IN PNPSTAT2.
    *                                 "Check Payslip Mail flag
      rp-provide-from-last p0655 space pn-begda  pn-endda.
      CHECK P0655-ESSONLY = 'X'.
      rp-provide-from-last p0001 space pn-begda  pn-endda.
    *                                 "Find email address
      RP-PROVIDE-FROM-LAST P0105 '0030' PN-BEGDA PN-ENDDA.
      if p0105-usrid_LONG ne ''.
        ITAB-PERNR      = P0001-PERNR.
        ITAB-ABKRS      = P0001-ABKRS.
        ITAB-ENAME      = P0001-ENAME.
        ITAB-USRID_LONG = P0105-USRID_LONG.
        append itab.
        clear itab.
      endif.
      "SY-UCOMM ='ONLI'
    END-OF-SELECTION.
    *------------------------------------------------------------------* start-of-selection.
      write : / 'Payroll Area        : ', S_ABKRS.
      write : / 'Payroll Period/Year : ',STR_MY_MONTH,'-',STR_MY_YEAR. write : / 'System Date : ', SY-DATUM.
      write : / 'System Time         : ', SY-UZEIT.
      write : / 'User Name           : ', SY-UNAME.
      write : / SY-ULINE.
      sort ITAB by PERNR.
      loop at ITAB.
        clear : P_INFO, P_FORM, P_INDEX, P_LIST, OBJBIN, DOCDATA, OBJTXT, OBJPACK, RECLIST, TAB_LINES.
        refresh : P_FORM, P_INDEX, P_LIST, OBJBIN, OBJTXT, OBJPACK, RECLIST.
    *                                                  Retrieve Payroll results sequence number for this run
        select single * from HRPY_RGDIR where PERNR eq ITAB-PERNR
                                        and FPBEG ge W_BEGDA
                                        and FPEND le W_ENDDA
                                        and SRTZA eq 'A'.
    *                                                  Produce payslip for those payroll results
        if SY-SUBRC = 0.
          call function 'GET_PAYSLIP'
            EXPORTING
              EMPLOYEE_NUMBER = ITAB-PERNR
              SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
              PAYSLIP_VARIANT = PAY_VAR
            IMPORTING
              RETURN          = RETURN
              P_INFO          = P_INFO
            TABLES
              P_FORM          = P_FORM.
          check RETURN is initial.
    *                                                 remove linetype from generated payslip
          loop at p_form.
            objbin = p_form-linda.
            append objbin.
            line_cnt = line_cnt + 1.
          endloop.
          file_length = line_cnt * 1022.
    *                                                 create spool file of paylsip
          CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
            EXPORTING
              i_file_length = file_length
            IMPORTING
              e_spoolid     = spool_id
            TABLES
              it_textdata   = objbin.
          IF sy-subrc EQ 0.
            WRITE spool_id.
          ENDIF.
          DESCRIBE table objbin.
          DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
          CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
            EXPORTING
              SRC_SPOOLID                    = spool_id
              NO_DIALOG                      = ' '
              DST_DEVICE                     = 'MAIL'
    *      PDF_DESTINATION                =
    *    IMPORTING
    *      PDF_BYTECOUNT                  = l_no_of_bytes
    *      PDF_SPOOLID                    = l_pdf_spoolid
    *      LIST_PAGECOUNT                 =
    *      BTC_JOBNAME                    =
    *      BTC_JOBCOUNT                   =
            TABLES
              PDF                            = pdf
            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
          IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    *Download PDF file C Drive
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename = 'C:\itab_to_pdf.pdf'
          filetype = 'BIN'
        TABLES
          data_tab = pdf.
    * Transfer the 132-long strings to 255-long strings
    *  LOOP AT pdf.
    *    TRANSLATE pdf USING ' ~'.
    *    CONCATENATE gd_buffer pdf INTO gd_buffer.
    *  ENDLOOP.
    *  TRANSLATE gd_buffer USING '~ '.
    *  DO.
    *    it_mess_att = gd_buffer.
    *    APPEND it_mess_att.
    *    SHIFT gd_buffer LEFT BY 255 PLACES.
    *    IF gd_buffer IS INITIAL.
    *      EXIT.
    *    ENDIF.
    *  ENDDO.
          OBJHEAD = 'Objhead'.
          append OBJHEAD.
    * preparing email subject
          concatenate W_ENDDA(6)
                    ' Payslip-'
                    ITAB-ENAME+0(28)
                    ITAB-PERNR+4(4) ')'
                 into DOCDATA-OBJ_DESCR.
          DOCDATA-OBJ_NAME = 'Pay Slip'.
          DOCDATA-OBJ_LANGU = SY-LANGU.
          OBJTXT = 'Pay Slip.'.
          append OBJTXT.
    *prepare email lines
          OBJTXT = DOCDATA-OBJ_DESCR.
          append OBJTXT.
          OBJTXT = 'Please find enclosed your current payslip.'.
          append OBJTXT.
    * Write Attachment(Main)
    * 3 has been fixed because OBJTXT has fix three lines
          read table OBJTXT index 3.
    *    DOCDATA-DOC_SIZE = ( 3 - 1 ) * 255 + strlen( OBJTXT ).
          clear OBJPACK-TRANSF_BIN.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = 3.
          OBJPACK-DOC_TYPE = 'RAW'.
          append OBJPACK.
    * Create Message Attachment
          ATT_TYPE = 'PDF'.
          describe table OBJBIN lines TAB_LINES.
          read table OBJBIN index TAB_LINES.
    *    OBJPACK-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
          OBJPACK-TRANSF_BIN = 'X'.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = TAB_LINES.
          OBJPACK-DOC_TYPE = ATT_TYPE.
          OBJPACK-OBJ_NAME = 'ATTACHMENT'.
          OBJPACK-OBJ_DESCR = 'Payslip'.
          append OBJPACK.
    * Create receiver list refresh RECLIST.
          clear RECLIST.
          RECLIST-RECEIVER = itab-USRID_long.
          translate RECLIST-RECEIVER to lower case.
          RECLIST-REC_TYPE = 'U'.
          append RECLIST.
    * Send the document
    *SO_NEW_DOCUMENT_ATT_SEND_API1
          call function 'SO_DOCUMENT_SEND_API1'
            exporting
              DOCUMENT_DATA = DOCDATA
              PUT_IN_OUTBOX = 'X'
              COMMIT_WORK = 'X'
    * IMPORTING
    *   SENT_TO_ALL =
    *   NEW_OBJECT_ID =
            tables
              PACKING_LIST  = OBJPACK
              OBJECT_HEADER = OBJHEAD
              CONTENTS_BIN  = pdf
              CONTENTS_TXT  = OBJTXT
    *   CONTENTS_HEX =
    *   OBJECT_PARA =
    *   OBJECT_PARB =
              RECEIVERS = RECLIST
            exceptions
              TOO_MANY_RECEIVERS = 1
              DOCUMENT_NOT_SENT = 2
              DOCUMENT_TYPE_NOT_EXIST = 3
              OPERATION_NO_AUTHORIZATION = 4
              PARAMETER_ERROR = 5
              X_ERROR = 6
              ENQUEUE_ERROR = 7
              others = 8.
          if SY-SUBRC NE 0.
            ITAB-MTEXT = 'Message Not Sent to : '.
          else.
            ITAB-MTEXT = 'Message Sent to : '.
          endif.
    *    else.
    *      ITAB-MTEXT = 'Message Not Sent to : '.
    *    endif.
        else.
          "SY-SUBRC Not = 0
          ITAB-MTEXT = 'Payroll data not found : '.
        endif.
        "end of SY-SUBRC = 0.
        modify ITAB.
      endloop. "end loop at ITAB
      sort ITAB by MTEXT PERNR.
      loop at ITAB.
        at new MTEXT.
          uline.
          write : / ITAB-MTEXT color 4 intensified on.
          write : / 'Emp. Code' color 2 intensified on,
                 12 'Emp. Name' color 2 intensified on,
                 54 'Email ID' color 2 intensified on.
        endat.
        write : / ITAB-PERNR, 12 ITAB-ENAME, 54 ITAB-USRID_LONG.
      endloop.

Maybe you are looking for