Looking for function that send mail

I AM LOOKING FOR A FUNCTION THAT SEND MAIL
<b><b>WITH ATTACMENT ONLY</b> ANYONE KNOW????
THANKS.

REPORT ZMAILOUTPUT
    MESSAGE-ID ZZ.
*  CONSTANTS                                                           *
CONSTANTS : C_X(1)      TYPE C VALUE 'X',      " For constant value
            C_OTF(3)    TYPE C VALUE 'OTF',    " For format
            C_U(1)      TYPE C VALUE 'U'.      " Mail Option
*  VARIABLES                                                           *
DATA : V_RQIDENT  TYPE TSP01-RQIDENT,  " For Spool Number
       V_RQCLIENT TYPE TSP01-RQCLIENT, " For Client
       V_RQO1NAME TYPE TSP01-RQO1NAME, " For Object name
       V_SPOOL    TYPE TSP01-RQIDENT,  " For Spool Number
       V_SPOOL1   TYPE TSP01-RQIDENT.  " For Spool Number
*  FLAGS                                                               *
DATA : F_SPOOL TYPE C.
*   INTERNAL TABLES                                                    *
* Internal table for sending mails
DATA: IT_PDF          LIKE TLINE      OCCURS 10 WITH HEADER LINE,
      IT_XI_PDF       LIKE TLINE      OCCURS 0  WITH HEADER LINE,
      IT_HTML         LIKE SOLISTI1   OCCURS 0  WITH HEADER LINE,
      IT_XI_TEMP      LIKE BAPIQCMIME OCCURS 0  WITH HEADER LINE,
      IT_XI_MIME(255) TYPE C          OCCURS 0  WITH HEADER LINE.
* For sending mail
DATA: IT_OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
* Internal table for Single List with Column Length 255
DATA : IT_OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
* Internal table for Single List with Column Length 255
DATA : IT_OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
* Internal table for Structure of the API Recipient List
DATA : IT_RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
* Structure of the API Recipient List
DATA: X_DOC_CHNG LIKE SODOCCHGI1.
* Internal table for storing the variants
DATA : BEGIN OF IT_VARIANT1 OCCURS 0,
        VARIANT LIKE VARID-VARIANT,
       END   OF IT_VARIANT1.
* Internal table to store variants for the programs
DATA: IT_VARIANT2 LIKE IT_VARIANT1 OCCURS 0 WITH HEADER LINE.
* Internal table for storing the selected values
DATA IT_RETURN TYPE DDSHRETVAL OCCURS 0 WITH HEADER LINE.
* Internal table for storing the mail-ids
DATA : BEGIN OF IT_MAILID OCCURS 0,
        KOKRS LIKE CSKS-KOKRS,
        KOSTL LIKE CSKS-KOSTL,
        DATBI LIKE CSKS-DATBI,
        TELX1 LIKE CSKS-TELX1,
       END   OF IT_MAILID.
* Internal table for storing the mail-ids
DATA : IT_MAILID1 LIKE IT_MAILID OCCURS 0 WITH HEADER LINE.
*   SELECTION SCREEN                                                   *
DATA : V_CHAR TYPE CHAR50.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_EMAIL FOR V_CHAR  NO INTERVALS
                LOWER CASE
                NO-DISPLAY.
SELECT-OPTIONS: S_EMAIL1 FOR V_CHAR  NO INTERVALS
                LOWER CASE
                NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-028.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : P_C1 AS CHECKBOX.
SELECTION-SCREEN COMMENT 3(66) TEXT-026 FOR FIELD P_C1.
SELECTION-SCREEN END OF LINE.
PARAMETERS : P_SET LIKE TSP1D-PAPART MATCHCODE OBJECT ZH_TSP1D.
SELECTION-SCREEN SKIP 1.
PARAMETERS : P_VARA1 TYPE RS38M-SELSET.
SELECTION-SCREEN END OF BLOCK A1.
SELECTION-SCREEN BEGIN OF BLOCK A2 WITH FRAME TITLE TEXT-029.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : P_C2 AS CHECKBOX.
SELECTION-SCREEN COMMENT 3(56) TEXT-027 FOR FIELD P_C1.
SELECTION-SCREEN END OF LINE.
PARAMETERS : P_SET1 LIKE TSP1D-PAPART MATCHCODE OBJECT ZH_TSP1D.
SELECTION-SCREEN SKIP 1.
PARAMETERS : P_VARA2 TYPE RS38M-SELSET.
SELECTION-SCREEN END OF BLOCK A2.
* AT SELECTION SCREEN ON VALUE REQUEST
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARA1.
* For fetching the variants available for the program
  PERFORM FETCH_VARIANTS.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARA2.
* For fetching the variants available for the program
  PERFORM FETCH_VARIANTS1.
* AT SELECTION SCREEN
AT SELECTION-SCREEN.
* For Validation
  PERFORM VALIDATION.
*  START OF SELECTION                                                  *
START-OF-SELECTION.
* To get the output data and mail
  PERFORM FETCH_DATA.
*  END OF SELECTION                                                    *
END-OF-SELECTION.
  IF F_SPOOL = C_X.
    MESSAGE E000 WITH 'Spool Not Generated'(060).
  ENDIF.
*&      Form  fetch_data
*       To get the output data and mail
FORM FETCH_DATA .
* To send the output to spool
  PERFORM GENERATE_SPOOL.
ENDFORM.                    " fetch_data
*&      Form  generate_spool
*       To send the output to spool
FORM GENERATE_SPOOL .
  DATA: L_PARAMS LIKE PRI_PARAMS,
        L_DAYS(1)  TYPE N VALUE 2,
        L_COUNT(3) TYPE N VALUE 1,
        L_VALID    TYPE C,
        L_VALID1   TYPE C,
        L_PARAMS1  LIKE PRI_PARAMS.
  DATA: L_DEVICE TYPE USR01-SPLD.
*Get the printer name for the user
  SELECT SINGLE SPLD INTO L_DEVICE FROM USR01 WHERE BNAME = SY-UNAME.
  IF L_DEVICE IS INITIAL.
    L_DEVICE = 'LOCL'.
  ENDIF.
* For report-1
  IF P_C1 = 'X'.
* Setting the print parameters
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        DESTINATION    = L_DEVICE
        COPIES         = L_COUNT
        LIST_NAME      = SY-UNAME
        LIST_TEXT      = 'SUBMIT ... TO SAP-SPOOL'(008)
        RELEASE        = C_X
        NEW_LIST_ID    = C_X
        EXPIRATION     = L_DAYS
*        LINE_SIZE      = 255
*        LINE_COUNT     = 65
        LAYOUT         = p_set
        SAP_COVER_PAGE = SPACE
        COVER_PAGE     = SPACE
        RECEIVER       = 'SAP*'(010)
        DEPARTMENT     = 'System'(011)
        NO_DIALOG      = C_X
      IMPORTING
        OUT_PARAMETERS = L_PARAMS
        VALID          = L_VALID.
    IF L_VALID <> SPACE.
      CLEAR V_SPOOL.
* Fetch the spool number b4 submit
      PERFORM FETCH_RECENT_SPOOL USING V_SPOOL.
* Submitting the program to spool
      SUBMIT RKAEP000 TO SAP-SPOOL
        USING SELECTION-SET P_VARA1
        SPOOL PARAMETERS L_PARAMS
        WITHOUT SPOOL DYNPRO
        AND RETURN.
      CLEAR V_SPOOL1.
* Fetch the spool number after submit
      PERFORM FETCH_RECENT_SPOOL USING V_SPOOL1.
      IF V_SPOOL = V_SPOOL1.
        F_SPOOL = C_X.
        IF P_C2 IS INITIAL.
          STOP.
        ENDIF.
      ELSE.
* Checking the format ( ABAP/OTF)
        PERFORM FORMAT_CHECK TABLES S_EMAIL.
      ENDIF.
    ELSE.
      MESSAGE E000 WITH 'Problem in print settings'(003).
      STOP.
    ENDIF.
  ENDIF.
* For Report-2
  IF P_C2 = 'X'.
* Setting the print parameters
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        DESTINATION    = L_DEVICE
        COPIES         = L_COUNT
        LIST_NAME      = SY-UNAME
        LIST_TEXT      = 'SUBMIT ... TO SAP-SPOOL'(008)
        RELEASE        = C_X
        NEW_LIST_ID    = C_X
        EXPIRATION     = L_DAYS
*        LINE_SIZE      = 200
*        LINE_COUNT     = 65
        LAYOUT         = p_set1
        SAP_COVER_PAGE = SPACE
        COVER_PAGE     = SPACE
        RECEIVER       = 'SAP*'(010)
        DEPARTMENT     = 'System'(011)
        NO_DIALOG      = C_X
      IMPORTING
        OUT_PARAMETERS = L_PARAMS1
        VALID          = L_VALID1.
    IF L_VALID1 <> SPACE.
      CLEAR V_SPOOL.
* Fetch the spool number b4 submit
      PERFORM FETCH_RECENT_SPOOL USING V_SPOOL.
* Submitting the program to spool
      SUBMIT GP3DIEHXY88SNFJ0391V7KF9EK7050 TO SAP-SPOOL
        USING SELECTION-SET P_VARA2
        SPOOL PARAMETERS L_PARAMS1
        WITHOUT SPOOL DYNPRO
        AND RETURN.
      CLEAR V_SPOOL1.
* Fetch the spool number after submit
      PERFORM FETCH_RECENT_SPOOL USING V_SPOOL1.
      IF V_SPOOL = V_SPOOL1.
        MESSAGE E000 WITH 'Spool Not Generated'(060).
        STOP.
      ENDIF.
* Checking the format ( ABAP/OTF)
      PERFORM FORMAT_CHECK TABLES S_EMAIL1.
    ELSE.
      MESSAGE E000 WITH 'Problem in print settings'(003).
      STOP.
    ENDIF.
  ENDIF.
ENDFORM.                    " generate_spool
*&      Form  fetch_recent_spool
*       Fetch the recent spool number generated
FORM FETCH_RECENT_SPOOL USING P_V_SPOOL TYPE TSP01-RQIDENT .
  DATA:  L_USER LIKE TSP01-RQ2NAME.
  CLEAR : V_RQIDENT,
          V_RQCLIENT,
          V_RQO1NAME.
  L_USER = SY-UNAME.
* Get latest Spool No
  SELECT SINGLE RQIDENT
                RQCLIENT
                RQO1NAME
         INTO (V_RQIDENT , V_RQCLIENT , V_RQO1NAME)
    FROM TSP01
   WHERE RQCRETIME =   ( SELECT MAX( RQCRETIME )
                                FROM TSP01
                               WHERE RQ2NAME EQ L_USER
                                 AND RQFINAL EQ '.' ).
  IF SY-SUBRC = 0 .
    P_V_SPOOL = V_RQIDENT.
  ENDIF.
ENDFORM.                    " fetch_recent_spool
*&      Form  format_check
*       Checking the format ( ABAP/OTF)
FORM FORMAT_CHECK TABLES P_S_EMAIL STRUCTURE S_EMAIL.
  DATA : L_OBJTYPE    LIKE RSTSTYPE-TYPE.
  CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
    EXPORTING
      AUTHORITY     = 'SP01'(019)
      CLIENT        = V_RQCLIENT
      NAME          = V_RQO1NAME
      PART          = 1
    IMPORTING
      OBJTYPE       = L_OBJTYPE
    EXCEPTIONS
      FB_ERROR      = 1
      FB_RSTS_OTHER = 2
      NO_OBJECT     = 3
      NO_PERMISSION = 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.
  IF L_OBJTYPE(3) = C_OTF.
* Convert OTF Spool to PDF
    PERFORM CONVERT_OTF2PDF TABLES P_S_EMAIL.
  ELSE.
* Convert ABAP Spool to PDF
    PERFORM CONVERT_ABAP2PDF TABLES P_S_EMAIL.
  ENDIF.
ENDFORM.                    " format_check
*&      Form  convert_otf2pdf
*       Convert OTF Spool to PDF
FORM CONVERT_OTF2PDF TABLES P_P_S_EMAIL STRUCTURE S_EMAIL .
  CLEAR   IT_PDF.
  REFRESH IT_PDF.
  DATA : L_BYTECOUNT  TYPE I.
* Fn. to get the PDF format
  CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
      SRC_SPOOLID              = V_RQIDENT
      NO_DIALOG                = 'X'
    IMPORTING
      PDF_BYTECOUNT            = L_BYTECOUNT
    TABLES
      PDF                      = IT_PDF
    EXCEPTIONS
      ERR_NO_OTF_SPOOLJOB      = 1
      ERR_NO_SPOOLJOB          = 2
      ERR_NO_PERMISSION        = 3
      ERR_CONV_NOT_POSSIBLE    = 4
      ERR_BAD_DSTDEVICE        = 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.
  IF SY-SUBRC = 0.
* For page format
    PERFORM PAGE_FORMAT TABLES P_P_S_EMAIL.
  ELSE.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " convert_otf2pdf
*&      Form  convert_abap2pdf
*        Convert ABAP Spool to PDF
FORM CONVERT_ABAP2PDF TABLES P_P_S_EMAIL STRUCTURE S_EMAIL.
  CLEAR   IT_PDF.
  REFRESH IT_PDF.
  DATA : L_BYTECOUNT  TYPE I.
* Fn. to convert to PDF format
  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    EXPORTING
      SRC_SPOOLID              = V_RQIDENT
      NO_DIALOG                = 'X'
    IMPORTING
      PDF_BYTECOUNT            = L_BYTECOUNT
    TABLES
      PDF                      = IT_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.
  IF SY-SUBRC = 0.
* For page formatting
    PERFORM PAGE_FORMAT TABLES P_P_S_EMAIL.
  ELSE.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " convert_abap2pdf
*&      Form  send_mail
*       For sending mail
FORM SEND_MAIL TABLES MAIL STRUCTURE S_EMAIL .
* Structures and internal tables for the send data
  DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2  WITH HEADER LINE,
        OBJHEAD LIKE SOLISTI1   OCCURS 1  WITH HEADER LINE,
        OBJBIN  LIKE SOLISTI1   OCCURS 0  WITH HEADER LINE,
        OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
        RECLIST LIKE SOMLRECI1  OCCURS 5  WITH HEADER LINE.
  DATA: DOC_CHNG LIKE SODOCCHGI1,
        TAB_LINES LIKE SY-TABIX.
* Data for the status output after sending
  DATA: SENT_TO_ALL LIKE SONV-FLAG.
  CLEAR: IT_RECLIST, IT_RECLIST[],
         IT_OBJTXT , IT_OBJTXT[],
         IT_OBJPACK, IT_OBJPACK[],
         IT_OBJBIN , IT_OBJBIN[],X_DOC_CHNG.
  LOOP AT IT_HTML.
    OBJBIN-LINE = IT_HTML-LINE.
    APPEND OBJBIN.
    CLEAR OBJBIN.
  ENDLOOP.
* Create the document which is to be sent
  DOC_CHNG-OBJ_NAME  = 'List'(012).
  DOC_CHNG-OBJ_DESCR = 'Mail'(013).
* Heading
  OBJTXT-LINE = 'Mail with pdf attachment'(014).
  APPEND OBJTXT.
  CLEAR OBJTXT.
* Size
  DESCRIBE TABLE OBJTXT LINES TAB_LINES.
  READ TABLE OBJTXT INDEX TAB_LINES.
  DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
* Fill the fields of the packing_list for the main document:
  CLEAR OBJPACK-TRANSF_BIN.
* The document needs no header (head_num = 0)
  OBJPACK-HEAD_START = 1.
  OBJPACK-HEAD_NUM = 0.
* Body
  OBJPACK-BODY_START = 1.
  OBJPACK-BODY_NUM = TAB_LINES.
  OBJPACK-DOC_TYPE = 'RAW'(015).
  APPEND OBJPACK.
* Create the attachment (the list itself)
  DESCRIBE TABLE OBJBIN LINES TAB_LINES.
* Fill the fields of the packing_list for the attachment:
  OBJPACK-TRANSF_BIN = 'X'.
* Header
  OBJPACK-HEAD_START = 1.
  OBJPACK-HEAD_NUM = 0.
* Body
  OBJPACK-BODY_START = 1.
  OBJPACK-BODY_NUM = TAB_LINES.
  OBJPACK-DOC_TYPE = 'PDF'(016).
  OBJPACK-OBJ_NAME = 'Attachment'(017).
  OBJPACK-OBJ_DESCR = 'Mail with pdf Attachment'(018).
  OBJPACK-DOC_SIZE = TAB_LINES * 255.
  APPEND OBJPACK.
*-Fill the mail recipient list
  LOOP AT MAIL.
    RECLIST-RECEIVER = MAIL-LOW.
    RECLIST-REC_TYPE = C_U.
    APPEND RECLIST.
    CLEAR: RECLIST,
           MAIL.
  ENDLOOP.
*-Send the document by calling the SAPoffice API1 module for sending
*-documents with attachments
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      DOCUMENT_DATA              = DOC_CHNG
      PUT_IN_OUTBOX              = C_X
      COMMIT_WORK                = C_X
    IMPORTING
      SENT_TO_ALL                = SENT_TO_ALL
    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.
  CASE SY-SUBRC .
    WHEN 0.
      MESSAGE I000 WITH 'Mail has been sent successfully'(006).
    WHEN OTHERS.
      MESSAGE E000 WITH 'Problem in sending the mail'(023).
  ENDCASE.
ENDFORM.                    " send_mail
*&      Form  page_format
*        For page foramtting
FORM PAGE_FORMAT TABLES EMAIL STRUCTURE S_EMAIL .
  DATA : L_LINES       TYPE I,
         L_TEMP(500)   TYPE C,
         L_OFFSET      TYPE P,
         L_LINESLEN(2) TYPE P,
         L_MIMELEN(2)  TYPE P,
         L_TABIX       LIKE SY-TABIX.
  CLEAR : IT_XI_PDF,
          IT_XI_TEMP.
  REFRESH : IT_XI_PDF,
            IT_XI_TEMP.
  IT_XI_PDF[] = IT_PDF[].
* Reformat the line to 255 characters wide (--code from SAP--)
  CLEAR: L_TEMP, L_OFFSET, IT_XI_TEMP.
  DESCRIBE TABLE IT_XI_PDF   LINES  L_LINES.
  DESCRIBE FIELD IT_XI_PDF   LENGTH L_LINESLEN IN CHARACTER MODE.
  DESCRIBE FIELD IT_XI_TEMP  LENGTH L_MIMELEN IN CHARACTER MODE.
  LOOP AT IT_XI_PDF.
    L_TABIX = SY-TABIX.
    MOVE IT_XI_PDF TO L_TEMP+L_OFFSET.
    IF L_TABIX = L_LINES.
      L_LINESLEN = STRLEN( IT_XI_PDF ).
    ENDIF.
    L_OFFSET = L_OFFSET + L_LINESLEN.
    IF L_OFFSET GE L_MIMELEN.
      CLEAR IT_XI_TEMP.
      IT_XI_TEMP = L_TEMP(L_MIMELEN).
      APPEND IT_XI_TEMP.
      SHIFT L_TEMP BY L_MIMELEN PLACES.
      L_OFFSET = L_OFFSET - L_MIMELEN.
    ENDIF.
    IF L_TABIX = L_LINES.
      IF L_OFFSET GT 0.
        CLEAR IT_XI_TEMP.
        IT_XI_TEMP = L_TEMP(L_OFFSET).
        APPEND IT_XI_TEMP.
      ENDIF.
    ENDIF.
  ENDLOOP.
  CLEAR : IT_XI_MIME,
          IT_XI_MIME[].
  LOOP AT IT_XI_TEMP.
    IT_XI_MIME(255) = IT_XI_TEMP-LINE.
    APPEND IT_XI_MIME.
    CLEAR  IT_XI_MIME.
  ENDLOOP.
* Final Data
  CLEAR : IT_HTML,
          IT_HTML[].
  IT_HTML[] = IT_XI_MIME[].
* For sending mail
  PERFORM SEND_MAIL TABLES EMAIL.
ENDFORM.                    " page_format
*&      Form  fetch_variants
*       For fetching the variants available for the program
FORM FETCH_VARIANTS .
  DATA : L_PROGRAM LIKE RS38M-PROGRAMM VALUE 'RKAEP000',
         L_VARA1 TYPE DFIES-FIELDNAME VALUE 'P_VARA1'.
  CLEAR : IT_VARIANT1,
          IT_VARIANT1[].
* Get variants
  PERFORM GET_VARIANTS TABLES IT_VARIANT1
                       USING L_PROGRAM.
* F4 Help
  IF NOT IT_VARIANT1[] IS INITIAL.
    PERFORM GET_F4_HELP TABLES IT_VARIANT1
                         USING L_VARA1
                        CHANGING P_VARA1.
  ELSE.
    MESSAGE E000 WITH 'No variants available for report1'(054).
  ENDIF.
ENDFORM.                    " fetch_variants
*&      Form  validation
*       For Validation
FORM VALIDATION .
  DATA : L_PRO1 LIKE RS38M-PROGRAMM VALUE 'RKAEP000',
         L_PRO2 LIKE RS38M-PROGRAMM VALUE 'GP3DIEHXY88SNFJ0391V7KF9EK7050',
         L_C1,
         L_C2.
* If both check-box are unchecked
  IF P_C1 IS INITIAL
AND P_C2 IS INITIAL.
    MESSAGE E000 WITH 'Check any one check-box'(049).
  ENDIF.
* If checked without varaint
  IF NOT P_C1 IS INITIAL AND P_VARA1 IS INITIAL.
    MESSAGE E000 WITH 'Please give any one of the variant for report1'(055).
  ENDIF.
* If checked without varaint
  IF NOT P_C2 IS INITIAL AND P_VARA2 IS INITIAL.
    MESSAGE E000 WITH 'Please give any one of the variant for report2'(061).
  ENDIF.
* Reading the variant and fetching the mail-ids
  IF P_C1 = C_X.
    L_C1 = '1'.
    CLEAR : S_EMAIL,
            S_EMAIL[].
    PERFORM READ_VARIANTS TABLES IT_MAILID
                                 S_EMAIL
                           USING P_VARA1
                                 L_PRO1
                                 L_C1.
    IF S_EMAIL[] IS INITIAL.
      MESSAGE E000 WITH 'No Id available for given Cost report1'(066).
    ELSE.
      SORT S_EMAIL BY LOW.
      DELETE ADJACENT DUPLICATES FROM S_EMAIL COMPARING LOW.
    ENDIF.
  ENDIF.
* Reading the variant and fetching the mail-ids
  IF P_C2 = C_X.
    CLEAR : S_EMAIL1,
            S_EMAIL1[].
    L_C2 = '2'.
    PERFORM READ_VARIANTS TABLES IT_MAILID1
                                 S_EMAIL1
                           USING P_VARA2
                                 L_PRO2
                                 L_C2.
    IF S_EMAIL1[] IS INITIAL.
      MESSAGE E000 WITH 'No Id available for given Cost report2'(067).
    ELSE.
      SORT S_EMAIL1 BY LOW.
      DELETE ADJACENT DUPLICATES FROM S_EMAIL1 COMPARING LOW.
    ENDIF.
  ENDIF.
ENDFORM.                    " validation
*&      Form  GET_VARIANTS
*       Fetching Variants
FORM GET_VARIANTS  TABLES   P_IT_VARIANT STRUCTURE IT_VARIANT1
                   USING    P_V_PROGRAM  TYPE RS38M-PROGRAMM.
  SELECT VARIANT
         FROM VARID
         INTO TABLE P_IT_VARIANT
         WHERE REPORT = P_V_PROGRAM.
ENDFORM.                    " GET_VARIANTS
*&      Form  GET_F4_HELP
*       text
FORM GET_F4_HELP  TABLES   P_IT_VARIANT1 STRUCTURE IT_VARIANT1
                   USING   P_L_VARA1 LIKE DFIES-FIELDNAME
                  CHANGING P_P_VARA LIKE P_VARA1.
* Fn. for Pop-Up
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      RETFIELD        = P_L_VARA1
      VALUE_ORG       = 'S'
      DISPLAY         = ' '
    TABLES
      VALUE_TAB       = P_IT_VARIANT1
      RETURN_TAB      = IT_RETURN
    EXCEPTIONS
      PARAMETER_ERROR = 1
      NO_VALUES_FOUND = 2
      OTHERS          = 3.
  IF SY-SUBRC = 0.
    P_P_VARA = IT_RETURN-FIELDVAL.
  ELSE.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " GET_F4_HELP
*&      Form  FETCH_VARIANTS1
*       text
FORM FETCH_VARIANTS1 .
  DATA : V_PROGRAM1 LIKE RS38M-PROGRAMM VALUE 'GP3DIEHXY88SNFJ0391V7KF9EK7050',
         L_VARA2  TYPE DFIES-FIELDNAME VALUE 'P_VARA2'.
  CLEAR : IT_VARIANT2,
          IT_VARIANT2[].
* Get Variants
  PERFORM GET_VARIANTS TABLES IT_VARIANT2
                       USING V_PROGRAM1.
* F4 Help
  IF NOT IT_VARIANT2[] IS INITIAL.
    PERFORM GET_F4_HELP TABLES IT_VARIANT2
                        USING  L_VARA2
                      CHANGING P_VARA2.
  ELSE.
    MESSAGE E000 WITH 'No variants available for report2'(050).
  ENDIF.
ENDFORM.                    " FETCH_VARIANTS1
*&      Form  read_variants
*        Reading the variant and fetching the mail-ids
FORM READ_VARIANTS TABLES P_IT_MAILID STRUCTURE IT_MAILID
                          P_S_EMAIL   STRUCTURE S_EMAIL
                   USING  P_P_VARA1   LIKE P_VARA1
                          P_L_PRO1    LIKE RS38M-PROGRAMM
                          P_L_C1      TYPE C.
  DATA : L_TEMP(44),
         IT_VALUTAB LIKE RSPARAMS OCCURS 0 WITH HEADER LINE.
  RANGES : R_COCEN FOR CSKS-KOSTL.
* Function Module to get the variant contents
  CALL FUNCTION 'RS_VARIANT_CONTENTS'
    EXPORTING
      REPORT               = P_L_PRO1
      VARIANT              = P_P_VARA1
    TABLES
      VALUTAB              = IT_VALUTAB
    EXCEPTIONS
      VARIANT_NON_EXISTENT = 1
      VARIANT_OBSOLETE     = 2
      OTHERS               = 3.
  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 : R_COCEN,
          R_COCEN[].
  LOOP AT IT_VALUTAB WHERE SELNAME = 'KOSTL'
                        OR SELNAME = '_C-CCTR'.
* Getting the range of cost centers
    IF IT_VALUTAB-OPTION = 'BT'.
      R_COCEN-LOW    = IT_VALUTAB-LOW.
* For Conversion Routine
      PERFORM CONVERSION USING R_COCEN-LOW.
      R_COCEN-HIGH   = IT_VALUTAB-HIGH.
* For Conversion Routine
      PERFORM CONVERSION USING R_COCEN-HIGH.
      R_COCEN-OPTION = 'BT'.
      R_COCEN-SIGN   = 'I'.
      APPEND R_COCEN.
      CLEAR  R_COCEN.
    ENDIF.
* Getting the single cost centers
    IF IT_VALUTAB-OPTION = 'EQ'.
      R_COCEN-LOW    = IT_VALUTAB-LOW.
* For Conversion Routine
      PERFORM CONVERSION USING R_COCEN-LOW.
      R_COCEN-OPTION = 'EQ'.
      R_COCEN-SIGN   = 'I'.
      APPEND R_COCEN.
      CLEAR  R_COCEN.
    ENDIF.
  ENDLOOP.
* If no cost centers
  IF NOT R_COCEN[] IS INITIAL.
    SELECT KOKRS
           KOSTL
           DATBI
           TELX1
      FROM CSKS
           INTO TABLE P_IT_MAILID
     WHERE KOSTL IN R_COCEN.
    IF P_IT_MAILID[] IS INITIAL.
      IF P_L_C1 = '1'.
        MESSAGE E000 WITH 'No IDs available for report1'(059).
      ELSEIF P_L_C1 = '2'.
        MESSAGE E000 WITH 'No IDs available for report2'(062).
      ENDIF.
    ENDIF.
* Deleting the blank entries
    DELETE P_IT_MAILID WHERE TELX1 = SPACE.
    CLEAR L_TEMP.
    READ TABLE P_IT_MAILID INDEX 1.
    L_TEMP = P_IT_MAILID-TELX1.
    DATA : L_CHECK.
    LOOP AT P_IT_MAILID WHERE TELX1 <> L_TEMP.
      L_CHECK = C_X.
    ENDLOOP.
* For checking the unique ids
    IF L_CHECK = C_X.
      IF P_L_C1 = '1'.
        MESSAGE E000 WITH 'No unique mail-ids for  report1'(058).
      ELSEIF P_L_C1 = '2'.
        MESSAGE E000 WITH 'No unique mail-ids for  report2'(065).
      ENDIF.
    ENDIF.
* Populating the IDs for the cost centers
    LOOP AT P_IT_MAILID.
      SET LOCALE LANGUAGE SY-LANGU.
      TRANSLATE P_IT_MAILID-TELX1 TO LOWER CASE.
      SET LOCALE LANGUAGE SPACE .
      CONCATENATE P_IT_MAILID-TELX1 '@allergan.com' INTO L_TEMP.
      P_S_EMAIL-LOW = L_TEMP.
      P_S_EMAIL-SIGN = 'I'.
      P_S_EMAIL-OPTION = 'EQ'.
      APPEND P_S_EMAIL.
      CLEAR  P_S_EMAIL.
    ENDLOOP.
  ELSE.
    IF P_L_C1 = '1'.
      MESSAGE E000 WITH 'No Cost Center Available for report1'(057).
    ELSEIF P_L_C1 = '2'.
      MESSAGE E000 WITH 'No Cost Center Available for report2'(063).
    ENDIF.
  ENDIF.
ENDFORM.                    " read_variants
*&      Form  CONVERSION
*       For Conversion Routine
FORM CONVERSION  USING    P_IT_VALUTAB_LOW TYPE C.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      INPUT  = P_IT_VALUTAB_LOW
    IMPORTING
      OUTPUT = P_IT_VALUTAB_LOW.
ENDFORM.                    " CONVERSION
check this Program......

Similar Messages

  • Procedure or Function that send E-mail with image background and file attached

    hi
    I4d like know if someone there is a procedure or function that send E-mail with image background and file attached, for me.
    thanks
    Josi Vieira

    If you go to this part of OTN you will find the official Oracle UTL_SMTP demo, which includes attachments:
    http://technet.oracle.com/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    Getting a background is slightly trickier. The UTL_SMTP package is for primarily sending text e-mails, whereas images require HTML e-mail. I suggest you look at the structure of a sample HTML e-mail and see if you can write the necessary HTML strings in the DATA parameter. Otherwise you'll need to investigate handcrafting a program based on the UTL_TCP package.
    [rant]
    If this seems like a lot of trouble I agree and urge you not to bother. HTML e-mail is one of the curses of the modern age, not least because it is frequently used by purveyors of viruses. I have a filter on my Outlook client that strips out all the HTML in any e-mail I receive, which means I get lots of e-mails rendered unreadable by the inclusion of <HTML> tags. But who cares, they're mostly spam anyway. In fact, the use of HTML in an e-mail is almost always an indicator of the irrelevance of its content.
    [rant]
    Vibes, APC

  • Looking for app that will allow me to control my iphone from my desktop

    Looking for app that will allow me to control my iphone from my desktop.  I would like to be able to send text messages, etc from my computer instead of using my iphone.  I don't want to jailbreak my phone.  Does anyone know of app like this?
    Thank you,
    Scott

    Windows or Mac?  You can at least send iMessages from a Mac with Mountain Lion installed.
    There are apps that let you do the reverse (control the computer from the phone).  I don't know of any that let you go the other way.  It would be kind of cool if we could do this though.  But, I suppose it could open up a Pandora's box of security problems for the phone itself.  Just imagine somebody hacking into your phone remotely and using it without your permission....

  • Looking for Function module through which I can get Logged comments

    Hi,
    I am new to CRM.
    On an activity task we have 'Logged comments' section. I am looking for FM that I could use to import 'Logged comments' for an activity task.
    I guess that I can use CRM_ORDER_READ. I was trying to find some documentation but did not find anything. I am not sure which object I should export.
    Could anyone help me?
    Many thanks,
    Jan

    If you are refering to text called logged comments then use function module READ_TEXT.
    Regard.

  • Looking for function module to update User data

    Hi All,
    I'm looking for function module/base table to update data into User (User-Specific Data) data. You can notice it under PRTE t.code. Thank you.
    Regards
    Kishore

    To Read: HRTRV_IF_GET_TRIP
    To Modify: HRTRV_IF_MODIFY_TRIP
    Please be aware that these FMs are not released for customers, i.e. you won't get any support for them.
    EDIT: Since you are dealing with Structure USER/PTK99, maybe the document I created is of interest to you: Adding fields in Travel WDA Applications
    Cheers, Lukas
    Message was edited by: Lukas Weigelt

  • Looking for app that can connect iPhone / Ipad to generic bluetooth camera

    looking for app that can connect iPhone / Ipad to generic bluetooth camera

    I doubt that you will find one. I have not heard of BT cameras.

  • Looking fora camcorder that also has an s-video or rca jack input to convert my vhs tapes to digital

    looking fora camcorder that also has an s-video or rca jack input to convert my vhs tapes to digital.

    Hi ltcps,
    Thanks for writing us!
    None of Canon's current camcorders include S-Videos, RCA or other auxiliary inputs.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • Looking for table that links a PM Reservation to a MM Purchase Requisition

    Looking for table that links a PM Reservation to a MM Purchase Requisition

    Hi,
        Typically the way most SAP systems are configured, there are two scenarios here:
    1. The component reserved in the PM order is item category 'N'. This is a non inventory item and must be directly procured for consumption against the PM order at the point of goods receipt. In this case no reservation is created and instead a requisition is directly created (in table EBAN) and the requisition is account assigned directly to the PM order (in table EBKN - field AUFNR).
    2. The component reserved in the PM order is item category 'L'. In this case no requisition is directly created, instead a reservation is created against the item in stock (in table RESB). If there is sufficient stock of the item already then the item is consumed when it is goods issued to the PM order from stock using MIGO and there is no requisition created. In the event that there is not sufficient stock of the item for the reservations that exist, when MRP is run, a requisition will be created to replenish the stock, but this requisition will not be assigned to a specific PM order as it could be replenishing stock of the item for several reservations which are all for different orders. So in this scenario there is no direct link from the reservation generated by the PM order to the requisition.

  • Does anyone make a water-tight, fully submergible, case for iPod Touches?  I am looking for one that could be taken into a pool or ocean, so that you could take underwater pictures.  Thank you!

    Does anyone know if anyone makes a waterproof, fully submergible case for iPod Touches, 4th Generation? I am looking for one that can be taken into a pool or ocean, where I would be able to take underwater pictures or videos. I've tried numerous web sites, including "Otter Box", but have been unable to find one for the iPod Touch.  I believe there might be one out for iPhones, but can't find one for an iPod Touch. Thank you for any help.

    I found this review...
    http://travel.spotcoolstuff.com/ipod-itouch-nano-accessories/best-waterproof-cas e
    Unfortunately, it sappears that the cameras are covered by the cases. I'm look too as I'm starting SCUBA lessons.

  • Looking for something that converts various file formtats to TIFF

    Hi everyone,
    I am currently working on a project where I am expected to convert numerous files of various formats into 1 multipage pdf and 1 multipage tiff.
    I've been messing around a lot with iText (which i liked a lot because of how it was free) and I see how it can very nicely convert a multipage TIFF to a multipage PDF.
    Hence, I am looking for something that can convert files of various formats (i.e. doc, txt, jpg, pdf) to a multipage tiff.
    Thank you very much.

    Uh-huh. So what on earth would possess you to ask that question on a forum devoted to Java sound?
    I hope that a mod. might notice this thread and move it to a more appropriate forum.
    And since I am here, the Java forum for TIFFs would be JAI. Try looking through some threads there, for tips.
    Edited by: AndrewThompson64 on Jan 8, 2009 3:30 PM

  • Has anyone found any glow-in-the-dark earbuds (with mic) for the iPhone?   I'm looking for some that glow or light up so they can be seen when I walk in the dark.

    Has anyone found any glow-in-the-dark earbuds (with mic) for the iPhone?   I'm looking for some that glow or light up so they can be seen when I walk in the dark.

    In a roaming network, your "main" router is the device that would require port mapping/forwarding to be configured in order to access the IP camera from the Internet. This router is also the one that would be provide the private IP address for the camera which you will want to be a static one.
    So as you described your network, the IP cameras should be getting an IP address or you assigned it a static one and this is the address that you would enter in the Private IP address (or equivalent depending on the router used) field when setting up port mapping.
    If you are not able to access this camera from the local network, then this should be troubleshot first.

  • Can I use a 60watt t adapter with my 2011 mac book pro 13"?  I have the L adapter now, but looking for replacement that will last!

    Can I use a 60watt t adapter with my 2011 mac book pro 13"?  I have the L adapter now, but looking for replacement that will last!

    Yes, a 13" non-Air model requires a minimum of 60 watts, so you will be fine. If it is a 2011 or earlier model, the connector is the regular MagSafe, whereas this year's models use the MagSafe 2 that is different.

  • Looking for software that allows CMS integration with InDesign.

    Looking for catalog production people who have already found a solution to this problem.
    We have a content management system that serves as our data warehouse for our catalog and product information. This data includes information from Marketing, Accounting, and Engineering and is used with our on line catalog and data extracts for customers. Our goal is to extend the use of this system to include an interface to the printed catalog process.
    Immediate goal would be to provide keyed access by product key into InDesign for pricing and technical specifications. Design staff needs to have keyed access to additional catalog information used in the catalog sections, headings, and product descriptions including bullets and paragraph information.
    We are looking for software that can act as a "bridge" between InDesign and our CMS. We need a software company that can provide training and support for the InDesign users and documentation allowing IT to support new processes including the possible use of apple scripting and automator scripts.
    Our IT staff has the database skills to manage and change the CMS database as needed by this project including custom tables and views. Our CMS is available using a MySql server running on Lunix. This is a dynamic copy of our primary CMS from a DB2/400 server.
    We have looked at a variety of software packages, but I have found you learn so much more when you actually USE the software. I would like to avoid any more expensive dead ends.
    Thanks for any input.

    You may possibly find something here:
    http://www.oneonlinegames.com/who-wants-to-be-a-millionaire-games
    but in any case beware of copyright.

  • Looking for function modules

    Hello All,
    I m looking for function modules for the following functionalities :
    1. Returns a list of purchase orders.
    2. Returns a list of vendors of a metarial/materialgroup.
    3. Getting details of a vendor evaluations
    Thanks all
    Moderator message: duplicate post locked.
    Edited by: Thomas Zloch on Nov 3, 2011 9:50 PM

    Hi,
    for CALL FUNCTION 'GET_FIELDTAB' 
    Replacement suggested is :
    DDIF_NAMETAB_GET or CACS_GET_TABLE_FIELDS or CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME 
    for NAMETAB_GET'  
    Replacement suggested is :
    'DDIF_NAMETAB_GET' 
    for more info
    https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action&pageid=68191235
    hope it helps you.
    Thanks!

  • Looking for ringtone that sounds like a landline p...

    Hi,
    I'm looking for ringtone that sounds like a landline phone, in other words no music, movie sounds, etc., just a good quality tone that sounds like a conventional (old fashioned even) telephone ring. Any ideas what site I can get one from?
    Many thanks, etc.
    PS. Handset is a Nokia 6300.

    Have a look at the ones I posted here they are a more traditional kind of ring rather than old fashioned ones though.
    http://www.fonefunshop.co.uk/forum/showthread.php?p=178318#post178318
    HTH.

Maybe you are looking for

  • Itunes wont install on windows7

    After downloading the latest itunes update, I can't install on my Windows Ver 7 laptop.   After re-booting, I received an error message that MSVCR80.dll is missing.I've already removed itunes and downloaded a fresh copy from apple site and tried to r

  • Xml and oracle 8i (geom)

    I try to excute the program called SampleSDOtoXML; wich exist in sdoapi_samples.zip and ;this program has for role to generate XML file from geom in oracle spatial 8i (sdo_geometry),and i include the directory for SampleSDOtoXML.class in my JAVA Clas

  • Big problem with police, Skype team, please read t...

    Hello everyone, hello Skype team. I want to tell short story what happened and I really hope you could help me. One day I was buying cellphone from a guy who I met in Skype. The phone, which I bought from him, was stolen, and now, after ~3-4 month, p

  • Set User Authentication at Particular UDF or Standard SAP Field?

    Hi Experts, I learn that we can set authorization at UDT by using Additional Authorization Creator. Is there any method we can set authorization at particular UDF or Standard SAP Field? For example: my customer just want to make one field in Business

  • Enable responses from 2 internet gateways on the same system

    Hello I tried this question in the Tiger Networking forum but didn't get a response so I'm giving it a shot here. I am hoping one of the network gurus here can help me out. I've spent quite a few hours trawling these forums and others online to try t