Display 2 internal tables as 2 ALV-lists..

Hi
  I have 2 internal tables itab1 and itab2. I have to display the contents of these internal tables as 2 different ALV lists in the same screen..Please help me with steps and if we have to use module pool kindly hep me with the code that has to be included in the PBO and PAI blocks.
Thanks.

hi,
u can use block ALV like,
TYPE-POOLS : slis.
TABLES : mara,
         makt.
SELECT-OPTIONS : mat FOR mara-matnr.
DATA : BEGIN OF itab OCCURS 0,
        matnr LIKE mara-matnr,
        maktx LIKE makt-maktx,
        matkl LIKE mara-matkl,
        mtart LIKE mara-mtart,
       END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
        mtart LIKE mara-mtart,
        count TYPE i,
       END OF itab1.
DATA : BEGIN OF itab1_col OCCURS 0,
        mtart LIKE mara-mtart,
        count TYPE i,
       END OF itab1_col.
DATA : t_fcat1 TYPE slis_t_fieldcat_alv,
       t_fcat2 TYPE slis_t_fieldcat_alv,
       wa_fcat TYPE slis_fieldcat_alv,
       t_eve TYPE slis_t_event,
       wa_eve TYPE slis_alv_event,
       t_layout TYPE slis_layout_alv.
DATA : v_repid LIKE sy-repid,
       t_mat LIKE mara-matnr.
DEFINE create_fcat.
  clear wa_fcat.
  wa_fcat-fieldname = &1.
  wa_fcat-seltext_l = &2.
  wa_fcat-outputlen = &3.
  append wa_fcat to t_fcat1.
END-OF-DEFINITION.
START-OF-SELECTION.
  PERFORM get_data.
  PERFORM dis_data.
*&      Form  get_data
      text
FORM get_data.
  SELECT amatnr bmaktx amtart amatkl INTO CORRESPONDING FIELDS OF TABLE itab
  FROM mara AS a INNER JOIN makt AS b ON
  amatnr = bmatnr
  WHERE a~matnr IN mat.
  LOOP AT itab.
    itab1-mtart = itab-mtart.
    itab1-count = 1.
    APPEND itab1.
  ENDLOOP.
  SORT itab1 BY mtart.
  LOOP AT itab1.
    MOVE-CORRESPONDING itab1 TO itab1_col.
    COLLECT itab1_col.
  ENDLOOP.
ENDFORM.                    "get_data
*&      Form  dis_data
      text
FORM dis_data.
  v_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
      i_callback_program      = v_repid.
  REFRESH t_fcat1.
  CLEAR t_fcat1.
  REFRESH t_eve.
  wa_eve-name = 'TOP_OF_PAGE'.
  wa_eve-form = 'TOP_OF_PAGE1'.
  APPEND wa_eve TO t_eve.
  create_fcat:
  'MATNR' 'Material' '10',
  'MAKTX' 'Material Description' '40',
  'MTART' 'Type' '10',
  'MATKL' 'Group' '10'.
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
      is_layout   = t_layout
      it_fieldcat = t_fcat1
      i_tabname   = 'ITAB'
      it_events   = t_eve
    TABLES
      t_outtab    = itab.
  REFRESH t_fcat1.
  CLEAR t_fcat1.
  REFRESH t_eve.
  wa_eve-name = 'TOP_OF_PAGE'.
  wa_eve-form = 'TOP_OF_PAGE2'.
  APPEND wa_eve TO t_eve.
  create_fcat:
  'MTART' 'Type' '10',
  'COUNT' 'Total' '5'.
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
      is_layout   = t_layout
      it_fieldcat = t_fcat1
      i_tabname   = 'ITAB1_COL'
      it_events   = t_eve
    TABLES
      t_outtab    = itab1_col.
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
ENDFORM.                    "dis_data
*&      Form  top_of_page1
      text
FORM top_of_page1.
  FORMAT COLOR COL_POSITIVE.
  WRITE:/ 'First Block'.
  FORMAT COLOR OFF.
ENDFORM.                    "top_of_page
*&      Form  top_of_page2
      text
FORM top_of_page2.
  FORMAT COLOR COL_NEGATIVE.
  WRITE /5 'Second Block'.
  FORMAT COLOR OFF.
ENDFORM.                    "top_of_page

Similar Messages

  • Need a POP-UP which can display internal table data in ALV format

    HI All,
    I need to display INTERNAL TABLE values through a POP-UP. Only condition is that the window with the internal table data should be in ALV format and not in TEXT only format.
    To clarify, I used FM 'POPUP_WITH_TABLE_DISPLAY_OK'   and  'POPUP_WITH_TABLE_DISPLAY', but both display the data in TEXT format and there is no provision to put the FIELD names there. Everthing needs to be put into internal table and it displays it in text format.
    So I want a FM where I can display internal tabel data in ALV format( same format that would appear if you creata search help for a filed and output window would have all the ALV features like SORT buttons etc.
    Hope there is some FM to achieve this ALV format data thing.
    Thanks in advance for all your help.
    Regards
    FX3

    check this
    REPORT y_demo_alv_3.
    TYPE-POOLS: slis.
    DATA: BEGIN OF i_outtab OCCURS 0.
            INCLUDE STRUCTURE sflight.
    DATA:   w_chk TYPE c.                  "For multiple selection
    DATA: END OF i_outtab.
    *       I_OUTTAB TYPE SFLIGHT OCCURS 0,
    DATA: i_private TYPE slis_data_caller_exit,
          i_selfield TYPE slis_selfield,
          W_exit(1) TYPE c.
    PARAMETERS: p_title TYPE sy-title.
    START-OF-SELECTION.
      SELECT * FROM sflight INTO TABLE i_outtab.
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
           EXPORTING
                i_title                 = p_title
                i_selection             = 'X'
                i_zebra                 = 'X'
    *           I_SCREEN_START_COLUMN   = 0
    *           I_SCREEN_START_LINE     = 0
    *           I_SCREEN_END_COLUMN     = 0
    *           I_SCREEN_END_LINE       = 0
                i_checkbox_fieldname    = 'W_CHK'
    *           I_LINEMARK_FIELDNAME    =
    *           I_SCROLL_TO_SEL_LINE    = 'X'
                i_tabname               = 'I_OUTTAB'
                i_structure_name        = 'SFLIGHT'
    *           IT_FIELDCAT             =
    *           IT_EXCLUDING            =
    *           I_CALLBACK_PROGRAM      =
    *           I_CALLBACK_USER_COMMAND =
    *            IS_PRIVATE             = I_PRIVATE
         IMPORTING
                es_selfield             = i_selfield
                e_exit                  = w_exit
           TABLES
                t_outtab                = i_outtab
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    *    MESSAGE i000(0k) WITH sy-subrc.
      ENDIF.
    *****the internal table is modified with a cross sign for marking the
    ***rows selected
      LOOP AT i_outtab WHERE w_chk = 'X'.
        WRITE: /  i_outtab-carrid, i_outtab-price.
      ENDLOOP.

  • 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

  • Is it Possible to display the output of the ALV list as POP-UP

    Hi Experts,
                     Is it Possible to display the output of the ALV list as POP-UP, if yes then provide some ideas on it.
    thanking in advance,
    Samad.

    Hi samad, it is possible to display alv list as pop-up by using the FM " REUSE_ALV_POPUP_TO_SELECT"
    try this sample code
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
          EXPORTING
       I_TITLE                       =  P1_TITLE
           I_SELECTION                   = 'X'
           I_ZEBRA                       = 'X'
      I_CHECKBOX_FIELDNAME          =
      I_LINEMARK_FIELDNAME          =
      I_SCROLL_TO_SEL_LINE          = 'X'
            I_TABNAME                     = 'T_VBAP'
           I_STRUCTURE_NAME              =  'T_VBAP'
           IT_FIELDCAT                   =  T_FCAT2
           I_CALLBACK_PROGRAM            = 'ZTEST_ALV_POPUP'
       IMPORTING
           ES_SELFIELD                   = I_SELFIELD
           E_EXIT                        = W_EXIT
          TABLES
            T_OUTTAB                      = T_VBAP.
    i think it will solve your problem
    Regards,
    Vijay

  • Need to display Internal table records on screen without using table contro

    Hi Experts,
    I have a requirement to display internal table on screen which is having three columns (Material no, Serial No and quantity).
    But I can't use table control as it is not supported by hand held devices.
    They are going to use this transaction on hand held devices.
    Thanks In advance.
    Gaurav

    You should be able to use the good old STEP LOOP processing for this... create your three fields in the row then convert them to a STEP-LOOP.
    You can look up in the help how to work with STEP-LOOPs if you are not familiar with it. It was the way to manage table-like information before the age of table controls

  • Get Multiple Rows into internal Table using Webdynpro Alv Display ..

    Hi guys ,
    I need to find out the logic for getting all the selected rows into the internal table.
    When i display the ALV Output on webdypro screen .
    USer Selects multiple rows for further processing ..
    Ineed to get all the rows selected by user into an internal table .
    Please let me know how to achive this ...
    Thanks in advance for quick reply
    Regards
    Saurabh Goel

    Hi,
    You need to use the method GET_SELECTED of IF_WD_CONTEXT_NODE to get the rows selected. Also ccheck for the paramters of that method, this retruns the element set.
    This meets your requirement.
    Regards,
    Lekha.

  • Problem in displaying internal table contents to excel(color)

    Hello Gurus!!!!!
    The code is given below :-
    *& Module pool       ZDEMO_DOWNLD1
    PROGRAM  ZDEMO_DOWNLD1.
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    DATA : f_name(120) type c,
           f_name1(120) type c.
    case sy-ucomm.
    when 'ATTACH'.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
       DEF_FILENAME           = ' '
      DEF_PATH               = ' '
      MASK                   = ' '
      MODE                   = ' '
      TITLE                  = ' '
    IMPORTING
       FILENAME               = f_name
      RC                     =
    EXCEPTIONS
      INV_WINSYS             = 1
      NO_BATCH               = 2
      SELECTION_CANCEL       = 3
      SELECTION_ERROR        = 4
      OTHERS                 = 5
    *f_name = DEF_FILENAME.
    f_name1 = f_name.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endcase.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    type-pools ole2.
    data: h_excel type ole2_object, " Excel object
    h_mapl type ole2_object, " list of workbooks
    h_map type ole2_object, " workbook
    h_zl type ole2_object, " cell
    h_f type ole2_object, " font
    h_interior type ole2_object. " Color
    *tables: spfli.
    DATA: ls_emp TYPE zpm_emp_det,
           lt_emp TYPE zpm_emp_det OCCURS 0,
           l_projectname TYPE zpm_emp_item_det-project_name,
           l_projectname_last TYPE zpm_emp_item_det-project_name,
           l_empid TYPE zpm_emp_item_det-empid,
           l_empid_last TYPE zpm_emp_item_det-empid.
    DATA: l_projectname_key TYPE lvc_nkey,
          l_role_of_emp_key TYPE lvc_nkey,
          l_last_key TYPE lvc_nkey.
    DATA :  lt_project_main TYPE TABLE OF zsach_pm ,
            ls_project_main TYPE zsach_pm,
            lt_project TYPE zsach_pm OCCURS 0,
            ls_project TYPE zsach_pm.
    internal table for excel headings
    DATA : BEGIN OF lt_project_ex OCCURS 0,
             line(50) TYPE c,
           END OF lt_project_ex.
    DATA: lt_project1 TYPE zsach_pm OCCURS 0,
          ls_project1 TYPE zsach_pm.
    DATA :   lt_project_temp TYPE zsach_pm OCCURS 0 ,
             ls_project_temp TYPE zsach_pm.
    DATA: lt_project2 TYPE zsach_pm OCCURS 0,
          ls_project2 TYPE zsach_pm.
    TYPES: BEGIN OF st_username,
           username TYPE zuser_names-username,
           END OF st_username.
    DATA: it_tab TYPE TABLE OF st_username,
          wa_tab TYPE st_username.
    data : lt_project_excel like zsach_pm occurs 0 with header line.
    *DATA: f_name TYPE string.
    data h type i.
    table of flights
    data: it_spfli like spfli occurs 10 with header line.
    *& Event START-OF-SELECTION
        SELECT empid
               project_name
               role_of_emp
               competancy
               manager
               price_category
               rate_per_hour
               first_day_pro
               last_day_pro
               ckey
         FROM zpm_emp_item_det
         INTO CORRESPONDING FIELDS OF TABLE lt_project.
        LOOP AT lt_project INTO ls_project.
        ENDLOOP.
        SELECT projectid project_name client begin_date end_date
          FROM zpm_project_det
          INTO CORRESPONDING FIELDS OF TABLE lt_project_temp FOR ALL ENTRIES IN lt_project
          WHERE project_name = lt_project-project_name.
        LOOP AT lt_project_temp INTO ls_project_temp.
          MODIFY lt_project FROM ls_project_temp TRANSPORTING
            projectid project_name client begin_date end_date
            WHERE project_name = ls_project_temp-project_name.
        ENDLOOP.
        SELECT empid
               employee_name
               designation
               employee_type
               date_of_joining
        FROM zpm_emp_head_det
        INTO CORRESPONDING FIELDS OF TABLE lt_project1 FOR ALL ENTRIES IN lt_project
        WHERE empid = lt_project-empid.
        LOOP AT lt_project1 INTO ls_project1.
          MODIFY lt_project FROM ls_project1 TRANSPORTING
                empid
                employee_name
                designation
                employee_type
                date_of_joining
             WHERE empid = ls_project1-empid.
        ENDLOOP.
    tell user what is going on
    call function 'SAPGUI_PROGRESS_INDICATOR'
    exporting
    PERCENTAGE = 0
    text = text-007
    exceptions
    others = 1.
    start Excel
    create object h_excel 'EXCEL.APPLICATION'.
    perform err_hdl.
    set property of h_excel 'Visible' = 1.
    perform err_hdl.
    tell user what is going on
    call function 'SAPGUI_PROGRESS_INDICATOR'
    exporting
    PERCENTAGE = 0
    text = text-008
    exceptions
    others = 1.
    get list of workbooks, initially empty
    call method of h_excel 'Workbooks' = h_mapl.
    perform err_hdl.
    add a new workbook
    call method of h_mapl 'Add' = h_map.
    perform err_hdl.
    tell user what is going on
    call function 'SAPGUI_PROGRESS_INDICATOR'
    exporting
    PERCENTAGE = 0
    text = text-009
    exceptions
    others = 1.
    output column headings to active Excel sheet
    perform fill_cell using 1 1 1 'Project ID'(001).
    perform fill_cell using 1 2 1 'Emp ID'(002).
    perform fill_cell using 1 3 1 'Project Name'(003).
    perform fill_cell using 1 4 1 'Client'(004).
    perform fill_cell using 1 5 1 'Begin Date'(005).
    perform fill_cell using 1 6 1 'End Date'(006).
    perform fill_cell using 1 7 1 'Role of Employee'(007).
    perform fill_cell using 1 8 1 'Module / Competancy'(008).
    perform fill_cell using 1 9 1 'Employee name'(009).
    perform fill_cell using 1 10 1 'Price Category'(010).
    perform fill_cell using 1 11 1 'Rate P/H'(011).
    perform fill_cell using 1 12 1 '1st day in project'(012).
    perform fill_cell using 1 13 1 'Last day in project'(013).
    perform fill_cell using 1 14 1 'Currency'(014).
    perform fill_cell using 1 15 1 'Manager'(015).
    perform fill_cell using 1 16 1 'Emp Type'(016).
    perform fill_cell using 1 17 1 'Designation'(017).
    perform fill_cell using 1 18 1 'Joining Date'(018).
    perform fill_cell using 1 19 1 'Last Date'(019).
    loop at lt_project into ls_project.
    *lt_project_excel[] = lt_project[].
    endloop.
    copy flights to active EXCEL sheet
    h = sy-tabix + 1.
    *perform fill_cell1 using h 1 0 ls_project-PROJECTID.
    *perform fill_cell1 using h 2 0 ls_project-EMPID.
    *perform fill_cell1 using h 3 0 ls_project-PROJECT_NAME.
    *perform fill_cell1 using h 4 0 ls_project-client.
    *perform fill_cell1 using h 5 0 ls_project-BEGIN_DATE.
    *perform fill_cell1 using h 6 0 ls_project-END_DATE.
    *perform fill_cell1 using h 7 0 ls_project-ROLE_OF_EMP.
    *perform fill_cell1 using h 8 0 ls_project-COMPETANCY.
    *perform fill_cell1 using h 9 0 ls_project-EMPLOYEE_NAME.
    *perform fill_cell1 using h 10 0 ls_project-PRICE_CATEGORY.
    *perform fill_cell1 using h 11 0 ls_project-RATE_PER_HOUR.
    *perform fill_cell1 using h 12 0 ls_project-FIRST_DAY_PRO.
    *perform fill_cell1 using h 13 0 ls_project-LAST_DAY_PRO.
    *perform fill_cell1 using h 14 0 ls_project-CKEY.
    *perform fill_cell1 using h 15 0 ls_project-MANAGER.
    *perform fill_cell1 using h 16 0 ls_project-EMPLOYEE_TYPE.
    *perform fill_cell1 using h 17 0 ls_project-DESIGNATION.
    *perform fill_cell1 using h 18 0 ls_project-DATE_OF_JOINING.
    *perform fill_cell1 using h 19 0 ls_project-LAST_WORKING_DAT.
    perform fill_cell1 using h 1 0 lt_project_excel-PROJECTID.
    perform fill_cell1 using h 2 0 lt_project_excel-EMPID.
    perform fill_cell1 using h 3 0 lt_project_excel-PROJECT_NAME.
    perform fill_cell1 using h 4 0 lt_project_excel-client.
    perform fill_cell1 using h 5 0 lt_project_excel-BEGIN_DATE.
    perform fill_cell1 using h 6 0 lt_project_excel-END_DATE.
    perform fill_cell1 using h 7 0 lt_project_excel-ROLE_OF_EMP.
    perform fill_cell1 using h 8 0 lt_project_excel-COMPETANCY.
    perform fill_cell1 using h 9 0 lt_project_excel-EMPLOYEE_NAME.
    perform fill_cell1 using h 10 0 lt_project_excel-PRICE_CATEGORY.
    perform fill_cell1 using h 11 0 lt_project_excel-RATE_PER_HOUR.
    perform fill_cell1 using h 12 0 lt_project_excel-FIRST_DAY_PRO.
    perform fill_cell1 using h 13 0 lt_project_excel-LAST_DAY_PRO.
    perform fill_cell1 using h 14 0 lt_project_excel-CKEY.
    perform fill_cell1 using h 15 0 lt_project_excel-MANAGER.
    perform fill_cell1 using h 16 0 lt_project_excel-EMPLOYEE_TYPE.
    perform fill_cell1 using h 17 0 lt_project_excel-DESIGNATION.
    perform fill_cell1 using h 18 0 lt_project_excel-DATE_OF_JOINING.
    perform fill_cell1 using h 19 0 lt_project_excel-LAST_WORKING_DAT.
    *endloop.
    disconnect from Excel
    *CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
       DOCUMENT_DATA                    =
      PUT_IN_OUTBOX                    = ' '
      SENDER_ADDRESS                   = SY-UNAME
      SENDER_ADDRESS_TYPE              = 'B'
      COMMIT_WORK                      = ' '
    IMPORTING
      SENT_TO_ALL                      =
      NEW_OBJECT_ID                    =
      SENDER_ID                        =
    TABLES
       PACKING_LIST                     =
      OBJECT_HEADER                    =
      CONTENTS_BIN                     =
      CONTENTS_TXT                     =
      CONTENTS_HEX                     =
      OBJECT_PARA                      =
      OBJECT_PARB                      =
       RECEIVERS                        =
    EXCEPTIONS
      TOO_MANY_RECEIVERS               = 1
      DOCUMENT_NOT_SENT                = 2
      DOCUMENT_TYPE_NOT_EXIST          = 3
      OPERATION_NO_AUTHORIZATION       = 4
      PARAMETER_ERROR                  = 5
      X_ERROR                          = 6
      ENQUEUE_ERROR                    = 7
      OTHERS                           = 8
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    free object h_excel.
    perform err_hdl.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    FORM FILL_CELL *
    sets cell at coordinates i,j to value val boldtype bold *
    form fill_cell using i j bold val.
    call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
    perform err_hdl.
    set property of h_zl 'Value' = val .
    perform err_hdl.
    get property of h_zl 'Font' = h_f.
    perform err_hdl.
    set property of h_f 'Bold' = bold .
    perform err_hdl.
    SET PROPERTY OF h_f 'ColorIndex' = 11 .
    perform err_hdl.
    endform.
    *& Form fill_cell1
    text
    -->P_H text
    -->P_1 text
    -->P_0 text
    -->P_IT_SPFLI_CARRID text
    form fill_cell1 using i j bold val.
    call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
    perform err_hdl.
    set property of h_zl 'Value' = val .
    perform err_hdl.
    get property of h_zl 'Font' = h_f.
    perform err_hdl.
    set property of h_f 'Bold' = bold .
    perform err_hdl.
    SET PROPERTY OF h_f 'ColorIndex' = 14 .
    perform err_hdl.
    endform. " fill_cell1
    *& Form ERR_HDL
    outputs OLE error if any *
    --> p1 text
    <-- p2 text
    form err_hdl.
    if sy-subrc <> 0.
    write: / 'Error in OLE-Automation:'(010), sy-subrc.
    stop.
    endif.
    endform. " ERR_HDL
    Entire excel file is displayed ,but the problem is I want to display the excel file in one shot i.e not <b>line by line</b>
    Kindly suggest if there is any keyword or FM to display the contents in excel using internal table.
    It should not take much time. Just by executing code , the contents of internal table should be displayed.
    Helpful answers will be rewarded
    Thanks,
    Sachin

    Hi Kavitha,
    maybe it's not sophisticated enough for your requirement, but I found function XXL_FULL_API easy to use. This will give same functionality as 'download' button in ALV-Grid display.
    Regards,
    Christian

  • REUSE_ALV_LIST_DISPLAY does not display internal table contents

    Hi,
    Im having a weird problem at my hand. Im using the function module REUSE_ALV_LIST_DISPLAY to display a basic list. I have the contents in an internal table. I have built a field catalog and its working fine. Im passing the internal table to the FM, but in the output I can't see any of the table entries.
    Im new to ALV programming. Please guide me in this regard. Also I would be thankful, if I could be provided with some links for learning more about 'ALV Lists'.

    Hi,
    Check out whether the data is present in the intenaltable or not. Try to debug ur program where it is not processing.
    If the problem persists try to post ur code  in this thread. Let me check it.
    ALV programs.
    http://www.geocities.com/mpioud/Abap_programs.html
    . How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    ALV
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
    BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
    BCALV_GRID_DEMO Simple ALV Control Call Demo Program
    BCALV_TREE_DEMO Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO
    BC_ALV_DEMO_HTML_D0100
    Regards,
    Priyanka.

  • Totals for the internal table field in alv

    Hi Gurus,
    I have an issue in displaying the totals in alv.
    I have an internal table with the three fields like below.
    scrap_code_001 like afru-xmnga, " Scrap Reason Qty.
    scrap_code_002 like afru-xmnga, " Scrap Reason Qty.
    scrap_code_003 like afru-xmnga, " Scrap Reason Qty.
    In the output table which i am passing to the fieldcatlog is having the three above fields with values 10,3,4 respectively.
    I am looping at the internal table
    loop at gt_grund.
    gv_tabix = sy-tabix.
    i_fieldcat-no_zero = gc_x.
    i_fieldcat-do_sum = gc_x.
    perform assign_alv_qty_format.
    if gt_grund-grund is initial.
    gt_grund = 'NONE'.
    gv_text = gt_grund.
    else.
    gv_text = gt_grund-grdtx.
    endif.
    gv_tabixn = gv_tabix.
    gv_scrap_code+11(03) = gv_tabixn.
    gv_fieldname = gv_scrap_code.
    translate gv_fieldname to upper case.
    perform bild_fieldcat using
    gv_fieldname 'GT_REPORT' 'AFRU' gv_text 'QUAN' '12' ' ' .
    endif.
    endloop.
    But in the output I am getting the totals but it displays totals for all the three columns as 17,17,17 (summing 10,3,4).
    How do I display total as 10,3,4 for each column separately.
    I appreciate you help and award points for the answer

    Hi,
    Please check if value fields i_fieldcat-ref_fieldname and i_fieldcat-ref_tabname regard to numc or curr type.
    EX: i_fieldcat-ref_fieldname = 'WRBTR'
           I_fieldcat-ref_tabname = 'BSEG'.
    Regards,
    Fernando

  • Dynamic creation of internal table based on alv layout

    Hi experts!!
    I have the following request from my client:
    I am displaying an alv report and i need to download it in txt format based on the columns showed in the current layout (i.e. if the user chooses to hide some columns, then they should not appear in the txt file ). In the alv i am using the Function Modules of the alv and not ABAP Objects.
    I thought of dynamically creating the internal table, but i am not sure how to do it.
    I also thaught of creating an internal table with only one field with the maximum length, but how can i check which fields are diplayed, and how can i get their values??
    Please Help!!
    Thank u in advance!!!
    Please - no duplicate posts
    Edited by: Rob Burbank on Feb 24, 2009 2:16 PM

    After call the above said function module you will get the exporting table for field catalog ie
              call function 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
                importing
                  es_layout     = ls_slis_layo
                  et_fieldcat   = lt_slis_fcat
    if you check the lt_slis_fcat internal table if the field are hide in the layout by the user then in this internal table check for field NO_OUT will X.
    Take the fields where NO_OUT ne X 
    then for creating dynamic internal table
      field-symbols :  <ptab>  type standard table.
      call method cl_alv_table_create=>create_dynamic_table
        exporting
          it_fieldcatalog =  lt_slis_fcat
        importing
          ep_table        = i_content.
      if sy-subrc = 0.
        assign i_content->* to <ptab>.
      else.
        write: 'Error creating internal table'.
        stop.
      endif.
    Here  is the dynamic internal table

  • Displaying dynamic table in OOPS ALV

    Hi,
    I am creating a dynamic internal table which consists of some fields which are being filled dynamically and some fields which are being filled from a static internal table. I am facing two issues in the development:-
    1. The static fields are being populated into the dynamic work area successfully but I am not able to modify the dynamic in ternal table using the work area.
    PFB my code:
    READ TABLE I_LEVEL1 WITH KEY KSCHL = WA_T681-KSCHL
                                           KOTABNR = WA_T681-KOTABNR.
              IF SY-SUBRC EQ 0.
                <WA_DYN_TABLE1>-UDATE    = I_LEVEL1-UDATE.
                <WA_DYN_TABLE1>-UTIME    = I_LEVEL1-UTIME.
                MOVE-CORRESPONDING <WA_DYN_TABLE1> TO <WA_DYN_TABLE>.
                MODIFY <I_DYN_TABLE> FROM <WA_DYN_TABLE> TRANSPORTING UDATE
                                                                      UTIME.
    The dynamic filds of <I_DYN_TABLE> are being populated successfully but the MODIFY statement gives an error.
    The specified type has no structure and therefore no component called UDATE.
    2. The other problem I am facing is that while displaying output for the same ALV, no column names are being displayed.
    I am using OOPS ALV.
    PFB my code for the same:
    CL_SALV_TABLE=>FACTORY( IMPORTING R_SALV_TABLE = O_TABLE
                                  CHANGING  T_TABLE      = <I_DYN_TABLE> ).
          O_FUNCTIONS = O_TABLE->GET_FUNCTIONS( ).
          O_FUNCTIONS->SET_ALL( ABAP_TRUE ).
          O_COLUMNS = O_TABLE->GET_COLUMNS( ).
          O_COLUMNS->SET_OPTIMIZE( 'X' ).
    Please help me regarding the issues.
    Thanks.
    Edited by: Suhas Saha on Jan 18, 2012 3:11 PM

    Hi Suhas,
    Thank you for the reply. The modify problem has been solved.
    Regarding the heading issue:
    Here is the code for populating the table:-
    LOOP AT I_TY_FIELD INTO WA_TY_FIELD.
              WA_DYN_IT-FIELDNAME = WA_TY_FIELD-FIELDNAME.
              WA_DYN_IT-TABNAME   = WA_TY_FIELD-TABNAME.
              WA_DYN_IT-DATATYPE  = WA_TY_FIELD-DATATYPE.
              WA_DYN_IT-INTTYPE   = WA_TY_FIELD-INTTYPE.
              WA_DYN_IT-INTLEN    = WA_TY_FIELD-INTLEN.
              WA_DYN_IT-SCRTEXT_M   = WA_TY_FIELD-FIELDDESC.
              APPEND WA_DYN_IT TO I_DYN_IT.
              CLEAR: WA_DYN_IT.
            ENDLOOP.
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
              EXPORTING
                IT_FIELDCATALOG = I_DYN_IT
              IMPORTING
                EP_TABLE        = I_DY_TABLE.
            ASSIGN I_DY_TABLE->* TO <I_DYN_TABLE>.
            ASSIGN <I_DYN_TABLE> TO <FS_2>.
    Create dynamic work area and assign to FS
            CREATE DATA I_DY_LINE LIKE LINE OF <I_DYN_TABLE>.
            ASSIGN I_DY_LINE->* TO <WA_DYN_TABLE>.
    I_TY_FIELD contains all static and dynamic fields.
    Is there any field of I_DYN_IT i need to fill I have missed which fills up the column header data?

  • 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

  • Displaying internal table horizontally using FM REUSE_ALV_GRID_DISPLAY

    Hi everyone,
             I'm quite having difficulty deciphering on how I can display my internal table in ALV_GRID horizontally.  Example:
    my itab:
    lastname(15),
    firstname(20),
    minit(1).
    OUTPUT:
    LASTNAME             FIRSTNAME                MINIT
    Is this possible?  Can someone help me by giving me the correct codes?  Thanks in advance.  
    Anna Bechayda

    by default it is printing horizontally.
    i think you are declaring your itab like this but when you will fetch or append the data into itab it will be like this
    firstnam  lastname minit
    a             b            1
    b             c            2
    like this. just pass your itab to reuse alv fn module.  but one thing you have to build your fieldcatalog for that.
    regards
    shiba dutta

  • How to display selected table fields in ALV report.

    Hi,
    I am displaying data from table EKPO using ALV through this query.
    select * from ekpo into table itab_ekpo up to 25 rows.
    bt if i need to display selected fields like
    select ebeln matnr netpr from ekpo into table itab_ekpo up to 25 rows.
    IT gives  error GETWA_NOT_ASSIGNED.
    FIELD SYMBOL HAS NOT YET BEEN ASSIGNED
    CAN ANYONE PLZ HELP ME.

    Hi ,
          I am pasting the code in which i am getting the error.Plz help.
    REPORT  ZHALV.
    tables:ekpo.
    data itab_ekpo type ekpo occurs 100 with header line.
    types: begin of itab_new,
           f_ebeln type ekpo-ebeln,
           f_matnr type ekpo-matnr,
           f_netpr type ekpo-netpr,
           end of itab_new.
    data itab1 TYPE STANDARD TABLE OF itab_new initial size 0.
    type-pools: slis.
    DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
          lf_fieldcat TYPE slis_fieldcat_alv.
    DATA:    ws_repid TYPE sy-repid VALUE 'ZHALV'.
    DATA:  l_layout   TYPE slis_layout_alv.
    selection-screen Begin of block block1 with frame title text-111.
    select-options : S_EBELN for EKPO-EBELN.
    selection-screen end of block block1.
    INITIALIZATION.
    start-of-selection.
      select ebeln matnr netpr from ekpo into table itab1 up to 10 rows WHERE EBELN IN S_EBELN.
    *select * from ekpo into table itab_ekpo up to 25 rows.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM GET_DETAILS.
    end-of-selection.
    *&      Form  build_fieldcatalog
          text
    FORM build_fieldcatalog .
    PURCHASING DOCUMENT NUMBER
      CLEAR lf_fieldcat.
      lf_fieldcat-fieldname = 'EBELN'.
      lf_fieldcat-ref_tabname = 'EKKO'.
      lf_fieldcat-ref_fieldname = 'EBELN'.
    MATERIAL NUMBER
      CLEAR lf_fieldcat.
      lf_fieldcat-fieldname = 'MATNR'.
      lf_fieldcat-ref_tabname = 'EKPO'.
      lf_fieldcat-ref_fieldname = 'MATNR'.
      APPEND lf_fieldcat TO lt_fieldcat.
    NET PRICE IN PURCHASING DOCUMENT
      CLEAR lf_fieldcat.
      lf_fieldcat-fieldname = 'NETPR'.
      lf_fieldcat-ref_tabname = 'EKPO'.
      lf_fieldcat-ref_fieldname = 'NETPR'.
      lf_fieldcat-cfieldname = 'WAERS'.
      lf_fieldcat-do_sum = 'X'.
      APPEND lf_fieldcat TO lt_fieldcat.
    ENDFORM.                    " build_fieldcatalog
    *&      Form  GET_DETAILS
          text
    FORM GET_DETAILS.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
                                 I_INTERFACE_CHECK                 = ' '
                                 I_BYPASSING_BUFFER                = ' '
                                 I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = ws_repid
                                 I_CALLBACK_PF_STATUS_SET          = ' '
                                 I_CALLBACK_USER_COMMAND           = ' '
                                 I_CALLBACK_TOP_OF_PAGE            = ' '
                                 I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
                                 I_CALLBACK_HTML_END_OF_LIST       = ' '
         I_STRUCTURE_NAME                  = 'EKPO'
                                 I_BACKGROUND_ID                   = ' '
                                 I_GRID_TITLE                      =
                                 I_GRID_SETTINGS                   =
                                 IS_LAYOUT                         =
                                  IT_FIELDCAT                       = lt_fieldcat
                                 IT_EXCLUDING                      =
                                 IT_SPECIAL_GROUPS                 =
                                 IT_SORT                           =
                                 IT_FILTER                         =
                                 IS_SEL_HIDE                       =
        I_DEFAULT                         = 'X'
        I_SAVE                            = 'A'
                                 IS_VARIANT                        =
                                 IT_EVENTS                         =
                                 IT_EVENT_EXIT                     =
                                 IS_PRINT                          =
                                 IS_REPREP_ID                      =
                                 I_SCREEN_START_COLUMN             = 0
                                 I_SCREEN_START_LINE               = 0
                                 I_SCREEN_END_COLUMN               = 0
                                 I_SCREEN_END_LINE                 = 0
                                 I_HTML_HEIGHT_TOP                 = 0
                                 I_HTML_HEIGHT_END                 = 0
                                 IT_ALV_GRAPHICS                   =
                                 IT_HYPERLINK                      =
                                 IT_ADD_FIELDCAT                   =
                                 IT_EXCEPT_QINFO                   =
                                 IR_SALV_FULLSCREEN_ADAPTER        =
                               IMPORTING
                                 E_EXIT_CAUSED_BY_CALLER           =
                                 ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = itab1
          EXCEPTIONS
                                 PROGRAM_ERROR                     = 1
                                OTHERS                            = 2.
      IF SY-SUBRC <> 0.
        WRITE: 'SY-SUBRC: ', SY-SUBRC .
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *append itab_ekpo to i_tab.
    ENDFORM.                    "GET_DETAILS

  • Populate and display internal table results using search help exit...

    I have copied F4IF_SHLP_EXIT_EXAMPLE and made changes. I want this search help exit to populate and display contents related to 'FIELD1' when the user enters a specific value for it in the search help screen, meaning when the user restricts the search by that value.  For field2, field3, field4, field5, field6, field7, and field8 I am using a custom view.
    Following is the code:
    TYPES:  BEGIN OF t_search,
                   field2 TYPE field2,
                   field3 TYPE field3,
                   field4 TYPE field4,
                   field5 TYPE field5,
                   field6 TYPE field6,
                   field7 TYPE field7,
                   field8 TYPE field8,
                   field1 TYPE field1,
                END OF t_search.
      DATA: it_itab TYPE TABLE OF t_search,
            wa TYPE t_search,
         wa_selopt TYPE ddshselopt,
            wa_fielddescr TYPE dfies.
    ranges: r_field1 for std_table1-field1
    STEP SELECT    (Select values)
        FREE: r_field1.
    **Get the value entered for FIELD1 in search help
        LOOP AT shlp-selopt INTO wa_selopt.
          CASE wa_selopt-shlpfield.
            WHEN 'FIELD1'.
              r_field1-sign = wa_selopt-sign.
              r_field1-option = wa_selopt-option.
              r_field1-low = wa_selopt-low.
              r_field1-high = wa_selopt-high.
              APPEND r_field1.
              CLEAR: r_field1.
          ENDCASE.
        ENDLOOP.
    **Select 'ID' and 'FIELD1' from table into lt_itab
        SELECT id field1
              INTO TABLE lt_itab
                FROM std_table1
                  WHERE field1 IN r_field1.
        IF sy-subrc = 0.
    **Now, based on the particular IDs from lt_itab, I need to select other values
    from other tables which also have 'ID' as the key.
           SELECT std_table2~field2
                std_table2~field3
                std_table3~field4
                std_table3~field5
                std_table3~field6
                std_table4~field7
                std_table4~field8
                std_table1~field1
              INTO CORRESPONDING FIELDS OF TABLE it_itab
              FROM std_table2
                         INNER JOIN std_table3 ON
                                std_table3mandt = std_table2mandt AND
                                std_table3id = std_table2id
                         INNER JOIN std_table4 ON
                                std_table4mandt = std_table2mandt AND
                                std_table4id = std_table2id
                         INNER JOIN std_table1 ON
                                std_table1mandt = std_table2mandt AND                                           std_table1id = std_table2id
              WHERE
                    std_table1~field1 IN r_field1.
    'id' is common in all the std_tables --> std_table1, std_table2, std_table3, std_table4.
    STEP DISP     (Display values)
    **Then I need to gather all the results in my internal table it_itab and display
    in search help results for the value of FIELD1 entered by the user in the search help.
        CALL FUNCTION 'F4UT_PARAMETER_RESULTS_PUT'
          EXPORTING
            parameter   = 'FIELD1'
            fieldname   = 'FIELD1'                          
          TABLES
            shlp_tab    = shlp_tab                                   
            record_tab  = record_tab
            source_tab  = it_itab
          CHANGING
            shlp        = shlp
            callcontrol = callcontrol.
    I am not getting all the data in my internal table and wanted to know if there is anyting wrong in my select statement.
    Any guidance will be appreciated and awarded appropriate points.
    Thanks.

    the webdynpro fieldname and the search help input parameter name were made same.

Maybe you are looking for