Use of concatenate

Hello Guys,
I have a doubt on concatenate.
That how it will be helpful in generating a reports in real time & also iam not having any demo code using concatenate. Try to hlp me for this & also send me any
sample code with using concatenate.
very urgent.
thank you.

Hi,
Look at this From SAP Help.
Concatenate :
CONCATENATE f1 ... fn INTO g.
1. ... SEPARATED BY h
2. ... IN BYTE MODE
3. ... IN CHARACTER MODE
Depending on whether byte or character string processing is carried out, the operands can only be byte-type or character-type (see Overview).
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Use Only Character-Type Fields when Processing Strings
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Character String Processing and Unicode
Effect
Places the fields f1 to fn (n >= 2) after g.
Note that trailing blanks in source fields of type C are ignored (since the system cannot distinguish between them and padding characters). Conversely, these blanks are taken into account in C strings. In summary, all fields are considered to have the length STRLEN( fi).
The Return Code is set as follows:
SY-SUBRC = 0:
The result fits in g.
SY-SUBRC = 4:
The result was too long for g and was truncated to fit g when copied.
Example
DATA: ONE(10)   VALUE ' John ',
      TWO(3)    VALUE 'F.',
      THREE(10) VALUE ' Kennedy',
      NAME(20).
      FIRST     TYPE STRING.
CONCATENATE ONE TWO THREE INTO NAME.
NAME then contains the value ' JohnF. Kennedy'.
But:
MOVE ONE TO FIRST.       "FIRST = ' John'
SHIFT FIRST CIRCULAR.    "FIRST = 'John '
CONCATENATE FIRST TWO INTO NAME.
NAME then contains the value 'JohnF. '.
Addition 1
... SEPARATED BY h
Effect
Inserts the separator h between the fields fi.
Here, h is used in its defined length, if the field is not of type STRING or XSTRING.
Examples
DATA: ONE(10)   VALUE 'John',
      TWO(3)    VALUE 'F.',
      THREE(10) VALUE 'Kennedy',
      NAME(20).
CONCATENATE ONE TWO THREE INTO NAME SEPARATED BY SPACE.
Then, NAME has the value "John F. Kennedy".
DATA SEPARATOR(4) VALUE 'USA'.
CONCATENATE SPACE ONE TWO THREE INTO NAME
            SEPARATED BY SEPARATOR.
Then, NAME has the value "USA JohnUSA F.USA Ke".
The Return Code SY-SUBRC is set to 4.
Addition 2
... IN BYTE MODE
Effect
Fields f1 to fn (n >= 2) are linked together and placed after g; all fields must be of type X oder XSTRING
Note that zeroes at the end of fields are not ignored.
Addition 3
... IN CHARACTER MODE
Effect
This is the default and does not have to be specified. Treat as described above.
Notes
Performance: You are recommended to use the key word CONCATENATE rather than your own constructions because it is safer, more efficient, and clearer.
If you use the CONCATENATE statement to cut part of a character-type field (example: CONCATENATE f(len) f+off INTO f) you should, for performance reasons, use the REPLACE SECTION statement.
Related
SPLIT, SHIFT, REPLACE, TRANSLATE, CONDENSE
Additional help
Concatenating Character Strings

Similar Messages

  • Plz  explain why concatenate statement is used in BDC

    Please do not post subject or content as ALL CAPITALS
    hi friends,
                    for the first time i am doing bdc table control.  i just cant make out the use of concatenate statement in that code.  i have gone thru some bdc table control codes in the forum but almost everywhere the concatenate statement has been used.  can u plz explain the use of that statement . THANKS IN ADVANCE.   
    eg:  THIS IS A CODE FROM ONE OF THE FORUM POSTS, SO I AM NOT COPYING IT FULLY.
         I HAVE HIGHLIGHTED THE  CONCATENATE PART.
    DATA : M(2) TYPE C,
    N(2) TYPE C,
    TEMP(50) TYPE C,
    WA_KUNNR LIKE KNA1-KUNNR.
    ****POPULATING HEADER DATA *******
    LOOP AT IT_HEADER INTO WA_HEADER.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    INPUT = WA_HEADER-KUNNR
    IMPORTING
    OUTPUT = WA_HEADER-KUNNR
    SELECT SINGLE KUNNR FROM KNA1 INTO WA_KUNNR WHERE KUNNR = WA_HEADER-KUNNR.
    IF SY-SUBRC 0.
    MESSAGE I004(ZZS_MSG).
    ENDIF.
    PERFORM BDC_DYNPRO USING 'SAPMV45A' '0101'.
    PERFORM BDC_FIELD USING 'BDC_CURSOR'
    'VBAK-SPART'.
    PERFORM BDC_FIELD USING 'BDC_OKCODE'
    '/00'.
    PERFORM BDC_FIELD USING 'VBAK-AUART' WA_HEADER-AUART.
    PERFORM BDC_FIELD USING 'VBAK-VKORG' WA_HEADER-VKORG.
    PERFORM BDC_FIELD USING 'VBAK-VTWEG' WA_HEADER-VTWEG.
    PERFORM BDC_FIELD USING 'VBAK-SPART' WA_HEADER-SPART.
    PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
    PERFORM BDC_FIELD USING 'BDC_OKCODE'
    '/00'.
    PERFORM BDC_FIELD USING 'VBKD-BSTKD' WA_HEADER-BSTKD.
    PERFORM BDC_FIELD USING 'KUAGV-KUNNR' WA_HEADER-KUNNR.
    PERFORM BDC_FIELD USING 'KUWEV-KUNNR' WA_HEADER-KUNNR1.
    PERFORM BDC_FIELD USING 'RV45A-KETDAT'
    '21.10.2008'.
    PERFORM BDC_FIELD USING 'RV45A-KPRGBZ'
    'D'.
    PERFORM BDC_FIELD USING 'VBKD-PRSDT'
    '21.10.2008'.
    **********ITEM LOOP TO FIND NO.OF ITEMS ************
    M = 0.
    LOOP AT IT_ITEMS INTO WA_ITEMS WHERE BSTKD = WA_HEADER-BSTKD.
    M = M + 1
    ENDLOOP.
    CONCATENATE 'VBAP-PS_PSP_PNR(' M ')' INTO TEMP.
    PERFORM BDC_FIELD USING 'BDC_CURSOR' TEMP.
    CLEAR TEMP.
    ******POPULATING ITEMS DATA ********
    N = 1.
    LOOP AT IT_ITEMS INTO WA_ITEMS WHERE BSTKD = WA_HEADER-BSTKD.
    CONCATENATE 'RV45A-MABNR(' N ')' INTO TEMP.
    PERFORM BDC_FIELD USING TEMP WA_ITEMS-MABNR.
    CLEAR TEMP.
    CONCATENATE 'RV45A-KWMENG(' N ')' INTO TEMP.PERFORM BDC_FIELD USING TEMP WA_ITEMS-KWMENG.
    CLEAR TEMP.
    CONCATENATE 'VBAP-PS_PSP_PNR(' N ')' INTO TEMP.
    PERFORM BDC_FIELD USING TEMP WA_ITEMS-WBS.
    CLEAR TEMP.
    N = N + 1.
    ENDLOOP.
    PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
    PERFORM BDC_FIELD USING 'BDC_OKCODE'
    '/00'.
    PERFORM BDC_FIELD USING 'VBKD-BSTKD' WA_HEADER-BSTKD.
    PERFORM BDC_FIELD USING 'KUAGV-KUNNR' WA_HEADER-KUNNR.
    PERFORM BDC_FIELD USING 'KUWEV-KUNNR' WA_HEADER-KUNNR1.
    PERFORM BDC_FIELD USING 'RV45A-KETDAT'
    '21.10.2008'.
    PERFORM BDC_FIELD USING 'RV45A-KPRGBZ'
    'D'.
    PERFORM BDC_FIELD USING 'VBKD-PRSDT'
    '21.10.2008'.
    PERFORM BDC_FIELD USING 'VBKD-ZTERM'
    'N30'.
    PERFORM BDC_FIELD USING 'VBKD-INCO1'
    'FOB'.
    PERFORM BDC_FIELD USING 'VBKD-INCO2'
    'NEW YORK'.
    PERFORM BDC_FIELD USING 'BDC_CURSOR'
    'RV45A-MABNR(02)'.
    PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
    PERFORM BDC_FIELD USING 'BDC_OKCODE'
    '=PKO1'.
    PERFORM BDC_FIELD USING 'VBKD-BSTKD' WA_HEADER-BSTKD.
    PERFORM BDC_FIELD USING 'KUAGV-KUNNR' WA_HEADER-KUNNR.
    PERFORM BDC_FIELD USING 'KUWEV-KUNNR' WA_HEADER-KUNNR1.
    PERFORM BDC_FIELD USING 'RV45A-KETDAT'
    '21.10.2008'.
    PERFORM BDC_FIELD USING 'RV45A-KPRGBZ'
    'D'.
    PERFORM BDC_FIELD USING 'VBKD-PRSDT'
    '21.10.2008'.
    PERFORM BDC_FIELD USING 'VBKD-ZTERM'
    'N30'.
    PERFORM BDC_FIELD USING 'VBKD-INCO1'
    'FOB'.
    PERFORM BDC_FIELD USING 'VBKD-INCO2'
    'NEW YORK'.
    PERFORM BDC_FIELD USING 'BDC_CURSOR'
    'VBAP-POSNR(01)'.
    PERFORM BDC_FIELD USING 'RV45A-VBAP_SELKZ(01)'
    'X'.
    LOOP AT IT_ITEMS INTO WA_ITEMS WHERE BSTKD = WA_HEADER-BSTKD.
    PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
    PERFORM BDC_FIELD USING 'BDC_OKCODE'
    '/00'.
    PERFORM BDC_FIELD USING 'BDC_CURSOR'
    'KOMV-KBETR(07)'.
    PERFORM BDC_FIELD USING 'KOMV-KSCHL(07)' WA_ITEMS-KSCHL.
    PERFORM BDC_FIELD USING 'KOMV-KBETR(07)' WA_ITEMS-KBETR.
    PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
    PERFORM BDC_FIELD USING 'BDC_OKCODE'
    '=POS+'.
    PERFORM BDC_FIELD USING 'BDC_CURSOR'
    'KOMV-KSCHL(08)'.
    ENDLOOP.
    PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
    PERFORM BDC_FIELD USING 'BDC_OKCODE'
    '/EBACK'.
    PERFORM BDC_FIELD USING 'BDC_CURSOR'
    'KOMV-KSCHL(08)'.
    PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
    PERFORM BDC_FIELD USING 'BDC_OKCODE'
    '=SICH'.
    CALL TRANSACTION 'VA01' USING IT_BDCDATA MODE 'A'.
    REFRESH IT_BDCDATA.
    ENDLOOP.
    u2022     Start new screen *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
    CLEAR WA_BDCDATA.
    WA_BDCDATA-PROGRAM = PROGRAM.
    WA_BDCDATA-DYNPRO = DYNPRO.
    WA_BDCDATA-DYNBEGIN = 'X'.
    APPEND WA_BDCDATA TO IT_BDCDATA.
    ENDFORM. "BDC_DYNPRO
    u2022     Insert field *
    FORM BDC_FIELD USING FNAM FVAL.
    IF FVAL SPACE.
    CLEAR WA_BDCDATA.
    WA_BDCDATA-FNAM = FNAM.
    WA_BDCDATA-FVAL = FVAL.
    APPEND WA_BDCDATA TO IT_BDCDATA.
    ENDIF.
    ENDFORM. "BDC_FIELD
    Edited by: Matt on Mar 9, 2009 4:38 PM

    Every input/output field on the screen has its own name.(for example: RV45A-KETDAT)
    PERFORM BDC_FIELD USING 'RV45A-KETDAT' '21.10.2008'.
    means fill the date '21.10.2008' into the screen field 'RV45A-KETDAT'.
    CONCATENATE 'RV45A-MABNR(' N ')' INTO TEMP.
    PERFORM BDC_FIELD USING TEMP WA_ITEMS-MABNR.
    There are some special input fields on the screen (table control). In fact, it's a table.
    RV45A-MABNR
    RV45A-KWMENG
    other fields...
    RV45A-MABNR(01)
    RV45A-KWMENG(01)
    RV45A-MABNR(02)
    RV45A-KWMENG(02)
    RV45A-MABNR(..)
    RV45A-KWMENG(..)
    RV45A-MABNR(N)
    RV45A-KWMENG(N)
    so, the code means fill the values line by line.
    and, I recommend you to learn more basic knowledge of dynpro.

  • Using concatenate function to write report comments

    Hi am a high school teacher and have just got my first iPad - lovinging it!!! and am using Numbers and Pages on both my Mac at home and my iPad, but have hit a bit of a snage with using the concatenate funtion in my report generating spreadsheet.
    We use a 5 grade descriptor at our school for student outcomes (A-E for simplicities sack here) which I use as the basis for generating comments to explain the students performance at each outcome - this actually saves me hours and gives me more original reports across a whole class - the problem that I am having is that when I use the traditional bracketed IF queries to return the various strings matched to the outcomes Numbers will only let me address the outcome source cell in the first case, whenever i hit the cell again the orignal reference just "highlights"
    Any clues as to what I am doing wrong?
    Here is the start of the equation:
    =CONCATENATE(B1, " ",IF(Ranks and Grades :: Effort 'Nada '="O", Comment Phrases :: B9,(if when i get to here i go to hit Ranks and Grades :: Effort 'Nada' and it just highlights the original entry
    Help!!!!! these need to be in yesterday!!!!
    Ta
    Steve

    Thanks for the help Barry - don't try and author stuff like this on the iPad, just use it for record keeping, viewing and editing, author in the Mac, unfortunately your reply came just a little too late for me no not have laready resorted to using Excel (grumble grumble) but I will be doing the rest of my junior classes on Numbers - is just a nicer environment ot work with, especially with the descriptor cell addresses!!!!
    And yes they were typos, working on reports while not beina able to breath (asthma) and writing questions while brain tired from low O2 (yes I'm a science teacher) not a good combo
    Thanks again for the help
    Steve
    PS can you shed any light as to why numbers operates in this manner, it seems a little Byzentine...

  • Can I use Concatenate function for multiple rows?

    I have a lead list that contains 5000 leads. The format of this list contains address data that is saved in separate columns (ie: address, address 2, city, state, zip). I need this data in 1 column. I tried to use the concatenate function to combine the data for 1 row and it worked perfectly. I tried to do this for multiple rows and the function is greyed out. Is there a work around or way that I can combine this data for all 5000 rows without doing it 1 by one?

    Look at this table;
    In B9, the formula is;
    =B2&" "&C2&" "&D2&" "&E2&" "&B3&" "&C3&" "&D3&" "&E3
    Yvan KOENIG (VALLAURIS, France) dimanche 18 octobre 2009 20:51:47

  • Concatenate field and use in smartform

    Hello,
    I have generated a form .In a program ,i have used a  CONCATENATE IT_OUT1-BSCHL UMSKZ INTO temp1.
    and IT_OUT1-BSCHL = temp1.
    temp1 is a variable type c.when i called it in smartform i.e.WA_IT_OUT-BSCHL.it does not shows both field data in print preview.
    Please give me the solution.
    Its an urgent.........
    Awaitng reply.
    Thanks
    Suchita

    hi
      in global Definition u can define variable , then in ur driver prg.
    add that fields name  and assign value to it of that fields of internal table.
    like this :
        netpr                      = itab_ekpo-netpr
       TOTAL_VALUE                = ITAB_TOTAL-TOTAL_VALUE
    importing
    Note :   netpe is variable u define in SF and itab_ekpo-netpe value ur passing to it.  add before importing
                                            OR
    add a new field in ur intarnal table and assign value to it and call it in SF.
    rewaed if helpful.

  • Multiple pdf attachments from server folder using SO_DOCUMENT_SEND_API1

    Dears,
    I am trying to build a program able to send an email with multiple pdf attachments.
    The files are stored in a folder in SAP server.
    I am able to generate a pdf file from a spool and sucessfully attach it to the email using:
    CALL FUNCTION 'CONVERT_OTF_2_PDF'
          IMPORTING
            bin_filesize           = v_bin_filesize
          TABLES
            otf                    = job_output_info-otfdata
            doctab_archive         = it_docs
            lines                  = it_lines
          EXCEPTIONS
            err_conv_not_possible  = 1
            err_otf_mc_noendmarker = 2
            OTHERS                 = 3.
        IF sy-subrc = 0.
          LOOP AT it_lines.
            TRANSLATE it_lines USING ' ~'.
            CONCATENATE gd_buffer it_lines INTO gd_buffer.
          ENDLOOP.
          TRANSLATE gd_buffer USING '~ '.
          DO.
            it_mess_att_aux = gd_buffer.
            APPEND it_mess_att_aux.
            SHIFT gd_buffer LEFT BY 255 PLACES.
            IF gd_buffer IS INITIAL.
              EXIT.
            ENDIF.
          ENDDO.
        ENDIF.
    Internal table it_mess_att_aux is the parameter contents_bin of FM SO_DOCUMENT_SEND_API1.
    I have now 2 files on a server folder which I would like to include as well.
    I am reading the content of the pdf files in following way:
    DATA:   gd_buffer                 TYPE string,
          OPEN DATASET lv_fileserver FOR INPUT IN BINARY MODE.
          IF sy-subrc <> 0.
            MESSAGE e257(zmsgsd) WITH lv_fileserver.
          ELSE.
            CLEAR: it_mess_att_aux[], gd_buffer.
            DO.
              READ DATASET lv_fileserver INTO gd_buffer.
              IF sy-subrc <> 0.
                EXIT.
              ENDIF.
              APPEND gd_buffer TO it_mess_att_aux.
            ENDDO.
            APPEND LINES OF it_mess_att_aux TO it_mess_att.
    I do not understand the purpose of the statement:
            TRANSLATE it_lines USING ' ~'.
    in this context. Could anyone explain it?
    All the files are attached to email with the desired name but corrupted and with the wrong size.
    Can anyone help me build the logic to attach a pdf file from server in a email?
    Thank you in advance,
    Kind Regards,
    João Cabrita

    hi , try this ,it is working fine  .
      DATA: i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
              i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
              i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    *          wa_doc_chng LIKE sodocchgi1,
              i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    *         i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
           i_objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_tline TYPE TABLE OF tline WITH HEADER LINE,
          i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          wa_doc_chng LIKE sodocchgi1,
          v_lines_txt TYPE i,
           l_lines TYPE I VALUE '20'.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format        = 'PDF'
          max_linewidth = 132
        IMPORTING
          bin_filesize  = bin_filesize
        TABLES
          otf           = int_tab_otf_final
          lines         = int_pdf_tab.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *****************soc ranjan***************************
    *  IF full_path IS INITIAL.
    *    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    *      EXPORTING
    **    WINDOW_TITLE         =
    **           DEFAULT_EXTENSION    = 'PDF'
    **    DEFAULT_FILE_NAME    =
    *           file_filter          = 'Portable Document Format (.pdf)' " for restricting saving file only as pdf
    *      CHANGING
    *        filename             = file_name
    *        path                 = file_path
    *        fullpath             = full_path
    *    IF sy-subrc <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *    ENDIF.
    *  ENDIF.
    ******************eoc ranjan*****************
    *break-point.
      CONCATENATE full_path git_select_option-pernr INTO path SEPARATED BY '_'.
      CONCATENATE path 'PDF' INTO path SEPARATED BY '.'.
    **  **************************for downloading*********************************
    *  CALL FUNCTION 'GUI_DOWNLOAD'
    *    EXPORTING
    *      bin_filesize = bin_filesize
    *      filename     = path
    *      filetype     = 'BIN'
    *    IMPORTING
    *      filelength   = file_size
    *    TABLES
    *      data_tab     = int_pdf_tab.
    *  IF sy-subrc <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *  ENDIF.
      CLEAR : lop , el , sl , cl .
    *  ******************addeddd later  by ranjan  21.04.2011
    DATA : desc TYPE char40 ,
          desc1 TYPE char100 .
      CALL FUNCTION 'QCE1_CONVERT'
    TABLES
    t_source_tab = int_pdf_tab
    t_target_tab = i_record
    EXCEPTIONS
    convert_not_possible = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    WRITE : / 'Error in conversion of pdf lines'(015).
    ENDIF.
    APPEND LINES OF i_record TO i_objbin.
    *Creation of the entry for the compressed attachment
    DESCRIBE TABLE i_objbin LINES bin_filesize.
    i_objtxt = 'Hi'.
    APPEND i_objtxt.
    i_objtxt = '                                     '.
    APPEND i_objtxt.
    i_objtxt = 'Pls  find  the attached  salary slip ' .
    APPEND i_objtxt.
    i_objtxt = '  '.
    APPEND i_objtxt.
    i_objtxt = '  '.
    APPEND i_objtxt.
    i_objtxt = '  '.
    APPEND i_objtxt.
    i_objtxt = '  '.
    APPEND i_objtxt.
    i_objtxt = '  '.
    APPEND i_objtxt.
    i_objtxt = '         '.
    APPEND i_objtxt.
    i_objtxt = '  '.
    APPEND i_objtxt.
    i_objtxt = '  '.
    APPEND i_objtxt.
    i_objtxt = '        '.
    APPEND i_objtxt.
    i_objtxt = '  '.
    APPEND i_objtxt.
    i_objtxt = '         '.
    APPEND i_objtxt.
    i_objtxt = '  '.
    APPEND i_objtxt.
    i_objtxt = '  '.
    APPEND i_objtxt.
    i_objtxt = '         '.
    APPEND i_objtxt.
    i_objtxt = '  '.
    APPEND i_objtxt.
    i_objtxt = 'Regards:  '.
    APPEND i_objtxt.
    i_objtxt = 'Corporate HR  '.
    APPEND i_objtxt.
    DESCRIBE TABLE i_objtxt LINES L_LINES.
    READ TABLE i_objtxt INDEX L_LINES.
    wa_doc_chng-doc_size = ( L_LINES - 1 ) * 255 + STRLEN( i_objtxt ).
    *Creating the entry for the compressed document
    CLEAR i_objpack-transf_bin.
    i_objpack-head_start = 1.
    i_objpack-head_num = 0.
    i_objpack-body_start = 1.
    i_objpack-body_num = L_LINES.
    i_objpack-doc_type = 'RAW'.
    APPEND i_objpack.
    ***CLEAR:  i_objpack .
    ***i_objpack-transf_bin = ' '.
    **i_objpack-head_start = 1.
    **i_objpack-head_num = 0.
    **i_objpack-body_start = 1.
    **i_objpack-body_num = L_LINES.
    **i_objpack-doc_type = 'TXT'.
    **i_objpack-obj_descr = desc1 .
    **APPEND i_objpack.
    *CLEAR: i_objhead .
    *i_objhead = DESC.
    *APPEND i_objhead.
    *break-point .
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 1.
    i_objpack-body_start = 1.
    i_objpack-body_num = bin_filesize.
    i_objpack-obj_name = 'Employee Payslip'.
    i_objpack-obj_descr = 'Employee Payslip'.
    i_objpack-doc_size = bin_filesize  * 255 .
    i_objpack-doc_type = 'PDF'.
    APPEND i_objpack.
    CONCATENATE 'Salary Slip of Month' p_month INTO desc SEPARATED BY ' ' .
    *DESCRIBE TABLE i_objtxt LINES v_lines_txt.
    *READ TABLE i_objtxt INDEX v_lines_txt.
    ****wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 375 + STRLEN( i_objtxt ).
    wa_doc_chng-obj_name = 'Payslip'.
    wa_doc_chng-expiry_dat = sy-datum + 10.
    wa_doc_chng-obj_descr = desc.
    wa_doc_chng-sensitivty = 'F'.
    wa_doc_chng-doc_size = v_lines_txt * 255.
    CLEAR i_objpack.
    DATA: l_usrid_long TYPE pa0105-usrid_long.
    DATA : emessage(70) TYPE c.
    CLEAR : l_usrid_long.
    SELECT SINGLE usrid_long
    FROM pa0105
    INTO l_usrid_long
    WHERE pernr = git_pa0001-pernr
    AND subty = '0010'.
    *break-point.
    IF sy-subrc EQ 0.
    i_reclist-receiver = l_usrid_long.                     
    i_reclist-rec_type = 'U'.
    i_reclist-com_type = 'INT'.
    APPEND i_reclist.
    ELSE.
    WRITE:/ 'No email id is maintained for this personnel number' , git_pa0001-pernr.
    ENDIF.
    IF NOT i_reclist[] IS INITIAL.
    ***************************************for senders id *************************************
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
      EXPORTING
        document_data                    = wa_doc_chng
      put_in_outbox = 'X'
       sender_address                   = 'xys'
       sender_address_type              = 'SMTP'
       commit_work                      = 'X'
    * IMPORTING
    *   SENT_TO_ALL                      =
    *   NEW_OBJECT_ID                    =
    *   SENDER_ID                        =
      TABLES
    packing_list = i_objpack
    object_header = i_objhead
    contents_bin = i_objbin
    contents_txt = i_objtxt
    receivers = i_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 <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • 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.

  • E-mail functionality using so_new_document_att_send_api1

    Hi
    We Implemented E-mail functionality in our tool useing "so_new_document_att_send_api1" standard FM but here im unable to attach excel document .How to attach a excel document in this standard FM plz help.
    Asif

    hi try this code
    *& Report  ZTEST_2                                                     *
    *& Report  ZTEST_2                                                     *
    REPORT  ztest_2                                 .
    TYPES : BEGIN OF t_email_update_iw32,
             aufnr LIKE viaufks-aufnr,
             vornr LIKE afvc-vornr,
             text(220),
            END OF t_email_update_iw32.
    DATA : gt_email_update_iw32 TYPE STANDARD TABLE OF t_email_update_iw32,
           gw_email_update_iw32 TYPE t_email_update_iw32.
    TYPES : BEGIN OF t_email_date_error,
             aufnr LIKE viaufks-aufnr,
             prueflos LIKE qamr-prueflos,
             merknr  LIKE qamr-merknr,
             text(220),
            END OF t_email_date_error.
    DATA : gt_email_date_error TYPE STANDARD TABLE OF t_email_date_error,
           gw_email_date_error TYPE t_email_date_error.
    TYPES : BEGIN OF t_email_conf_doc_error,
             aufnr LIKE viaufks-aufnr,
             vornr LIKE afvc-vornr,
             text(220),
            END OF t_email_conf_doc_error.
    DATA : gt_email_conf_doc_error TYPE STANDARD TABLE OF
    t_email_conf_doc_error,
           gw_email_conf_doc_error TYPE t_email_conf_doc_error.
    SELECTION-SCREEN : BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
    PARAMETERS : cb_email AS CHECKBOX DEFAULT 'X'.
    *SELECTION-SCREEN BEGIN OF LINE.
    *SELECTION-SCREEN COMMENT (16) text-007 FOR FIELD p_email1.
    PARAMETERS : p_email LIKE somlreci1-receiver,
                 p_email1 LIKE adr6-smtp_addr.
    PARAMETERS : p_table1 AS CHECKBOX,
                 p_table2 AS CHECKBOX,
                 p_table3 AS CHECKBOX.
    SELECTION-SCREEN : END OF BLOCK b4.
    CLEAR gw_email_update_iw32.
    REFRESH gt_email_update_iw32.
    gw_email_update_iw32-aufnr = '1234567'.
    gw_email_update_iw32-vornr = '0010'.
    gw_email_update_iw32-text = 'This is table1'.
    APPEND  gw_email_update_iw32 TO gt_email_update_iw32.
    CLEAR gw_email_update_iw32.
    gw_email_update_iw32-aufnr = '4564578'.
    gw_email_update_iw32-vornr = '0020'.
    gw_email_update_iw32-text = 'This is table1'.
    APPEND  gw_email_update_iw32 TO gt_email_update_iw32.
    gw_email_date_error-aufnr = '222615'.
    gw_email_date_error-prueflos = '1111'.
    gw_email_date_error-merknr = '2222'.
    gw_email_date_error-text = 'This is table2'.
    APPEND gw_email_date_error TO gt_email_date_error.
    gw_email_date_error-aufnr = '222615'.
    gw_email_date_error-prueflos = '3333'.
    gw_email_date_error-merknr = '4444'.
    gw_email_date_error-text = 'This is table2'.
    APPEND gw_email_date_error TO gt_email_date_error.
    gw_email_conf_doc_error-aufnr = '9900107987'.
    gw_email_conf_doc_error-vornr = '999999'.
    gw_email_conf_doc_error-text  = 'This is table3'.
    APPEND gw_email_conf_doc_error TO gt_email_conf_doc_error.
    gw_email_conf_doc_error-aufnr = '9900107987'.
    gw_email_conf_doc_error-vornr = '999999'.
    gw_email_conf_doc_error-text  = 'This is table3'.
    APPEND gw_email_conf_doc_error TO gt_email_conf_doc_error.
    DATA : lw_space VALUE ''.
    SET PARAMETER ID 'ZPDF' FIELD lw_space.
    DATA : pripar LIKE pri_params.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        in_parameters          = pripar
        line_size              = 255
        layout                 = 'X_65_132'
        no_dialog              = 'X'
      IMPORTING
        out_parameters         = pripar
      EXCEPTIONS
        archive_info_not_found = 1
        invalid_print_params   = 2
        invalid_archive_params = 3
        OTHERS                 = 4.
    NEW-PAGE PRINT ON PARAMETERS pripar NO DIALOG .
    RESERVE 5 LINES.
    DATA : text1(10) TYPE c  VALUE 'AUFNR',
           text2(10) TYPE c VALUE 'VORNR',
           text3(50) TYPE c VALUE 'TEXT'.
    IF p_table1 = 'X'.
      WRITE  AT 10   text1. WRITE AT 30  text2 . WRITE AT 30 text3.
      LOOP AT  gt_email_update_iw32 INTO  gw_email_update_iw32.
        WRITE : /  gw_email_update_iw32-aufnr , gw_email_update_iw32-vornr ,
    gw_email_update_iw32-text.
      ENDLOOP.
    ENDIF.
    WRITE : / sy-uline .
    IF p_table2 = 'X'.
      WRITE : / 'AUFNR' , 'PRUEFLOS' ,  'MERKNR', 'TEXT' .
      LOOP AT gt_email_date_error INTO gw_email_date_error.
        WRITE : / gw_email_date_error-aufnr, gw_email_date_error-prueflos,
    gw_email_date_error-merknr,gw_email_date_error-text.
      ENDLOOP.
    ENDIF.
    WRITE : / sy-uline .
    IF p_table3 = 'X'.
      WRITE : / 'AUFNR' , 'VORNR' , 'TEXT' .
      LOOP AT gt_email_conf_doc_error INTO gw_email_conf_doc_error.
        WRITE : / gw_email_conf_doc_error-aufnr,
    gw_email_conf_doc_error-vornr, gw_email_conf_doc_error-text.
      ENDLOOP.
    ENDIF.
    NEW-PAGE PRINT OFF.
    DATA : mtab_pdf LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : rqident LIKE tsp01-rqident ,
           rqcretime LIKE tsp01-rqcretime .
    SELECT  rqident  rqcretime FROM tsp01
           INTO (rqident,rqcretime)
           WHERE rqowner = sy-uname
           ORDER BY rqcretime DESCENDING.
      EXIT.
    ENDSELECT.
    DATA: spool_id LIKE tsp01-rqident.
    MOVE  rqident TO spool_id.
    DATA : p_file LIKE rlgrap-filename VALUE 'C:\file.pdf' ,
           numbytes TYPE i,
           cancel.
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid = spool_id
          NO_DIALOG =
          DST_DEVICE =
          PDF_DESTINATION =
    IMPORTING
        pdf_bytecount = numbytes
          PDF_SPOOLID =
          LIST_PAGECOUNT =
          BTC_JOBNAME =
          BTC_JOBCOUNT =
      TABLES
        pdf = mtab_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 'I' NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    end
    DATA :  w_buffer TYPE string. "To convert from 132 to 255
    DATA : i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE.
    LOOP AT mtab_pdf.
    Replacing space by ~
      TRANSLATE mtab_pdf USING ' ~'.
      CONCATENATE w_buffer mtab_pdf INTO w_buffer.
    ENDLOOP.
    Replacing ~ by space
    TRANSLATE w_buffer USING '~ ' .
    DO.
      i_record = w_buffer.
    Appending 255 characters as a record
      APPEND i_record.
      SHIFT w_buffer LEFT BY 255 PLACES.
      IF w_buffer IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    *start try
    DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
    DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
    DATA: doc_chng LIKE sodocchgi1.
    DATA : tab_lines TYPE c.
    doc_chng-obj_name = 'TEST'.
    doc_chng-obj_descr = 'Mail came successfully'.
    objtxt = 'Regards'.
    APPEND objtxt.
    objtxt = 'Nitin'.
    APPEND objtxt.
    objtxt = 'hahaha'.
    APPEND objtxt.
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    * ERSTELLEN DES EINTRAGS ZUM KOMPRIMIERTEN DOKUMENT
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'RAW'.
    APPEND objpack.
    * ERSTELLEN DER ANLAGE FUR DAS DOKUMENT
    **OBJBIN = '\O/ '. APPEND OBJBIN.
    **OBJBIN = ' '. APPEND OBJBIN.
    **OBJBIN = ' / \ '. APPEND OBJBIN.
    LOOP AT i_record.
      objbin[] =  i_record[].
    ENDLOOP.
    DESCRIBE TABLE objbin LINES tab_lines.
    *objhead = 'picasso.txt'. APPEND objhead.
    * Erstellen des Eintrags zur komprimierten Anlage
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num = 1.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'PDF'.
    objpack-obj_name = 'PDF File received '.
    objpack-obj_descr = 'PDF File received '.
    *objpack-doc_size = ( tab_lines ) * 255 .
    APPEND objpack.
    * Fullen der Empfangerliste
    refresh reclist.
    reclist-rec_type = 'U'.
    reclist-receiver = p_email1.
    APPEND reclist.
    reclist-rec_type = 'B'.
    reclist-receiver = sy-uname.
    APPEND reclist.
    reclist-rec_type = 'U'.
    reclist-receiver = p_email.
    APPEND reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng
        put_in_outbox              = 'X'
      TABLES
        packing_list               = objpack
       object_header              = objhead
        contents_bin               = objbin
        contents_txt               = objtxt
        receivers                  = reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        operation_no_authorization = 4
        OTHERS                     = 99.

  • Can anyone answer this question? What is used to format a string so that it falls into a certain Row/Column in excel? see text for indepth question.

    I'm attaching a file that may help. Just remember this is my FIRST attempt at using NI/FeildPoint so things that would be obvious to the normal users more than likely would slide right by me. So I'll try and explain what the text contains as to make my problem more clear. I'm using a FP-1000, FP-AI-100, and a FP-TB-10. i'm creating a application where I'm using the 8 channels from the FP-AI-100 to monitor a control system ,that we manufacture. The control system is in an environmental chamber. I use the FP-TB-10 to monitor the temperature while in the chamber. The control system is ran for 4 hours under varing enviromental conditions while I monitor vital system voltages with the FP-AI-100. Now the application that i'm building starts with the obvious FP CREATE.VI and so forth I have no problem communicating with the FP's, but the information that I'm monitioring needs to be placed into a file with Headers describing the information below it. Now I use a "WHILE LOOP.VI" to monitor the FP-AI-100 & FP-TB-10 for the 4 hour period. but before that I create and open a file where I use a "CONCATENATE STRINGS.VI" to enter the headers I need. I do this by CONSTANTS, CONTROLS, TABs, AND CARRIAGE RETURN being entered into the "CONCATENATE STRINGS.VI" in the order I want them to appear. I use ROW 1 to enter (OPERATOR:with a CONSTANT) an a (CONTROL so the operator may enter his name and be recorded into the file) using a TAB to seperate Columns and a CARRIAGE RETURNto drop down to ROW 2 for the next headers. I use header names and TABs to seperate the columns. This part works great. I end up with ROW 1 having the operator information then ROW 2 having the headers for all the channels I'm using to monitor the control system with in their own column. The trouble happens when I write to this file during the "WHILE LOOP". The information recorded for DATE:, TIME:, and Channel 0 of the FP-AI-100 end up right under their corresponding header on ROW 3, but the rest of the data ends up on ROW 4 in column 3 and goes down many rows with some of the data not being stored at all. It varies on how many rows are used starting at ROW 4 but hey always stay in column 3. I use the "FP READ.VI" outputing to a "ARRAY TO SPREADSHEET STRING.VI" outputing to a "CONCATENATE STRINGS.VI" for each channel within the "WHILE LOOP" then into the "WRITE.VI". I use the "CONCATENATE STRINGS.VI" to place my data OR atleast I thought you could do that some how I'm not quit doing something write either there is a sampling/timing issue or writing to file issue where things are being confused in the "WHILE LOOP" if someone know a better route to perform what I'm tring here I would be interested. Its not like I'm not giving it the old colledge try here but without proper training and the vagness of the manuals it's difficult to understand what every connection actually does.I'm tring though for everyone who happens to fill pity for me
    Thanks for your help
    John Morris
    Glendinning Marine Product, Inc.
    Attachments:
    ALLchannels ‏273 KB

    > I appreciate your effort to help me, but there is still a slight cloud
    > in front of my eyes here.(I must mention that I'm using Labview 5.1
    Oh, to bad. I'm using LV 6,02 and tried to save the application as LV5.1,
    but it didn't work.
    > Lets start with the easy one which is the SECOND main thing you
    > wanted to mention. In my application I used individual Create Tag.vi's
    > "so your saying that I can use just one Create Tag.vi and one Read.vi
    > and what ever I use to display the values will automatically to show
    > the individual channels" in other words if I use a "Indicator(DBL)"
    > comming out of the Read.vi what ever I use in the "PANEL" layout will
    > expand to show all 8 channel if I was using a FP-AI-100? Cool...
    Allmost right. The 8 channels come out as 1D-array, ch0...ch7.
    > #1--How do I change the delimiter (TAB) to a delimiter (comma) in a
    > Array to Spreadsheet String.vi?
    > ...cut
    I don't use this Spreadsheet VI, because files coming out there allways
    start this time consuming EXCEL wizzard. Because of this, I programmed my
    own CSV-conversion vi. Maybe you could just use a common texteditor, like
    wordpad and put the csv-examples from my last reply down to a text file
    and rename it to *.csv. Texteditors terminate lines with "\r\n" by
    default, so this is a very quick way for testing.
    > FP_Analog_Logging example to record all eight channels it uses a Array
    I didn't find the vi you metione above, but there is another good one:
    Look at examples\FieldPoint\DataLogging\FP Logger.vi.
    In a little case structure, at "false", there is a function called "Format
    into string".
    Pop up on the format string and adjust >>'\' Codes Display<<.
    Then you change the format string into: %.;%-f%s
    A Tab string is connected to the lower input of this function. Replace
    this one with a comma.
    That should do.
    >
    > #2--If using just one Create Tag.vi and one Read.vi and I have the
    > Item Name listed as ALL I take it that the information comming out of
    > the Read.vi is data for each channel in a String format starting with
    > channel 0 and ending with channel 7 for the FP-AI-100.
    Yes, just as explained above. If you put a indicator at the output to
    display the values, you can expand the display to show all 8 channels, but
    you can't name induvidual cells. In a array, all cells have identical
    named labels. If you want to name the individually, you have to attach the
    array to cluster function and put the indicator after this one. Enable
    labe display and name the output values individually.
    > #3--Now I use the following to "Format String" in the Array to
    > Spreadsheet string.vi (%.4f)but I don't see anyway of changing the
    > delimiter from (TAB) to (COMA)
    Explained above.
    > #4 you stated text strings need a "as prefix and sufix" and each
    > string is seperated by a coma, a period is used as decimal number
    > separator and lines have to be terminated by my question is
    > WHERE IS THIS ACCOMPLISHED? WHAT VI OR WHAT CONNECTOR PIN?
    Well, modifying strings are done with string functions.
    Above, as I explained how the sample FP Logger.vi can be modified to do
    the job for numbers. The pre- and suffixing with ", you only need for
    strings, which EXCEL should interpret a string and as nothing else as a
    string, even if there's a number inside. You usually need this only for
    headers. So its easyest, if you just write your string into a string
    constant or control and concatenate it to the previous csv-file contents.
    Oh, I just see by looking at the above mentioned example... Inside the
    case structure, but in the "true" case, there are error messages
    concatenated to the logfile. At this point it is importent, to use " for
    integrating the message into the CSV file, because a error message usually
    looks like this: >> ERROR 2345 in vi yxz <<
    Here you have text and number strings mixed in one line. EXCEL does not
    know, if it should interpret the number inside the error line as separate
    number, separating the line into three colums i.e. string before number,
    number and string after number. So tell EXCEL by putting a " before and
    after the line each.
    For this, expand the Format To String function by one input, move down all
    connections, to be able to insert a string constant with a " to the first
    argument connector. Change the contents of the string constant at the
    bottom argument from tab to ", (quotation mark AND comma)
    > #5 You gave me an example of what a 3 column header could look like:
    > "col0","col1","col2"\r\n Now is this something that you enter
    > somewhere cause I know that \r is carriage return and \n is newline so
    > I take it that the above is entered somewhere maybe in the Write.vi to
    > the connector called Header (F)? See this is what confuses me because
    > NI manuals have no examples of certain connectors types being used or
    > any reference as to how they manipluate data with there varing type
    > inputs. Or maybe I'm just missing them.
    The example I mentioned above help here to.
    Look at the Write File function. This function receves data from a
    function named concatenate strings. Expand this function to have one more
    spare input at the bottom. Create a string constant. Switch the constant
    display to "\" mode. Enter "col0","col1","col2"\r\n into the constant.
    Connect the constant to the spare input.
    Doing this, every dataline in the csv file is followed by
    "col0","col1","col2"\r\n .
    I wish you a nice weekend,
    Rainer Ehrt

  • How can I use a web app to provide me with results from a matrix?

    I have a need to set up a search type box based off a matrix. This is a matrix which shows a list of zip codes down the left column, and a list of products across the top, and the corresponding field from a zip code and a product is the freight rate.
    e.g.
              Product 1     Product 2     Product 3     Product 4
    1234     $10               $12               $14               $16
    4567     $11               $11               $13               $17
    5678     $55               $54               $27               $35    
    so the freight rate to 4567 for product 3 is $13.
    Then what i want to have is a drop down list for a customer to select the product, then a field to enter their zip code, and the search result will be the cross referenced freight rate.
    Is this possible? If so, can someone guide me as to how this would be done?

    Throw this open to the community to chip in, but off the top of my head.... thinking of something along lines of:
    Create 3 web apps,
    Product (Fields Product Name & ProductID)
    Zipcode (Fields Area Desc & Zipcode)
    Freight Rates (Fields FreightRateID (made up of ProductID_ZipCode), Freight Rate)
    Create a web app search form for Web App Freight Rates with:
    Product select, with options drawn from web app 1 using ProductID for value.
    Zipcode select, with options drawn from web app 2 using Zipcode for value.
    Hidden FreightRateID field.
    Once a visitor has selected their product and zipcode, using javascript concatenate the selected ProductID with selected Zipcode.
    This will produce a FreightRateID (e.g. PROD1_4567), which can be loaded into the hidden FreightRateID field.
    When submitted, it will perform a web app search for a Freight Rate that matches the chosen product and zipcode, ie. FreightRateID.
    To make entry of the freight rates easier, maybe add 2 datasource fields to the Freight Rate web app for Product and Zipcode.
    Then create a front end web app add/edit (via a secure zone) to allow entry to be done by:
    Select product, select zipcode then enter freight rate.  (FreightRateID can be created and populated in same way as search above)

  • Problem in mailing smartforms output using SO_DOCUMENT_SEND_API1

    Hi all,
    Iam using the function module SO_DOCUMENT_SEND_API1 to email purchase order through driver program.
    the code goes like this:
    first iam calling the function module of smartform
    CALL FUNCTION lv_fm_name
    where iam passing the desired paramets.
    from where iam taking the otfdata returned from the fm
    like:
    IMPORTING
             job_output_info  = w_return
    where w_return is declared as TYPE ssfcrescl.
    then iam writing this code
    i_otf[] = w_return-otfdata[].
    DELETE w_return-otfdata WHERE tdprintcom = '//'.
    READ TABLE i_otf WITH KEY tdprintcom = 'EP'.
    my_tabix = sy-tabix + 1.
    INSERT lines of w_return-otfdata INTO i_otf INDEX my_tabix.
    then iam calling the fm
          CALL FUNCTION 'CONVERT_OTF'
            EXPORTING
              format                = 'PDF'
              max_linewidth         = 132
            IMPORTING
              bin_filesize          = v_len_in
            TABLES
              otf                   = i_otf
              lines                 = i_tline
            EXCEPTIONS
              err_max_linewidth     = 1
              err_format            = 2
              err_conv_not_possible = 3
              OTHERS                = 4.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    then converting it to 255 using
    DATA: gd_buffer TYPE string.
    DATA: w_cnt TYPE i,
                i_record LIKE solix OCCURS 0 WITH HEADER LINE.
          LOOP AT i_tline.
            TRANSLATE i_tline USING ' ~'.
            CONCATENATE gd_buffer i_tline INTO gd_buffer.
          ENDLOOP.
          TRANSLATE gd_buffer USING '~ '.
          DO.
            i_record-line = gd_buffer.
            APPEND i_record.
            SHIFT gd_buffer LEFT BY 255 PLACES.
            IF gd_buffer IS INITIAL.
              EXIT.
            ENDIF.
          ENDDO.
    the to test whether its converting into pdf iam using the fm
    CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              bin_filesize = bin_filesize
              filename     = 'C:\TESTPDF.PDF'
              filetype     = 'BIN'
            TABLES
              data_tab     = i_record.
    then calling my main fm
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
            EXPORTING
              document_data              = w_doc_chng
             put_in_outbox               =  'X'
           sender_address              = sender
           sender_address_type         = 'INT'
           commit_work                  = 'X'
            TABLES
              packing_list               = it_packing_list
              object_header              = w_objhead
            CONTENTS_BIN               = I_OBJBIN
              contents_txt               = i_objtxt
             contents_hex                = i_objbin            
              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
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    all the parametrs for the above fm are passed correctly like populating  it_packing_list,w_objhead, i_objtxt, i_objbin,it_receivers.iam using this fm because i need to pass sender email id.
    the first problem iam facing is when iam using the fm gui_download iam not able to view the smartform
    the error is "adobe reader could not open "test.pdf" as it is not supported etc..."
    second is same problem iam facing while trying to open the attachment in pdf which is emailed to reciever.
    i think there is some problem in converting 132 to 255 characters.
    can some one please help on this.(might be a problem where iam passing DO
            i_record-line = gd_buffer.)
    thanks in advance.
    regards
    sunil

    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    format = 'PDF'
    max_linewidth = <b>255 "132</b>
    IMPORTING
    bin_filesize = v_len_in
    TABLES
    otf = i_otf
    lines = i_tline
    EXCEPTIONS
    err_max_linewidth = 1
    err_format = 2
    err_conv_not_possible = 3
    OTHERS = 4.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    I guess it will solve your problem.
    CLose the thread if your question is answered.
    Regards,
    SaiRam

  • ALV o/p TO PDF Converison using  CONVERT_ABAPSPOOLJOB_2_PDF

    Hi Geeks,
    My rquirement is to attach the output of ALV report to the mail as PDF file.I am using FM "CONVERT_ABAPSPOOLJOB_2_PDF" for converting the ALV ouput to PDF format but when i check the data in PDF fomat table , it's corrupted and thus pdf file opens with error in the mail.
    Can anyone have some suggestion please !!!
    Usefull answer will be rewarded !!!

    Harmeet,
    Code is :
    Preparing the recepeint list
      LOOP AT S_EMAIL1.
        CLEAR : TBL_RECLIST.
        TBL_RECLIST-RECEIVER = S_EMAIL1-LOW.
        TBL_RECLIST-REC_TYPE = 'U'.
        APPEND TBL_RECLIST.
      ENDLOOP.
      LOOP AT S_EMAIl2.
        CLEAR : TBL_RECLIST.
        TBL_RECLIST-RECEIVER = S_EMAIL2-LOW.
        TBL_RECLIST-REC_TYPE = 'U'.
        APPEND TBL_RECLIST.
      ENDLOOP.
    PDF spooling (For generating spool number)
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
        SRC_SPOOLID                    = lv_spool
        NO_DIALOG                      = c_no
        DST_DEVICE                     = c_device
      PDF_DESTINATION                =
      IMPORTING
        PDF_BYTECOUNT                  = LV_BYTE_COUNT
      PDF_SPOOLID                    =
      LIST_PAGECOUNT                 =
      BTC_JOBNAME                    =
      BTC_JOBCOUNT                   =
      TABLES
        PDF                            = TBL_PDF_OUTPUT[]
      EXCEPTIONS
        ERR_NO_ABAP_SPOOLJOB           = 1
        ERR_NO_SPOOLJOB                = 2
        ERR_NO_PERMISSION              = 3
        ERR_CONV_NOT_POSSIBLE          = 4
        ERR_BAD_DESTDEVICE             = 5
        USER_CANCELLED                 = 6
        ERR_SPOOLERROR                 = 7
        ERR_TEMSEERROR                 = 8
        ERR_BTCJOB_OPEN_FAILED         = 9
        ERR_BTCJOB_SUBMIT_FAILED       = 10
        ERR_BTCJOB_CLOSE_FAILED        = 11
        OTHERS                         = 12
       IF sy-subrc = 0.
            LOOP AT TBL_PDF_OUTPUT.
              TRANSLATE TBL_PDF_OUTPUT USING ' ~'.
              CONCATENATE LV_BUFFER TBL_PDF_OUTPUT INTO LV_BUFFER.
            ENDLOOP.
            TRANSLATE LV_BUFFER USING '~ '.
            DO.
              TBL_OBJBIN = LV_BUFFER.
              APPEND TBL_OBJBIN.
              SHIFT LV_BUFFER LEFT BY 255 PLACES.
              IF LV_BUFFER IS INITIAL.
                EXIT.
              ENDIF.
            ENDDO.
          ENDIF.
          DESCRIBE TABLE TBL_OBJBIN LINES LV_TBL_LINE.
        Prepare document
          LV_DOC-OBJ_NAME  = 'ERROR'.
          LV_DOC-OBJ_DESCR = 'ERROR IN OBZT MAINTENANCE – ACTION REQUIRED'.
        Prepare for attachement
          TBL_OBJPACK-TRANSF_BIN = 'X'.
          TBL_OBJPACK-HEAD_START = 1.
          TBL_OBJPACK-HEAD_NUM   = 0.
          TBL_OBJPACK-BODY_START = 2.
          TBL_OBJPACK-BODY_NUM   = LV_TBL_LINE.
          TBL_OBJPACK-DOC_TYPE = 'PDF'.
          TBL_OBJPACK-OBJ_NAME = 'ATTACHEMENT'.
          TBL_OBJPACK-OBJ_DESCR = 'Error in tax code with OBZT'.
          TBL_OBJPACK-DOC_SIZE = ( LV_TBL_LINE - 1 ) * 255  + STRLEN( TBL_OBJBIN ).
          APPEND TBL_OBJPACK .
          CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
            EXPORTING
              DOCUMENT_DATA                    = LV_DOC
            PUT_IN_OUTBOX                    = ' '
              COMMIT_WORK                      = 'X'
           IMPORTING
             SENT_TO_ALL                      =
             NEW_OBJECT_ID                    =
            TABLES
              PACKING_LIST                     = TBL_OBJPACK[]
             OBJECT_HEADER                    = TBL_OBJHEAD[]
              CONTENTS_BIN                     = TBL_OBJBIN[]
            CONTENTS_TXT                     =
            CONTENTS_HEX                     =
            OBJECT_PARA                      =
            OBJECT_PARB                      =
              RECEIVERS                        = TBL_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
        ENDIF.
    ENDIF.

  • Mail sending using sender importing parameter using so_object_send function

    Hi all,
            I using so_object_send function module to send mail. My requirement is with respect to any user 
            logged in the sender mail address should be taken by V_SENDER parameter in exporting
            parameter.
    <code>
    CALL FUNCTION 'SO_OBJECT_SEND'
           EXPORTING
                folder_id                  = wa_folder_id
                forwarder                  = w_forwarder
                object_fl_change           = wa_object_fl_change
                object_hd_change           = wa_object_hd_change
                object_id                  = wa_object_id
                object_type                = w_object_type
                outbox_flag                = w_outbox_flag
                owner                      = w_owner
                store_flag                 = w_store_flag
           IMPORTING
                object_id_new              = wa_object_id_new
                sent_to_all                = w_sent_to_all
                sender                     =  v_sender
           TABLES
                objcont                    = i_objcont
                objhead                    = i_objhead
                objpara                    = i_objpara
                objparb                    = i_objparb
                receivers                  = i_receivers
           EXCEPTIONS
                active_user_not_exist      = 1
                communication_failure      = 2
                component_not_available    = 3
                folder_not_exist           = 4
                folder_no_authorization    = 5
                forwarder_not_exist        = 6
                note_not_exist             = 7
                object_not_exist           = 8
                object_not_sent            = 9
                object_no_authorization    = 10
                object_type_not_exist      = 11
                operation_no_authorization = 12
                owner_not_exist            = 13
                parameter_error            = 14
                substitute_not_active      = 15
                substitute_not_defined     = 16
                system_failure             = 17
                too_much_receivers         = 18
                user_not_exist             = 19
                originator_not_exist       = 20
                x_error                    = 21
                OTHERS                     = 22.
      IF sy-subrc  0.
      ENDIF.
    </code>    
    My Requirement is V_SENDER can be any user of that SAP system,noot particularly logged in user.
    I tried using this functionality my sy-subrc is zero. but i am not able to get any mails with that user name in V_SENDER.
    Do i need to do any further settings or any more code is required.
    Even i tired giving SUBMIT rsconn01 .
    still its not working.
    Please suggest any solutions if we have.
    Thanks,
    satish

    Hi,
    to send mails check this:
    FORM docu_send_email USING pv_otfdata TYPE tsfotf
    pv_emailid TYPE any
    pv_formname TYPE any.
    DATA: lv_filesize TYPE i,
    lv_buffer TYPE string,
    lv_attachment TYPE i,
    lv_testo TYPE i.
    DATA: li_pdfdata TYPE STANDARD TABLE OF tline,
    li_mess_att TYPE STANDARD TABLE OF solisti1,
    li_mtab_pdf TYPE STANDARD TABLE OF tline,
    li_objpack TYPE STANDARD TABLE OF sopcklsti1,
    li_objtxt TYPE STANDARD TABLE OF solisti1,
    li_objbin TYPE STANDARD TABLE OF solisti1,
    li_reclist TYPE STANDARD TABLE OF somlreci1,
    li_objhead TYPE soli_tab.
    DATA: lwa_pdfdata TYPE tline,
    lwa_objpack TYPE sopcklsti1,
    lwa_mess_att TYPE solisti1,
    lwa_objtxt TYPE solisti1,
    lwa_objbin TYPE solisti1,
    lwa_reclist TYPE somlreci1,
    lwa_doc_chng TYPE sodocchgi1.
    CONSTANTS: lc_u TYPE char1 VALUE 'U',
    lc_0 TYPE char1 VALUE '0',
    lc_1 TYPE char1 VALUE '1',
    lc_pdf TYPE char3 VALUE 'PDF',
    lc_raw TYPE char3 VALUE 'RAW',
    lc_ordform TYPE char15 VALUE 'ZORDCONFIRM_01',
    lc_attachment TYPE char10 VALUE 'ATTACHMENT'.
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    format = lc_pdf
    max_linewidth = 132
    IMPORTING
    bin_filesize = lv_filesize
    TABLES
    otf = pv_otfdata
    lines = li_pdfdata
    EXCEPTIONS
    err_max_linewidth = 1
    err_format = 2
    err_conv_not_possible = 3
    err_bad_otf = 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.
    ENDIF.
    LOOP AT li_pdfdata INTO lwa_pdfdata.
    TRANSLATE lwa_pdfdata USING ' ~'.
    CONCATENATE lv_buffer lwa_pdfdata INTO lv_buffer.
    CLEAR lwa_pdfdata.
    ENDLOOP.
    TRANSLATE lv_buffer USING '~ '.
    DO.
    lwa_mess_att = lv_buffer.
    APPEND lwa_mess_att TO li_mess_att.
    CLEAR lwa_mess_att.
    SHIFT lv_buffer LEFT BY 255 PLACES.
    IF lv_buffer IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    Object with PDF.
    REFRESH li_objbin.
    li_objbin] = li_mess_att[.
    DESCRIBE TABLE li_objbin LINES lv_attachment.
    Object with main text of the mail.
    lwa_objtxt = space.
    APPEND lwa_objtxt TO li_objtxt.
    CLEAR lwa_objtxt.
    DESCRIBE TABLE li_objtxt LINES lv_testo.
    Create the document which is to be sent
    lwa_doc_chng-obj_name = text-008.
    lwa_doc_chng-obj_descr = text-008.
    lwa_doc_chng-sensitivty = lc_0.
    lwa_doc_chng-obj_prio = lc_1.
    lwa_doc_chng-doc_size = lv_testo * 225.
    Pack to main body.
    CLEAR lwa_objpack-transf_bin.
    header
    lwa_objpack-head_start = 1.
    The document needs no header (head_num = 0)
    lwa_objpack-head_num = 0.
    body
    lwa_objpack-body_start = 1.
    lwa_objpack-body_num = lv_testo.
    lwa_objpack-doc_type = lc_raw.
    APPEND lwa_objpack TO li_objpack.
    CLEAR lwa_objpack.
    Create the attachment.
    Fill the fields of the packing_list for the attachment:
    lwa_objpack-transf_bin = gc_x .
    header
    lwa_objpack-head_start = 1.
    lwa_objpack-head_num = 1.
    body
    lwa_objpack-body_start = 1.
    lwa_objpack-body_num = lv_attachment.
    lwa_objpack-doc_type = lc_pdf.
    lwa_objpack-obj_name = lc_attachment.
    lwa_objpack-obj_descr = text-008.
    lwa_objpack-doc_size = lv_attachment * 255.
    APPEND lwa_objpack TO li_objpack.
    CLEAR lwa_objpack.
    lwa_reclist-receiver = pv_emailid.
    lwa_reclist-rec_type = lc_u.
    lwa_reclist-notif_del = gc_x.
    lwa_reclist-notif_ndel = gc_x.
    APPEND lwa_reclist TO li_reclist.
    IF li_reclist IS NOT INITIAL.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = lwa_doc_chng
    put_in_outbox = gc_x
    TABLES
    packing_list = li_objpack
    object_header = li_objhead
    contents_bin = li_objbin
    contents_txt = li_objtxt
    receivers = li_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 0.
    MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    ENDFORM. " DOCU_SEND_EMAIL

  • I would like to get only specific channels from several .csv files and concatenate into one group.

    Hello,
    I am working with other groups and getting the data in daily .csv files.  When I use the "concatenate groups" script along with a script on importing files, I end up getting a huge file that takes about an hour to concatenate.  In order to reduce the amount of time and memory that this takes, I was hoping that someone could help me modify the script so that I could just list the channel name that I am interested in and concatinating only those channels rather than all of them. 
    For example, if voltage, temperature, pressure and time data are taken daily for 30 days, I would like to import only the temperature and time data (from .csv format) and concatenate into one group.
    I have attached the .vbs files that I use.
    Thanks in advance,
    Alan
    Attachments:
    Import and concatenate files.zip ‏9 KB

    Hi Alan,
    Actually, the feature you're asking for is already in the code of mine that you sent back. Look on line 11 of the main VBScript:    ChannelSet = "" ' "" or "1-" (DataPlugin) or "Sheet1" (EXCEL Wizard) 
    If this "ChannelSet" parameter is set to something other than "" or "1-" then it is used in line 78:
    Call DataFileLoadSel(FilePaths(i), DataPlugin, ChannelSet) 
    Yo can specify the channel indices to load with an expression like this:
    ChannelSet = "[1]/[1],[3]" 
    Let me know if you have further questions,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Saving the Text using save_text FM

    Hi Abap gurus,
           i have to save the text in FB03 transaction.  i found the option called in the menu bar EXTRAS - > TEXTS. i have written the code as :
    *UPDATING THE DOCUMENT NUMBER
        l_header-tdobject = c_object.
        CONCATENATE s_bukrs w_output-belnr s_gjahr INTO l_name SEPARATED BY space.
        l_header-tdname   = l_name.
        l_header-tdid     = c_id.
        l_header-tdspras  = sy-langu.
        CONCATENATE 'GR NUMBER'
                    'GR ITEM NO'
                    'GR QTY'
                    'GR ASSIGN QTY'
                    'RUN DATE'
                    'LTL DATE'
                    INTO l_notes
                    SEPARATED BY space.
        ULINE.
        CONCATENATE w_output-mblnr
                    w_output-buzei
    *               w_output-gr_qty
    *               w_output-gr_assign_qty
                    sy-datum
                    t_ltldate
                    INTO l_notes
                    SEPARATED BY space.
        t_line_save-tdformat = '*'.
        t_line_save-tdline   = l_notes.
        APPEND t_line_save.
    *    CLEAR  t_line_save.
        CALL FUNCTION 'SAVE_TEXT'
          EXPORTING
           client                 = sy-mandt
            header                = l_header
    *   INSERT                = ' '
           savemode_direct        = 'X'
    *   OWNER_SPECIFIED       = ' '
    *   LOCAL_CAT             = ' '
    * IMPORTING
    *   FUNCTION              =
    *   NEWHEADER             =
          TABLES
            lines                 = t_line_save
         EXCEPTIONS
           id                    = 1
           language              = 2
           name                  = 3
           object                = 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.
        ENDIF.
      ENDLOOP.
    my requirement is that
    i have to save header as  GR NUMBER',   'GR ITEM NO' ,     'GR QTY',     'GR ASSIGN QTY' ,   'RUN DATE',        LTL DATE'
                                               10                     20                       30                      15                         02..3.2012          03..03.2012
                                               20                     40                       50                      13                         02..3.2012          03..03.2012 
    how to print the header ?   i am not able to geting using the concatenate statement.

    should be done like the below, shouldn't it?
    data: lv_Gr_qty type char15,
             lv_gr_assign_qty type char15,
             lv_today type char10,
            lv_ltldate type char10.
    CONCATENATE 'GR NUMBER'
                    'GR ITEM NO'
                    'GR QTY'
                    'GR ASSIGN QTY'
                    'RUN DATE'
                    'LTL DATE'
                    INTO t_line_save-tdline
                           SEPARATED by space.
        t_line_save-tdformat = '*'.
        APPEND t_line_save.
       loop at some table into w_output.
          lv_gr_qty = w_output-gr_qty." (put it into char 15 or so).
          lv_gr_assign_qty = w_output-gr_assign_qty. "conver to char field
         write: sy-datum to lv_today mm/dd/yyyy,  "put into correct format.
                    w_output-ltldate  to lv_ltldate mm/dd/yyyy.
        CONCATENATE w_output-mblnr
                                   w_output-buzei
                                   lv_gr_qty            
                                   lv_gr_assign_qty      
                                  lv_today               
                                  lv_ltldate  
                    INTO t_line_save-tdline
                       SEPARATED BY space.
        t_line_save-tdformat = '*'.
         APPEND t_line_save.
        CLEAR  t_line_save.
       endloop.
    then call your save_text.

Maybe you are looking for