How to send ALV list report as html attachment in a mail??

Hi all,
I have an ALV report which I want to send as an HTML attachment in a mail to an external id. I know that spool can be converted to HTML attachment in a mail. But I don't want to have 2 programs - one for generating ALV and the other to send mail with the spool-converted of the first report as attachment. I want to send the mail in the same program itself. Is it possible? Helpful answers will be suitably rewarded.

Hi Sandip,
In your ALV program after the alv output is build in the program do the following steps.
1). Export the list to memory
2). Import the list from mempry
3). Do a COmpress of the data
4). Send an email as an attachment using the normal FM.
Take a look at the following links which will explain how to do the above steps.
http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
remember to change the doc type as 'HTM' in the FM to send email.
Cheers
VJ

Similar Messages

  • How to send ALV Grid report to Email?

    hai all,
    How to send ALV Grid report to Email.
    please its very urgent.....

    Hi,
    when u run the Alv, u will button 'Mail Recepiant' in tool bar.When u click it and enter to new screen, go to the Recipient Tab(down) enter ur maild id and click 'Send' button on tool bar.
    or.
    if u want to send the Alv content to mail id thru prg, go thru the following code.
                              TABLES
    TABLES: BSID. " Accounting: Secondary Index for Customers.
                              TYPE-POOLS
    TYPE-POOLS: SLIS.
                              INTERNAL TABLES
        Internal table to hold Customer data.
    DATA: BEGIN OF TB_BSID OCCURS 0,
            BUKRS   LIKE BSID-BUKRS,    " Company code
            KUNNR   LIKE BSID-KUNNR,    " Customer number
            AUGDT   LIKE BSID-AUGDT,    " Clearing Date
            BLDAT   LIKE BSID-BLDAT,    " Doc date in document
            SHKZG   LIKE BSID-SHKZG,    " Debit/credit indicator
            DMBTR   LIKE BSID-DMBTR,    " Amount in local currency
            ZFBDT   LIKE BSID-ZFBDT,    " Baseline date for due date calc
            ZBD1T   LIKE BSID-ZBD1T,    " Cash discount days 1
            ZBD2T   LIKE BSID-ZBD2T,    " Cash discount days 2
            ZBD3T   LIKE BSID-ZBD3T,    " Net Payment Terms Period
            REBZG   LIKE BSID-REBZG,    " No Of the Inv the Tran Belongs to
            REBZT   LIKE BSID-REBZT,    " Follow-On Document Type
          END OF TB_BSID.
        Internal table to hold Open Items.
    DATA: TB_BSID_OPEN LIKE TABLE OF TB_BSID WITH HEADER LINE.
        Internal table to hold Cleared Items.
    DATA: TB_BSAD_CLEAR LIKE TABLE OF TB_BSID WITH HEADER LINE.
        Internal table to hold General Data in Customer Master
    DATA: BEGIN OF TB_KNA1 OCCURS 0,
            KUNNR LIKE KNA1-KUNNR,      " Customer Number
            NAME1 LIKE KNA1-NAME1,      " Name Line 1
            TELF1 LIKE KNA1-TELF1,      " Telephone Number
            ADRNR LIKE KNA1-ADRNR,      " Address
          END OF TB_KNA1.
        Internal table to hold Customer Master (Company Code)
    DATA: BEGIN OF TB_KNB1 OCCURS 0,
            KUNNR LIKE KNB1-KUNNR,     " Customer Number
            BUKRS LIKE KNB1-BUKRS,     " Company code
            ERDAT LIKE KNB1-ERDAT,     " Rec Created Date
            ZAMIB LIKE KNB1-ZAMIB,     " DMS Managed Indicator
          END OF TB_KNB1.
        Internal table to hold Final Output Data
    DATA: BEGIN OF TB_FINAL OCCURS 0,
            KUNNR           LIKE KNA1-KUNNR, " Customer Number
            NAME1           LIKE KNA1-NAME1, " Name Line 1
            ADDRESS1(25)    TYPE C,          " Address line 1
            ADDRESS2(25)    TYPE C,          " Address line 2
            ADDRESS3(25)    TYPE C,          " Address line 3
            ADDRESS4(25)    TYPE C,          " Address line 4
            PHONE           LIKE KNA1-TELF1, " Telephone Number
            DAYS_SLOW(3)    TYPE C,          " Days Slow
            LAST_DATE(8)    TYPE C,          " Date of Last Invoice
            AVG(4)          TYPE C,          " Average Days to Pay
            CURRENT(10)     TYPE N,          " Current
            AVG_1_30(10)    TYPE N,          " 1-30 past due
            AVG_31_60(10)   TYPE N,          " 31-60 past due
            AVG_61_90(10)   TYPE N,          " 61-90 past due
            AVG_90G(10)     TYPE N,          " 90+ past due
          END OF TB_FINAL.
         ALV Internal tables
    DATA : TB_FIELDCAT       TYPE SLIS_T_FIELDCAT_ALV,  " Field Catalog
           TB_EVENTS         TYPE SLIS_T_EVENT,         " ALV Events
           TB_COMMENTS       TYPE SLIS_T_LISTHEADER.    " Comment
        Internal tables for the sending mail data
    DATA: TB_OBJPACK  TYPE SOPCKLSTI1 OCCURS 2  WITH HEADER LINE,
          TB_OBJHEAD  TYPE SOLISTI1   OCCURS 1  WITH HEADER LINE,
          TB_OBJTXT   TYPE SOLISTI1   OCCURS 10 WITH HEADER LINE,
          TB_RECLIST  TYPE SOMLRECI1  OCCURS 5  WITH HEADER LINE,
          TB_OBJBIN   LIKE SOLISTI1   OCCURS 0  WITH HEADER LINE,
          TB_DOC_CHNG TYPE SODOCCHGI1.
        Internal table to get mail Receivers Address
    DATA: TB_ZRECEIVE LIKE YSMTP_ADDRESS OCCURS 0 WITH HEADER LINE.
                               STRUCTURES
    DATA: X_SADR            TYPE SADR,                 " For Address
          X_FIELDCAT        TYPE SLIS_FIELDCAT_ALV,    " For Field Catalog
          X_LAYOUT          TYPE SLIS_LAYOUT_ALV,      " For Layout
          X_EVENTS          TYPE SLIS_ALV_EVENT,       " For Events
          X_COMMENTS        TYPE SLIS_LISTHEADER,      " For Comments
          X_ADDR1_SEL       LIKE ADDR1_SEL,            " For Address
          WA_FAEDE          TYPE FAEDE.                " For FAEDE struct
                               VARIABLES
    DATA: G_REPID        LIKE SY-REPID,             " Prog ID
          G_DAYS_SLOW(3) TYPE N,                    " Days Slow
          G_OPEN         TYPE I,                    " Counter
          G_AVG(4)       TYPE C,                    " Avg Days
          G_COUNT        TYPE I,                    " Counter
          G_TITLE        TYPE SOLISTI1-LINE,        " Description
          G_TAB_LINES    TYPE SY-TABIX,             " Internal data count
          G_REC_COUNT    TYPE I,                    " Total records
          G_CURR_BAL     TYPE N,                    " Account balance
          G_FILE_NAME    LIKE EDI_PATH-PTHNAM.      " Output File Name
                               CONSTANTS
    CONSTANTS: C_D            TYPE C VALUE 'D',     " Account type
               C_X            TYPE C VALUE 'X',     " Check Value
               C_0(4)         TYPE N VALUE '0.00',  " Constant for char
               C_1(2)         TYPE C VALUE '01',    " Posting key const
               C_H            TYPE C VALUE 'H',     " For Commenet-Type
               C_TXT(3)       TYPE N VALUE 'TXT',   " File type
               C_RAW(3)       TYPE C VALUE 'RAW',   " File type
               C_DELIMITER    TYPE X VALUE '09',    " ASCII CODE LINE
               C_TOP_OF_PAGE  TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
               C_INTERFACE    TYPE YWFSALOFFICNOTIF-INTERFACE_ID VALUE 'AP',
               C_FILENAME(20) TYPE N VALUE 'TEXT.TXT'," File name
               C_TITLE(30)    TYPE N VALUE 'Z21614_DB_CREDIT_AGENCY',
               C_Z001 TYPE RF035-RASID VALUE 'Z001'." Net 30/60/90/120/150
                               SELECTION SCREEN.
    Selection Screen for Selection Criteria.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01.
    SELECT-OPTIONS:  S_BUKRS FOR  BSID-BUKRS OBLIGATORY,    " Company Code
                     S_BLDAT FOR  BSID-BLDAT," OBLIGATORY,  " Doc Date
                     S_KUNNR FOR  BSID-KUNNR,               " Cust No
                     S_ZUONR FOR  BSID-ZUONR.               " Assignment
    PARAMETERS:      P_GRACE(2)   TYPE N OBLIGATORY,        " Grace Days
                     P_ZAMIB LIKE KNB1-ZAMIB AS CHECKBOX.   " DMS Indicator
    SELECTION-SCREEN END OF BLOCK B1.
    Selection Screen for Output Options.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-T02.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 01.
    PARAMETERS: P_REPORT RADIOBUTTON GROUP R1.             " Report Only
    SELECTION-SCREEN COMMENT 5(25) TEXT-016.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 01.
    PARAMETERS: P_DOWN RADIOBUTTON GROUP R1.               " Dwnld to Unix
    SELECTION-SCREEN COMMENT 5(25) TEXT-017.
    SELECTION-SCREEN POSITION 30.
    PARAMETERS: P_FILE LIKE FILENAME-FILEINTERN DEFAULT
                                 'Z21614_DB_CREDIT_AGENCY'. " File Name
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2.
    Selection Screen for E-mail.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-T03.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 01.
    PARAMETERS: P_EMAIL AS CHECKBOX.                        " E-mail
    SELECTION-SCREEN COMMENT 5(25) TEXT-018.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B3.
                               INITIALIZATION
    INITIALIZATION.
      G_REPID = SY-REPID.
                   AT SELECTION SCREEN.                                  *
    AT SELECTION-SCREEN.
    Validation of selection screen entries
    perform validate_data.
                               START-OF-SELECTION
    START-OF-SELECTION.
    Select Data from Customer Master (Company Code)
      PERFORM SELECT_KNB1.
    Select Custmer Open Items.
      PERFORM SELECT_CUSTOMER_OPEN_ITEMS.
    Select Custmer Cleared Items.
      PERFORM SELECT_CUSTOMER_CLEARED_ITEMS.
    Select General Data in Customer Master
      PERFORM SELECT_KNA1.
    Populate Final Output Data.
      PERFORM POPULATE_TB_FINAL.
                       End of selection                                  *
    END-OF-SELECTION.
    If both display report and send email is checked
      IF P_REPORT = C_X AND P_EMAIL  = C_X.
        MESSAGE E999 WITH
          'Select One Among Report Only & Send E-mail'(023).
    When Radiobutton for Email or if the program is run background
      ELSEIF ( P_EMAIL = C_X OR SY-BATCH = C_X ).
      To send the mail
        PERFORM SEND_EMAIL.
      ELSEIF P_REPORT = C_X .
      To display the Final Output data using ALV's
        PERFORM DISPLAY_ALV_REPORT.
      ENDIF.
    Transfering data to file when downloading to Unix
      IF P_DOWN = C_X.
        IF G_REC_COUNT IS INITIAL.
          MESSAGE I999 WITH
            'No Records Found For Selection Criteria'(024).
          EXIT.
        ELSE.
          IF NOT G_FILE_NAME IS INITIAL.
          Trasefering data to file
            PERFORM TRANSFER_DATA_FILE.
          Interface Audit report
            PERFORM WRITE_REPORT.
          ENDIF.
        ENDIF.
      ENDIF.
                              F O R M S
    *&      Form  VALIDATE_DATA
          Validating selection-screen entries
    FORM VALIDATE_DATA.
    Local variables
      DATA : L_BUKRS LIKE BSEG-BUKRS,          " For Company Code
             L_KUNNR LIKE BSEG-KUNNR.          " For Customer Number
    Validate the Company code.
      SELECT SINGLE BUKRS
        INTO L_BUKRS
        FROM T001
       WHERE BUKRS IN S_BUKRS.
      IF SY-SUBRC <> 0.
        MESSAGE E999 WITH 'Enter valid Company Code'(025).
      ENDIF.
    Validate the Customer number
      IF NOT S_KUNNR[] IS INITIAL.
        SELECT SINGLE KUNNR
          INTO L_KUNNR
          FROM KNA1
         WHERE KUNNR IN S_KUNNR.
        IF SY-SUBRC <> 0.
          MESSAGE E999 WITH 'Enter valid Customer Number'(026).
        ENDIF.
      ENDIF.
    ENDFORM.                    " VALIDATE_DATA
    *&      Form  SELECT_KNB1
          Select Data from Customer Master (Company Code)
    FORM SELECT_KNB1 .
      CLEAR: TB_KNB1,
             TB_KNB1[].
      SELECT KUNNR
             BUKRS
             ERDAT
             ZAMIB
             FROM KNB1
             INTO TABLE TB_KNB1
             WHERE BUKRS IN S_BUKRS
               AND KUNNR IN S_KUNNR.
      IF SY-SUBRC = 0.
      Sort TB_KNB1 by Customer no & Rec Created Date
        SORT TB_KNB1 BY KUNNR ERDAT DESCENDING.
      ENDIF.
    ENDFORM.                    " SELECT_KNB1
    *&      Form  SELECT_CUSTOMER_OPEN_ITEMS
          Select Custmer Open Items.
    FORM SELECT_CUSTOMER_OPEN_ITEMS .
      CLEAR: TB_BSID,
             TB_BSID[].
      SELECT  A~BUKRS
              B~KUNNR
              B~AUGDT
              B~BLDAT
              B~SHKZG
              B~DMBTR
              B~ZFBDT
              B~ZBD1T
              B~ZBD2T
              B~ZBD3T
              B~REBZG
              B~REBZT
         INTO TABLE TB_BSID
         FROM BKPF AS A JOIN BSID AS B
           ON ABUKRS = BBUKRS
          AND ABELNR = BBELNR
          AND AGJAHR = BGJAHR
        WHERE A~BUKRS IN S_BUKRS
          AND A~BLDAT IN S_BLDAT
          AND B~KUNNR IN S_KUNNR
          AND B~ZUONR IN S_ZUONR
          AND B~BSCHL = C_1.
      IF SY-SUBRC = 0.
      DMS Managed Indicator  = ‘X’.
        IF P_ZAMIB = C_X.
          LOOP AT TB_KNB1 WHERE ZAMIB = SPACE.
            DELETE TB_BSID WHERE BUKRS = TB_KNB1-BUKRS
                             AND KUNNR = TB_KNB1-KUNNR.
          ENDLOOP.
        ENDIF.
      Transfering Open Items from TB_BSID to TB_BSID_OPEN
        TB_BSID_OPEN[] = TB_BSID[].
      ENDIF.
    ENDFORM.                    " SELECT_CUSTOMER_OPEN_ITEMS
    *&      Form  SELECT_CUSTOMER_CLEARED_ITEMS
          Select Custmer Cleared Items.
    FORM SELECT_CUSTOMER_CLEARED_ITEMS .
      CLEAR: TB_BSAD_CLEAR,
             TB_BSAD_CLEAR[].
      SELECT   A~BUKRS
               B~KUNNR
               B~AUGDT
               B~BLDAT
               B~SHKZG
               B~DMBTR
               B~ZFBDT
               B~ZBD1T
               B~ZBD2T
               B~ZBD3T
               B~REBZG
               B~REBZT
          INTO TABLE TB_BSAD_CLEAR
          FROM BKPF AS A JOIN BSAD AS B
            ON ABUKRS = BBUKRS
          AND  ABELNR = BBELNR
          AND  AGJAHR = BGJAHR
         WHERE A~BUKRS IN S_BUKRS
           AND A~BLDAT IN S_BLDAT
           AND B~KUNNR IN S_KUNNR
           AND B~ZUONR IN S_ZUONR
           AND B~BSCHL = C_1.
      IF SY-SUBRC = 0.
      DMS Managed Indicator = ‘X’.
        IF P_ZAMIB = C_X.
          LOOP AT TB_KNB1 WHERE ZAMIB = SPACE.
            DELETE TB_BSID WHERE BUKRS = TB_KNB1-BUKRS
                             AND KUNNR = TB_KNB1-KUNNR.
          ENDLOOP.
        ENDIF.
      Sort TB_BSID_CLEAR by Customer number
        SORT TB_BSAD_CLEAR BY KUNNR.
      ENDIF.
    Append lines of TB_BSID_CLEAR to table TB_BSID
      APPEND LINES OF TB_BSAD_CLEAR TO TB_BSID.
    Sort TB_BSID by Cust num AND Doc date in document
      SORT TB_BSID BY KUNNR BLDAT.
    ENDFORM.                    " SELECT_CUSTOMER_CLEARED_ITEMS
    *&      Form  SELECT_KNA1
          Select General Data in Customer Master
    FORM SELECT_KNA1.
      CLEAR: TB_KNA1,
             TB_KNA1[].
      SELECT  KUNNR
              NAME1
              TELF1
              ADRNR
         INTO TABLE TB_KNA1
         FROM KNA1
        WHERE KUNNR IN S_KUNNR.
      IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    " SELECT_KNA1
    *&      Form  POPULATE_TB_FINAL
          Populate Final Output Data.
    FORM POPULATE_TB_FINAL.
    Local variable
      DATA: L_DAYS_SLOW(3) TYPE N.       " Days Slow
      CLEAR: TB_FINAL,
             TB_FINAL[].
      LOOP AT TB_KNA1.
      Move-corresponding TB_KNA1 to TB_FINAL.
        TB_FINAL-KUNNR = TB_KNA1-KUNNR.  " Customer Number
        TB_FINAL-NAME1 = TB_KNA1-NAME1.  " Name Line 1
        TB_FINAL-PHONE = TB_KNA1-TELF1.  " Telephone Number
      To get Customer Address.
        PERFORM GET_CUSTOMER_ADDRESS.
      To get Date of Last Invoice.
        READ TABLE TB_BSID WITH KEY KUNNR = TB_KNA1-KUNNR.
        IF SY-SUBRC = 0.
          TB_FINAL-LAST_DATE = TB_BSID-BLDAT.
        ENDIF.
      To get past due and current details.
        PERFORM GET_PAST_DUE_CURRENT.
      To get Days Slow.
        CLEAR WA_FAEDE .
        LOOP AT TB_BSID_OPEN WHERE KUNNR = TB_KNA1-KUNNR.
          WA_FAEDE-SHKZG = TB_BSID-SHKZG.
          WA_FAEDE-ZFBDT = TB_BSID-ZFBDT.
          WA_FAEDE-ZBD1T = TB_BSID-ZBD1T.
          WA_FAEDE-ZBD2T = TB_BSID-ZBD2T.
          WA_FAEDE-ZBD3T = TB_BSID-ZBD3T.
          WA_FAEDE-REBZG = TB_BSID-REBZG.
          WA_FAEDE-REBZT = TB_BSID-REBZT.
          WA_FAEDE-KOART = C_D.
        To Determine Due Date.
          CALL FUNCTION 'DETERMINE_DUE_DATE'
               EXPORTING
                    I_FAEDE                    = WA_FAEDE
               IMPORTING
                    E_FAEDE                    = WA_FAEDE
               EXCEPTIONS
                    ACCOUNT_TYPE_NOT_SUPPORTED = 1
                    OTHERS                     = 2.
          IF SY-SUBRC <> 0.
            CLEAR WA_FAEDE.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          CLEAR: L_DAYS_SLOW.
          L_DAYS_SLOW = SY-DATUM - WA_FAEDE-NETDT - P_GRACE.
          G_DAYS_SLOW = G_DAYS_SLOW + ABS( L_DAYS_SLOW ).
          G_OPEN      = G_OPEN + 1.
        ENDLOOP.
        IF G_OPEN IS INITIAL.
          TB_FINAL-DAYS_SLOW = G_DAYS_SLOW / G_OPEN.  " Days Slow
        ENDIF.
      To get Average days to Pay.
        PERFORM GET_AVG_DAYS_PAY.
      Calculating total records .
        G_REC_COUNT = G_REC_COUNT + 1.
        APPEND TB_FINAL.
        CLEAR  TB_FINAL.
      ENDLOOP.
    Current account balance.
      G_CURR_BAL   = TB_FINAL-CURRENT + TB_FINAL-AVG_1_30  +
                                        TB_FINAL-AVG_31_60 +
                                        TB_FINAL-AVG_61_90 +
                                        TB_FINAL-AVG_90G   .
    ENDFORM.                    " POPULATE_TB_FINAL
    *&      Form  GET_PAST_DUE_CURRENT
          To get past due and current details.
    FORM GET_PAST_DUE_CURRENT.
        Local Varaibles.
      DATA: L_RF035_SFAE1 TYPE RF035-SFAE1,
            L_RF035_SFAE2 TYPE RF035-SFAE2,
            L_RF035_SFAE3 TYPE RF035-SFAE3,
            L_RF035_SFAE4 TYPE RF035-SFAE4,
            L_RF035_SFAE5 TYPE RF035-SFAE5,
            L_RF035_SFAE6 TYPE RF035-SFAE6,
            L_RF035_SFAEL TYPE RF035-SFAEL,
            L_RF035_SNFA1 TYPE RF035-SNFA1,
            L_RF035_SNFA2 TYPE RF035-SNFA2,
            L_RF035_SNFA3 TYPE RF035-SNFA3,
            L_RF035_SNFA4 TYPE RF035-SNFA4,
            L_RF035_SNFA5 TYPE RF035-SNFA5,
            L_RF035_SNFA6 TYPE RF035-SNFA6,
            L_RF035_SNFAE TYPE RF035-SNFAE.
      LOOP AT TB_KNB1 WHERE KUNNR = TB_KNA1-KUNNR.
        CALL FUNCTION 'CUSTOMER_DUE_DATE_ANALYSIS'
             EXPORTING
                  BUKRS          = TB_KNB1-BUKRS
                KKBER          = ' '
                  KUNNR          = TB_KNB1-KUNNR
                  RASID          = C_Z001
             IMPORTING
                  SFAE1          = L_RF035_SFAE1
                  SFAE2          = L_RF035_SFAE2
                  SFAE3          = L_RF035_SFAE3
                  SFAE4          = L_RF035_SFAE4
                  SFAE5          = L_RF035_SFAE5
                  SFAE6          = L_RF035_SFAE6
                  SFAEL          = L_RF035_SFAEL
                  SNFA1          = L_RF035_SNFA1
                  SNFA2          = L_RF035_SNFA2
                  SNFA3          = L_RF035_SNFA3
                  SNFA4          = L_RF035_SNFA4
                  SNFA5          = L_RF035_SNFA5
                  SNFA6          = L_RF035_SNFA6
                  SNFAE          = L_RF035_SNFAE
             EXCEPTIONS
                  INVALID_RASTER = 1
                  NO_OPEN_ITEMS  = 2
                  OTHERS         = 3
        IF SY-SUBRC = 0.
          TB_FINAL-AVG_1_30  = TB_FINAL-AVG_1_30  + L_RF035_SFAE1.
          TB_FINAL-AVG_31_60 = TB_FINAL-AVG_31_60 + L_RF035_SFAE2.
          TB_FINAL-AVG_61_90 = TB_FINAL-AVG_61_90 + L_RF035_SFAE3.
          TB_FINAL-AVG_90G   = TB_FINAL-AVG_90G   + L_RF035_SFAE4
                                                  + L_RF035_SFAE5
                                                  + L_RF035_SFAE6.
          TB_FINAL-CURRENT  = TB_FINAL-CURRENT    + L_RF035_SNFAE.
        ELSE.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " GET_PAST_DUE_CURRENT
    *&      Form  GET_CUSTOMER_ADDRESS
          To get Customer Address.
    FORM GET_CUSTOMER_ADDRESS.
      X_ADDR1_SEL-ADDRNUMBER = TB_KNA1-ADRNR.
      CALL FUNCTION 'ADDR_GET'
           EXPORTING
                ADDRESS_SELECTION = X_ADDR1_SEL
           IMPORTING
                SADR              = X_SADR
           EXCEPTIONS
                PARAMETER_ERROR   = 1
                ADDRESS_NOT_EXIST = 2
                VERSION_NOT_EXIST = 3
                INTERNAL_ERROR    = 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.
      ADDRESS LINE 1.
      TB_FINAL-ADDRESS1 = X_SADR-STRAS.
      ADDRESS LINE 2.
      CONCATENATE X_SADR-PFACH 'CODE' X_SADR-PSTL2 INTO TB_FINAL-ADDRESS2
                                                      SEPARATED BY SPACE.
      ADDRESS LINE 3.
      CONCATENATE  X_SADR-ORT01 X_SADR-ORT02 ',' X_SADR-REGIO X_SADR-PSTLZ
                                INTO TB_FINAL-ADDRESS3 SEPARATED BY SPACE.
      ADDRESS LINE 4.
      TB_FINAL-ADDRESS4 = X_SADR-LAND1.
    ENDFORM.                    " GET_CUSTOMER_ADDRESS
    *&      Form  GET_AVG_DAYS_PAY
          To get Average days to Pay.
    FORM GET_AVG_DAYS_PAY.
    *Local variable
      DATA: L_DAYS TYPE N .                            " Number of Days
      LOOP AT TB_BSAD_CLEAR WHERE KUNNR = TB_KNA1-KUNNR.
        L_DAYS  = TB_BSAD_CLEAR-AUGDT - TB_BSAD_CLEAR-BLDAT.
        G_AVG   = G_AVG + L_DAYS.
        G_COUNT = G_COUNT + 1.
      ENDLOOP.
      IF NOT G_COUNT IS INITIAL.
        TB_FINAL-AVG = G_AVG / G_COUNT. " Average days to Pay.
      ENDIF.
    ENDFORM.                    " GET_AVG_DAYS_PAY
    *&      Form  DISPLAY_ALV_REPORT
          text
    FORM DISPLAY_ALV_REPORT.
    For Populating Field Catalog.
      PERFORM RPT_BUILD_FIELDCATLOG.
    For Modifying Field Catalog.
      PERFORM RPT_MODIFY_FIELDCATLOG.
    For TOP_OF_PAGE Event.
      PERFORM RPT_GET_EVENTS.
    For Displaying Output in Grid Format.
      PERFORM RPT_GRID_DISPLAY.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  RPT_BUILD_FIELDCATLOG
          text
    FORM RPT_BUILD_FIELDCATLOG.
    To build the Field Catlog.
      DATA : L_TABNAME TYPE SLIS_TABNAME.  " Table Name
      L_TABNAME = 'TB_FINAL'.
      REFRESH : TB_FIELDCAT.
      CLEAR   : TB_FIELDCAT.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = G_REPID
                I_INTERNAL_TABNAME     = L_TABNAME
                I_INCLNAME             = G_REPID
           CHANGING
                CT_FIELDCAT            = TB_FIELDCAT
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 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.
    ENDFORM.                    " RPT_BUILD_FIELDCATLOG
    *&      Form  RPT_MODIFY_FIELDCATLOG
          text
    FORM RPT_MODIFY_FIELDCATLOG.
    Getting the Header Text for the Coloumns
      DATA : L_TABIX LIKE SY-TABIX,            " Index
             L_DDICTXT TYPE C  VALUE 'L'.      " Flag
    Getting the Header Text for the Coloumns
      LOOP AT TB_FIELDCAT INTO X_FIELDCAT.
        CLEAR L_TABIX.
        L_TABIX = SY-TABIX.
        CASE X_FIELDCAT-FIELDNAME.
          WHEN 'KUNNR'.                                   " Customer Number
            X_FIELDCAT-SELTEXT_L = 'Customer Number'(001).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'NAME1'.                                   " Name Line 1
            X_FIELDCAT-SELTEXT_L = 'Name'(002).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'ADDRESS1'.                                " Address line 1
            X_FIELDCAT-SELTEXT_L = 'Address 1'(003).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'ADDRESS2'.                                " Address line 2
            X_FIELDCAT-SELTEXT_L = 'Address 2'(004).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'ADDRESS3'.                                " Address line 3
            X_FIELDCAT-SELTEXT_L = 'Address 3'(005).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'ADDRESS4'.                                " Address line 4
            X_FIELDCAT-SELTEXT_L = 'Address 4'(006).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'PHONE'.                                   " Telephone Number
            X_FIELDCAT-SELTEXT_L = 'Telephone Number'(007).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'DAYS_SLOW'.                               " Days Slow
            X_FIELDCAT-SELTEXT_L = 'Days Slow'(008).
            X_FIELDCAT-DDICTXT      =  L_DDICTXT.
          WHEN 'LAST_DATE'.                         " Date of Last Invoice
            X_FIELDCAT-SELTEXT_L = 'Date of Last Invoice'(009).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'AVG'.                               " Average Days to Pay
            X_FIELDCAT-SELTEXT_L = 'Average Days to Pay'(010).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'CURRENT'.                  " Current
            X_FIELDCAT-SELTEXT_L = 'Aging Category 1'(011).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'AVG_1_30'.                  " 1-30 past due
            X_FIELDCAT-SELTEXT_L = 'Aging Category 2'(012).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'AVG_31_60'.                  " 31-60 past due
            X_FIELDCAT-SELTEXT_L = 'Aging Category 3'(013).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'AVG_61_90'.                  " 61-90 past due
            X_FIELDCAT-SELTEXT_L = 'Aging Category 4'(014).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
          WHEN 'AVG_90G'.                  " 90+ past due
            X_FIELDCAT-SELTEXT_L = 'Aging Category 5'(015).
            X_FIELDCAT-DDICTXT   =  L_DDICTXT.
        ENDCASE.
        MODIFY TB_FIELDCAT FROM X_FIELDCAT INDEX L_TABIX.
      ENDLOOP.
    ENDFORM.                    " RPT_MODIFY_FIELDCATLOG
    *&      Form  RPT_GET_EVENTS
          text
    FORM RPT_GET_EVENTS.
      DATA : L_TABIX TYPE SY-TABIX.                " Index
      CLEAR   : TB_EVENTS,
                TB_EVENTS[].
    To get the events from this function module
    for ALV display
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE     = 0
           IMPORTING
                ET_EVENTS       = TB_EVENTS
           EXCEPTIONS
                LIST_TYPE_WRONG = 1
                OTHERS          = 2.
      IF SY-SUBRC <> 0.
        MESSAGE I999 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Modifing Top of Page event
      READ TABLE TB_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
                          INTO X_EVENTS.
      IF SY-SUBRC = 0.
        CLEAR L_TABIX.
        L_TABIX = SY-TABIX.
        X_EVENTS-FORM = C_TOP_OF_PAGE.
        MODIFY TB_EVENTS FROM X_EVENTS INDEX L_TABIX.
        CLEAR  X_EVENTS.
      ENDIF.
    ENDFORM.                    " RPT_GET_EVENTS
    *&      Form  TOP_OF_PAGE
          Top Of Page for the ALV format
    FORM  TOP_OF_PAGE.
      REFRESH TB_COMMENTS.
    For heading
      CLEAR   X_COMMENTS.
      X_COMMENTS-TYP  = C_H.
      X_COMMENTS-INFO = 'D&B Credit Agency Interface'(019).
      APPEND X_COMMENTS TO TB_COMMENTS.
    This module outputs formatted simple header information at TOP-OF-PAGE
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = TB_COMMENTS.
    ENDFORM.                          " TOP_OF_PAGE
    *&      Form  RPT_GRID_DISPLAY
          text
    FORM RPT_GRID_DISPLAY.
    Layout Settings
      CLEAR X_LAYOUT.
      X_LAYOUT-ZEBRA = 'X'.
      X_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
      X_LAYOUT-NO_COLHEAD        = SPACE.
    To Display the Output in ALV Format
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM = G_REPID
                IS_LAYOUT          = X_LAYOUT
                IT_FIELDCAT        = TB_FIELDCAT
                IT_EVENTS          = TB_EVENTS
           TABLES
                T_OUTTAB           = TB_FINAL
           EXCEPTIONS
                PROGRAM_ERROR      = 1
                OTHERS             = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " RPT_GRID_DISPLAY
    *&      Form  SEND_EMAIL
          text
    -->  p1        text
    <--  p2        text
    FORM SEND_EMAIL.
    Prepare the mail
      PERFORM SEND_MAIL USING C_INTERFACE.
    Sending the mail to Receivers
      PERFORM SENDING_MAIL.
    ENDFORM.                    " SEND_EMAIL
    *&      Form  SEND_MAIL
         Sending the Mail
    FORM SEND_MAIL USING  P_C_INTERFACE TYPE YWFSALOFFICNOTIF-INTERFACE_ID.
    Populating Report name
      G_TITLE = C_TITLE.
      PERFORM POPULATE_EMAIL_REF_DATA USING G_TITLE.
      IF NOT G_REC_COUNT IS INITIAL.
      To populate the data to table tb_objbin
        PERFORM POPULATE_DATA_OBJBIN.
      To get the attached file for the mail
        CLEAR G_TAB_LINES.
        DESCRIBE TABLE TB_OBJBIN LINES G_TAB_LINES.
        TB_OBJHEAD = C_FILENAME.
        APPEND TB_OBJHEAD.
        CLEAR TB_OBJHEAD.
      Creation of the entry for the mail
        TB_OBJPACK-TRANSF_BIN = C_X.
        TB_OBJPACK-HEAD_START = C_1.
        TB_OBJPACK-HEAD_NUM   = C_1.
        TB_OBJPACK-BODY_START = C_1.
        TB_OBJPACK-BODY_NUM   = G_TAB_LINES.
        TB_OBJPACK-DOC_TYPE   = C_TXT.
        TB_OBJPACK-OBJ_NAME   = G_REPID.
        TB_OBJPACK-OBJ_DESCR  = 'Interface Audit Report'(020).
        TB_OBJPACK-DOC_SIZE   = G_TAB_LINES * 255.
        APPEND TB_OBJPACK.
      ENDIF.
    ENDFORM.                    " SEND_MAIL
    *&      Form  SENDING_MAIL
    FORM SENDING_MAIL.
    Function Module to send mail along with attached file
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = TB_DOC_CHNG
           TABLES
                PACKING_LIST               = TB_OBJPACK
                OBJECT_HEADER              = TB_OBJHEAD
                CONTENTS_BIN               = TB_OBJBIN
                CONTENTS_TXT               = TB_OBJTXT
                RECEIVERS                  = TB_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.
      CASE SY-SUBRC.
        WHEN 0.
          MESSAGE S999 WITH 'Mail has been sucessfully sent'(029).
        WHEN 1.
          MESSAGE S999 WITH 'Too Many Parameters'(030).
        WHEN 2.
          MESSAGE S999 WITH 'Doc Could Not Be Sent'(031).
        WHEN 4.
          MESSAGE S999 WITH 'No Authority To Send'(032).
        WHEN 99.
          MESSAGE S999 WITH 'Error While Sending'(033).
      ENDCASE.
    ENDFORM.                    " SENDING_MAIL
    *&      Form  POPULATE_EMAIL_REF_DATA
       Poplulating the body of the mail
    FORM POPULATE_EMAIL_REF_DATA USING TEXT TYPE SOLISTI1-LINE.
    Setting up Mail Subject
      TB_DOC_CHNG-OBJ_DESCR = 'Interface Audit Report'(020).
    Populating body of the mail
      TB_OBJTXT-LINE = 'Interface Audit Report'(020).
      APPEND TB_OBJTXT.
      CLEAR: TB_OBJTXT.
      DESCRIBE TABLE TB_OBJTXT LINES G_TAB_LINES.
      READ TABLE TB_OBJTXT INDEX G_TAB_LINES.
    *To determine the document size
    TB_DOC_CHNG-DOC_SIZE = ( G_TAB_LINES - 1 ) * 255 + STRLEN( TB_OBJTXT ).
    Creation of the entry for the Mail Contents
      CLEAR TB_OBJPACK-TRANSF_BIN.
      TB_OBJPACK-HEAD_START = C_1.
      TB_OBJPACK-HEAD_NUM = C_0.
      TB_OBJPACK-BODY_START = C_1.
      TB_OBJPACK-BODY_NUM = G_TAB_LINES.
      TB_OBJPACK-DOC_TYPE = C_RAW.
      APPEND TB_OBJPACK.
    ENDFORM.                    " POPULATE_EMAIL_REF_DATA
    *&      Form  POPULATE_DATA_OBJBIN
          Populating table for file attachment

  • How to  send ALV output data into Excel sheet format via Mail to the user?

    Hi friends,
    I have a doubt ie,
    How to  send ALV output data into Excel sheet format via Mail to the user?
    regards
    Moosa

    Hi,
    Provide the output internal table to the objbin in the below FM
    Send Message
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                document_data              = i_docdata
                put_in_outbox              = c_x
           TABLES
                packing_list               = i_objpack
                object_header              = i_objhead
                contents_bin               = i_objbin
                contents_txt               = i_objtxt
                receivers                  = i_reclist
    and specify the document type
      i_objpack-doc_type   = 'XLS'.
    and try.
    Regards,
    Nandha

  • How to send huge no. of excel sheet attachment to a mail ID

    HI ,
            I have mail functionality program which send mail to a mail id with multiple excel sheet attchment. I have done all these things.  When it sends small number of excel attchment  then it's ok. But when  it sends huge number of excel attchment (ex.- 1000 excel attchment) then it showing error message to the mail  id -
       'This message is larger than the size limit for messages. Please make it smaller and try sending it again.'
    I have used cl_bcs, cl_document_bcs these class. I have seen all related post in sdn but unable to get my requirement.
    i need your suggestion.

    Hi,
    Try this code::
    FORM MAIL_SEND .
      *Mail Body
      MOVE text-004 TO wa_text.  "Space
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE TEXT-003 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE text-005 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE TEXT-003 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE text-011 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      tl_contents[] = wt_text.
      TRY.
        TRY.
    **-- Create persistent send request
          l_send_request = cl_bcs=>create_persistent( ).
          CATCH CX_SEND_REQ_BCS.
       ENDTRY.
    *-- Get the length of the Document
          DESCRIBE TABLE tl_contents LINES l_cnt.
          READ TABLE tl_contents INTO wa_contents INDEX l_cnt.
          l_doc_len = ( l_cnt - 1 ) * 255 + STRLEN( wa_contents ).
    *-- Subject of the mail
          l_sub = 'TEST1'.
          I_SUBJECT = 'BP assignment report for Credit analyst and CrSeg'.
    **-- Create Document
          l_document = cl_document_bcs=>create_document(
                 i_type       = c_htm
                 i_text       = tl_contents
                 i_length     = l_doc_len
                 i_subject    = I_SUBJECT "'BP assignment report for Credit analyst and CrSeg
                 i_language   = sy-langu
                 i_importance = '1' ).
        CATCH CX_DOCUMENT_BCS.
    **-- Subject of the mail
          MOVE l_sub TO l_subj.
      ENDTRY.
      TRY.
    *-- Set the Message Subject
          CALL METHOD l_send_request->set_message_subject
            EXPORTING
              ip_subject = l_subj.
        CATCH CX_SEND_REQ_BCS.
      ENDTRY.
    **-- Add document to send request
      try.
          CALL METHOD l_send_request->set_document( l_document ).
        CATCH CX_SEND_REQ_BCS.
      endtry.
      CALL FUNCTION 'SPLIT_FILENAME'
        EXPORTING
          long_filename  = 'C:\BP_DETAILS.XLS'
        IMPORTING
          pure_filename  = p_name
          pure_extension = p_ext.
      TRANSLATE p_ext TO UPPER CASE.
      elpath = 'C:\BP_DETAILS.XLS'.
    *Upload the file
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = elpath
          filetype                = 'BIN'
        TABLES
          data_tab                = t_ann
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      try.
          IF t_ann[] IS NOT INITIAL.
    *-- File name of the Attachment
            l_subject  = p_name.
    *-- Extension of the Attachment
            l_att_type = p_ext.
            TRY.
                w_document = l_document.
    *-- Add Attachment to the Document
                CALL METHOD L_document->add_attachment
                  EXPORTING
                    i_attachment_type    = l_att_type
                    i_attachment_subject = l_subject
                    i_att_content_hex    = t_ann. "t_mailhex.
              CATCH cx_document_bcs.
            ENDTRY.
          ENDIF.
    *-- Do send delivery info for successful mails
          lv_msg = 'E'.
          CALL METHOD l_send_request->set_status_attributes
            EXPORTING
              i_requested_status = lv_msg  "Error status
              i_status_mail      = lv_msg. "Error status
          TRY.
              send_request = l_send_request->send_request.
            CATCH cx_bcs.
          ENDTRY.
    set outbox flag
          TRY.
              CALL METHOD send_request->set_link_to_outbox( 'X' ).
            CATCH cx_bcs.
          ENDTRY.
    request error status
          TRY.
              CALL METHOD send_request->setu_requested_status( req_stat ).
            CATCH cx_bcs INTO l_bcs_exception.
          ENDTRY.
    *-- Set sender
          l_sender = cl_sapuser_bcs=>create( sy-uname ).
          CALL METHOD l_send_request->set_sender
            EXPORTING
              i_sender = l_sender.
          gs_mail-e_mail = 'mail ID1'.
          APPEND gs_mail TO gt_mail.
          CLEAR gs_mail.
          gs_mail-e_mail = 'mail ID2'.
          APPEND gs_mail TO gt_mail.
          CLEAR gs_mail.
          gs_mail-e_mail = 'mail ID3'.
          APPEND gs_mail TO gt_mail.
          CLEAR gs_mail.
          loop at gt_mail into gs_mail.
            try.
                l_recipient = cl_cam_address_bcs=>create_internet_address(
                                                                    gs_mail-e_mail ).
              catch cx_address_bcs.
            endtry.
            CALL METHOD l_send_request->add_recipient
              EXPORTING
                i_recipient = l_recipient
               i_express   = 'X'
                i_copy      = 'X'.
          endloop.
    *-- Send Email
          CALL METHOD l_send_request->send(
              EXPORTING
                i_with_error_screen = 'X'
              RECEIVING
                result              = l_result ).
        CATCH cx_bcs INTO l_bcs_exception.
      ENDTRY.
      COMMIT WORK.
    ENDFORM.
    Thanks

  • Send ALV Grid output as PDF attachment to external mail id?

    Any solution on this please

    Check SOST transaction for external email problem.Is it showing some error there or it has not started external send process.
    If external send process has not started then follow below route :
    Go to sost->eneter selection criteria -> utilities-> start send process
    you are sending attachement as PDF ? or which type o document ?
    Please check the type of document & whether it's been supported by application via which you are trying to view.
    Re: Sending Email  to external email address in Batch mode
    Hope this explanation helps.
    Message was edited by:
            Karthikeyan Pandurangan

  • How to save ALV list  and send listoutput as email in background process

    Can anyone tell me if an ALV list report could be saved as LIST using 'LIST_TO_MEMORY' and then by using 'LIST_FROM_MEMORY' we need to read the list. If so How?
    I don't want to use 'Submit....exporting list to memory and return' as then I have to trigger my program twice.
    Finally with one program itself i want to get the listoutput and send the list output as an email to the customer in background.
    I have gone through the forums and could see many of them facing the same problem, but could not find the solution in the forums.
    Waiting for a reply
    Santhoshi

    if you want to send mail with the same data as you display in ALV, you can use the same internal table,which you sent to ALV_LIST_DISPLAY function module.
    take the email ids from the user on the selection-screen & use the below code to send mail to them.
    call this FORM F_SEND_MAIL before you called the ALV function module.
    FORM F_SEND_MAIL .
      CLEAR WA_RECLIST.
      REFRESH IT_RECLIST.
    *-popualate email ids
    *--Receipient 1
    this receipient can be select-option from the selection screen. or can be hardcoded as below.
      WA_RECLIST-RECEIVER = '[email protected]'.
      WA_RECLIST-REC_TYPE = C_U.
      WA_RECLIST-EXPRESS  = C_X.
    *--append receiver table
      APPEND WA_RECLIST TO IT_RECLIST.
      CLEAR : WA_RECLIST.
    *--Receipient 2
      WA_RECLIST-RECEIVER = '[email protected]'.
      WA_RECLIST-REC_TYPE = C_U.
      WA_RECLIST-EXPRESS  = C_X.
    *-append receiver table
      APPEND WA_RECLIST TO IT_RECLIST.
      CLEAR : WA_RECLIST.
    *--populate document attributes
      CLEAR: X_DOC_CHNG.
      X_DOC_CHNG-OBJ_NAME = 'HEADING'.
      CONCATENATE 'Japan BOL details for the delivery#'(003)
                  V_VBELN
                  INTO X_DOC_CHNG-OBJ_DESCR SEPARATED BY SPACE.
    *-populate body text
    CONCATENATE 'Japan BOL details for the Delivery#'(003)
      CONCATENATE TEXT-003
                   V_VBELN
                   ',is attached'
                   INTO WA_OBJTXT SEPARATED BY SPACE.
      APPEND WA_OBJTXT TO IT_OBJTXT.
    *---- Append Date and Time into Body of email.
      MOVE 'File is generated on'(004) TO V_INFO.
      V_TIME = SY-UZEIT.
    WRITE : SY-UZEIT TO V_TIME USING EDIT MASK '__:__:__'.
      CONCATENATE V_TIME+0(2)
                  V_TIME+2(2)
                  V_TIME+4(2)
                  INTO
                  V_TIME2 SEPARATED BY ':'.
       WRITE : sy-datum MM/DD/YYYY TO lv_date .
      CONCATENATE SY-DATUM+4(2)
                  SY-DATUM+6(2)
                  SY-DATUM+0(4)
                  INTO V_DATE.
      CONCATENATE V_INFO
                  V_DATE
                  'At'
                  V_TIME2
                  INTO V_INFO
                  SEPARATED BY SPACE.
      WA_OBJTXT = V_INFO.
      APPEND WA_OBJTXT TO IT_OBJTXT.
    *-document size
      CLEAR : V_TABLE_LINES.
      DESCRIBE TABLE IT_OBJTXT LINES V_TABLE_LINES.
      READ TABLE IT_OBJTXT INTO WA_OBJTXT INDEX V_TABLE_LINES.
      X_DOC_CHNG-DOC_SIZE =
                     ( V_TABLE_LINES - 1 ) * 255 + STRLEN( WA_OBJTXT ).
    *-populate packing list for body text
    CLEAR IT_OBJPACK-TRANSF_BIN.
      WA_OBJPACK-HEAD_START = 1.
      WA_OBJPACK-HEAD_NUM = 0.
      WA_OBJPACK-BODY_START = 1.
      WA_OBJPACK-BODY_NUM = V_TABLE_LINES.
      WA_OBJPACK-DOC_TYPE = 'RAW'.
      APPEND WA_OBJPACK TO IT_OBJPACK.
      CLEAR WA_OBJPACK.
    *--for attachment
    *--add Internal table lines here, as attachment.
    *--IT_FINAL IS THE internal table which you used to display the result as ALV output
      loop at IT_FINAL.
        CONCATENATE IT_FINAL-FIELD1
                    IT_FINAL-FIELD2
    *--AND SO ON
             INTO WA_OBJBIN.
      APPEND WA_OBJBIN TO IT_OBJBIN.
      CLEAR  WA_OBJBIN.
    ENDLOOP.
    *-get total no.of lines of Object table(attachment)
      CLEAR : V_TABLE_LINES.
      DESCRIBE TABLE IT_OBJBIN LINES V_TABLE_LINES.
    *-populate object header
      CONCATENATE  'Delivery#'(005)
                     V_VBELN
                     SY-DATUM
                     V_TIME
                     INTO
                     WA_OBJHEAD SEPARATED BY SPACE.
      APPEND WA_OBJHEAD TO IT_OBJHEAD.
      CLEAR  WA_OBJHEAD.
    *-packing list for attachment
      WA_OBJPACK-TRANSF_BIN = C_X.
      WA_OBJPACK-HEAD_START = 1.
      WA_OBJPACK-HEAD_NUM = 1.
      WA_OBJPACK-BODY_START = 1.
      WA_OBJPACK-BODY_NUM = V_TABLE_LINES .
    WA_OBJPACK-DOC_TYPE = 'CSV' .
      WA_OBJPACK-DOC_TYPE = 'RAW' .
      WA_OBJPACK-OBJ_NAME = 'POTR'.
    CONCATENATE 'Delivery details for '(005)
      CONCATENATE TEXT-005
                V_VBELN
                SY-DATUM
                V_TIME
                '.CSV'
                INTO
                WA_OBJPACK-OBJ_DESCR SEPARATED BY SPACE.
      BREAK-POINT.
      WA_OBJPACK-DOC_SIZE = V_TABLE_LINES * 255.
      APPEND WA_OBJPACK TO IT_OBJPACK.
      CLEAR  WA_OBJPACK.
    *-Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = X_DOC_CHNG
          PUT_IN_OUTBOX              = C_X
          COMMIT_WORK                = C_X
        TABLES
          PACKING_LIST               = IT_OBJPACK
          OBJECT_HEADER              = IT_OBJHEAD
          CONTENTS_BIN               = IT_OBJBIN
          CONTENTS_TXT               = IT_OBJTXT
          RECEIVERS                  = IT_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.
    ENDFORM.                    " F_SEND_MAIL
    Regards
    srikanth
    added comments
    Message was edited by: Srikanth Kidambi

  • How To Create Header in ALV List Report

    Hi All,
    I want to create a Header for <b>MY ALV List Report</b>!
    How can i achieve the same. It should come above <b>ALV</b>.
    ALV report i had already written and it is coming correctly.
    Heading should look like this:
    <i>1st Line</i>
    <b>PROGRAM NAME: XXXXXX      CLIENT: XXXXXXXXXX   PAGE:XX</b>
    <i>2nd Line</i>
    <b>RUN DATE/TIME: XXXXX - XXXX     REPORT NAME/HEADER</b>
    How can i acheive the same in <b>ALV List Report</b>!
    I am amking use of <b>REUSE_ALV_LIST_DISPLAY</b> Function module.
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Hi Prasad,
    Use the sample code specified below as the guideline. For more info. refer to the documentation of the FM 'REUSE_ALV_COMMENTARY_WRITE'.
    DATA: first(01) type c,
    events type slis_t_event,
    gt_list_top_of_page type slis_t_listheader,
    ls_event type slis_alv_event.
    initialization.
    call function 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = events
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2.
    read table events with key name = 'TOP_OF_PAGE'
    into ls_event.
    if sy-subrc = 0.
    move: 'TOP_OF_PAGE' to ls_event-form.
    append ls_event to events.
    clear ls_event.
    endif.
    End of additions
    Start-of-selection
    START-OF-SELECTION.
    Top-of-page
    TOP-OF-PAGE.
    PERFORM TOP_OF_PAGE.
    FORM TOP_OF_PAGE .
    data: ls_line type slis_listheader.
    if first is initial.
    ls_line-typ = 'S'.
    ls_line-key = 'Run Date :'.
    write: sy-datum to ls_line-key+10 mm/dd/yyyy.
    ls_line-info = 'Billing Date:'.
    write: s_fkdat-low to ls_line-info+15 mm/dd/yyyy.
    ls_line-info+28 = 'To'.
    write s_fkdat-high to ls_line-info+32 mm/dd/yyyy.
    append ls_line to gt_list_top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = gt_list_top_of_page.
    first = 'N'.
    else.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = gt_list_top_of_page.
    endif.
    ENDFORM. " top_of_page
    <b>Please mark helpful answer.</b>
    Regards,
    Amit Mishra

  • How To Send ALV Output By Email.

    Hi !
    I wanted to ask how to send ALV output of report by email.
    I know that i have to use the fms :
    1. 'WWW_HTML_FROM_LISTOBJECT' - in order to convert the table to HTML.
    2. 'SO_NEW_DOCUMENT_ATT_SEND_API1' - in order to  send the HTML file.
    My problem is how to convert the ALV screen output to the apropriate table parameter of the function 'WWW_HTML_FROM_LISTOBJECT' to listobject type ?
    thanks
    moshe

    Hi look at the following program.
    *& Report  ZSM17_EMAIL1
    REPORT  zsm17_email.
    tables : mara.
    data: begin of it_mara occurs 0,
          matnr like  mara-matnr,
          ernam like mara-ernam,
          mtart like mara-mtart,
          matkl like mara-matkl,
          end of it_mara.
    data: begin of it_final occurs 0,
          v_string(255),
          end of it_final.
    *DATA: objpack LIKE sopcklsti1 OCCURS  2 WITH HEADER LINE,
         objhead LIKE solisti1   OCCURS  1 WITH HEADER LINE,
         objbin  LIKE solisti1   OCCURS 10 WITH HEADER LINE,
         objtxt  LIKE solisti1   OCCURS 10 WITH HEADER LINE,
         reclist LIKE somlreci1  OCCURS  5 WITH HEADER LINE.
    DATA: objpack LIKE sopcklsti1 OCCURS  0 with header line,
          objhead LIKE solisti1   OCCURS  0 WITH HEADER LINE,
          objbin  LIKE solisti1   OCCURS 0 WITH HEADER LINE,
          objtxt  LIKE solisti1   OCCURS 0 WITH HEADER LINE,
          reclist LIKE somlreci1  OCCURS  0 WITH HEADER LINE.
    data: wa_objbin like line of objbin.
    DATA: doc_chng LIKE sodocchgi1.
    DATA: tab_lines LIKE sy-tabix.
    select-options s_matnr for mara-matnr.
    *--- Selecting data from mara
    select matnr
           ernam
           mtart
           matkl
           into table it_mara
           from mara
           where matnr in s_matnr.
    if sy-subrc ne 0.
    write:/ 'no data found'.
      exit.
    else.
    loop at it_mara.
       concatenate it_mara-matnr
                   it_mara-ernam
                   it_mara-mtart
                   it_mara-matkl
         into it_final-v_string separated by '~'.
        append it_final.
        clear it_final.
    endloop.
    endif.
    Creating the document to be sent
    doc_chng-obj_name = 'TEST'.   "name of the document
    title of document or subject
    doc_chng-obj_descr = 'Test Email program'.
    body of the mail
    objtxt = 'A test report'.
    APPEND objtxt.
    objtxt = 'is enclosed as an attachment.'.
    APPEND objtxt.
    *clear objtxt.
    DESCRIBE TABLE objtxt LINES tab_lines.
    Size of SAPoffice Document (for API1)
    doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    Creating the entry for the compressed attachment
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'RAW'.
    *objpack-obj_name   = 'ATTACHMENT'.
    *objpack-obj_descr = 'Test Email Program'.
    *objpack-doc_size   = tab_lines * 255.
    APPEND objpack..
    *--- Populating the records in the attachment
    data: w_str(255) TYPE c.
    loop at it_final into wa_objbin.
    append wa_objbin to objbin.
    append objbin.
    clear wa_objbin.
    endloop.
    DESCRIBE TABLE objbin LINES tab_lines.
    tab_lines = tab_lines + 1.
    objhead = 'test_report.txt'.
    append objhead.
    Creating the entry for the compressed attachment
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 1.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'txt'.
    objpack-obj_name   = 'txt'.
    objpack-obj_descr = 'Test Email Program'.
    objpack-doc_size   = tab_lines * 255.
    APPEND objpack..
    *write:/ 'object text', objtxt.
    Entering names in the distribution list
    reclist-receiver = '[email protected]'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    Sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng
        put_in_outbox              = 'X'
        commit_work                = '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.
    CASE sy-subrc.
      WHEN 0.
        WRITE: / 'Result of the send process:'.
        LOOP AT reclist.
          WRITE:  reclist-receiver(48), ':'.
          IF reclist-retrn_code = 0.
            WRITE 'sent successfully'.
          ELSE.
            WRITE 'not sent'.
          ENDIF.
        ENDLOOP.
       loop at objbin.
         write: objbin-line.
       endloop.
      WHEN 1.
        WRITE: / 'no authorization to send to the specified number of' .
        "'recipients!'.
      WHEN 2.
        WRITE: / 'document could not be sent to any of the recipients!'.
      WHEN 4.
        WRITE: / 'no authorization to send !'.
      WHEN OTHERS.
        WRITE: / 'error occurred during sending !'.
    ENDCASE.

  • SAVE Layout Option in ALV list Report

    Hi Experts,
    Is it possible to SAVE the layout option for Block ALV list Reports?
    Thanks in Advance,
    Sivak.

    Hi,
    It is not possible to save layout in BLock ALV display but possible to change layout. There is no parameter to save. It is not possible to store the layout as it has several structure.
    Thanks & Regards
    Rocky

  • How can we generate the reports in html or text file formats?

    Hi,
    Is there any package that can help in creating HTMLDB reports in .txt files or .html files? (Similar to TEXT_IO in Oracle Forms)
    How can we generate the reports in html or text file formats from HTMLDB?
    Thanks in Advance
    Renjith

    Hello all.
    Bi Publisher is great, but has a very high price tag. It's even more expensive than Forms & Reports Services. We are considering APEX to replace Forms & Reports on the web, but the reporting limitations are still a problem.
    I wonder if there is another option.
    Thanks

  • Font is small while printing alv list report

    Hi,
    while printing ALV list report font is too small, can you tell me where i can increase the font size. I tried in GUI font ,In which i can increase the font for GUI, not for ALV priniting . Can any body help me to solve this problem?
    Regards,
    siva kumar

    HI Kushboo,
    I think You are talking about header text in ALV , while printing ALV list i need to increase all the font size.. In fieldcatlog there is no option called Style...for increasing ALV font line item details. Can you tell me which style you are talking about?
    Regards,
    siva kumar

  • Create Change Layout in ALV list report

    Hi,
    i have create my own change layout button at my alv list report, my problem is i don't know what coding can be used to activate the change layout function in my own button. Who have sample programming for this function please share it....
    tq.

    Hi,
    By default if you're using the ALV List Display function module, there's no need for you to code the 'Change Layout' function, the standard function will be there, unless there's something you want and the standard 'Change Layout' function could not provide.
    Go to Abap Editor and look for program with 'BALV*'. You'll get a whole list of DEMO program on ALV.

  • Editable column in ALV list report

    Hi,
    I  developed a ALV list block report. I want to make some of column editable in my alv list report.I set WA_FIELDCAT-EDIT     = 'X' in fieldcatalog but it's not working.
    Could you please sugest.
    Regards,
    Mohit

    Hi Mohit ,
    please  check WA_FIELDCAT-EDIT = 'X'    fieldcat which you are passing to ALV grid function module is same  or different  .
    or use in this way
    perform get_fieldcat using  'QUANTITY'     'Enter.Qty'               12 'R' 'N' '000' 'N' 'N' 'N' 'N'  'N' 'N' .
    get_fieldcat  using   p_fieldname
                                p_txtname
                                p_length
                                p_justfy
                                p_keyfld
                                p_color
                                p_hotspt
                                p_total
                                p_sort
                                p_subtot
                                p_para1
                                p_zero .
      clear ms_fieldcat .
      ms_fieldcat-fieldname = p_fieldname .
      ms_fieldcat-seltext_l = p_txtname   .
      ms_fieldcat-ddictxt   = 'L'         .
      ms_fieldcat-outputlen = p_length    .
      ms_fieldcat-just      = p_justfy    .
      ms_fieldcat-lzero     = 'X'         .
      ms_fieldcat-checkbox = 'X'          .
      ms_fieldcat-edit     = 'X'          .
      if p_fieldname = 'CHK' .
        ms_fieldcat-checkbox = 'X'.
        ms_fieldcat-edit = 'X'.
      else.
        ms_fieldcat-checkbox = ' '.
        ms_fieldcat-edit = ' '.
      endif.
      if p_fieldname = 'QUANTITY' .
        ms_fieldcat-edit = 'X'.
      endif.
    regards
    Deepak.

  • Issue Regarding ALV List Report

    Hi,
    I have prepared a ALV List report.
    I have made use of <b>REUSE_ALV_LIST_DISPLAY</b>.
    I have put a <b>check box</b> in the output at the begining of every Record.
    Now what i want is to put a <b>SELECT ALL</b> & <b>DESELECT ALL Buttons</b> on Application Tool Bar & If i hit on them i should be able to <b>SELECT & DE-SELECT</b> all the <b>Records/Check Boxes</b> in the output.
    Can anybody tell me the logic for both <b><b>SELECT & DE-SELECT</b></b> functionalities.
    Thanks in advance.
    Thanks & Regards,
    Prasad.
    <b></b>

    Hi,
    <b>Call to F.M is as below:</b>
    FORM f_display_alv_report .
      DATA: l_valid,
            l_params LIKE pri_params.
      SET PF-STATUS c_alv.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          mode           = 'BATCH'
          report         = v_repid
          no_dialog      = c_x
        IMPORTING
          out_parameters = l_params
          valid          = l_valid.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = v_repid
          i_callback_user_command  = c_command
          i_callback_pf_status_set = c_alv
          is_layout                = i_gd_layout
          it_fieldcat              = i_fieldcatalog[]
          it_events                = i_events
          is_print                 = i_params
          i_save                   = c_x
        TABLES
          t_outtab                 = i_display_data
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " f_display_alv_report
    <b>Then User Command Call is as below:</b>
    FORM f_user_command USING p_ucomm    LIKE sy-ucomm
                              p_selfield TYPE slis_selfield.
      CLEAR:  v_field, v_index, v_line, v_value.
      IF p_ucomm EQ c_select.
        LOOP AT i_display_data.
          i_display_data-selected = c_x.
          MODIFY i_display_data TRANSPORTING selected.
          CLEAR i_display_data.
        ENDLOOP.
      ELSEIF p_ucomm EQ c_deselect.
        LOOP AT i_display_data.
          i_display_data-selected = space.
          MODIFY i_display_data TRANSPORTING selected.
          CLEAR i_display_data.
        ENDLOOP.
      ENDIF.
    Get cursor field, value and Line
      GET CURSOR FIELD  v_field
                 VALUE  v_value
                 LINE   v_line.
      v_line = v_line - 3.
      CLEAR: i_display_data,
             i_mem,
             v_mem_kschl,
             v_mem_printer,
             v_ucomm,
             v_mem_print.
      REFRESH: i_mem.
      LOOP AT i_display_data
              WHERE selected EQ c_x.
        i_mem-v_mem_vbeln   = i_display_data-vbeln.
        i_mem-v_mem_posnr   = i_display_data-posnr.
        APPEND i_mem.
        CLEAR i_mem.
      ENDLOOP.
    READ TABLE i_display_data INDEX v_line.
      IF sy-subrc EQ 0.
        v_mem_kschl   = p_kschl.
        v_mem_printer = p_print.
        v_ucomm       = sy-ucomm.
        EXPORT i_mem         TO MEMORY ID 'MEM'.
        EXPORT v_mem_kschl   TO MEMORY ID 'KSCHL'.
        EXPORT v_mem_printer TO MEMORY ID 'PRINTE'.
        EXPORT v_ucomm       TO MEMORY ID 'UCOM'.
      ENDIF.
      CASE p_ucomm.
    To Print SAP Script Output
        WHEN c_print.
          v_mem_print = c_x.
          EXPORT v_mem_print TO MEMORY ID 'PRINT'.
          v_return_code = c_999.
          v_screen      = c_x.
          IF ( v_field EQ c_mark     OR
               v_field EQ c_selected OR
               v_field EQ c_vbeln    OR
               v_field EQ c_posnr    OR
               v_field EQ c_kschl )  AND
               NOT v_value IS INITIAL.
            PERFORM f_entry IN PROGRAM zasdf0012_sales_order
                    USING v_return_code v_screen.
          ENDIF.
    Display SAP Script Output
        WHEN c_pripreview.
          v_return_code = c_999.
          v_screen      = c_x.
          IF ( v_field EQ c_mark     OR
               v_field EQ c_selected OR
               v_field EQ c_vbeln    OR
               v_field EQ c_posnr    OR
               v_field EQ c_kschl )  AND
               NOT v_value IS INITIAL.
            PERFORM f_entry IN PROGRAM zasdf0012_sales_order
                    USING v_return_code v_screen.
          ENDIF.
        WHEN c_back.
          BACK.
        WHEN c_exit.
          CALL METHOD cl_gui_cfw=>flush.
          LEAVE TO SCREEN 0.
        WHEN c_cancel.
          CALL METHOD cl_gui_cfw=>flush.
          LEAVE TO SCREEN 0.
        WHEN c_others.
      ENDCASE.
    ENDFORM.                               " F_USER_COMMAND
    <b>The Field Catalog Build up is :</b>
      i_fieldcatalog-fieldname   = 'KSCHL'.
      i_fieldcatalog-tabname     = 'I_DISPLAY_DATA'.
      i_fieldcatalog-seltext_m   = 'Output Type'.
      i_fieldcatalog-col_pos     = 1.
      i_fieldcatalog-outputlen   = 11.
      APPEND i_fieldcatalog.
      CLEAR i_fieldcatalog.
      i_fieldcatalog-fieldname   = 'VBELN'.
      i_fieldcatalog-tabname     = 'I_DISPLAY_DATA'.
      i_fieldcatalog-seltext_m   = 'Sales Document No'.
      i_fieldcatalog-col_pos     = 2.
      i_fieldcatalog-outputlen   = 17.
      APPEND i_fieldcatalog.
      CLEAR i_fieldcatalog.
      i_fieldcatalog-fieldname   = 'POSNR'.
      i_fieldcatalog-tabname     = 'I_DISPLAY_DATA'.
      i_fieldcatalog-seltext_m   = 'Sales Item No'.
      i_fieldcatalog-col_pos     = 3.
      i_fieldcatalog-outputlen   = 14.
      APPEND i_fieldcatalog.
      CLEAR i_fieldcatalog.
    <b>Events Build Up:</b>
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = i_events.
      READ TABLE i_events
           INTO wa_events
           WITH KEY name = slis_ev_top_of_page.
      IF sy-subrc = 0.
        MOVE c_top_of_page TO wa_events-form.
        MODIFY i_events FROM wa_events INDEX sy-tabix.
      ENDIF.
      READ TABLE i_events WITH KEY name = c_user_command
                          INTO wa_events.
      IF sy-subrc = 0.
        MOVE c_command    TO wa_events-form.
        MODIFY i_events FROM  wa_events INDEX sy-tabix.
      ENDIF.
    <b>Layout Buil up is as:</b>
      i_gd_layout-no_input          = space.
      i_gd_layout-colwidth_optimize = c_x.
      i_gd_layout-totals_text       = 'Totals'(201).            "#EC *
      i_gd_layout-box_fieldname     = 'SELECTED'.
      i_gd_layout-box_tabname       = 'I_DISPLAY_DATA'.
      i_gd_layout-edit              = c_x.
    Here one thing we need to take care id i am combining Check Box with & another field Output Type [KSCHL] like in Std. TCode VL71.
    Can anybody solve this issue!
    Thanks for reply.
    Thanks & Regards,
    Prasad.

  • Keeping alv list  report layout

    when i run my alv list report using the saved layout and then change the layout of the report and then go into one of the items, i want the report to keep the changed layout when i save and go back to the report. at the moment its reverting back to the standard layout when go out of the transaction

    Make the Default Layout as your Changed Layout it'll work. It Can be done in the properties i guess.
    Regards,
    Sai

Maybe you are looking for