Newbie question: Send data to printer from ABAP program

Hello, I am a newbie.
I do not use  SAPScript nor SmartForms.
But I need to send a printer command stream from my ABAP to printer.
Is it possible?
How can this be possible? Please give me some guideline.
I will reward you points. Promise.
Thanks

hi,
u can send ur program details to printer using submit to sap-spool statement.
SUBMIT TO SAP-SPOOL
Basic form
SUBMIT rep ... TO SAP-SPOOL.
Extras:
1.... DESTINATION dest         ... COPIES cop
        ... LIST NAME name
        ... LIST DATASET dsn
        ... COVER TEXT text
        ... LIST AUTHORITY auth
        ... IMMEDIATELY flag
        ... KEEP IN SPOOL flag
        ... NEW LIST IDENTIFICATION flag
        ... DATASET EXPIRATION days
        ... LINE-COUNT lin
        ... LINE-SIZE  col
        ... LAYOUT layout
        ... SAP COVER PAGE mode
        ... COVER PAGE flag
        ... RECEIVER rec
        ... DEPARTMENT dep
        ... ARCHIVE MODE armode
        ... ARCHIVE PARAMETERS arparams
        ... WITHOUT SPOOL DYNPRO
2. ... SPOOL PARAMETERS params
         ... ARCHIVE PARAMETERS arparams
         ... WITHOUT SPOOL DYNPRO
3. ... Further parameters (for passing variants)
        are described in the documentation for SUBMIT
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Missing print parameters with SUBMIT.
Effect
Calls the report rep with list output to the SAP spool database.
Additions
... DESTINATION dest(output device)
... COPIES cop(number of copies)
... LIST NAME name(name of list)
... LIST DATASET dsn(name of spool dataset)
... COVER TEXT text(title of spool request)
... LIST AUTHORITY auth(authorization for display)
... IMMEDIATELY flag(print immediately ?)
... KEEP IN SPOOL flag(keep list after print ?)
... NEW LIST IDENTIFICATION flag(new spool request ?)
... DATASET EXPIRATION days(number of days list
retained)
... LINE-COUNT lin ( lin lines per page)
... LINE-SIZE  col(col columns per line)
... LAYOUT layout(print format)
... SAP COVER PAGE mode(SAP cover sheet ?)
... COVER PAGE flag(selection cover sheet ?)
... RECEIVER rec(SAP user name of
recipient)
... DEPARTMENT dep(name of department)
... ARCHIVE MODE armode(archiving mode)
... ARCHIVE PARAMETERS arparams(structure with archiving
parameters)
... WITHOUT SPOOL DYNPRO(skip print control screen)
With the parameters IMMEDIATELY, KEEP IN SPOOL, NEW LIST IDENTIFICATION and COVER TEXT, flag must be a literal or character field with the length 1. If flag is blank, the parameter is switched off, but any other character switches the parameter on. You can also omit any of the sub-options of PRINT ON. mode with SAP COVER PAGE can accept the values ' ', 'X' and 'D'. These values have the following meaning:
' ' : Do not output cover sheet
'X' : Output cover sheet
'D' : Cover sheet output according to printer setting
armode with ARCHIVE MODE can accept the values '1', '2' and '3'. These values have the following meaning:
'1' : Print only
'2' : Archive only
'3' : Print and archive
arparams with ARCHIVE PARAMETERS must have the same structure as ARC_PARAMS. This parameter should only be processed with the function module GET_PRINT_PARAMETERS.
Effect
Output is to the SAP spool database with the specified parameters. If you omit one of the parameters, the system uses a default value. Before output to the spool, you normally see a screen where you can enter and/or modify the spool parameters. However, you can suppress this screen with the following statement:
... TO SAP-SPOOL WITHOUT SPOOL DYNPRO
You could use this option if all the spool parameters have already been set!
Note
When specifying the LINE-SIZE, you should not give any value > 132 because most printers cannot print wider lists.
Addition 2
... SPOOL PARAMETERS params(structure with print
parameters)
... ARCHIVE PARAMETERS arparams(Structure with archive
parameters)
... WITHOUT SPOOL DYNPRO(skip print parameters
screen)
Effect
Output is to the SAP spool database with the specified parameters. The print parameters are passed by the field string params which must have the structure of PRI_PARAMS. The field string can be filled and modified with the function module GET_PRINT_PARAMETERS. The specification arparams with ARCHIVE PARAMETERS must have the structure of ARC_PARAMS. This parameter should only be processed with the function module GET_PRINT_PARAMETERS. Before output to the spool, you normally see a screen where you can enter and/or modify the spool parameters. However, you can suppress this screen with the following statement:
... WITHOUT SPOOL DYNPRO
Example
Without archiving
DATA: PARAMS LIKE PRI_PARAMS,
      DAYS(1)  TYPE N VALUE 2,
      COUNT(3) TYPE N VALUE 1,
      VALID    TYPE C.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING DESTINATION           = 'LT50'
            COPIES                = COUNT
            LIST_NAME             = 'TEST'
            LIST_TEXT             = 'SUBMIT ... TO SAP-SPOOL'
            IMMEDIATELY           = 'X'
            RELEASE               = 'X'
            NEW_LIST_ID           = 'X'
            EXPIRATION            = DAYS
            LINE_SIZE             = 79
            LINE_COUNT            = 23
            LAYOUT                = 'X_PAPER'
            SAP_COVER_PAGE        = 'X'
            COVER_PAGE            = 'X'
            RECEIVER              = 'SAP*'
            DEPARTMENT            = 'System'
            NO_DIALOG             = ' '
  IMPORTING OUT_PARAMETERS        = PARAMS
            VALID                 = VALID.
IF VALID <> SPACE.
  SUBMIT RSTEST00 TO SAP-SPOOL
    SPOOL PARAMETERS PARAMS
    WITHOUT SPOOL DYNPRO.
ENDIF.
Example
With archiving
DATA: PARAMS   LIKE PRI_PARAMS,
      ARPARAMS LIKE ARC_PARAMS,
      DAYS(1)  TYPE N VALUE 2,
      COUNT(3) TYPE N VALUE 1,
      VALID    TYPE C.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING DESTINATION            = 'LT50'
            COPIES                 = COUNT
            LIST_NAME              = 'TEST'
            LIST_TEXT              = 'SUBMIT ... TO SAP-SPOOL'
            IMMEDIATELY            = 'X'
            RELEASE                = 'X'
            NEW_LIST_ID            = 'X'
            EXPIRATION             = DAYS
            LINE_SIZE              = 79
            LINE_COUNT             = 23
            LAYOUT                 = 'X_PAPER'
            SAP_COVER_PAGE         = 'X'
            COVER_PAGE             = 'X'
            RECEIVER               = 'SAP*'
            DEPARTMENT             = 'System'
            SAP_OBJECT             = 'RS'
            AR_OBJECT              = 'TEST'
            ARCHIVE_ID             = 'XX'
            ARCHIVE_INFO           = 'III'
            ARCHIVE_TEXT           = 'Description'
            NO_DIALOG              = ' '
  IMPORTING OUT_PARAMETERS         = PARAMS
            OUT_ARCHIVE_PARAMETERS = ARPARAMS
            VALID                  = VALID.
IF VALID <> SPACE.
  SUBMIT RSTEST00 TO SAP-SPOOL
    SPOOL PARAMETERS PARAMS
    ARCHIVE PARAMETERS ARPARAMS
    WITHOUT SPOOL DYNPRO.
ENDIF.

Similar Messages

  • How can i print data in smartforms from ABAP program.

    Dear gurus:
    in my abap program i process require data, and saved in a internal table.
    how can l print the data in smartforms.?
    who can give me a code sample is better:)
    reward all helpful advise.

    Try this....
    1) Tcode --> SmartForms
    2) Form name --> Z_SF_TEST Create
    3) Under Global settings
    a) Form Interface  
        Table Tab
       ITAB LIKE EKPO
    b) GLOBAL Definitions
    WA_NETPR LIKE EKPO-NETPR
    In smart forms if we want to display quantity and currency fields. We can't directly display currency field and quantity fields
    For that we have to create an extra variable in global definitions
    Ex: netpr FIELD of EKPO
    CREATE program lines and specify WA_NETWR = itab-netpr.
    4) RT CLick on main Window
       CREATE --> TABLE
      Click Table painter
    DEFAULT %LTYPE will be Created
    a) If you want more like Header footer etc add by rt click on %LTYPE1
    Table (Tab)
    %LTYPE  Radio(SELECT) 5 CM 5 CM 6 CM
    CLICK on DATA (Tab)
    INTERNAL TABLE ITAB LIKE ITAB
    5)RT click on table control and create --> program lines
    General attribute (Tab)
    INPUT PARAMETER               OUTPUT PARAMETER
    itab                               WA_NETPR
    Code Area
    WA_NETWR = ITAB-NETPR.
    6) RT CLcick on table ctl and create 3 text to display the fields
    a) % text1 +button(insert field)
       FIELD name &itab-ebeln&
    Output options (tab)
    Check New line   LINETYPE   %Ltype1
    check new cell
    b) % text2
       & itab-ebelp&
    output options
    check new cell
    c) % text2
       & wa_netpr&
    output options
    check new cell
    <b>Report ac
    Tables ekpo.
    Data: itab1 like ekpo occurs 0 with header line.
    select * into table itab1 from ekpo.
    Call function module --> smart form function module and pass your internal table</b>
    Regards,
    SaiRam

  • Printing barcode from ABAP program

    Hi,
    Is it possible to print barcode (using zebra barcode printing) from ABAP program directly without using Smart Form, SAP Script or Adobe PDF Form.
    I have the barcode instructions, I just want to output it to the barcode printer directly.
    Sample instructions to be output to barcode printer:
    FT128,288XG005.GRF,1,1^FS
    FT96,128XG000.GRF,1,1^FS
    FT64,192XG001.GRF,1,1^FS
    FT0,288XG002.GRF,1,1^FS
    FT0,224XG003.GRF,1,1^FS
    FT128,256XG004.GRF,1,1^FS
    FO16,180GB496,0,5^FS
    FO52,37GB450,66,4^FS
    BY4,3,40FT86,320^BCN,,Y,N
    FD>;123456>67FS
    PQ1,0,1,YXZ
    XAID000.GRFFSXZ
    Thanks in advance.

    Hello,
    Yes we can do it..
    Go through this link you will some idea
    http://sapprograms.blogspot.com/2008/11/barcode-printing.html
    http://www.sap-img.com/abap/details-information-about-sap-barcodes.htm

  • Send BW query results as HTML email from ABAP program

    I have published a code sample for sending BW query results as HTML email from ABAP program. if you have any questions or clarification, please post them here.
    the same can be accessed from this link.
    http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b7658119-0a01-0010-39a9-b600c816f370
    Regards
    Raja
    Message was edited by: Durairaj Athavan Raja

    OK forget about my earlier post.
    do the following changes.
    declare the following variables:
    data: xtext type standard table of solix .
    DATA: atta_sub TYPE sood-objdes .
    after the call of FM SCMS_STRING_TO_FTEXT add the following code.
    CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
      EXPORTING
        ip_solitab        = text
    IMPORTING
       EP_SOLIXTAB       = xtext .
    and after the following statement
    document = cl_document_bcs=>create_document(
                              i_type    = 'HTM'
                              i_text    = text
                              i_length  = conlengths
                              i_subject = subject ).
    add the following code
    CALL METHOD document->add_attachment
                EXPORTING
                  i_attachment_type    = 'htm'
                  i_attachment_subject = atta_sub
                  i_att_content_hex    = xtext.
    now you will have results both in the body as well as attachment. (this is for test you can remove one of them )
    Regards
    Raja

  • [solved] printer - brother DCP-J315W - "sending data to printer"

    Hi All,
    My sister have a printer brother DCP-J315W, connected with  usb.
    I installed the brother-dcpj315w package from AUR, and it used to work without issue.
    But I was informed "recently" that this printer is not working correctly since perhaps two months. (perhaps it's related to the AUR package update, but I think it's was already not working before the update.)
    When I try to print, there is no activity on the printer, and, using the cups web-interface, I can see, for the printer status: "idle - sending data to printer"
    I'm not sure about what I see in the logs, there are some failure about systemd and avahi service, when I try to print, perhaps it's the issue, but I really don't know.
    journaltct -f - when I try to print a test page.
    /var/logs/cups/error.log - for this day, with a debug log level, and when I added this printer and print a test page.
    It tried to not use the usblp kernel module without success, the printer is not recognized by cups without this module loaded.
    So, I'm quite lost with this issue.
    Cupsd info:
    /etc/cups/cupsd.conf
    Printer info
    Bus 003 Device 002: ID 04f9:0254 Brother Industries, Ltd
    lsmod | grep 'usb'
    usblp 13011 0
    usbhid 41358 0
    hid 86421 2 hid_generic,usbhid
    usb_storage 43828 0
    scsi_mod 130423 4 usb_storage,libata,sd_mod,sr_mod
    usbcore 174164 5 usblp,uhci_hcd,usb_storage,ehci_hcd,usbhid
    usb_common 955 1 usbcore
    If you have any idea to help me debug this issue, I'd be grateful.
    Thanks a lot to read this.
    Last edited by gyan000 (2013-03-16 13:29:13)

    Hi again,
    Issue solved, I had to execute this commande after the package installation:
    /opt/brother/Printers/dcpj315w/cupswrapper/cupswrapperdcpj315w
    I contacted the package owner so he can update his package.
    Thanks
    Last edited by gyan000 (2013-03-16 13:29:42)

  • Sending an email to users from abap program

    Hi experts ,
    How to send an email to users from abap program ...
    i need full coding please..so that i can copy and paste it in my program.
    Thank you in advance.
    Rajasekhar.P

    Hi Venkat
    check the below simple code to convert spool to HTML and email it
    data: list type table of  abaplist with header line.
    data: htmllines type table of w3html with header line.
    data: maildata   like sodocchgi1.
    data: mailtxt    like solisti1 occurs 10 with header line.
    data: mailrec    like somlrec90 occurs 0  with header line.
    start-of-selection.
    Produce a list
      do 100 times.
        write:/ sy-index, at 30 sy-index, at 50 sy-index.
      enddo.
    Save the list
      call function 'SAVE_LIST'
           tables
                listobject         = list
           exceptions
                list_index_invalid = 1
                others             = 2.
    Convert the list
      call function 'WWW_LIST_TO_HTML'
           tables
                html = htmllines.
    Send mail
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test Subject'.
      loop at htmllines.
        mailtxt = htmllines.
        append mailtxt.
      endloop.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type  = 'U'.
      append mailrec.
      call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_data              = maildata
                document_type              = 'HTM'
                put_in_outbox              = 'X'
           tables
                object_header              = mailtxt
                object_content             = mailtxt
                receivers                  = mailrec
           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  0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.

  • PASS DATA FROM ABAP PROGRAM TO WORKFLOW CONTAINER

    Hello Everybody,
    I am a workflow beginner and I want to pass a data from my ABAP code to a workflow container. This workflow container is used in the Send Mail step.
    The ABAP  Program is:
    REPORT  zdb_work_flow.
    tables : vbak.
    DATA : k TYPE sweinstcou-objkey,
                e TYPE swetypecou-event.
    DATA : st TYPE swcont,
                itab TYPE STANDARD TABLE OF swcont.
    PARAMETERS : vbeln TYPE vbak-vbeln.
    start-of-selection.
      st-element = 'VBELN'.   "This is my WORKFLOW CONTAINER
      st-tab_index = 1.
      st-elemlength = 10.
      st-type = 'C'.
      st-value = vbeln.
      append st to itab.
      k = vbeln.
      e = 'TRIGGER'               "This is an event in my BUS OBJ ZDB_WFLOW
      CALL FUNCTION 'SWE_EVENT_CREATE'
        EXPORTING
          objtype                               = 'ZDB_WFLOW'   "My BUS OBJ
          objkey                                 = k
          event                                  = e    "Event TRIGGER in ZDB_WFLOW
        tables
          event_container               = itab
        exceptions
          objtype_not_found             = 1
          OTHERS                        = 2
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.         .
      COMMIT WORK.
    Now I have created a workflow in SWDD as ZDB_WF_SW.
    In this WF I have created a container as VBELN.
    In the SEND MAIL I have given a header as "Worflow Triggered for &VBELN&"
    PROBLEM.
    The Workflow is getting triggered. I am also getting a mail "Workflow Triggered for" in my mailbox but the &VBELN& is missing from the header.
    I have set the IMPORT EXPORT flag of the WF CONTAINER "VBELN"
    Please Help.
    Edited by: Deepankar.B on Feb 22, 2011 4:08 PM
    Edited by: Deepankar.B on Feb 22, 2011 4:10 PM

    You wouldn't use a SMA as an assistance class - but refer to one within it.
    I would use Shared Memory Area classes - but I'd also build a SMA that could talk across multiple application servers.
    Thomas Jung proposed this in a forum reply some time ago.
    It shouldn't be too difficult to use RFC's to access the content of SMA's in multiple app servers - ensuring synchronisation across multi app servers. I've not yet had the need, so haven't attempted.
    The long polling in 7.02 apparently uses this approach, so in a 7.02 system there may even be standard components/ SMAs that you could use.
    I do not think global areas in FM's are available across sessions - I don't think you could use that as a data transport.

  • Sending IDOCS from ABAP Program

    hi friends,
               can we send IDOC ( of type MATMAS) form ABAP Program. if it possible how can we send, are there any function modules to do so....could any one tell me the procedure to accomplish the task...i have finished the configuration sting in both reciver and sender systems....just need to send material in form of IDOC from abap program.
    ( Note: not form BD10).
    Thanks in advance,
    Santosh.

    Hi,
      Follow this code it will help u...
    This is for the user created IDOC but as u are making use of ur own basic type i.e., Idoc type MATMAS05
    and u can write the code.
    *& Report  ZZ_Program_To_Create_Idoc                                        
    report  zz_program_to_create_idoc                     .
    tables: ekko,ekpo.
    selection-screen skip 3.
    selection-screen begin of block b1 with frame title titl.
    selection-screen skip.
    select-options s_ebeln for ekko-ebeln.
    selection-screen skip.
    selection-screen end of block b1.
    data: header_segment_name like edidd-segnam value 'Z1EKKO',
          item_segment_name like edidd-segnam value 'Z1EKPO',
          idoc_name like edidc-idoctp value 'Z19838IDOC1'.
    data: header_segment_data like z1ekko,
          item_segment_data like z1ekpo.
    data: control_record like edidc.
    data: messagetyp like edmsg-msgtyp value 'ZZ9838MESG1'.
    data: i_communication like edidc occurs 0 with header line,
          i_data like edidd occurs 0 with header line.
    data: begin of i_ekko occurs 0,
          ebeln like ekko-ebeln,
          aedat like ekko-aedat,
          bukrs like ekko-bukrs,
          bsart like ekko-bsart,
          lifnr like ekko-lifnr,
          end of i_ekko.
    data: begin of i_ekpo occurs 0,
          ebelp like ekpo-ebelp,
          matnr like ekpo-matnr,
          menge like ekpo-menge,
          meins like ekpo-meins,
          netpr like ekpo-netpr,
          end of i_ekpo.
    start-of-selection.
    select  ebeln aedat bukrs bsart lifnr from ekko
              into table i_ekko where ebeln in s_ebeln.
    select ebelp
           matnr
           menge
           meins
           netpr
           from ekpo
           into table i_ekpo
           where ebeln in s_ebeln.
    control_record-mestyp = messagetyp.
    control_record-rcvprt = 'LS'.
    control_record-idoctp = idoc_name.
    control_record-rcvprn = '0MART800'.
    loop at i_ekko.
    header_segment_data-ebeln = i_ekko-ebeln.
    header_segment_data-aedat = i_ekko-aedat.
    header_segment_data-bukrs = i_ekko-bukrs.
    header_segment_data-bsart = i_ekko-bsart.
    header_segment_data-lifnr = i_ekko-lifnr.
    i_data-segnam = header_segment_name.
    i_data-sdata = header_segment_data.
    append i_data.
    select ebelp
           matnr
           menge
           meins
           netpr
           from ekpo
           into table i_ekpo
           where ebeln = i_ekko-ebeln.
    loop at i_ekpo.
    item_segment_data-ebelp = i_ekpo-ebelp.
    item_segment_data-matnr = i_ekpo-matnr.
    item_segment_data-menge = i_ekpo-menge.
    item_segment_data-meins = i_ekpo-meins.
    item_segment_data-netpr = i_ekpo-netpr.
    i_data-segnam = item_segment_name.
    i_data-sdata = item_segment_data.
    append i_data.
    endloop.
    clear i_ekpo.
    refresh i_ekpo.
    endloop.
    call function 'MASTER_IDOC_DISTRIBUTE'
      exporting
        master_idoc_control                  = control_record
      OBJ_TYPE                             = ''
      CHNUM                                = ''
      tables
        communication_idoc_control           = i_communication
        master_idoc_data                     = i_data
    exceptions
       error_in_idoc_control                = 1
       error_writing_idoc_status            = 2
       error_in_idoc_data                   = 3
       sending_logical_system_unknown       = 4
       others                               = 5
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    else.
      loop at i_communication.
        write: 'IDOC GENERATED', i_communication-docnum.
      endloop.
      commit work.
    endif.
    initialization.
    titl = 'ENTER THE PURCHASE ORDER NUMBER'.

  • Sending emails from ABAP program

    Hi,
    I need to send error emails from ABAP program.
    I have to pass error internal table as text (not as attachment) in the email.
    Can anybody supply any sample code?
    Thanks in advance.
    Regards,
    Arun Mohan

    HI,
    See if this code helps:
    ***Sending mail to the receipients
    if not it_final[] is initial.
    Populate table with detaisl to be entered into .xls file
    PERFORM BUILD_XLS_DATA_TABLE.
    PERFORM POPULATE_EMAIL_MESSAGE_BODY.
    Send file by email as .xls speadsheet
    PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
    TABLES IT_MESSAGE
    IT_ATTACH
    USING P_EMAIL
    'Sales Register Report - Set Top Box / Accessories'
    'XLS'
    'SSTB'
    CHANGING GD_ERROR
    GD_RECIEVER.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
    PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
    endif.
    *& Form BUILD_XLS_DATA_TABLE
    text
    --> p1 text
    <-- p2 text
    FORM BUILD_XLS_DATA_TABLE .
    data: wa_itab like it_final.
    CONSTANTS:
    CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
    CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
    CONCATENATE 'Business Place' 'Region Code' 'Region' 'Branch Code'
    'Branch' 'Material Desc' 'Area off Code'
    'Area Name' 'Zone code' 'Zone Name' 'Cust No' 'Cust Name'
    'Bill Doc No' 'Bill Date' 'Base Val' 'Total Val' 'Quantity'
    INTO IT_ATTACH SEPARATED BY CON_TAB.
    CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.
    APPEND IT_ATTACH.
    LOOP AT IT_FINAL INTO WA_ITAB.
    CONCATENATE WA_ITAB-BUSINESS_PLACE
    WA_ITAB-KVGR1
    WA_ITAB-REGION
    WA_ITAB-VKBUR
    WA_ITAB-SALES_OFF
    WA_ITAB-ARKTX
    WA_ITAB-vkgrp
    WA_ITAB-sales_grp
    WA_ITAB-bzirk
    WA_ITAB-zone
    WA_ITAB-kunnr
    WA_ITAB-name
    WA_ITAB-vbeln
    WA_ITAB-fkdat
    WA_ITAB-base_value
    WA_ITAB-total_value
    WA_ITAB-fkimg
    INTO IT_ATTACH SEPARATED BY CON_TAB.
    CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.
    APPEND IT_ATTACH.
    ENDLOOP.
    ENDFORM. " BUILD_XLS_DATA_TABLE
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    text
    --> p1 text
    <-- p2 text
    FORM POPULATE_EMAIL_MESSAGE_BODY .
    REFRESH IT_MESSAGE.
    CONCATENATE SY-DATUM6(2) '/' SY-DATUM4(2) '/' SY-DATUM+0(4) INTO G_DATE.
    IT_MESSAGE = 'Please find attached excel sheet.'.
    APPEND IT_MESSAGE.
    IT_MESSAGE = 'Sales Register Report - Set Top Box / Accessories'.
    APPEND IT_MESSAGE.
    Concatenate 'Report generated date' ':' G_Date '.' into IT_MESSAGE.
    APPEND IT_MESSAGE.
    clear it_message.
    append it_message.
    IT_MESSAGE = 'This is an autogenerated mail, please do not reply'.
    APPEND IT_MESSAGE.
    ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    Send email
    FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
    PIT_ATTACH
    USING P_EMAIL
    P_MTITLE
    P_FORMAT
    P_FILENAME
    P_ATTDESCRIPTION
    P_SENDER_ADDRESS
    P_SENDER_ADDRES_TYPE
    CHANGING P_ERROR
    P_RECIEVER.
    DATA: LD_ERROR TYPE SY-SUBRC,
    LD_RECIEVER TYPE SY-SUBRC,
    LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
    LD_EMAIL LIKE SOMLRECI1-RECEIVER,
    LD_FORMAT TYPE SO_OBJ_TP ,
    LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
    LD_ATTFILENAME TYPE SO_OBJ_DES ,
    LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
    LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
    LD_RECEIVER LIKE SY-SUBRC.
    LD_EMAIL = P_EMAIL.
    LD_MTITLE = P_MTITLE.
    LD_FORMAT = P_FORMAT.
    LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
    LD_ATTFILENAME = P_FILENAME.
    LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
    LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    Fill the document data.
    W_DOC_DATA-DOC_SIZE = 1.
    Populate the subject/generic message attributes
    W_DOC_DATA-OBJ_LANGU = SY-LANGU.
    W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
    W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
    W_DOC_DATA-SENSITIVTY = 'F'.
    Fill the document data and get size of attachment
    CLEAR W_DOC_DATA.
    READ TABLE IT_ATTACH INDEX W_CNT.
    W_DOC_DATA-DOC_SIZE =
    ( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
    W_DOC_DATA-OBJ_LANGU = SY-LANGU.
    W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
    W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
    W_DOC_DATA-SENSITIVTY = 'F'.
    CLEAR T_ATTACHMENT.
    REFRESH T_ATTACHMENT.
    T_ATTACHMENT[] = PIT_ATTACH[].
    Describe the body of the message
    CLEAR T_PACKING_LIST.
    REFRESH T_PACKING_LIST.
    T_PACKING_LIST-TRANSF_BIN = SPACE.
    T_PACKING_LIST-HEAD_START = 1.
    T_PACKING_LIST-HEAD_NUM = 0.
    T_PACKING_LIST-BODY_START = 1.
    T_PACKING_LIST-OBJ_NAME = 'stb'.
    DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
    T_PACKING_LIST-DOC_TYPE = 'RAW'.
    APPEND T_PACKING_LIST.
    Create attachment notification
    T_PACKING_LIST-TRANSF_BIN = 'X'.
    T_PACKING_LIST-HEAD_START = 1.
    T_PACKING_LIST-HEAD_NUM = 1.
    T_PACKING_LIST-BODY_START = 1.
    DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
    T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
    T_PACKING_LIST-DOC_TYPE = 'XLS'.
    T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
    T_PACKING_LIST-OBJ_DESCR = 'Sales_STB'.
    T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
    T_PACKING_LIST-OBJ_NAME = 'stb'.
    T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
    APPEND T_PACKING_LIST.
    Add the recipients email address
    CLEAR T_RECEIVERS.
    REFRESH T_RECEIVERS.
    LOOP AT IT_RECV.
    T_RECEIVERS-RECEIVER = IT_RECV-EMAIL.
    T_RECEIVERS-REC_TYPE = 'U'.
    T_RECEIVERS-COM_TYPE = 'INT'.
    T_RECEIVERS-COPY = 'X'.
    T_RECEIVERS-NOTIF_DEL = 'X'.
    T_RECEIVERS-NOTIF_NDEL = 'X'.
    APPEND T_RECEIVERS.
    ENDLOOP.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = W_DOC_DATA
    PUT_IN_OUTBOX = 'X'
    SENDER_ADDRESS = LD_SENDER_ADDRESS
    SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
    COMMIT_WORK = 'X'
    IMPORTING
    SENT_TO_ALL = W_SENT_ALL
    TABLES
    PACKING_LIST = T_PACKING_LIST
    CONTENTS_BIN = T_ATTACHMENT
    CONTENTS_TXT = IT_MESSAGE
    RECEIVERS = T_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.
    Populate zerror return code
    LD_ERROR = SY-SUBRC.
    Populate zreceiver return code
    LOOP AT T_RECEIVERS.
    LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
    ENDLOOP.
    ENDFORM. "SEND_FILE_AS_EMAIL_ATTACHMENT
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    text
    --> p1 text
    <-- p2 text
    FORM INITIATE_MAIL_EXECUTE_PROGRAM .
    WAIT UP TO 2 SECONDS.
    SUBMIT RSCONN01 WITH MODE = 'INT'
    WITH OUTPUT = ''
    AND RETURN.
    ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
    Regards
    Subramanian

  • Passing data from abap-program to mssql database table thro native sql

    Hi,
    To pass the data from abap-program to mssql server,i have created database connection through dbco t.code.
    now i am trying to get connection thro native sql but am not able to get it .Am working in ECC 5.0.
    Could anyone help me on this.Did i miss anything?
    i have tried Native-sql like this.
    DATA: CON_NAME LIKE DBCON-CON_NAME VALUE 'BIW'.
    EXEC SQL.
      CONNECT TO :con_name AS 'C1'
    ENDEXEC.
    Thanks in advance.

    Hi,
    Trying to do the same here, only using Oracle DB.
    DATA:     dbc TYPE DBCON_NAME VALUE 'BI'
    TRY.
      EXEC SQL.
        CONNECT TO :dbc
      ENDEXEC.
      IF sy-subrc NE 0.
        RAISE EXCEPTION TYPE cx_sy_native_sql_error.
      ENDIF.
    CATCH cx_sy_native_sql_error INTO oref_native_sql_error.
      sql_emsg = oref_native_sql_error->get_text( ).
      MESSAGE sql_emsg TYPE 'I'.
    ENDTRY.
    I keep getting the message 'Native SQL exception has occured' (because of the RAISE statement, I wonder how we can get a meaningfull error description).
    Of course this can be a result of a number of network issues, so I'm trying to resolve this together with my BC admin.
    I suggest the same to you..
    In the meantime, if anyone can help out, it will be appreciated.
    Regards,
    SD

  • SMS from ABAP program to send error message

    Hi,
    I would like to know what are settings to be done in the system to send an SMS from ABAP program using FM 'SO_DOCUMENT_SEND_API1'.I was trying to send SMS using above FM but the error was "Cannot process message, no route from <userid> to <Mobile.no> ".
    Pls let me know the pre requisites to send an SMS using above FM.
    Regards,
    Nivas

    Hi,
    I have gone thru this blog but I want send SMS to US Mobile no.I checked other webservice but it supports only few cellular networks in US.
    any other alternate for this...
    anyway thanks for your reply
    Regards,
    Nivas

  • Keep getting error message when sending data to printer

    i keep getting an error message when trying to print.  window says "sending data to printer" but nothing happens and i get an error message.
    anyone else experience this and how did you solve the problem?

    Hi psknv3,
    Welcome to Apple Support Communities.
    What error message are you seeing when the printing issue occurs? The article linked below provides a lot of great information and general troubleshooting suggestions that may resolve the issue.
    Troubleshooting printer issues in OS X
    http://support.apple.com/kb/TS3147
    I hope this helps.
    -Jason

  • Sending EMAIL from ABAP Program Configuration+Code(Step by step)

    Dear All,
    Please anybody can provide me Step by Step document for sending Email from ABAP Program.
    Thanks,
    RP

    Not an appropriate forum. Try ABAP forum.
    Regards,
    Jai Shankar

  • XML files from ABAP programs

    Hi everyone!
    Is there a way in ABAP to output XML files?  Pls. send code/ function module if any.
    From ABAP programs, we are sure that we can output TEXT files, but how about XML files?
    The significance of this question is related
    Currently we are using XI to interface SAP and AMS, this question for ABAP to produce XML file arose, if for example, the XI server is down and we have to still send data from one system to another. IDocs can also produce XML files, pls confirm.  Earlier however, we have preferred XI rather than IDocs to do this.  Anyway, any idea regarding this scenario will be greatly appreciated. 
    Thanks and God bless!
    Celeste

    Hi,
    Please check this sample codes from other thread.
    1. itab --- > xml
        xml ---> itab.
    2. This program will do both.
    (just copy paste in new program)
    3.
    REPORT abc.
    *-------------- DATA
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    DATA : BEGIN OF itab OCCURS 0,
    a(100) TYPE c,
    END OF itab.
    DATA: xml_out TYPE string .
    DATA : BEGIN OF upl OCCURS 0,
    f(255) TYPE c,
    END OF upl.
    DATA: xmlupl TYPE string .
    ******************************* FIRST PHASE
    ******************************* FIRST PHASE
    ******************************* FIRST PHASE
    *------------------ Fetch Data
    SELECT * FROM t001 INTO TABLE t001.
    *------------------- XML
    CALL TRANSFORMATION ('ID')
    SOURCE tab = t001[]
    RESULT XML xml_out.
    CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
    EXPORTING
    TEXT = xml_out
    * IMPORTING
    * LENGTH =
    TABLES
    FTEXT_TAB = itab.
    *-------------- Download
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filetype = 'BIN'
    filename = 'd:xx.xml'
    TABLES
    data_tab = itab.
    ******************************* SECOND PHASE
    ******************************* SECOND PHASE
    ******************************* SECOND PHASE
    BREAK-POINT.
    REFRESH t001.
    CLEAR t001.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'D:XX.XML'
    filetype = 'BIN'
    TABLES
    data_tab = upl.
    LOOP AT upl.
    CONCATENATE xmlupl upl-f INTO xmlupl.
    ENDLOOP.
    *------------------- XML
    CALL TRANSFORMATION ('ID')
    SOURCE XML xmlupl
    RESULT tab = t001[]
    BREAK-POINT.
    Regards,
    Ferry Lianto

  • Execute webdynpro from abap program and return to the caller program

    Guys,
    I have a question here.
    I know there is a way to call an abap webdynpro application from normal abap program by either using a class method, or use a function module WDY_EXECUTE_IN_PLACE by providing
    the webdynpro application or using CALL TRANSACTION statement.
    But, is there anyways that we can call the webdynpro application from abap program by supplying data to the webdynpro and display to the user from the portal, and then
    once the user do some manipulation on the data, can we transfer back the data to the caller abap program?

    hey ,
    you can pack any web-dynpro program in tranasaction code and run it from R/3 and not via portal  :
    search in " SAPTECHNICAL" how to do so  - for some reason i cant post a link here
    than you can use call transaction .
    regards
    ASA

Maybe you are looking for

  • How do I set the Default website when a virtual site is unavailable?

    I am hosting several virtual domains. Yesterday I disabled one of my virtual sites inadvertantly by de-checking the "Enabled" box in Server Admin > Web > Settings > Sites. While the site was disabled, browsers were directed to the first site in the S

  • Add custom fields in VL02N under Item overview tab

    Hi, In VL02N, I need to add two input fields under the tab "Item Overview"... I found the BADI  LE_SHP_TAB_CUST_ITEM but it is for adding a new tab i guess.... Is there any way to add fields under item overview only ??

  • Supplier as Customer

    Hi All, We have a supplier who is also our customer. I just like to ask from Gurus out there, Is there ne specific set up we need to make in Either Payables or Receiveables. Please reply soon. Thanks

  • Bat file only way to run java application

    hi, is there exists any other way to(other then writting java applic.class in a bat file) execute the java programs,of course other then writting java applic.class to command prompt. thanks 4 reply kk

  • How do i add new fonts that i've downloaded?

    easy question.. sorry. i downloaded a lot of freebies, now how do i install them to be ready to use in word? thanks.