How to display 2 internal tablea in one report

hi
experts can u help me for this

suppose you are using 2 tables mara and marc
move the data into 2 internal tables i_mara and i_marc.
then move the data into i_out.
write the data of i_out.
see this code for data from 4 tables
REPORT  YSG_MATSTKREPT LINE-SIZE 125.
                         LINE-COUNT 50(5).
*&                       DATA DECLARATION                              *
TABLES: MARA,              "GENERAL MASTER DATA
        MARC,              "PLANT DATA FOR MATERIAL
        MARD,              "STORAGE LOCATION DATA FOR MATERIAL
        MAKT.              "MATERIAL DESCRIPTION
DATA: BEGIN OF I_MARA OCCURS 0,
           MATNR LIKE MARA-MATNR,"MATERIAL NUMBER
      END OF I_MARA.
DATA: BEGIN OF I_MARC OCCURS 0,
          MATNR LIKE MARC-MATNR,"MATERIAL NUMBER
          WERKS LIKE MARC-WERKS,"PLANT
      END OF I_MARC.
DATA: BEGIN OF I_MAKT OCCURS 0,
           MATNR LIKE MAKT-MATNR,"MATERIAL NUMBER
           MAKTX LIKE MAKT-MAKTX,"MATERIAL DESCRIPTION
      END OF I_MAKT.
DATA: BEGIN OF I_MARD OCCURS 0,
           MATNR LIKE MARD-MATNR,"MATERIAL NUMBER
           WERKS LIKE MARD-WERKS,"PLANT
           LGORT LIKE MARD-LGORT,"STORAGE LOCATION
           LABST LIKE MARD-LABST,"VALUATED STOCK WITH UNRESTRICTED USE
      END OF I_MARD.
DATA: BEGIN OF I_OUT OCCURS 0,
        MATNR LIKE MARC-MATNR,
        WERKS LIKE MARC-WERKS,
        MAKTX LIKE MAKT-MAKTX,
        LGORT LIKE MARD-LGORT,
        LABST LIKE MARD-LABST,
      END OF I_OUT.
DATA : TOT TYPE I, " TOT - TOTAL STOCK
       PLSTK TYPE I, " PLSTK - PLZNT WISE STOCK
       X TYPE C. "FLAG
*&                   S E L E C T I O N - S C R E E N                   *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR .
SELECTION-SCREEN END OF BLOCK B1.
**&                  I N I T I A L I Z A T I O N                      *
*INITIALIZATION.
S_MATNR-SIGN = 'I'.
S_MATNR-OPTION = 'EQ'.
S_MATNR-LOW = 'M-12'.
S_MATNR-HIGH = 'M-18'.
*&             S T A R T - O F - S E L E C T I O N                     *
START-OF-SELECTION.
SELECT MATNR WERKS FROM MARC
                      INTO TABLE I_MARC
                      WHERE MATNR IN S_MATNR .
SELECT MATNR WERKS LGORT LABST FROM MARD
                      INTO TABLE  I_MARD
                      FOR ALL ENTRIES IN I_MARC
                      WHERE MATNR = I_MARC-MATNR
                      AND WERKS = I_MARC-WERKS.
SELECT MATNR MAKTX FROM MAKT INTO TABLE I_MAKT
                      FOR ALL ENTRIES IN I_MARC
                      WHERE MATNR = I_MARC-MATNR.
  LOOP AT I_MARC.
    MOVE I_MARC-MATNR TO I_OUT-MATNR.
    MOVE I_MARC-WERKS TO I_OUT-WERKS.
    READ TABLE I_MAKT WITH KEY MATNR = I_MARD-MATNR.
    MOVE I_MAKT-MAKTX TO I_OUT-MAKTX.
  LOOP AT I_MARD WHERE MATNR = I_MARC-MATNR
                     AND WERKS = I_MARC-WERKS.
      MOVE I_MARD-LGORT TO I_OUT-LGORT.
      MOVE I_MARD-LABST TO I_OUT-LABST.
      APPEND I_OUT.
    ENDLOOP.
    CLEAR I_OUT.
  ENDLOOP.
*&                  T O P - O F - P A G E                              *
TOP-OF-PAGE.
  WRITE:/ 'DATE:' ,SY-DATUM.
  FORMAT COLOR 4 INTENSIFIED OFF.
  WRITE:/2 'PLANT',
         9 'STG.LOC',
        20 'MATERIAL.NO.',
        55 'DESCRIPTION',
        88 'STOCK'.
*&                  E N D - O F - P A G E                              *
END-OF-PAGE.
  WRITE: / SY-ULINE,
         /100 'PAGNO: ',SY-PAGNO,
         SY-ULINE.
*&        E N D -- O F --  S E L E C T I O N                           *
END-OF-SELECTION.
SORT I_OUT ASCENDING BY WERKS LGORT.
  LOOP AT I_OUT.
    WRITE:/    SY-ULINE,SY-VLINE,
               I_OUT-WERKS,SY-VLINE,
               I_OUT-LGORT,SY-VLINE,
               I_OUT-MATNR,SY-VLINE,
               I_OUT-MAKTX,SY-VLINE.
               AT END OF LABST.
               WRITE: I_OUT-LABST,SY-VLINE.
               ENDAT.
    TOT = TOT + I_OUT-LABST.
    AT END OF LABST.
    WRITE : TOT, SY-VLINE.
    ENDAT.
*AT END OF WERKS.
*NEW-PAGE.
*ENDAT.
    AT LAST.
    FORMAT COLOR 7 INTENSIFIED OFF.
    WRITE : /87 'TOTAL STOCK = ',TOT.
    ENDAT.
  ENDLOOP.
regards,
srinivas

Similar Messages

  • How to display internal table content to table control

    hi experts
            I am very new to dialog programming
            I have the Internal table in a report program containing data that needs to be displayed in table  control.
          Can you explain in step by step.
         Thanks in advance.
    Regards
    Rajaram

    Hi Raja
    Dialog-driven programs, or any program started using a transaction code, are known as SAP transactions, or just transactions. The term "transaction" is used in several different contexts in the IT world. In OLTP (Online Transaction Processing), where several users are working in one system in dialog mode, the term "transaction" stands for a user request. In conjunction with database updates, it means a change in state in the database.
    Programs with type M can only be started using a transaction code, in which an initial screen is defined. Programs with type 1 can be started either using a transaction code, or by entering the program name in one of the transactions SE38 or SA38. Screens call dialog modules in the associated ABAP program from their flow logic. Type M programs serve principally as containers for dialog modules, and are therefore known as module pools. Type 1 programs, or function modules can also switch to dialog mode by calling screens using the CALL SCREEN statement. The program code of the corresponding executable program or function pool must then contain the corresponding dialog modules.
    Programs that are partially or wholly dialog-driven cannot be executed in the background. They are therefore sometimes referred to as dialog programs.
    <u><b>Transaction code</b></u>
    The transaction code starts a screen sequence. You create transaction codes in the Repository Browser in the ABAP Workbench or using Transaction SE93. A transaction code is linked to an ABAP program and an initial screen. As well as using a transaction code, you can start a screen sequence from any ABAP program using the CALL SCREEN statement.
    <u><b>Screens</b></u>
    Each dialog in an SAP system is controlled by one or more screens. These screens consist of a screen mask and its flow logic. Since the flow logic influences the program flow, screens are sometimes referred to as "dynamic programs". You create screens using the Screen Painter in the ABAP Workbench. Each screen belongs to an ABAP program.
    The screen has a layout that determines the positions of input/output fields and other graphical elements such as checkboxes and radio buttons. The flow logic consists of two parts:
    Process Before Output (PBO). This defines the processing that takes place before the screen is displayed.
    Process After Input (PAI). This defines the processing that takes place after the user has chosen a function on the screen.
    All of the screens that you call within an ABAP program must belong to that program. The screens belonging to a program are numbered. For each screen, the system stores the number of the screen which is normally displayed next. This screen sequence can be either linear or cyclic. From within a screen chain, you can even call another screen chain and, after processing it, return to the original chain. You can also override the statically-defined next screen from within the dialog modules of the ABAP program.
    <u><b>GUI status</b></u>
    Each screen has a GUI status. This controls the menu bars, standard toolbar, and application toolbar, with which the user can choose functions in the application. Like screens, GUI statuses are independent components of an ABAP program. You create them in the ABAP Workbench using the Menu Painter.
    <b><u>ABAP Program</u></b>
    Each screen and GUI status in the R/3 System belongs to one ABAP program. The ABAP program contains the dialog modules that are called by the screen flow logic, and also process the user input from the GUI status. ABAP programs that use screens are also known as dialog programs. In a module pool (type M program); the first processing block to be called is always a dialog module. However, you can also use screens in other ABAP programs, such as executable programs or function modules. The first processing block is then called differently; for example, by the runtime environment or a procedure call. The screen sequence is then started using the CALL SCREEN statement.
    Dialog modules are split into PBO modules and PAI modules. Dialog modules called in the PBO event are used to prepare the screen, for example by setting context-specific field contents or by suppressing fields from the display that are not needed. Dialog modules called in the PAI event are used to check the user input and to trigger appropriate dialog steps, such as the update task.
    <b><u>Passing Data Between ABAP Programs and Screens</u></b>
    How are fields from ABAP programs displayed on the screen? And how is user input on the screen passed back to the ABAP program? Unlike in list programming, you cannot write field data to the screen using the WRITE statement. Instead, the system transfers the data by comparing the names of screen fields with the names of the ABAP fields in the program. If it finds a pair of matching names, the data is transferred between the screen and the ABAP program. This happens immediately before and immediately after displaying the screen.
    <u><b>
    Field Attributes</b></u>
    For all screen fields of a dialog screen, field attributes are defined in the Screen Painter. If a field name in the screen corresponds to the name of an ABAP Dictionary field, the system automatically establishes a reference between these two fields. Thus, a large number of field attributes for the screen are automatically copied from the ABAP Dictionary. The field attributes together with data element and domain of the assigned Dictionary field form the basis for the standard functions the screen executes in a dialog (automatic format check for screen fields, automatic value range check, online help, and so on).
    <u><b>Error Dialogs</b></u>
    Another task of the screen processor is to conduct error dialogs. Checking the input data is carried out either automatically using check tables of the ABAP Dictionary or by the ABAP program itself. The screen processor includes the error message into the received screen and returns the screen to the user. The message may be context-sensitive, that is, the system replaces placeholders in the message text with current field contents. In addition, only fields whose contents is related to the error and for which a correction may solve the error can accept input. See also Messages on Screens.
    <b>
    <u>Data Consistency</b></u>
    To keep data consistent within complex applications, ABAP offers techniques for optimizing database updates that operate independent of the underlying database and correspond to the special requests of dialog programming. See also Programming Database Updates.
    TRANSACTION CODES
    MENU PAINTER : SE 41.
    SCREEN PAINTER : SE 51 .
    BOTH : SE 80 .
    &#61672; ONLY EXISTING PROGRAMS CAN BE VIEWED IN SE 41 , SO USE SE 38 .
    CONCEPT :
    STEPS :
    1. GIVE TRANSACTION CODE SE 38 , CREATE A REPORT NAMED
    " ZVRPRDIALOGTEST2 " . SAVE , CHECK , ACTIVATE IT .
    2. THEN GIVE CODE SE 51. GIVE SAME PROGRAM NAME AS SE38 .
    GIVE SCREEN NUMBER , PRESS CREATE .
    3. GIVE SHORT DESCRIPTION . THEN CLICK ELEMENT LIST .
    4. THE SCREEN COMES , TYPE " OKCODE " .
    5. CLICK FLOW LOGIC , THE SCREEN COMES .
    6. one screen will come.
    7. SAVE . CHECK , ACTIVATE .
    8. CLICK LAYOUT . SCREN PAINTER SCREEN COMES .
    9. PRESS " F6 " . TYPE TABLE NAME , PRESS ENTER . THE SCREEN COMES .
    10 . TO SELECT THE DESIRED FIELDS , CLICK THE " TO SELECT " AREA IN
    EACH ROW , PRESS ENTER .
    11 . AFTER CLICKING , PRESS ENTER .
    12. THE FINAL SELECTION WIL COME
    13 . GIVE THE NESSARY BUTTONS IN THE SCREEN PAINTER .
    14 . DOUBLE CLICK IN EACH BUTTON GIVE LABLE , FUNCTION CODE .
    15 . THE FINAL SCREEN WIL COME
    16 . SAVE . CHECK .ACTIVATE. TO CHECK SCREEN PRESS F8.
    17 . TO WRITE CODING : PRESS FLOW LOGIG .
    18 . THE SCREEN COMES .
    19 . DOUBLE CLICK FIRST EVENT ( MODULE STATUS _ 3000 ).
    20 . PBO MODULE WINDOW COMES , PRESS TICK MARK .
    21 . EDITOR COMES . SAVE .
    TYPING PROGRAM IN THE EDITOR
    Steps :
    THE EDITOR WILL BE AS SHOWN ABOVE , NOW TYPE THE FOLLOWING CODE .
    NOTE :
    BEFORE TYPING CODE : TAKE COMMENTS FROM , THEN TYPE LIKE :
    SET PF_STATUS ' PRSTATUS '
    SET TITLEBAR 'PRTITLE' .
    *& Module STATUS_3000 OUTPUT
    * text
    TABLES : ZVTIKFS.
    DATA BEGIN OF INT_TAB OCCURS 0.
    INCLUDE STRUCTURE ZVTIKFS.
    DATA END OF INT_TAB.
    DATA OKCODE LIKE SY-UCOMM.
    DATA INDEX TYPE I VALUE 1.
    * MODULE STATUS_3000 OUTPUT *
    MODULE STATUS_3000 OUTPUT.
    SET PF-STATUS 'PRSTATUS'. "COMMENTS TOOK
    SET TITLEBAR 'PRTITLE1'. " COMMENTS TOOK
    SELECT * FROM ZVTIKFS INTO TABLE INT_TAB.
    READ TABLE INT_TAB INDEX INDEX.
    ZVTIKFS-NAME = INT_TAB-NAME.
    ZVTIKFS-ADDRESS = INT_TAB-ADDRESS.
    ZVTIKFS-PHONE = INT_TAB-PHONE.
    ZVTIKFS-AREA = INT_TAB-AREA.
    ENDMODULE. " STATUS_3000 OUTPUT
    *& Module USER_COMMAND_3000 INPUT
    * text
    MODULE USER_COMMAND_3000 INPUT.
    CASE OKCODE.
    WHEN 'INS'.
    INSERT ZVTIKFS.
    WHEN 'DEL'.
    DELETE ZVTIKFS.
    WHEN 'PRE'.
    INDEX = INDEX - 1.
    IF INDEX < 1.
    INDEX = 1.
    ENDIF.
    WHEN 'NEX'.
    INDEX = INDEX + 1.
    IF INDEX > SY-DBCNT.
    INDEX = SY-DBCNT.
    ENDIF.
    WHEN 'EXI'.
    LEAVE PROGRAM.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_3000 INPUT
    NEXT :
    SAVE , CHECK , ACTIVATE .
    TO COME TO DESIGN MENU
    <b>STEPS :</b>
    1 . TRANSACTION CODE : SE 80 . OBJECT NAVIGATOR WINDOW COMES .
    NOTE : IF YOUR REOORT DOSENOT COME DO THE FOLLOWING PROCESS
    <u><b>Vey useful link:</b></u>http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
    <u><b>Other links:</b></u>
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb2d40358411d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/10/e7dbde82ba11d295a40000e8353423/content.htm
    <u><b>For Screens</b></u>
    http://help.sap.com/saphelp_47x200/helpdata/en/e4/2adbef449911d1949c0000e8353423/content.htm
    <u><b>Screen elements</b></u>
    http://help.sap.com/saphelp_47x200/helpdata/en/47/e07f5f2b9911d2954f0000e8353423/content.htm
    <u><b>Processing Screens</b></u>
    http://help.sap.com/saphelp_47x200/helpdata/en/47/e07f682b9911d2954f0000e8353423/content.htm
    <u><b>Complex Screen elements</b></u>
    http://help.sap.com/saphelp_47x200/helpdata/en/fd/02da2a61d811d295750000e8353423/content.htm
    <b><u>DIALOG Programming</u></b>
    http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://www.sap-img.com/
    http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
    http://www.sapgenie.com/links/abap.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
    http://www.allsaplinks.com/dialog_programming.html
    http://sap.mis.cmich.edu/sap-abap/abap09/
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
    http://sap.mis.cmich.edu/abap-00/
    http://www.allsaplinks.com/files/using_table_in_screen.pdf
    http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
    http://www.sapgenie.com/links/abap.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://help.sap.com
    http://www.sapgenie.com/abap/example_code.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
    http://www.allsaplinks.com/dialog_programming.html
    http://www.sapbrain.com/TUTORIALS/default.html
    http://www.sappoint.com/abap/spmp.pdf
    http://sappoint.com/abap.html
    http://www.sap-img.com/abap.htm
    http://sap.ittoolbox.com/code/archives.asp?i=10&t=450&a=t
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://www.sap-img.com/abap/
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://www.sap-img.com/
    http://www.sappoint.com/faq/faqdiapr.pdf
    http://www.allsaplinks.com/dialog_programming.html
    Reward all helpfull answers
    Regards
    Pavan

  • How to display Internal Table in ALV?

    Hi all,
    can anyone teach me the simple way to insert my internal table records to ALV by providing me the sample codes from the start of declaration to the end? Below is how i define my internal table:
    DATA: DOM_NAME(40) TYPE C,
           P_TABLE(40) TYPE C.
    TYPES: BEGIN OF ITAB6,
           FIELDNAME TYPE DD03M-FIELDNAME,
    END OF ITAB6.
    P_TABLE = 'ABC'
    DOM_NAME = 'TRY'
    DATA: ITAB6 TYPE STANDARD TABLE OF ITAB6 WITH HEADER LINE.
        SELECT FIELDNAME FROM DD03M INTO TABLE ITAB6 WHERE TABNAME = P_TABLE AND
        DOMNAME = DOM_NAME.
    Hope that anyone can just start the part of alv from the continuation of my codes. cus i went through others thread but it seem to be confusing me. thx! hope to get replies asap.

    hai
    copy this program and past in to the wk bench....(se38)
    thn execute  it...
    REPORT ZALVTEST2_RNJ .
    *ABAP LIST VIEWER
    This is a basic ALV with the followings:-
    - Page Heading
    - Page No
    - Sub-Total
    - Grand Total
    *REPORT ZALV.
    TYPE-POOLS: SLIS.
    DATA: G_REPID LIKE SY-REPID,
    GS_PRINT            TYPE SLIS_PRINT_ALV,
    GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
    GT_EVENTS           TYPE SLIS_T_EVENT,
    GT_SORT             TYPE SLIS_T_SORTINFO_ALV,
    GS_LAYOUT           TYPE SLIS_LAYOUT_ALV,
    GT_FIELDCAT         TYPE SLIS_T_FIELDCAT_ALV,
    FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
    COL_POS TYPE I.
    DATA: BEGIN OF ITAB,
      FIELD1(5) TYPE C,
      FIELD2(5) TYPE C,
      FIELD3(5) TYPE P DECIMALS 2,
    END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0.
      INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB1.
    DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
      INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB_FIELDCAT.
    Print Parameters
    PARAMETERS:
                P_PRINT  AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
                P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
                P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
                P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
                P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
                P_RESERV TYPE I.                  "NO OF FOOTER LINE
    INITIALIZATION.
    G_REPID = SY-REPID.
    PERFORM PRINT_BUILD    USING GS_PRINT.      "Print PARAMETERS
    START-OF-SELECTION.
    TEST DATA
    MOVE 'TEST1' TO ITAB1-FIELD1.
    MOVE 'TEST1' TO ITAB1-FIELD2.
    MOVE '10.00' TO ITAB1-FIELD3.
    APPEND ITAB1.
    MOVE 'TEST2' TO ITAB1-FIELD1.
    MOVE 'TEST2' TO ITAB1-FIELD2.
    MOVE '20.00' TO ITAB1-FIELD3.
    APPEND ITAB1.
    DO 50 TIMES.
      APPEND ITAB1.
    ENDDO.
    END-OF-SELECTION.
    PERFORM BUILD.
    PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
    PERFORM COMMENT_BUILD  CHANGING GT_LIST_TOP_OF_PAGE.
    PERFORM CALL_ALV.
    FORM BUILD.
    DATA FIELD CATALOG
    Explain Field Description to ALV
    DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME = 'FIELD1'.
    FIELDCAT_LN-TABNAME   = 'ITAB1'.
    *FIELDCAT_LN-NO_OUT    = 'X'.  "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
    FIELDCAT_LN-KEY       = ' '.   "SUBTOTAL KEY
    FIELDCAT_LN-NO_OUT    = ' '.
    FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME = 'FIELD2'.
    FIELDCAT_LN-TABNAME   = 'ITAB1'.
    FIELDCAT_LN-NO_OUT    = 'X'.
    FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME     = 'FIELD3'.
    FIELDCAT_LN-TABNAME       = 'ITAB1'.
    FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
    FIELDCAT_LN-REF_TABNAME   = 'MSEG'.  "<- REF TABLE IN THE DICTIONNARY
    FIELDCAT_LN-NO_OUT        = ' '.
    FIELDCAT_LN-DO_SUM        = 'X'.   "SUM UPON DISPLAY
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    DATA SORTING AND SUBTOTAL
    DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD1'.
    GS_SORT-SPOS      = 1.
    GS_SORT-UP        = 'X'.
    GS_SORT-SUBTOT    = 'X'.
    APPEND GS_SORT TO GT_SORT.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD2'.
    GS_SORT-SPOS      = 2.
    GS_SORT-UP        = 'X'.
    *GS_SORT-SUBTOT    = 'X'.
    APPEND GS_SORT TO GT_SORT.
    ENDFORM.
    FORM CALL_ALV.
    ABAP List Viewer
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = G_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_STRUCTURE_NAME = 'ITAB1'
    IS_LAYOUT =  GS_LAYOUT
    IT_FIELDCAT = GT_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
      IT_SORT = GT_SORT[]
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
      IT_EVENTS = GT_EVENTS[]
    IT_EVENT_EXIT =
      IS_PRINT = GS_PRINT
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB = ITAB1
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2.
    ENDFORM.
    HEADER FORM
    FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
    CONSTANTS:
    GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    *GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = LT_EVENTS.
      READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO LT_EVENTS.
      ENDIF.
    define END_OF_PAGE event
    READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_END_OF_PAGE
                             INTO LS_EVENT.
    IF SY-SUBRC = 0.
      MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
      APPEND LS_EVENT TO LT_EVENTS.
    ENDIF.
    ENDFORM.
    FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      DATA: GS_LINE TYPE SLIS_LISTHEADER.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'H'.
      GS_LINE-INFO = 'HEADER 1'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'S'.
      GS_LINE-KEY  = 'STATUS 1'.
      GS_LINE-INFO = 'INFO 1'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      GS_LINE-KEY  = 'STATUS 2'.
      GS_LINE-INFO = 'INFO 2'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
    CLEAR GS_LINE.
    GS_LINE-TYP  = 'A'.
    GS_LINE-INFO = 'ACTION'.
    APPEND GS_LINE TO  GT_TOP_OF_PAGE.
    ENDFORM.
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
      WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
    ENDFORM.
    FORM END_OF_PAGE.
      WRITE at (sy-linsz) sy-pagno CENTERED.
    ENDFORM.
    PRINT SETTINGS
    FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
      LS_PRINT-PRINT              = P_PRINT.  "PRINT IMMEDIATE
      LS_PRINT-NO_PRINT_SELINFOS  = P_NOSINF. "NO SELECTION INFO
      LS_PRINT-NO_COVERPAGE       = P_NOCOVE. "NO COVER PAGE
      LS_PRINT-NO_NEW_PAGE        = P_NONEWP.
      LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
      LS_PRINT-RESERVE_LINES      = P_RESERV.
    ENDFORM.
    *END OF ZALV PROGRAM
    regard
    nawa

  • How to display mutpliple components of one report in SharePoint webparts?

    Our customer requires flexible report layouts in SharePoint. For example, if we create a PivotTable, a PivotChart and a filter in Excel, then these three elements should be made available as separate webparts so they can be placed anywhere on the SharePoint
    page, e.g. the filter should be placed into an area which only opens on demand. The different webparts that make up the one report should still interact of course.
    Another demand is to export certain parameters, e.g. the name of a dimension, and again make that option available in the form of a webpart, so the end user is able to select from a preset list of dimensions.
    I am unsure if any of this is at all possible, since I have worked with rather "plain" Report Services reports and some Excel Services (w/o PowerView) reports in the past. I am thankful for any hints concerning such customizations, whatever the
    technology may be (must stay in the MS BI world of course). Even implementing custom webparts that somehow communicate with SSAS (using Reports Services web service maybe?) would be an option if everything else fails.

    Hi timvdh,
    As per my understanding, you are creating a PivotTable, a PivotChart and a filter using the same AS cube in three Excel files. You want to select some parameters in the filter, then PivotTable and PivotChart can be updated based on the filter.
    If in this scenario, I suggest you can open the PivotTable Excel file, then add the same filter in the PivotTable, and then create the same PivotChart based on the PivotTable. In this way, the data in PivotTable and PivotChart can be updated based on the
    filter, all components in the same excel file. Then add an Excel Web Access Web Part in a SharePoint page, upload this excel file to the web part.
    Reference:
    Display a workbook in an Excel Web Access Web Part
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to display a value of one report in another report in obiee 11G

    Hi,
    I have Requirement, I created one report in that i have a columns Rank, Net price, list price and ..., so in prompt i have rank column and year column so if i enter rank as 5 and year it shows me top 5 ranks with net prices according to selected year in prompt, now i did a grand total on rank column to get total sum on net price, i got $12345 value for net price column . Now I created another report in this it shows sum of total year for net price with value $1234567, this value i got when i selected year 2011 in prompt i.e same prompt . Both this reports have same prompt in section 1 Prompt and in section 2 this two reports. Now i need to Display a pie chart with this two total values coming from two different reports in same pie chart. but i can't display both columns on same report. please help me
    Thanks,
    Pankaj
    Edited by: Pankaj on Apr 2, 2012 4:20 PM

    Any Help Guys..

  • How to display internal table or DDIC data into Form

    Hi
         can anybody help me that how can i show the field data from internal table or DDIC into SAPscript form.
    Pls let me know the example of both se38 code and text element screen.

    Why cant u refer a standard sapscript program.
    refer form RVORDER01
    in SE38 refer program RVADOR01
    Thi sis simple example.
    DATA: IT_INVOICEDETAIL LIKE TABLE OF ZINVOICEDETAIL WITH HEADER LINE.
    DATA: TOTAL LIKE ZINVOICEDETAIL-AMOUNT,
          CARRY LIKE ZINVOICEDETAIL-AMOUNT.
    SELECT * FROM ZINVOICEDETAIL INTO TABLE IT_INVOICEDETAIL.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
       FORM                              = 'ZDEMO1'.
       CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'HEAD'
      FUNCTION                       = 'SET'
       TYPE                           = 'TOP'
       WINDOW                         = 'MAIN'.
    LOOP AT IT_INVOICEDETAIL.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'BOX'
       WINDOW                         = 'MAIN'.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'ITEM'
       WINDOW                         = 'MAIN'.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'SUMMARY'
      FUNCTION                       = 'SET'
       TYPE                           = 'BOTTOM'
       WINDOW                         = 'MAIN'.
    ENDLOOP.
    CALL FUNCTION 'CLOSE_FORM'.
    In SE71 form u have to create the text element.
    BOX, ITEM,SUMMARY.
    /E  ITEM.
    P1 &IT_INVOICEDETAIL-TOTAL&

  • How to create an internal table in a Report from File of FTP Server.

    Hi All,
    I want to create an internal table in a Report program. But the problem is I have to download two latest files from FTP server.
    Now, based in those file I have to design internal tables in current program. The problem is the program from which these files are being generated has options to display some fields in the output. Hence, the columns of these files becomes dynamic due to which I am not able to design the internal table in my current program...Please Help.
    Regards & Thanks.
    Prashant.

    Hi,
    Or you can use the RTTS classes...
    Plenty of examples over here.
    one external link: http://help-abap.zevolving.com/2008/09/dynamic-internal-table-creation/
    Kr,
    Manu.

  • How to Populate Internal table data to Table Control in a Report Program

    Dear All,
           How to Populate Internal table data to Table Control in a Report Program? It is a pure report program with out any Module pool coding involved, which is just used to display data. Till now it is being displayed in a report. Now the user wants the data to be displayed in a table control. Could someone tell me how to go about with this.
    Thanks in Advance,
    Joseph Reddy

    If you want to use a table control, you will need to create a screen.
    In your report....
    start-of-selection.
    perform get_data.  " Get all your data here
    call screen 100. " Now present to the user.
    Double click on the "100" in your call screen statement.  This will forward navigate you to the screen.  If you have not created it yet, it will ask you if you want to create it, say yes.  Go into screen painter or layout of the screen.  Use the table control wizard to help you along the process.  It will write the code for you.  Since it is an output only table control, it will be really easy with not a lot of code. 
    A better way to present the data to the user would be to give it in a ALV grid.  If you want to go that way, it is a lot easier.  Here is a sample of the ALV function module.  You don't even have to create a screen.
    report zrich_0004
           no standard page heading.
    type-pools slis.
    data: fieldcat type slis_t_fieldcat_alv.
    data: begin of imara occurs 0,
          matnr type mara-matnr,
          maktx type makt-maktx,
          end of imara.
    * Selection Screen
    selection-screen begin of block b1 with frame title text-001 .
    select-options: s_matnr for imara-matnr .
    selection-screen end of block b1.
    start-of-selection.
      perform get_data.
      perform write_report.
    *  Get_Data
    form get_data.
      select  mara~matnr makt~maktx
                into corresponding fields of table imara
                  from mara
                   inner join makt
                     on mara~matnr = makt~matnr
                        where mara~matnr in s_matnr
                          and makt~spras = sy-langu.
    endform.
    *  WRITE_REPORT
    form write_report.
      perform build_field_catalog.
    * CALL ABAP LIST VIEWER (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                it_fieldcat = fieldcat
           tables
                t_outtab    = imara.
    endform.
    * BUILD_FIELD_CATALOG
    form build_field_catalog.
      data: fc_tmp type slis_t_fieldcat_alv with header line.
      clear: fieldcat. refresh: fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material Number'.
      fc_tmp-fieldname  = 'MATNR'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '18'.
      fc_tmp-col_pos    = 2.
      append fc_tmp to fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material'.
      fc_tmp-fieldname  = 'MAKTX'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '40'.
      fc_tmp-col_pos    = 3.
      append fc_tmp to fieldcat.
    endform.
    Regards,
    Rich Heilman

  • How to display a table control in a report

    hi
    how to display a table control in a report

    create a screen in your report.
    Call that screen in your report.
    While designing your screen, use Table control creation wizard to create table control on that screen.
    http://www.planetsap.com/online_pgm_main_page.htm

  • How to join THREE different tables into internal table using one select statement .

    How to join THREE different tables into internal table using one select statement .
    Hi experts,
    I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
    Scenario:
    Database tables:
    SPFLI
    SFLIGHT
    SBOOK.
    Table Fields:
    SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
    SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
    SEATSOCC_C SEATSMAX_F SEATSOCC_F
    SBOOK - CARRID CONNID CLASS
    MY INTERNAL TABLE IS IT_XX.
    Your help much appreciated.
    Thanks in advance.
    Pawan.

    Hi Pawan,
    please check below codes. hope it can help you.
    TYPES: BEGIN OF ty_xx,
            carrid     TYPE spfli-carrid   ,
            connid     TYPE spfli-connid   ,
            countryfr  TYPE spfli-countryfr,
            cityfrom   TYPE spfli-cityfrom  ,
            countryto  TYPE spfli-countryto,
            cityto     TYPE spfli-cityto   ,
            fldate     TYPE sflight-fldate ,
            seatsmax   TYPE sflight-seatsmax ,
            seatsocc   TYPE sflight-seatsocc ,
            seatsmax_b TYPE sflight-seatsmax_b,
            seatsocc_b TYPE sflight-seatsocc_b,
            seatsmax_f TYPE sflight-seatsmax_f,
            seatsocc_f TYPE sflight-seatsocc_f,
            class      TYPE sbook-class,
          END OF ty_xx,
          t_xx TYPE STANDARD TABLE OF ty_xx.
    DATA: it_xx TYPE t_xx.
    SELECT spfli~carrid
           spfli~connid
           spfli~countryfr
           spfli~cityfrom
           spfli~countryto
           spfli~cityto
           sflight~fldate
           sflight~seatsmax
           sflight~seatsocc
           sflight~seatsmax_b
           sflight~seatsocc_b
           sflight~seatsmax_f
           sflight~seatsocc_f
           sbook~class
      INTO TABLE it_xx
      FROM spfli INNER JOIN sflight
      ON spfli~carrid = sflight~carrid
      AND spfli~connid = sflight~connid
      INNER JOIN sbook
      ON spfli~carrid = sbook~carrid
      AND spfli~connid = sbook~connid.
    Thanks,
    Yawa

  • How to consolidate 4 internal table into one

    how can we consolidate data from
    two or more internal tables into one
    please help
    its a bit uegent
    thanks in advance

    Hi,
    If you want to combine two internal table,you can follow 2 approaches.
    Case1: If both the internal table are of same structure,
    append lines of itab1 to itab2.
    The above statement will append all the records in itab1 to itab2.
    Case2:If both the internal table are of differnt structure,
    you need one or more common fields in the two tables to connect.
    loop at itab1.
    move-corresponding itab1 to itab.
    loop at itab2 where f1 = itab1-f1.
    move-corresponding itab2 to itab.
    append itab.
    clear : itab2, itab.
    endloop.
    clear itab1.
    endloop.
    Now itab will hold the entries from itab1 and itab2.

  • How to display all data on one page in web app

    Hello.
    So I have web app JSF (IceFaces framework) + JBoss all Crystal Report working perfectly. So I have page with Crystal Report tags (e.g.
    <bocrv:reportPageViewer reportSource="#{crystalReport.reportPath}" ...
    in this report I have table with some data (data from DB) and I want to display this data on one page. Unfortunately now this data are moving to the next page and unfortunately I even donu2019t know how switch to the next page (I see only info e.g. 1with 2).
    So how to display this data on one page if its impossible how to torn on pagination.

    So I canu2019t do this, I canu2019t display all data on one page (until Iu2019m using JSF tags)?
    In JSF tags Iu2019m setting only path to file. In my bean Iu2019m using u201CReportClientDocumentu201D object itu2019s easy way to load report file (u201Copenu201D method) and set parameters (u201CgetDataDefController().getParameterFieldController()u201D method) and also connect to data base (u201Clogonu201D method) but I havenu2019t this property u201CsetSeparatePages(boolean)u201D.
    Maybe Iu2019m doing this wrong and there is a simpler way maybe I can use somehow u201CCrystalReportVieweru201D please give my any advice.

  • How to create internal table storing instances of ABAP class

    Hi experts, any one knows how to create internal table storing instances of ABAP class or alternative to implement such function?

    Hi
    Please see below example from ABAPDOCU, this might help you.
    Internal Table cnt_tab is used to store class objects.
    Regards,
    Vishal
    REPORT demo_objects_references.
    CLASS counter DEFINITION.
      PUBLIC SECTION.
        METHODS: set IMPORTING value(set_value) TYPE i,
                 increment,
                 get EXPORTING value(get_value) TYPE i.
      PRIVATE SECTION.
        DATA count TYPE i.
    ENDCLASS.
    CLASS counter IMPLEMENTATION.
      METHOD set.
        count = set_value.
      ENDMETHOD.
      METHOD increment.
        ADD 1 TO count.
      ENDMETHOD.
      METHOD get.
        get_value = count.
      ENDMETHOD.
    ENDCLASS.
    DATA: cnt_1 TYPE REF TO counter,
          cnt_2 TYPE REF TO counter,
          cnt_3 TYPE REF TO counter,
          cnt_tab TYPE TABLE OF REF TO counter.
    DATA number TYPE i.
    START-OF-SELECTION.
      CREATE OBJECT: cnt_1,
                     cnt_2.
      MOVE cnt_2 TO cnt_3.
      CLEAR cnt_2.
      cnt_3 = cnt_1.
      CLEAR cnt_3.
      APPEND cnt_1 TO cnt_tab.
      CREATE OBJECT: cnt_2,
                     cnt_3.
      APPEND: cnt_2 TO cnt_tab,
              cnt_3 TO cnt_tab.
      CALL METHOD cnt_1->set EXPORTING set_value = 1.
      CALL METHOD cnt_2->set EXPORTING set_value = 10.
      CALL METHOD cnt_3->set EXPORTING set_value = 100.
      DO 3 TIMES.
        CALL METHOD: cnt_1->increment,
                     cnt_2->increment,
                     cnt_3->increment.
      ENDDO.
      LOOP AT cnt_tab INTO cnt_1.
        CALL METHOD cnt_1->get IMPORTING get_value = number.
        WRITE / number.
      ENDLOOP.

  • How to display multi tables side-by-side

    Hi All,
    I need some help on BI Publisher layout.
    I'd like to display two tables side-by-side in one page.
    Though I can put the tables correctly in Template Builder,
    the tables are joined into one table in generated Report(Preview).
    - Template Builder
    +[Page1]+---------------------------------------------- +
    | |
    | [Table1] [Table2] |
    | ------------------ ------------------ |
    | |EMPNO | |DNAME | |
    | ------------------ ------------------ |
    | | <EMPNO> | | <DNAME> | |
    | ------------------ ------------------ |
    | |
    - Report Preview
    +[Page1]+---------------------------------------------- +
    | |
    | [Table1] |
    | ------------------ |
    | |EMPNO | |
    | ------------------ |
    | | 1234| |
    | | 2345| |
    | | 3456| |
    | | 4567| |
    | | :| |
    | | :| |
    | ------------------ |
    | |DNAME | |
    | ------------------ |
    | | ACCOUNTING| |
    | | RESEARCH| |
    | | SALES| |
    | | OPERATIONS| |
    | ------------------ |
    | |
    Does anyone know how to display two tables side-by-side in the
    same page?
    Thanks in advance.

    Thanks for your quick reply.
    I can display side-by-side layout as I had expected!
    Thanks.

  • How to Send Internal table to SAP Spool using Function Modules or Methods?

    Hi Experts,
    How to Send Internal table to SAP Spool using Function Modules or Methods?
    Thanks ,
    Kiran

    This is my code.
    I still get the no ABAP list data for the spool, even tho I can see it sp01?
    REPORT  Z_MAIL_PAYSLIP.
    * Declaration Part *
    tables: PERNR, PV000, T549Q, V_T514D, HRPY_RGDIR.
    infotypes: 0000, 0001, 0105, 0655.
    data: begin of ITAB occurs 0,
      MTEXT(25) type C,
      PERNR like PA0001-PERNR,
      ABKRS like PA0001-ABKRS,
      ENAME like PA0001-ENAME,
      USRID_LONG like PA0105-USRID_LONG,
    end of ITAB.
    data: W_BEGDA like HRPY_RGDIR-FPBEG,
          W_ENDDA like HRPY_RGDIR-FPEND.
    data: RETURN like BAPIRETURN1 occurs 0 with header line.
    data: P_INFO like PC407,
          P_FORM like PC408 occurs 0 with header line.
    data: P_IDX type I,
          MY_MONTH type T549Q-PABRP,
          STR_MY_MONTH(2) type C,
          MY_YEAR type T549Q-PABRJ,
          STR_MY_YEAR(4) type C,
          CRLF(2) type x value '0D0A'.
    data: W_CMONTH(10) type C.
    data: TAB_LINES type I,
          ATT_TYPE like SOODK-OBJTP.
    data: begin of P_INDEX occurs 0,
            INDEX type I,
    end of P_INDEX.
    constants: begin of F__LTYPE, "type of line
       CMD like PC408-LTYPE value '/:',  "command
       TXT like PC408-LTYPE value 's',   "textline
    end of F__LTYPE.
    constants: begin of F__CMD, "commands
      NEWPAGE like PC408-LINDA value '',
    end of F__CMD.
    data: P_LIST like ABAPLIST occurs 1 with header line.
    *data: OBJBIN like SOLISTI1 occurs 10 with header line,
    data: OBJBIN like  LVC_S_1022 occurs 10 with header line,
          DOCDATA like SODOCCHGI1,
          OBJTXT like SOLISTI1 occurs 10 with header line,
          OBJPACK like SOPCKLSTI1 occurs 1 with header line,
          RECLIST like SOMLRECI1 occurs 1 with header line,
          OBJHEAD like SOLISTI1 occurs 1 with header line,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_buffer type string,
          l_no_of_bytes TYPE i,
          l_pdf_spoolid LIKE tsp01-rqident,
          l_jobname     LIKE tbtcjob-jobname.
    data: file_length  type int4,
          spool_id     type rspoid,
          line_cnt     type i.
    *-------------------------------------------------------------------* * INITIALIZATION *
    OBJBIN = ' | '.
    append OBJBIN.
    OBJPACK-HEAD_START = 1.
    data: S_ABKRS like PV000-ABKRS.
    data: S_PABRP like T549Q-PABRP.
    data: S_PABRJ like T549Q-PABRJ.
    * SELECTION SCREEN                                                  *
    selection-screen begin of block BL1.
    parameters: PAY_VAR like BAPI7004-PAYSLIP_VARIANT default 'ESS_PAYSLIPS' obligatory.
    selection-screen end of block BL1.
    START-OF-SELECTION.
      s_ABKRS = PNPXABKR.
      S_PABRP = PNPPABRP.
      s_pabrj = PNPPABRJ.
      w_begda = PN-BEGDA.
      w_endda = PN-ENDDA.
    get pernr.
    *                                 "Check active employees
      rp-provide-from-last p0000 space pn-begda  pn-endda.
      CHECK P0000-STAT2 IN PNPSTAT2.
    *                                 "Check Payslip Mail flag
      rp-provide-from-last p0655 space pn-begda  pn-endda.
      CHECK P0655-ESSONLY = 'X'.
      rp-provide-from-last p0001 space pn-begda  pn-endda.
    *                                 "Find email address
      RP-PROVIDE-FROM-LAST P0105 '0030' PN-BEGDA PN-ENDDA.
      if p0105-usrid_LONG ne ''.
        ITAB-PERNR      = P0001-PERNR.
        ITAB-ABKRS      = P0001-ABKRS.
        ITAB-ENAME      = P0001-ENAME.
        ITAB-USRID_LONG = P0105-USRID_LONG.
        append itab.
        clear itab.
      endif.
      "SY-UCOMM ='ONLI'
    END-OF-SELECTION.
    *------------------------------------------------------------------* start-of-selection.
      write : / 'Payroll Area        : ', S_ABKRS.
      write : / 'Payroll Period/Year : ',STR_MY_MONTH,'-',STR_MY_YEAR. write : / 'System Date : ', SY-DATUM.
      write : / 'System Time         : ', SY-UZEIT.
      write : / 'User Name           : ', SY-UNAME.
      write : / SY-ULINE.
      sort ITAB by PERNR.
      loop at ITAB.
        clear : P_INFO, P_FORM, P_INDEX, P_LIST, OBJBIN, DOCDATA, OBJTXT, OBJPACK, RECLIST, TAB_LINES.
        refresh : P_FORM, P_INDEX, P_LIST, OBJBIN, OBJTXT, OBJPACK, RECLIST.
    *                                                  Retrieve Payroll results sequence number for this run
        select single * from HRPY_RGDIR where PERNR eq ITAB-PERNR
                                        and FPBEG ge W_BEGDA
                                        and FPEND le W_ENDDA
                                        and SRTZA eq 'A'.
    *                                                  Produce payslip for those payroll results
        if SY-SUBRC = 0.
          call function 'GET_PAYSLIP'
            EXPORTING
              EMPLOYEE_NUMBER = ITAB-PERNR
              SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
              PAYSLIP_VARIANT = PAY_VAR
            IMPORTING
              RETURN          = RETURN
              P_INFO          = P_INFO
            TABLES
              P_FORM          = P_FORM.
          check RETURN is initial.
    *                                                 remove linetype from generated payslip
          loop at p_form.
            objbin = p_form-linda.
            append objbin.
            line_cnt = line_cnt + 1.
          endloop.
          file_length = line_cnt * 1022.
    *                                                 create spool file of paylsip
          CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
            EXPORTING
              i_file_length = file_length
            IMPORTING
              e_spoolid     = spool_id
            TABLES
              it_textdata   = objbin.
          IF sy-subrc EQ 0.
            WRITE spool_id.
          ENDIF.
          DESCRIBE table objbin.
          DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
          CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
            EXPORTING
              SRC_SPOOLID                    = spool_id
              NO_DIALOG                      = ' '
              DST_DEVICE                     = 'MAIL'
    *      PDF_DESTINATION                =
    *    IMPORTING
    *      PDF_BYTECOUNT                  = l_no_of_bytes
    *      PDF_SPOOLID                    = l_pdf_spoolid
    *      LIST_PAGECOUNT                 =
    *      BTC_JOBNAME                    =
    *      BTC_JOBCOUNT                   =
            TABLES
              PDF                            = pdf
            EXCEPTIONS
              ERR_NO_ABAP_SPOOLJOB           = 1
              ERR_NO_SPOOLJOB                = 2
              ERR_NO_PERMISSION              = 3
              ERR_CONV_NOT_POSSIBLE          = 4
              ERR_BAD_DESTDEVICE             = 5
              USER_CANCELLED                 = 6
              ERR_SPOOLERROR                 = 7
              ERR_TEMSEERROR                 = 8
              ERR_BTCJOB_OPEN_FAILED         = 9
              ERR_BTCJOB_SUBMIT_FAILED       = 10
              ERR_BTCJOB_CLOSE_FAILED        = 11
              OTHERS                         = 12
          IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    *Download PDF file C Drive
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename = 'C:\itab_to_pdf.pdf'
          filetype = 'BIN'
        TABLES
          data_tab = pdf.
    * Transfer the 132-long strings to 255-long strings
    *  LOOP AT pdf.
    *    TRANSLATE pdf USING ' ~'.
    *    CONCATENATE gd_buffer pdf INTO gd_buffer.
    *  ENDLOOP.
    *  TRANSLATE gd_buffer USING '~ '.
    *  DO.
    *    it_mess_att = gd_buffer.
    *    APPEND it_mess_att.
    *    SHIFT gd_buffer LEFT BY 255 PLACES.
    *    IF gd_buffer IS INITIAL.
    *      EXIT.
    *    ENDIF.
    *  ENDDO.
          OBJHEAD = 'Objhead'.
          append OBJHEAD.
    * preparing email subject
          concatenate W_ENDDA(6)
                    ' Payslip-'
                    ITAB-ENAME+0(28)
                    ITAB-PERNR+4(4) ')'
                 into DOCDATA-OBJ_DESCR.
          DOCDATA-OBJ_NAME = 'Pay Slip'.
          DOCDATA-OBJ_LANGU = SY-LANGU.
          OBJTXT = 'Pay Slip.'.
          append OBJTXT.
    *prepare email lines
          OBJTXT = DOCDATA-OBJ_DESCR.
          append OBJTXT.
          OBJTXT = 'Please find enclosed your current payslip.'.
          append OBJTXT.
    * Write Attachment(Main)
    * 3 has been fixed because OBJTXT has fix three lines
          read table OBJTXT index 3.
    *    DOCDATA-DOC_SIZE = ( 3 - 1 ) * 255 + strlen( OBJTXT ).
          clear OBJPACK-TRANSF_BIN.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = 3.
          OBJPACK-DOC_TYPE = 'RAW'.
          append OBJPACK.
    * Create Message Attachment
          ATT_TYPE = 'PDF'.
          describe table OBJBIN lines TAB_LINES.
          read table OBJBIN index TAB_LINES.
    *    OBJPACK-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
          OBJPACK-TRANSF_BIN = 'X'.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = TAB_LINES.
          OBJPACK-DOC_TYPE = ATT_TYPE.
          OBJPACK-OBJ_NAME = 'ATTACHMENT'.
          OBJPACK-OBJ_DESCR = 'Payslip'.
          append OBJPACK.
    * Create receiver list refresh RECLIST.
          clear RECLIST.
          RECLIST-RECEIVER = itab-USRID_long.
          translate RECLIST-RECEIVER to lower case.
          RECLIST-REC_TYPE = 'U'.
          append RECLIST.
    * Send the document
    *SO_NEW_DOCUMENT_ATT_SEND_API1
          call function 'SO_DOCUMENT_SEND_API1'
            exporting
              DOCUMENT_DATA = DOCDATA
              PUT_IN_OUTBOX = 'X'
              COMMIT_WORK = 'X'
    * IMPORTING
    *   SENT_TO_ALL =
    *   NEW_OBJECT_ID =
            tables
              PACKING_LIST  = OBJPACK
              OBJECT_HEADER = OBJHEAD
              CONTENTS_BIN  = pdf
              CONTENTS_TXT  = OBJTXT
    *   CONTENTS_HEX =
    *   OBJECT_PARA =
    *   OBJECT_PARB =
              RECEIVERS = RECLIST
            exceptions
              TOO_MANY_RECEIVERS = 1
              DOCUMENT_NOT_SENT = 2
              DOCUMENT_TYPE_NOT_EXIST = 3
              OPERATION_NO_AUTHORIZATION = 4
              PARAMETER_ERROR = 5
              X_ERROR = 6
              ENQUEUE_ERROR = 7
              others = 8.
          if SY-SUBRC NE 0.
            ITAB-MTEXT = 'Message Not Sent to : '.
          else.
            ITAB-MTEXT = 'Message Sent to : '.
          endif.
    *    else.
    *      ITAB-MTEXT = 'Message Not Sent to : '.
    *    endif.
        else.
          "SY-SUBRC Not = 0
          ITAB-MTEXT = 'Payroll data not found : '.
        endif.
        "end of SY-SUBRC = 0.
        modify ITAB.
      endloop. "end loop at ITAB
      sort ITAB by MTEXT PERNR.
      loop at ITAB.
        at new MTEXT.
          uline.
          write : / ITAB-MTEXT color 4 intensified on.
          write : / 'Emp. Code' color 2 intensified on,
                 12 'Emp. Name' color 2 intensified on,
                 54 'Email ID' color 2 intensified on.
        endat.
        write : / ITAB-PERNR, 12 ITAB-ENAME, 54 ITAB-USRID_LONG.
      endloop.

Maybe you are looking for