Sending external trigger on AI scan start

I've a trio of E-series DAQ's synchonised with RTSI. Now I want to use the start of the acquisition to trigger an external device.
How do I route the "AI start scan" signal so that I may actually read it on a scope?
I've tried rerouting the AI start scan signal to the various PFI lines but it's not really working!

Dear Foeth,
What programming language are you using and which version of the NI-DAQ driver?
Regards,
RikP
Application Engineering
National Instruments
Rik Prins, CLD
Applications Engineering Specialist Northern Europe, National Instruments
Please tip your answer providers with kudos.
Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

Similar Messages

  • How to externally trigger the execution of TestStand with a start and abort button through a digital interface?

    Hello,
    I'm Currently evaluating TestStand as an alternative for an in-house developed Test Sequencer.
    To start our own Test Sequencer we use a small box, connected to a DIO board. The box has a start button and an abort button. The box also has a pass, a fail and a running led.
    The interface with this box is made via some digital lines of a PCI-DIO-96.
    In our own Test Sequencer we have groups named Init, Run, Abort, Exit.
    The Init group is executed at startup (only once). It is used to initialize all the HW and SW. -> I guess this is the Pre UUT Loop callback in TestStand.
    The Exit group is only executed once at the end of the day when the application is terminated. It is used to free all the used hardware and cleanup all the resources. This probably is the Post UUT Loop Callback in TS.
    When a product needs to be tested, the operator presses the "start" button which triggers our own Test Sequencer and the run and abort group are being executed (first the run group, afterwards the abort group).
    When the product is being tested the "running led" of the little box lights up to indicate to the operator that the application is running. (only when the run and abort group are running)
    The Run group has all the functional tests in it. (MainSequence)
    The abort group is used to put everything back in it's original state after the test on this single product is done. (Post UUT)
    When executing the tests and something goes wrong (operator gets stuck in a clamper, ...) the operator can still press the abort button and then the execution immediately jumps from the currently executing step in the run group to the first step of the abort group. So, when something goes wrong, immediately the abort group is called.
    At the end of the run and abort group, if no errors occured, the "pass led" lights up. If one or more steps went wrong the "fail" led lights up.
    This setup can also be used to test multiple product in parallel. At that time all the different parallel testers have such a small box which contains a "start" and "abort" button and a pass, fail and running led. (it is possible that they are all connected to the same PCI-DIO-96 board. )
    My question:
    Is it possible to do something similar like this in Teststand? If yes, is there an example available that shows me how to do this in TestStand? (externally trigger the execution of TestStand)
    Typically, in the Init group (Pre UUT Loop) the digital interface box gets initialised.
    In the Close group (Post UUT Loop) the digital interface box is taken out of scope.
    Note: The PCI-DIO-96 board to which the digital interface box is connected will also be used in the rest of the developed application (MainSequence, ...)
    What's really important for me is that I can create a process model that all the application developers in our organisation can use. I really don't want any of the application developers (limited software experience) to mess around in all the features of TestStand.
    For them it's important that they just add the function DigitalInterfaceBoxInit () in the Pre UUT Loop Callback and the DigitalInterfaceBoxClose () in the Post UUT Loop Callback, and then everything works!
    It is important that the appliation developers do not have to create any global variables, other functions, synchronisations, parallel sequences, ... in TestStand. All this needs to be done with a simple call to the DigitalInterfaceBoxInit function.
    Thanks in advance for all the help!
    Best Regards,
    Dennis Vanotterdijk
    [email protected]

    Dennis-
    Your application sounds very well suited to TestStand's abilities. I am also quite impressed with your knowledge of how TestStand's architecture is arranged when you are still just considering whether or not to use it.
    I think that TestStand would work really well for you in this application. Like you mentioned it will provide you with a form of standardization for your application developers to work from. It also provides the flexibility for you to add your custom routines in many different places. TestStand also makes parallel and batch testing much easier in TS 2.0 so that you could develop one test for your product and execute different instances of it in parallel to test multiple products at once.
    As for your specific question about how to c
    ontrol TestStand using a DIO board. I think this is very feasible and should not be too difficult. Since TestStand provides you the ability to create a custom operator interface your operator interface could monitor the status of your DIO board and launch/abort executions based on the read values. Usually the executions are launched/aborted when a button on the GUI is pressed however, I do not see any thing different about basing the action on a DI signal vs a mouse click. I am sure your application is more involved than this high level description but from the sounds of it I think it is very possible to do with TestStand.
    Based on my experience of building test systems with TestStand and your description of the application, I would feel very confident in using TestStand to achieve all the goals you mentioned. If you have further detailed questions on how one of your features might be implemented, feel free to contact one of our Application Engineers or email us at www.ni.com/ask
    and we would be glad to help you.
    Best regards,
    Richard McDonell
    National Instruments

  • How can I get started if I am not an advanced user but still want to config ATS660 external trigger?

    There r 2 groups VIs provided by the company: easy VIs and advanced VIs. And set external trigger VI is in the latter one. The manual indicates that only the person who r very familar with the ATSApi Application Programming Interface should attempt using the Advaced VIs. Unfortunately I am not that kind of advanced user. If I want to learn all these stuff(like how to call the VIs in correct order), how can I get started?
    I will be really appreciated if I can get some help here.  all I have now is the ATS660 User Manual and ATS-VI Software Manual. I wonder if there should be other useful manuals, like NI-DAQ user manual that can help to understand how to call/config the device in right order.
    Thank u in advance.
    Dyna----an eager learner

    ya, u r right. That was what happened to me.
    The company is Alazartech. This is a PCI waveform digitizer.
    I've visited the www.alazartech.com , and found no further info about how to call this subVIs in correct order. So I am asking here , hope that any one is familiar with this stuff.
    Anyway, thank u for ur reply.
    I will keep focusing here and expecting some replies.
    Dyna

  • How do I auire data at every third pulse of an external trigger?

    I need to aquire 2048 data points where each one is triggered by the third pulse of an external trigger (TTL). Currently I can aquire 2048 data points where each is triggered by every pulse of an external trigger but I need to be able to do this at every third trigger pulse. It seems that I can't do this simply by entering "2" into the "skip count" input of the "Additional Trig Parameters' input of the "AI Start" VI. My attempt is in the VI titled TriggerScanA.
    Further more I will need to know the actual trigger scan rate for data analysis. This is also prooving difficult since even when I am triggering off every external trigger pulse the actual scan rate only returns zeros. My attempt is i
    n the VI entitled TriggerScanB.
    Thankyou.
    Attachments:
    Trigger_Scan_VI's.llb ‏211 KB

    Greetings,
    This sounds like an interesting application. I would suggest that you use your external pulse train as a scan clock, not as a start trigger. Furthermore, since you want to acquire data every third pulse, you will need to use one of your device's counters to divide-down this signal. To accomplish this task, you will need to configure the counter for pulse train generation with an external source - your external pulse train. You will then need to choose the correct "raw counts" to generate a pulse train with a frequency that is 1/3 of that of your external signal. I would suggest that you examine the example Generate Pulse Train (DAQ-STC).vi for this purpose. Now, you can perform a finite analog input acquisition of 2048 data points u
    sing this pulse train as your scan clock. Finally, to determine the frequency of your scan clock, you will need to us your device's other counter to perform a frequency measurement of either pulse train.
    I believe that this will be your best approach to accomplishing this task. Good luck with your application.
    Spencer S.

  • Digital trigger for analog scan

    I need to synchronize the start of several measurements with a trigger. I am using a NI 4472 input card and PCI-6731 output card. I need to trigger an analog scan on the 4472, a voltage output from the 6731, and trigger a dmm to start scanning with a digital output from the 6731.

    To trigger acquisition on the 4472 from a DIO line on a 6731, you would need to follow recommendations similar to Sal's. You could route the DIO line to a RTSI line on the PXI backplane, and then set up the 4472 to trigger acquisition off that RTSI line. You could also use an external connection and wire the DIO line to the "External Trigger" input on the 4472, and configure it to trigger off that signal. Probably the most important thing for you to do is make sure that everything that you want to trigger off that DIO line is setup and waiting for it before the trigger occurs.
    You can also use the example finder to find examples that will work with each individual device. In the bottom left-hand corner of the LabVIEW example finder, there is a button that you
    can click on to select or add the different pieces of hardware you want examples for. After you have configured that correctly, if you limit results to that hardware (check box), the only examples that you will see will be work with that piece of hardware. There are numerous examples of triggering on a digital line for the 4472. Hopefully this get's you moving. Good luck!
    Logan S.

  • ACE GigE - external trigger - example needed

    Hello,
    I have a CVS-1457RT with a Basler ACE GigE cam - I am having issues when I try to use a hardware trigger for the camera (thru the I/O connection on the camera)
    I've been trying for a few days now, so I decided it was time to ask here
    - have anyone used a similar setup, meaning the camera with external trigger? (controller is not the issues) and would it be possible to share the acquisition VI's?
    best regards,
    Henrik

    Hi Ehlert,
    Sorry you are having problems getting this to work!
    There are a few things to keep in mind when configuring the triggers....
    You will need to enable the trigger on the Ace camera to trigger the specific event (Frame Start) that you want to occur on the specific trigger signal. You might want to consult the Ace user manual for the specifics of doing this, as they have quite a number of options for how the trigger can be configured. Are you using the 1457RT to send the signal to the camera? If so you will then need to configure the 1457RT to send an appropriate trigger. We have some Vision RIO examples that show how to do this. Keep in mind that you also may be experiencing a hardware setup issue. If you are using the isolated outputs on the CVS you will need to provide external power for the outputs to work. It is probably helpful to examine your physical trigger line with a scope and verify thaty the trigger signal is going when you expect, allowing you to isolate which end is not configured appropriately.
    In general, assuming your trigger signal to the camera is working, setting the camera up for triggering is pretty simple:
    -Set Trigger Selector to "Frame Start" (to set context for the other trigger features)
    -Set Trigger Source to "Line1" (only option on Ace GigE)
    -Set Trigger Mode to "On"
    -Set other related features (rising/falling edge, delay, ...)
    Eric

  • How to connect external trigger PCI-1433

    Hi all:
    I met the same problem as this old post: https://forums.ni.com/t5/Machine-Vision/How-to-connect-external-trigger-PCIe-1433/m-p/1677560/highli...
    however the post did not give solution.
    I am having an issue getting the external trigger( from PCI 6259) to work with a cameralink camera, a PCIe-1433 card . The PCI 6259 is connected to BNC 2111, the output trigger signal from CTR0 is connected to the SMB connector on the 1433 card and is providing pulse train at TTL voltages (0-5V).  Using the MAX SOFTWARE and under the Acquisition tab I have CC1 set to external 0, however the camera is not receiving this external trigger. The camera is Basler 4096-140km.
    I measured the ouiput signal from CTL0, the sigal seems good.
    I tried RTSI trigger before, failded. I thought SMB should be more straight forward, seems I was wrong.
    Looking forward to reply!
    Attachments:
    camera configuration.jpg ‏168 KB
    External Camera Trigger(SMB).vi ‏57 KB

    Bobjojo,
    You will actually need to affect the properties of both the camera and the frame grabber to take advantage of this triggering mode. I found a document that contains a good run down of the process to acquire in this mode (linked below). As far as the programming for the acquisition is concerned, the frames will be built at the driver level for the specified frame height. This means that the IMAQ driver will composite the line scans for you, and any simple acquisition (the document shows using the Vision Acquisition Express VI) will be able to pull the image into LabVIEW.
    www.ni.com/white-paper/13786/en/pdf
    Karl G.
    Applications Engineer
    ni.com/support

  • How to use an external trigger on an electrometer (KEITHLEY 6517A)

    I'm really new using LABVIEW, so please, be patient with me...
    I'm using a KEITHLEY electrometer to acquire data from a dosimeter. We are going to do some measurements on a pulsed source and before the pulse there's a trigger signal. I don't know the size of the trigger, I'll just know that when I start my measurements (in another lab) So I would like to implement a case were the user can decide the value of the external trigger, so this information goes to the eqipment before starting the measurement.
    What I would like to know is... Someone can give me a hint on how to do that? I'm using GPIB and LABVIEW 7.1.  and I already took all the 6517A libraries for labview.
    Thank you all

    The external trigger on a 6517 is a TTL signal. Any pulse higher than 3.4V will trigger it. You cannot program the threshold level.
    You can set the delay programmatically with TRIG: DEL <n> command.
    ref: page 2-81 and following of User Manual
    Message Edited by normandinf on 10-21-2008 03:55 PM

  • How to send external mails to the user

    Dears,
    How to send external mails to the user who creates the sales document (Quotation)
    Can you please suggest what modification required in the FM
    Thanks,
    pinky

    You can have a partner function like 'Created by' and use an exit to populate the User ID to this partner function(dont have the system right now but i think this can be done with standard partner detr. procedure also)
    Then, create an Output type for that Partner function with transmission medium as 'External Send'. You can use the standard SAP program to trigger the email. To send the actual email after the output is trigerred, the link connection has to be set up be BASIS but if you want to check, then goto SOST and see if the email got trigerred or not.

  • How to use scb-68 board to send a trigger signal

    I am using Labview 8.5. Our DAQ card is scb-68. I want to send a trigger signal out by using the DAQ. Could anybody tell me how to do that?

    There is a program in another computer waiting for the trigger signal. We don't need to worry about that computer.
    We had a program which can collect data from a temperature controller. When the program start, it also sends a trigger singal out so that the two computers can work simultaneously. But now our temperature controller is changed to a new one. I've built a program to collect data. All what I need now is just sending a trigger signal when the program starts.
    One attachment is the former program (writted by using Lab  windows), another attachment is my new  VI for trigger signal.
    Attachments:
    trigger4.vi ‏28 KB
    diode_scan3.c ‏12 KB

  • Acquisitio​n.GetLastI​mage based on Gige camera external trigger doesn't give me the latest image

    I am planning on using the camera's trigger input to start capturing the image. I have 4 cameras, but I only need 1 image each time. \
    Here are the steps I am using:
    1.  Set the camera to exteral trigger
    2. PLC send the trigger to camera to take the picture
    3. Read the image from camera.
    It only works for the first time becasue it can get the first image, then never refresh the image again..
    Here are the sample codes I use:
                         _session = New ImaqdxSession("Name")
                        _session.Acquisition.Configure(ImaqdxAcquisitionTy​pe.SingleShot, 1)
                        _session.Acquisition.Start();
                        _session.Acquisition.GetImageAt(_currImage, 0)
    The piece of code is running when the PLC sends the trigger to camera. I was wondering whether it might be caused by no image was taken at that time.
    I also tried
                   _session.Acquisition.GetLastImage(_currImage)
    Same behavior..
    The strange thing is if I change the codes like the following
                        _session = New ImaqdxSession("Name")
                        _session.Acquisition.Configure(ImaqdxAcquisitionTy​pe.Continuous, 1)
                        _session.Acquisition.Start();
                        _session.Acquisition.GetLastImage(_currImage)
    It only works when 2 trigger sent from PLC. Should I use _session.Acquisition.GetNextImage(_currImage) instead?
    Question:
    How I do know the new image is arrived?               

    How are you running the repeat acquisition? I assume you are running it a loop of some sort. Are you closing the IMAQdx session at any point? This will help understand why we are seeing the behavior you are getting.
    Cameron T
    Applications Engineer
    National Instruments

  • Does the external trigger of the 5152 count as a second channel?

    Hi everyone,
    The PXI-5152 digitizer is listed as providing a 2GS/s sampling rate (TIS) for one channel only.  My question is whether or not the External Trigger channel counts as a "second channel" when used during data acquisition.  If so, does this cause the maximum acheivable sampling rate to drop to 1GS/s for my data channel (CH 0)?
    My experience has been that this is the case, but I lack a smoking gun which explicitly states this.  When I use the external trigger to control data acquisition on Channel 0, I'm only ever able to acheive 1GS/s.  Am I making a mistake?
    I was hoping that the trigger port would act as a simple comparator.  If not, does this imply that the external trigger channel is being sampled at 1GS/s? 
    Many thanks,
    Jimmy

    Hi Jimmy,
    The External Trigger is not digitized and therefore is not a second channel. It is appropriate to consider it like a comparator.  It can be used as an analog trigger source for the TIS acquisition on channel 0 to achieve 1 channel at 2 GS/s.  I am not sure why you are only achieving 1 GS/s.
    I recommend starting with an example program such as "Configured Acquisition".  You can navigate to this example through the Example Finder, or by using your Start Menu and navigating to All Programs>>National Instruments>>NI-SCOPE>>Examples.  Select your preferred programming environment such as LabVIEW and locate Configured Acquisition.
    Once you have the example open try the following settings to achieve 2GS/s on ch0 triggered from the external trigger input. Set the sampling rate to 2GS/s, the channel to 0, check "TIS Enabled", and ensure that Enforce Realtime is also checked.  Set the trigger type to Edge, and the trigger source to the External Trigger.
    - Jennifer O.
    Product Support Engineer - High Speed Digitizers

  • Sending external email via SAPCONNECT

    Hi all,
    I want to know how to send external email through sap.
    Thanks in advance,
    Manosh.

    HI,
    Try this  code:
    *& Report  ZSENDEMAIL                                                  *
    *& Example of sending external email via SAPCONNECT                    *
    REPORT  zsendemail                    .
    PARAMETERS: psubject(40) type c default  'Hello',
                p_email(40)   type c default '[email protected]' .
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Perform populate_message_table.
    *Send email message, although is not sent from SAP until mail send
    *program has been executed(rsconn01)
    PERFORM send_email_message.
    *Instructs mail send program for SAPCONNECT to send email(rsconn01)
    perform initiate_mail_execute_program.
    *&      Form  POPULATE_MESSAGE_TABLE
          Adds text to email text table
    form populate_message_table.
      Append 'Email line 1' to it_message.
      Append 'Email line 2' to it_message.
      Append 'Email line 3' to it_message.
      Append 'Email line 4' to it_message.
    endform.                    " POPULATE_MESSAGE_TABLE
    *&      Form  SEND_EMAIL_MESSAGE
          Send email message
    form send_email_message.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      gd_doc_data-obj_name  = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    Add the recipients email address
      clear it_receivers.
      refresh it_receivers.
      it_receivers-receiver = p_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      append it_receivers.
    Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_txt               = it_message
                receivers                  = it_receivers
           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.
    Store function module return code
      gd_error = sy-subrc.
    Get it_receivers return code
      loop at it_receivers.
      endloop.
    endform.                    " SEND_EMAIL_MESSAGE
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    form initiate_mail_execute_program.
      wait up to 2 seconds.
      if gd_error eq 0.
          submit rsconn01 with mode = 'INT'
                        with output = 'X'
                        and return.
      endif.
    endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    Reward points if found helpful....
    Cheers,
    Chandra Sekhar.

  • External trigger for internal event

    Hello,
    I would like to use an external trigger on a PFI-line to trigger an
    internal event, e.g. the switch of an indicator on the front panel from
    "1" to "2".
    How do I do that?

    Thanks for your answer!
    The problem was that I wanted to use a PFI-line on a PCI-board
    (BNC-2110) from NI to trigger the start of a voltage output task. On
    the other hand, I wanted to use the same trigger event for stopping a
    while-loop which would otherwise abort the task after some seconds if
    the trigger didn't come; the data generation itself is rather long, so
    you have to set the "timeout" terminal of "DAQmx Wait Until Done" to "
    -1". The problem was that it is not possible (at least on this board)
    to use a digital in-line for triggering the task and the PFI-line for
    getting a digital input. So I splitted the signal up: it was weird to
    both lines and worked as trigger on the PFI and was monitored on a
    DI-line.
    This setup worked, but as there were still some problems, I changed it
    again. Now I check for some digital in-lines (which provide a stimulus)
    in a while-loop while waiting for the trigger; if the stimulus changes,
    the task (which is waiting for the trigger) is aborted. The problem is
    that if the stimulus doesn't change and the task is triggered as usual
    and is completed, I can't report that fact to the while loop! So the
    while-loop goes on and blocks the rest of the diagram. I just wrote
    another posting concerning that thing, if you would have a look... It
    can be really a little hard sometimes, can't it...
    This thing concerning the event structure and value (signaling) sounds
    interesting, I'm just trying to figure out the possibilities how to use
    an event structure; but it's not always really intuitive.
    Best regards,
    Mitja
    Message Edited by Mitja on 11-14-2005 07:09 PM

  • Sending external email from SAP with following requirements...

    Hi All,
           I need to send external emails from SAP by meeting following requirements.
    1) With subject line more than 100 characters.
    2) No attachments, only body which has specific format (blueprint/layout) and would be amended often, hence code shouldn't be touched during amendments.
    3) Should be able to know the success/failure of mail sending at program level.

    Hi,
    The code below demonstrates how to send an email to an external email address
    *& Report  ZSENDEMAIL                                                  *
    *& Example of sending external email via SAPCONNECT                    *
    REPORT  zsendemail                    .
    PARAMETERS: psubject(40) type c default  'Hello',
                p_email(40)   type c default '[email protected]' .
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Perform populate_message_table.
    *Send email message, although is not sent from SAP until mail send
    *program has been executed(rsconn01)
    PERFORM send_email_message.
    *Instructs mail send program for SAPCONNECT to send email(rsconn01)
    perform initiate_mail_execute_program.
    *&      Form  POPULATE_MESSAGE_TABLE
          Adds text to email text table
    form populate_message_table.
      Append 'Email line 1' to it_message.
      Append 'Email line 2' to it_message.
      Append 'Email line 3' to it_message.
      Append 'Email line 4' to it_message.
    endform.                    " POPULATE_MESSAGE_TABLE
    *&      Form  SEND_EMAIL_MESSAGE
          Send email message
    form send_email_message.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      gd_doc_data-obj_name  = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    Add the recipients email address
      clear it_receivers.
      refresh it_receivers.
      it_receivers-receiver = p_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      append it_receivers.
    Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_txt               = it_message
                receivers                  = it_receivers
           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.
    Store function module return code
      gd_error = sy-subrc.
    Get it_receivers return code
      loop at it_receivers.
      endloop.
    endform.                    " SEND_EMAIL_MESSAGE
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    form initiate_mail_execute_program.
      wait up to 2 seconds.
      if gd_error eq 0.
          submit rsconn01 with mode = 'INT'
                        with output = 'X'
                        and return.
      endif.
    endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

Maybe you are looking for