Using ALV

Hi all,
I need to generate a report using ALV which displays certain fields. After displaying this output, I have a requirement as mentioned below :
Each line should have a checkbox present in the first column.  Multiple checkboxes can be selected, and upon execution all selected documents will print.  A status field will be found at the end of the row and will reflect the current status of the print documents.  After printing occurs, the screen should refresh and processing status reflected to show post-print status.  The user will then be able to see what documents printed immediately.  Any documents that did not successfully print will need to be reprinted through the .PDF files stored in the shared directory.
I am unable to proceed further.
Pointers would be helpful.
Thanks in advance.
Regards,
Nikhil.

Hi Nikhil,
Your whole requirement is very vast. If I look the same then I can broadly divide the same in following area:
1. Introducing checkbox in ALV.
2. Take only those documents which are selected
3. Status field of every document selected should the print status of the document.
4. Saving the whole selected data in the .pdf file.
Now for first one use the following code:
         checkbox TYPE c.                       "Declare a checkbox in your internal table
FORM fill_fieldcatalog .                          "Use this code form ALV display.
  CLEAR i_fieldcat[].
  i_fieldcat-fieldname = 'CHECKBOX'.
  i_fieldcat-tabname = 'I_OUTPUT'.
  i_fieldcat-col_pos = 1.
  i_fieldcat-col_opt = 'X'.
  i_fieldcat-checkbox = 'X'.
  i_fieldcat-edit = 'X'.
  APPEND i_fieldcat.
  CLEAR i_fieldcat.
Endform.
Siddarth

Similar Messages

  • How to trigger New page while using ALV with classes/oops?

    Hi All
    I am trying to print a report which has to show the data in two pages.
    I am using ALV with classes/oops.
    Though I am able to print the report but a new page is not coming. Whole of the data is coming in one single page.
    Please tell me as to how to trigger a NEW PAGE while using ALV with classes/oops.
    Please send some code samples also if available.
    Thanks in advance.
    Jerry

    using sort option you can do it. in case of grid/oo alv class ALV you can view that only in print mode/preview mode.
    in case of list you can view that directly.
    sort-fieldname = 'FIELDNAME'.
    sort-group = '*'  "triggers new page
    sort-up = 'X'.
    append sort to it_sort.

  • Generated a report which gives PR(Purchase Requisition) analysis using ALV.

    hi experts,
    please give me tables and fields for following report, and also exlain me briefly,
    Generated a report which gives PR(Purchase Requisition) analysis using ALV.
    thanks in advance,
    radhakrishna

    Hi
    please find this report which link SO PO PR and Prd Ord and there status.
    >
    REPORT z_so_info.
    TABLES: vbak, vbap, afko, afpo.
    *Field catalog
    TYPE-POOLS: slis.
    DATA: lv_repid TYPE sy-repid VALUE sy-repid,
    xfield TYPE slis_t_fieldcat_alv,
    afield TYPE slis_fieldcat_alv.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(25) text-002.
    SELECT-OPTIONS: so_so FOR vbak-vbeln OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-003.
    PARAMETERS:
    p_kunnr LIKE vbak-kunnr, " sold-to
    p_kunwe LIKE vbak-kunnr. " ship-to
    SELECTION-SCREEN END OF BLOCK b2.
    *Constants
    CONSTANTS: c_zor TYPE vbak-auart VALUE 'ZOR',
    c_we TYPE vbpa-parvw VALUE 'WE',
    c_ag TYPE vbpa-parvw VALUE 'AG'.
    c_space TYPE space.
    *Ranges
    RANGES: ra_parvw FOR vbpa-parvw,
    ra_kunnr FOR vbpa-kunnr.
    *Tables
    DATA: BEGIN OF gt_output OCCURS 0,
    vbeln LIKE vbak-vbeln, " sales order number
    posnr LIKE vbap-posnr, " SO item number
    matnr LIKE vbap-matnr, " material number
    sh LIKE vbpa-kunnr, " Ship-to
    sp LIKE vbpa-kunnr, " Sold-to
    lifnr LIKE ekko-lifnr, " Vendor
    bstnk LIKE vbak-bstnk, " PO number
    banfn LIKE vbep-banfn, " Purchase requi
    po_st TYPE char30, " PO status text
    pstyv TYPE vbap-pstyv, " Item catagory
    aufnr LIKE afpo-aufnr, " Production Order
    prd_stat TYPE string, " Prd order status
    END OF gt_output.
    DATA: wa_output LIKE gt_output.
    FIELD-SYMBOLS: <fs_output> LIKE gt_output.
    *Table for sales order and PO
    TYPES : BEGIN OF gs_data,
    vbeln TYPE vbak-vbeln,
    posnr TYPE vbap-posnr,
    pstyv TYPE vbap-pstyv,
    matnr TYPE vbap-matnr,
    END OF gs_data.
    DATA: gt_data TYPE STANDARD TABLE OF gs_data,
    wa_data TYPE gs_data.
    *Table for Production Orders
    TYPES: BEGIN OF gs_prd,
    aufnr TYPE afpo-aufnr,
    posnr TYPE afpo-posnr,
    kdauf TYPE afpo-kdauf,
    kdpos TYPE afpo-kdpos,
    wepos TYPE afpo-wepos, "Goods Receipt Indicator
    elikz TYPE afpo-elikz, "Delivery Completed Indicator
    objnr TYPE aufk-objnr, "Object number
    getri TYPE afko-getri, "Confirmed Order Finish Date
    gltri TYPE afko-gltri, "Actual finish date
    END OF gs_prd.
    DATA: gt_prd TYPE STANDARD TABLE OF gs_prd,
    wa_prd TYPE gs_prd.
    *Table for partner data
    TYPES: BEGIN OF gs_partner,
    vbeln TYPE vbak-vbeln,
    posnr TYPE vbap-posnr,
    parvw TYPE vbpa-parvw,
    kunnr TYPE vbpa-kunnr,
    END OF gs_partner.
    DATA: gt_partner TYPE STANDARD TABLE OF gs_partner,
    wa_partner TYPE gs_partner.
    TYPES: BEGIN OF gs_po,
    ebeln TYPE ekkn-ebeln,
    ebelp TYPE ekkn-ebelp,
    vbeln TYPE ekkn-vbeln,
    vbelp TYPE ekkn-vbelp,
    END OF gs_po.
    DATA: gt_po TYPE STANDARD TABLE OF gs_po,
    wa_po TYPE gs_po.
    TYPES: BEGIN OF gs_preq,
    vbeln TYPE vbep-vbeln,
    posnr TYPE vbep-posnr,
    banfn TYPE vbep-banfn,
    END OF gs_preq.
    DATA: gt_preq TYPE STANDARD TABLE OF gs_preq,
    wa_preq TYPE gs_preq.
    TYPES: BEGIN OF gs_po_stat,
    ebeln TYPE ekko-ebeln,
    procstat TYPE ekko-procstat,
    lifnr TYPE ekko-lifnr,
    END OF gs_po_stat.
    DATA: gt_po_stat TYPE STANDARD TABLE OF gs_po_stat,
    wa_po_stat TYPE gs_po_stat.
    *Field symbols
    FIELD-SYMBOLS: <fs> TYPE tj02t-txt04,
    <fs_temp> TYPE tj02t-txt04,
    <fs_stat> TYPE char30.
    START-OF-SELECTION.
    PERFORM fr_build_range.
    PERFORM fr_get_data.
    PERFORM fr_build_fc.
    PERFORM fr_output.
    *& Form fr_get_data
    text
    --> p1 text
    <-- p2 text
    FORM fr_get_data.
    *Get SO
    SELECT avbeln aposnr apstyv amatnr
    FROM vbap AS a
    JOIN vbak AS b
    ON avbeln = bvbeln
    JOIN vbpa AS c
    ON bvbeln = cvbeln
    INTO TABLE gt_data
    WHERE b~vbeln IN so_so
    AND b~auart EQ c_zor "Only Sales Orders
    AND c~kunnr IN ra_kunnr. "from selection screen
    DELETE ADJACENT DUPLICATES FROM gt_data COMPARING vbeln posnr.
    *get data of the production order
    IF NOT gt_data[] IS INITIAL.
    SELECT aaufnr aposnr akdauf akdpos awepos aelikz
    b~objnr
    FROM afpo AS a
    JOIN aufk AS b
    ON aaufnr = baufnr
    INTO TABLE gt_prd
    FOR ALL ENTRIES IN gt_data
    WHERE a~kdauf EQ gt_data-vbeln
    AND a~kdpos EQ gt_data-posnr.
    ENDIF.
    *Get partner data
    IF NOT gt_data[] IS INITIAL.
    SELECT vbeln posnr parvw kunnr
    FROM vbpa
    INTO TABLE gt_partner
    FOR ALL ENTRIES IN gt_data
    WHERE vbeln EQ gt_data-vbeln.
    ENDIF.
    *Get Purchase Order
    IF NOT gt_data[] IS INITIAL.
    SELECT ebeln ebelp vbeln vbelp
    FROM ekkn
    INTO TABLE gt_po
    FOR ALL ENTRIES IN gt_data
    WHERE vbeln EQ gt_data-vbeln
    AND vbelp EQ gt_data-posnr.
    SELECT vbeln posnr banfn
    FROM vbep
    INTO TABLE gt_preq
    FOR ALL ENTRIES IN gt_data
    WHERE vbeln EQ gt_data-vbeln
    AND posnr EQ gt_data-posnr.
    ENDIF.
    IF NOT gt_po[] IS INITIAL.
    SELECT aebeln aprocstat a~lifnr
    FROM ekko AS a
    JOIN ekpo AS b
    ON aebeln = bebeln
    INTO TABLE gt_po_stat
    FOR ALL ENTRIES IN gt_po
    WHERE b~ebeln EQ gt_po-ebeln
    AND b~ebelp EQ gt_po-ebelp.
    ENDIF.
    *Move data to output table
    LOOP AT gt_data INTO wa_data.
    wa_output-vbeln = wa_data-vbeln.
    wa_output-posnr = wa_data-posnr.
    wa_output-pstyv = wa_data-pstyv.
    wa_output-matnr = wa_data-matnr.
    READ TABLE gt_po INTO wa_po WITH KEY vbeln = wa_data-vbeln
    vbelp = wa_data-posnr.
    IF sy-subrc EQ 0.
    wa_output-bstnk = wa_po-ebeln.
    READ TABLE gt_po_stat INTO wa_po_stat WITH KEY ebeln = wa_po-ebeln.
    IF sy-subrc EQ 0.
    wa_output-lifnr = wa_po_stat-lifnr.
    CASE wa_po_stat-procstat.
    WHEN '01'.
    wa_output-po_st = 'Version in process'.
    WHEN '02'.
    wa_output-po_st = 'Active'.
    WHEN '03'.
    wa_output-po_st = 'In release'.
    WHEN '04'.
    wa_output-po_st = 'Partially released'.
    WHEN '05'.
    wa_output-po_st = 'Released Completely'.
    WHEN '08'.
    wa_output-po_st = 'Rejected'.
    ENDCASE.
    ENDIF. "inner read subrc
    ENDIF. "outer read subrc
    READ TABLE gt_preq INTO wa_preq WITH KEY vbeln = wa_data-vbeln
    posnr = wa_data-posnr.
    IF sy-subrc EQ 0.
    wa_output-banfn = wa_preq-banfn.
    ENDIF.
    READ TABLE gt_prd INTO wa_prd WITH KEY kdauf = wa_data-vbeln
    kdpos = wa_data-posnr.
    IF sy-subrc EQ 0.
    wa_output-aufnr = wa_prd-aufnr.
    *get the purchase requisition for production order as well
    SELECT SINGLE banfn
    FROM ebkn
    INTO wa_output-banfn
    WHERE aufnr EQ wa_prd-aufnr.
    *Get the status of the production order
    PERFORM fr_get_prd_stat USING wa_prd-objnr
    CHANGING wa_output-prd_stat.
    ENDIF. " sy-subrc
    READ TABLE gt_partner INTO wa_partner WITH KEY vbeln = wa_data-vbeln
    parvw = c_we.
    IF sy-subrc EQ 0.
    wa_output-sh = wa_partner-kunnr.
    ENDIF.
    READ TABLE gt_partner INTO wa_partner WITH KEY vbeln = wa_data-vbeln
    parvw = c_ag.
    IF sy-subrc EQ 0.
    wa_output-sp = wa_partner-kunnr.
    ENDIF.
    APPEND wa_output TO gt_output.
    CLEAR: wa_data, wa_prd,wa_partner,wa_output.
    ENDLOOP.
    ENDFORM. " fr_get_data
    *& Form fr_build_range
    text
    --> p1 text
    <-- p2 text
    FORM fr_build_range .
    *Range for partner function
    MOVE 'I' TO ra_parvw-sign.
    MOVE 'EQ' TO ra_parvw-option.
    MOVE 'SH' TO ra_parvw-low. " we
    APPEND ra_parvw.
    CLEAR ra_parvw.
    MOVE 'I' TO ra_parvw-sign.
    MOVE 'EQ' TO ra_parvw-option.
    MOVE 'SP' TO ra_parvw-low. " ag
    APPEND ra_parvw.
    CLEAR ra_parvw.
    *Range for ship-to and sold-to
    MOVE 'I' TO ra_kunnr-sign.
    MOVE 'EQ' TO ra_kunnr-option.
    MOVE p_kunnr TO ra_kunnr-low.
    APPEND ra_kunnr.
    CLEAR ra_kunnr.
    MOVE 'I' TO ra_kunnr-sign.
    MOVE 'EQ' TO ra_kunnr-option.
    MOVE p_kunwe TO ra_kunnr-low.
    APPEND ra_kunnr.
    CLEAR ra_kunnr.
    ENDFORM. " fr_build_range
    *& Form fr_build_fc
    text
    --> p1 text
    <-- p2 text
    FORM fr_build_fc .
    sales order number
    afield-fieldname = 'VBELN'.
    afield-seltext_s = 'Sales #'.
    afield-ref_tabname = 'VBAK'.
    APPEND afield TO xfield. CLEAR afield.
    sales ITEM number
    afield-fieldname = 'POSNR'.
    afield-seltext_s = 'Item #'.
    afield-ref_tabname = 'VBAP'.
    APPEND afield TO xfield. CLEAR afield.
    Material Number
    afield-fieldname = 'MATNR'.
    afield-seltext_s = 'Material #'.
    afield-ref_tabname = 'VBAP'.
    afield-outputlen = 10.
    APPEND afield TO xfield. CLEAR afield.
    *Vendor Number
    afield-fieldname = 'LIFNR'.
    afield-seltext_s = 'Vendor Num.'.
    afield-ref_tabname = 'EKKO'.
    APPEND afield TO xfield. CLEAR afield.
    ship-to-party
    afield-fieldname = 'SH'.
    afield-seltext_s = 'Ship-to'.
    afield-ref_tabname = 'VBPA'.
    APPEND afield TO xfield. CLEAR afield.
    sold-to-party
    afield-fieldname = 'SP'.
    afield-seltext_s = 'Sold-to'.
    afield-ref_tabname = 'VBPA'.
    APPEND afield TO xfield. CLEAR afield.
    *PO number
    afield-fieldname = 'BSTNK'.
    afield-seltext_s = 'PO NUM'.
    afield-ref_tabname = 'EKKO'.
    APPEND afield TO xfield. CLEAR afield.
    *PO status
    afield-fieldname = 'PO_STAT'.
    afield-seltext_s = 'Step'.
    afield-ref_tabname = 'zbacklog_v2'.
    APPEND afield TO xfield. CLEAR afield.
    *PO step status
    afield-fieldname = 'PO_ST'.
    afield-seltext_s = 'PO.Status'.
    afield-ref_tabname = 'zbacklog_v2'.
    APPEND afield TO xfield. CLEAR afield.
    *Purchase requisition
    afield-fieldname = 'BANFN'.
    afield-seltext_s = 'Pur. Req.'.
    afield-ref_tabname = 'VBEP'.
    APPEND afield TO xfield. CLEAR afield.
    *Item catagory
    afield-fieldname = 'PSTYV'.
    afield-seltext_s = 'Itm. Catg'.
    afield-ref_tabname = 'VBAP'.
    APPEND afield TO xfield. CLEAR afield.
    *Prodcution Order number
    afield-fieldname = 'AUFNR'.
    afield-seltext_m = 'Prod.Order'.
    afield-ref_tabname = 'AFKO'.
    APPEND afield TO xfield. CLEAR afield.
    *PRODCUTION status
    afield-fieldname = 'PRD_STAT'.
    afield-seltext_s = 'Prd. Step'.
    afield-ref_tabname = 'zbacklog_v2'.
    afield-outputlen = 20.
    APPEND afield TO xfield. CLEAR afield.
    *PRODUCTION step status
    afield-fieldname = 'PRD_ST'.
    afield-seltext_s = 'Prd. Status'.
    afield-ref_tabname = 'zbacklog_v2'.
    APPEND afield TO xfield. CLEAR afield.
    ENDFORM. " fr_build_fc
    *& Form fr_output
    text
    --> p1 text
    <-- p2 text
    FORM fr_output .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_STRUCTURE_NAME =
    IS_LAYOUT =
    it_fieldcat = xfield[]
    i_default = 'X'
    i_save = 'A'
    TABLES
    t_outtab = gt_output
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    ENDFORM. " fr_output
    *& Form fr_get_prd_stat
    text
    -->P_WA_PRD_OBJNR text
    FORM fr_get_prd_stat USING p_objnr CHANGING p_prd_stat.
    DATA: lt_status TYPE STANDARD TABLE OF jstat,
    wa_status TYPE jstat,
    lv_status TYPE tj02t-txt04,
    lv_temp2 TYPE char5,
    lv_buff TYPE string.
    CALL FUNCTION 'STATUS_READ'
    EXPORTING
    client = sy-mandt
    objnr = p_objnr
    only_active = 'X'
    TABLES
    status = lt_status
    EXCEPTIONS
    object_not_found = 1
    OTHERS = 2.
    LOOP AT lt_status INTO wa_status.
    IF wa_status-stat(1) EQ 'I'.
    SELECT txt04 FROM tj02t
    INTO lv_status
    WHERE istat EQ wa_status-stat
    AND spras EQ 'E'.
    ENDSELECT.
    lv_temp2 = lv_status.
    CONCATENATE lv_temp2 p_prd_stat INTO p_prd_stat
    SEPARATED BY ','.
    ENDIF.
    CLEAR: wa_status, lv_status, lv_temp2.
    ENDLOOP.
    lv_buff = p_prd_stat.
    *Status of Production Order
    IF lv_buff CS 'CRTD'.
    p_prd_stat = 'Not Active'.
    ENDIF.
    IF lv_buff CS 'REL'.
    IF lv_buff CS 'GMPS'.
    p_prd_stat = 'Printed In Prod'.
    ELSE.
    p_prd_stat = 'Printed'.
    ENDIF.
    ENDIF.
    IF lv_buff CS 'TECO'.
    p_prd_stat = 'Technically Compt.'.
    ENDIF.
    ENDFORM. " fr_get_prd_stat
    >

  • Display two heading in single column using ALV report

    Hi Experts,
    I got a requirement for displaying 2 rows heading in a single column report. Is it possible that I can perform this task using ALV. How to get this 2 rows in ALV.
    This is a criteria that need to be output in ALV REPORT.
    MATERIAL CODE--MATERIAL NUMBERSTORAGE LOC----SLOC1     SLOC2
    --DATE--DATE1      DATE2
    123445--TEST MATERIAL22--
    3
    As mentioned above storage loc and date will be changing with respect to data dynamically and under this double heading qty will be displayed.
    Just want to know how to get double heading. It is clear that how to display dynamically but unaware of double heading using fieldcatalog.
    Regards,
    Yahya

    Hi Yahya,
    Please pass row position in fieldcatalogue for the respective columns.
    E.g  MOVE '2' to w_fieldcat-row_pos.  " This will display the field in 2nd row.
    Thanks,
    Rupali

  • Problem while placing a button in the Output using ALV OOPs

    Hi,
    I am using ALV OOPs to display  report output.
    In the toolbar i have to palce an update button  and if i click on that update it should then call the selection screen 500 .
    So,please  help me to achieve this using ALV OOPs.
    THANKS & REGARDS,
    Kiranmai.

    Hi,
    you can use set pf-status statement with the OOPs' concept where in you will have to give this in the events table and pass it to the method to display the alv ...
    Regards,
    Siddarth

  • How to slection screen fields in  output of the  report by using alv classe

    hi all,
    i want to get all the fields in the selection screen to be displayed in the output layout.i am developing report by using alv grid classes can any one help me.
    answers are rewarded

    Hello
    u first place some dictionary input/output fields in your screen and
    below that u place ur custom control,
    so what ever input u are giving in those fields  , u seelct data accordingly,
    for example.
    in screen there is one icon 'dictionary/program fields, click that and give some table , suppose u want to extract data from kna1 table using kunnr, select kunnr and press enter, then along withn cursor u get one frame, take that on to screen and place it ,
    now in the program write
    tables: kna1.
    select  *  from kna1 into it_kna1  where kunnr = kna1-kunnr. 
    now u get the data into it_kna1.
    it will work , try this.
    bye.

  • How to print check boxes in output using alv

    send me replly immediately

    hi
    Program Name: ALV ON SECONDARY LISTS            Creation: 02/01/2007*
    SAP Name    : YH634_0102007_ALV_LIST            Application:        *
    Author      : P.V.D.Veeresh Babu                Type: 1             *
    Description : This program is used to display secondary lists using *
                  ALV.                                                  *
    Inputs:                                                             *
      Tables:                                                           *
        SPFLI - Flight information                                      *
        SFLIGHT - Flight                                                *
        SBOOK   - Flight booking details                                *
      Select options:                                                   *
        N/A                                                             *
      Parameters:                                                       *
        NO                                                              *
    Outputs: secondary lists with ALV                                   *
    External Routines                                                   *
      Function Modules:                                                 *
        REUSE_ALV_LIST_DISPLAY                                          *
      Transactions    : No                                              *
      Programs        : No                                              *
    Return Codes: No                                                    *
    Ammendments:                                                        *
       Programmer        Date     Req. #            Action              *
    ================  ==========  ======  ==============================*
    type-pools: slis.
    *" Data declarations...................................................
    Data declaration of the structure to hold layout details            *
    data:
      fs_layout type slis_layout_alv.
    *" Data declarations...................................................
    Data declaration of the structure to hold spfli details             *
    data: begin of fs_spfli,
            color(4) type c,               " Color
            check    type c.               " Check box
            include  structure spfli.      " Spfli
    data  end of fs_spfli.
    *" Data declarations...................................................
    Data declaration of the structure to hold sflight details           *
    data:begin of fs_sflight,
          color(4) type c,                 " Color
          check    type c.                 " Check box
          include  structure sflight.      " Sflight
    data  end of fs_sflight.
    *" Data declarations...................................................
    Data declaration of the structure to hold sbook details             *
    data:
      fs_sbook like sbook.
    Internal table to hold list details                                 *
    data:
      t_sbook like
    standard table
           of fs_sbook.
    Internal table to hold list details                                 *
    data:
      t_sflight like
       standard table
             of fs_sflight .
    Internal table to hold spfli details                                *
    data:
    t_spfli like
    standard table
    of fs_spfli.
    fs_layout-box_fieldname = 'CHECK'.
    fs_layout-info_fieldname = 'COLOR'.
    "........Retrieving basic list data containing spfli details......."
    select *
      from spfli
      into corresponding fields of table t_spfli.
    if sy-subrc ne 0.
      message text-001 type 'I'.
    endif.                                 " IF SY-SUBRC NE 0
    ".................Calling function module for ALV..................."
    call function 'REUSE_ALV_LIST_DISPLAY'
      exporting
        i_callback_program       = sy-repid
        i_callback_pf_status_set = 'STATUS1'
        i_callback_user_command  = 'USER_COMMAND1'
        i_structure_name         = 'SPFLI'
        is_layout                = fs_layout
      tables
        t_outtab                 = t_spfli
      exceptions
        program_error            = 1
        others                   = 2.
    if sy-subrc <> 0.
      message text-002 type 'I'.
    endif.                                 " IF SY-SUBRC NE 0
    Form  STATUS1                                                     *
    This subroutine gives pf-status for spfli list                    *
         -->T_EXTAB    excluding table                                 *
    form status1 using t_extab type slis_t_extab.
      set pf-status 'STATUS1'.
    endform.                               " STATUS1
    Form  USER_COMMAND1                                               *
    This subroutine displays secondary list containing sflight details*
         -->FS_UCOMM   user command                                    *
         -->T_SELFIELD selfield                                        *
    form user_command1 using fs_ucomm type sy-ucomm
                             t_selfield type slis_selfield.
      case fs_ucomm.
        when 'SFLIGHT'.
          perform display_list2.
      endcase.                             " CASE FS_UCOMM
      t_selfield-refresh = 'X'.
    endform.                               " USER_COMMAND1
    Form  DISPLAY_LIST2                                                *
    This subroutine displays sflight details on secondary list         *
    There are no interface parameters to be passed in this subroutine  *
    form display_list2 .
      data lw_flag type i.                 " Flag
      refresh t_sflight.
      loop at t_spfli into fs_spfli.
        if fs_spfli-check = 'X'.
    "........Retrieving basic list data containing sflight details......."
          select *
            from sflight
       appending corresponding fields of table t_sflight
           where carrid eq fs_spfli-carrid
             and connid eq fs_spfli-connid.
          if sy-subrc eq 0.
            lw_flag = 1.
          endif.                           " IF SY-SUBRC EQ 0
          FS_SPFLI-CHECK = '0'.
          fs_spfli-color = 'C510'.
          modify t_spfli from fs_spfli .
        endif.                             " IF FS_SPFLI-CHECK EQ 'X'
      endloop.                             " LOOP AT T_SPFLI INTO FS_SPFLI
      if lw_flag eq 0.
        message text-003 type 'E'.
      endif.                               " IF LW_FLAG EQ 1
    ".................Calling function module for ALV..................."
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_callback_program       = sy-repid
          i_callback_pf_status_set = 'STATUS2'
          i_callback_user_command  = 'USER_COMMAND2'
          i_structure_name         = 'SFLIGHT'
          is_layout                = fs_layout
        tables
          t_outtab                 = t_sflight
        exceptions
          program_error            = 1
          others                   = 2.
      if sy-subrc <> 0.
        message text-002 type 'I'.
      endif.                               " IF SY-SUBRC NE 0
    endform.                               " DISPLAY_LIST2
    Form  STATUS2                                                     *
    This subroutine gives pf-status for secondary list.               *
         -->T_EXTAB    Excluding table                                 *
    form status2 using t_extab type slis_t_extab.
      set pf-status 'STATUS2'.
    endform.                               " STATUS2
    Form  USER_COMMAND2                                               *
    This subroutine gives secondary list containing sbook details     *
         -->FS_UCOMM   user command                                    *
         -->T_SELFIELD selfield                                        *
    form user_command2 using fs_ucomm type sy-ucomm
                             t_selfield type slis_selfield.
      case fs_ucomm.
        when 'SBOOK'.
          perform display_list3.
      endcase.                             " CASE FS_UCOMM
      t_selfield-refresh = 'X'.
    endform.                               " USER_COMMAND2
    Form  DISPLAY_LIST3                                                *
    This subroutine displays sbook details on secondary list           *
    There are no interface parameters to be passed in this subroutine  *
    form display_list3 .
      data lw_flag type i.                 " Flag
      refresh t_sbook.
      loop at t_sflight into fs_sflight.
        if fs_sflight-check eq 'X'.
    "........Retrieving basic list data containing sbook details......."
          select *
            from sbook
       appending corresponding fields of table t_sbook
           where carrid eq fs_sflight-carrid
             and connid eq fs_sflight-connid
             and fldate eq fs_sflight-fldate.
          if sy-subrc eq 0.
            lw_flag = 1.
          endif.                           " IF SY-SUBRC EQ 0
          FS_SFLIGHT-CHECK = '0'.
          fs_sflight-color = 'C910'.
          modify  t_sflight from fs_sflight.
        endif.                             " IF FS_FLIGHT-CHECK EQ 'X'
      endloop.                             " LOOP AT T_SFLIGHT INTO....
      if lw_flag eq 0.
        message text-004 type 'E'.
      endif.                               " IF LW_FLAG EQ 1
    ".................Calling function module for ALV..................."
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_structure_name = 'SBOOK'
          is_layout        = fs_layout
        tables
          t_outtab         = t_sbook
        exceptions
          program_error    = 1
          others           = 2.
      if sy-subrc <> 0.
        message text-002 type 'I'.
      endif.                               " IF SY-SUBRC NE 0
    endform.                               " DISPLAY_LIST3
    regards,
    veeresh
    null

  • Sublist by using ALV OO can not be refreshed

    Hi Gurus,
    i met with a very strange problem. i created a interactive list by using ALV OO and if you double click on one of the rows, the screen will go to a sublist which displays the detail information of the row.
    My question is every time i chose a row(double click), the program will always display the sublist of the row firstly chosen. For example:
    i have a overview list:
    10001   Micheal
    10002   Tom
    10003   Michelle
    and the sublist for 10001:
    Surname     Frank
    Givenname Micheal
    Age            18
    Gender       Male
    sublist for 10002:
    Surname     Lee
    Givenname Tom
    Age            19
    Gender       Male
    sublist for 10003:
    Surname    Williams
    Givenname Michelle
    Age            17
    Gender       Female
    at the very beginning, the program is launched, the overlist shall be displayed correctly. then if i double click on 10001, the detail information of Micheal will be displayed in a sublist correctly. after that i go back to the overview list and double click on 10002, the detail information displayed is still for Micheal instead of Tom. and no matter which row is chosen, the detail information displayed will always be :
    Surname     Frank
    Givenname Micheal
    Age            18
    Gender       Male
    Here is some of the source code
    the main program:
    INITIALIZATION.
      PERFORM f_init.
    AT SELECTION-SCREEN on p_mode.
      PERFORM f_screen_change.
    START-OF-SELECTION.
      PERFORM f_fetch_data.
    END-OF-SELECTION.
      CALL SCREEN 2000.
    The code for event double click:
    FORM handle_double_click USING i_row_id    TYPE lvc_s_row
                                   i_column_id TYPE lvc_s_col
                                   is_row_no   TYPE lvc_s_roid.
      REFRESH i_rebate_detail.
      READ TABLE i_rebate_header INDEX is_row_no-row_id.
      IF sy-subrc EQ 0.
        LOOP AT i_rebate_log_detail WHERE vkorg = i_rebate_header-vkorg
                                      AND vtweg = i_rebate_header-vtweg
                                      AND spart  = i_rebate_header-spart
                                      AND payer = i_rebate_header-payer.
          MOVE-CORRESPONDING  i_rebate_log_detail TO i_rebate_detail.
          APPEND i_rebate_detail TO i_rebate_detail.
          CLEAR i_rebate_detail.
        ENDLOOP.
        CALL SCREEN 3000.
      ENDIF.
    ENDFORM .                    "handle_double_click

    The source code for sublist display:
    FORM f_output_detail.
    * ALV Grid instance reference
      DATA:
        gr_alvgrid_detail    TYPE REF TO
                             cl_gui_alv_grid,
    * Custom container instance reference
        gr_ccontainer_detail TYPE REF TO
                             cl_gui_custom_container,
    * Field catalog table
        gt_fieldcat_detail   TYPE lvc_t_fcat,
    * Layout structure
        gs_layout_detail     TYPE lvc_s_layo.
      IF gr_alvgrid_detail IS INITIAL .
    * Creating custom container instance
        CREATE OBJECT gr_ccontainer_detail
          EXPORTING
            container_name              = 'ALV_CONTAINER_DETAIL'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
    *----Creating ALV Grid instance
        CREATE OBJECT gr_alvgrid_detail
          EXPORTING
            i_parent          = gr_ccontainer_detail
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
    *----Preparing field catalog.
        PERFORM f_field_catalog_detail CHANGING gt_fieldcat_detail.
    *----Preparing layout structure
        PERFORM f_layout CHANGING gs_layout_detail .
        CALL METHOD gr_alvgrid_detail->set_table_for_first_display
          EXPORTING
            is_layout = gs_layout_detail
          CHANGING
            it_outtab = i_rebate_detail[]
            it_fieldcatalog = gt_fieldcat_detail[]
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error = 2
            too_many_lines = 3
            OTHERS = 4 .
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
      ELSE .
        CALL METHOD gr_alvgrid_detail->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS = 2 .
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
      ENDIF.
    ENDFORM.                    " F_OUTPUT

  • How to use ALV  in web dynpro for ABAP?

    Hi,
    I am new to web dynpro. Now I want to create a table using ALV to display. I have no idea how to use it.
    I only know I need to add the SALV_WD_TABLE for component usage. Can anyone give me some hints
    or step-by-step procedure?
    Thanks.
    Awards will be provided.
    Best Regards,
    Chris Gu

    Hi,
    Please go thru this set of [tutuorials|https://www.sdn.sap.com/irj/sdn/webdynpro?rid=/webcontent/uuid/60ea94e5-0901-0010-c3bb-aad5ea9620d8].
    Its really good for ALV.
    I also used this as I am also new to WD ABAP.
    Revert back with issues.
    Regards,
    Sumit

  • Need to use ALV instead of write:/ statement in this perform

    How can I use ALV within this perform instead of using Write:/ in it.
    Scroll the program. At the bottom there is use of write:/ statement.
    How to use ALV in this perform?
    FORM display_logfile .
      TYPES: BEGIN OF lt_openbal,
                bukrs TYPE bukrs,
                hkont TYPE hkont,
                augdt TYPE augdt,
                augbl TYPE augbl,
                zuonr TYPE dzuonr,
                gjahr TYPE gjahr,
                belnr TYPE belnr_d,
                buzei TYPE buzei,
                shkzg TYPE shkzg,
                dmbtr TYPE dmbtr,
             END OF lt_openbal,
             BEGIN OF lt_log2,
                hkont TYPE hkont,
                opbal TYPE dmbtr,
                exp   TYPE dmbtr,
                cap   TYPE dmbtr,
                err   TYPE dmbtr,
             END OF lt_log2,
             BEGIN OF lt_zsct_record,
                kongr TYPE ckml_kongr,
                hkont TYPE hkont,
                zcptp TYPE zdecptp,
                zerrc TYPE zdeerrc,
             END OF lt_zsct_record.
      DATA: lw_zscs_record  TYPE t_zscs_record,
            lw_zsct_record       TYPE lt_zsct_record,
            li_zsct_record         TYPE STANDARD TABLE OF lt_zsct_record,
            li_zsct_record1       TYPE STANDARD TABLE OF lt_zsct_record,
            lw_log1                  TYPE t_zscs_record,
            li_log1                   TYPE STANDARD TABLE OF t_zscs_record,
            li_temp                  TYPE STANDARD TABLE OF t_zsct_autoinv,
            li_openbal              TYPE STANDARD TABLE OF lt_openbal,
            li_openbal_mod      TYPE STANDARD TABLE OF lt_openbal,
            li_log2                   TYPE STANDARD TABLE OF lt_log2,
            li_log2_t                TYPE STANDARD TABLE OF lt_log2,
            lw_log2                 TYPE lt_log2,
            lw_log2_t               TYPE lt_log2,
            lw_openbal_mod    TYPE lt_openbal,
            lw_openbal            TYPE lt_openbal.
      i_zscs_record1 = i_zscs_record.
      DELETE i_zscs_record1 WHERE zerrf NE space.
      SORT i_error_bapi BY recid.
      SORT i_error_bdc BY recid.
      SORT i_suc_bdc BY recid.
      SORT i_suc_bapi BY recid.
      SORT i_zscs_record1 BY recid.
      LOOP AT i_zscs_record1 INTO lw_zscs_record.
        lw_log1-recid = lw_zscs_record-recid.
        lw_log1-kongr = lw_zscs_record-kongr.
        lw_log1-hkont = lw_zscs_record-hkont.
        CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
          EXPORTING
            input  = lw_zscs_record-projk
          IMPORTING
            output = lw_log1-projk.
        lw_log1-werks = lw_zscs_record-werks.
        lw_log1-matnr = lw_zscs_record-matnr.
        lw_log1-zcptp = lw_zscs_record-zcptp.
        lw_log1-zerrf = lw_zscs_record-zerrf.
    To  Check if the KONGR value is is equal to 'E'
        IF lw_zscs_record-kongr = c_e.
          READ TABLE i_error_bapi INTO w_error_bapi WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
          IF sy-subrc = 0.
            lw_log1-zerrc = w_error_bapi-number.
            lw_log1-zertx = w_error_bapi-message.
          ENDIF.
        ELSE.
          READ TABLE i_error_bdc INTO w_error_bdc WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
          IF sy-subrc = 0.
            lw_log1-zerrc = w_error_bdc-number.
            lw_log1-zertx = w_error_bdc-message.
          ENDIF.
        ENDIF.
    *****To Check if the KONGR value is is equal to 'E'
        IF lw_zscs_record-kongr = c_e.
          READ TABLE i_suc_bapi INTO w_suc_bapi WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
          IF sy-subrc = 0.
            lw_log1-zerrf = c_x.
    *******To check if  lw_log1-zertx = w_error_bapi-message.
          ENDIF.
        ELSE.
          READ TABLE i_suc_bdc INTO w_suc_bdc WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
          IF sy-subrc = 0.
            lw_log1-zerrf = c_x.
    ********To check if lw_log1-zertx = w_error_bdc-message.
          ENDIF.
        ENDIF.
        APPEND lw_log1 TO li_log1.
    *To clear work areas
        CLEAR: lw_log1,
               w_error_bapi,
               w_suc_bdc,
               w_suc_bapi,
               w_error_bdc,
               lw_zscs_record.
      ENDLOOP.
      IF NOT i_zscs_record1 IS INITIAL.
    *To retrieve required data from the custom table ZSCT_AUTOINV
        SELECT saknr
               fipos
               geber
               saknr_off
               fipos_off
          FROM zsct_autoinv
          INTO TABLE i_autoinv
           FOR ALL ENTRIES IN i_zscs_record1
           WHERE saknr = i_zscs_record1-hkont.
        IF sy-subrc = 0.
          SORT i_autoinv.
        ENDIF.
      ENDIF.
    Assigning I_AUTOINV data into a local internal table for further processing
      li_temp[] = i_autoinv[ ].
    Sort LI_TEMP by SAKNR
      SORT li_temp BY saknr.
    Delete adjacent duplicates from LI_TEMP comparing SAKNR
      DELETE ADJACENT DUPLICATES FROM li_temp COMPARING saknr.
    Check if LI_TEMP is initial
      IF NOT li_temp[] IS INITIAL.
    Retrieve required data from table BSIS for all the G/L accounts
        SELECT  bukrs
                hkont
                augdt
                augbl
                zuonr
                gjahr
                belnr
                buzei
                shkzg
                dmbtr
           FROM bsis
           INTO TABLE li_openbal_mod
           FOR ALL ENTRIES IN li_temp
         WHERE  bukrs = c_wfp
           AND  hkont = li_temp-saknr.
        IF sy-subrc = 0.
        ENDIF.
      ENDIF.
      SORT li_openbal_mod BY hkont.
    ****Retrieve data from table ZSCT_RECORD for further processing for
    ****all entries where ZERRF is equal to space
      IF p_prsall = c_x.
        SELECT kongr
               hkont
               zcptp
               zerrc
          FROM zsct_record                                  "#EC CI_NOFIRST
          INTO TABLE li_zsct_record
          WHERE zerrf = space.
        IF sy-subrc = 0.
    *****Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
          DELETE li_zsct_record WHERE hkont EQ space.
        ENDIF.
      ELSEIF p_cstcpt = c_x.
        SELECT kongr
               hkont
               zcptp
               zerrc
          FROM zsct_record                                  "#EC CI_NOFIRST
          INTO TABLE li_zsct_record
         WHERE zerrf = space
         AND   kongr NE c_e.
        IF sy-subrc = 0.
    ******Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
          DELETE li_zsct_record WHERE hkont EQ space.
        ENDIF.
      ELSEIF p_cstexp = c_x.
        SELECT kongr
               hkont
               zcptp
               zerrc
         FROM  zsct_record                                  "#EC CI_NOFIRST
         INTO TABLE li_zsct_record
         WHERE zerrf = space
         AND   kongr EQ c_e.
        IF sy-subrc = 0.
    ******Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
          DELETE li_zsct_record WHERE hkont EQ space.
        ENDIF.
      ENDIF.
      LOOP AT li_openbal_mod INTO lw_openbal.
        IF lw_openbal-shkzg = c_shkzg1.
          v_todmbtr = v_todmbtr + lw_openbal-dmbtr.
        ELSEIF lw_openbal-shkzg = c_shkzg2.
          v_todmbtr = v_todmbtr - lw_openbal-dmbtr.
        ENDIF.
        AT END OF hkont.
          lw_log2-hkont = lw_openbal-hkont.           "GL account
          lw_log2-opbal = ABS( v_todmbtr ).      "Open item balance
          APPEND lw_log2 TO li_log2.
    *log record appended with GL Account and account open item balance
          CLEAR: v_todmbtr,
                 lw_openbal.
        ENDAT .
      ENDLOOP.
      SORT li_log2 BY hkont.
      LOOP AT li_log2 INTO lw_log2.
        CLEAR v_totexppe.
        CLEAR v_totcapit.
        CLEAR v_toterror.
    *Cost portion to be capitalised calculated
        LOOP AT li_zsct_record INTO lw_zsct_record
                 WHERE hkont = lw_log2-hkont AND
                  kongr NE c_e AND zerrc IS INITIAL.
          v_totcapit = v_totcapit + lw_zsct_record-zcptp.  "CC calculated
        ENDLOOP.
    *Expensed cost portion calculated
        LOOP AT li_zsct_record INTO lw_zsct_record WHERE
                hkont = lw_log2-hkont        AND
                kongr = c_e AND zerrc IS INITIAL .
          v_totexppe = v_totexppe + lw_zsct_record-zcptp.  "ECP calculated
        ENDLOOP.
    *Errors calculated
        LOOP AT li_zsct_record INTO lw_zsct_record WHERE
                hkont = lw_log2-hkont AND
                zerrc IS NOT INITIAL .
          v_toterror = v_toterror + lw_zsct_record-zcptp.  "Errors calculated
        ENDLOOP.
        lw_log2-exp = v_totexppe.           "Expensed cost portion
        lw_log2-cap = v_totcapit.           "Cost capitalised
        lw_log2-err = v_toterror.           "Errors
    *Cost portion capitalised expensed and errors in calculation are
    *trans ported for related GL accont
        MODIFY li_log2 FROM lw_log2
        TRANSPORTING exp cap err.
      ENDLOOP.
      LOOP AT li_log2_t INTO lw_log2_t.
        MODIFY li_log2 FROM lw_log2_t TRANSPORTING opbal WHERE hkont = lw_log2_t-hkont.
        CLEAR : lw_log2_t.
      ENDLOOP.
      WRITE:/1(15) text-018,sy-datum.             "SESSION DATE:
      SKIP 2.
    For printing the hear level of the output log
      WRITE:/1(16)   text-003,                     "Record ID number
             20(11)  text-004,                     "Reason Code
             34(10)  text-005,                     "GL Account
             47(12)  text-006,                     "Project Code
             62(5)   text-007,                     "Plant
             70(9)   text-008,                     "Commodity
             82(25)  text-009,                     "Cost portion To be posted
             110(12) text-010,                     "Success Flag
             125(10) text-011,                     "Error Code
             138(50) text-012.                     "Error TXT
      SKIP.
      LOOP AT li_log1 INTO lw_log1.
        WRITE:/1(16)   lw_log1-recid,
               20(11)  lw_log1-kongr,
               34(10)  lw_log1-hkont,
               47(12)  lw_log1-projk,
               62(5)   lw_log1-werks,
               70(9)   lw_log1-matnr,
               82(25)  lw_log1-zcptp,                       "#EC UOM_IN_MES
               110(12) lw_log1-zerrf,
               125(10) lw_log1-zerrc,
               138(80) lw_log1-zertx.
        CLEAR:lw_log1.
      ENDLOOP.
      SKIP 2.
      IF NOT li_log2 IS INITIAL.
        ULINE.
        WRITE:/1(16)  text-013,                  "GL ACCOUNT CODE
               20(17) text-014,                  "OPEN ITEM BALANCE
               40(21) text-015,                  "EXPENSED COST PORTION
               64(24) text-016,                  "CAPITALIZED COST PORTION
               92(20) text-017.                  "ERRORS.
        LOOP AT li_log2 INTO lw_log2.
          WRITE:/1(16)   lw_log2-hkont,
                 20(17)  lw_log2-opbal,                
                 40(21)  lw_log2-exp,                      
                 64(24)  lw_log2-cap,                     
                 92(20)  lw_log2-err.                     
          CLEAR:lw_log2.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " DISPLAY_LOGFILE

    hi,
    You need to use FM 'REUSE_ALV_LIST_DISPLAY' for this purpose. For using this FM, you need to create a field catlog which will contain all information about the coloumns you want to display for example their position, their text etc.
    Below there is a small demo for achiving this.
    TYPE-POOLS:slis.
    DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
    TYPES: BEGIN OF ty_itab1,
           vbeln LIKE vbap-vbeln,
           posnr LIKE vbap-posnr,
           werks LIKE vbap-werks,
           lgort LIKE vbap-lgort,
           END OF ty_itab1.
    DATA: itab1 TYPE TABLE OF ty_itab1.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
    SELECTION-SCREEN END OF  BLOCK b1.
    START-OF-SELECTION.
      PERFORM select_data.
    END-OF-SELECTION.
    PERFORM display.
    FORM select_data .
      SELECT vbeln
         posnr
         werks
         lgort
         INTO CORRESPONDING  FIELDS OF TABLE itab1
         FROM vbap
         WHERE  vbeln IN s_vbeln.
      IF sy-subrc <> 0.
        MESSAGE 'Enter The Valid Sales Document Number'(t04) TYPE 'I'.
        EXIT.
      ENDIF.
    ENDFORM.
      IF alv_list = 'X'.
        PERFORM build_fieldcat TABLES i_fieldcat[]
                               USING :
    *-Output-field Table      Len  Ref fld Ref tab Heading    Col_pos
       'VBELN'       'ITAB1'     10   'VBAP'  'VBELN'    ''            1,
       'POSNR'       'ITAB1'     6    'VBAP'  'POSNR'    ''            2,
       'WERKS'       'ITAB1'     4    'VBAP'  'WERKS'    ''            3,
       'LGORT'       'ITAB1'     4    'VBAP'  'LGORT'    ''            4.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program       = sy-repid
           i_callback_pf_status_set = c_pf_status
            i_callback_user_command  = 'USER_COMMAND '
           it_events                = t_alv_events[]
            it_fieldcat              = i_fieldcat[]
          TABLES
            t_outtab                 = itab1[]
          EXCEPTIONS
            program_error            = 1
            OTHERS                   = 2.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    FORM build_fieldcat TABLES  fpt_fieldcat TYPE slis_t_fieldcat_alv
                        USING   fp_field     TYPE slis_fieldname
                                fp_table     TYPE slis_tabname
                                fp_length    TYPE dd03p-outputlen
                                fp_ref_tab   TYPE dd03p-tabname
                                fp_ref_fld   TYPE dd03p-fieldname
                                fp_seltext   TYPE dd03p-scrtext_l
                                fp_col_pos   TYPE sy-cucol.
    *-- Local data declaration
      DATA:   wl_fieldcat TYPE slis_fieldcat_alv.
    *-- Clear WorkArea
      wl_fieldcat-fieldname       = fp_field.
      wl_fieldcat-tabname         = fp_table.
      wl_fieldcat-outputlen       = fp_length.
      wl_fieldcat-ref_tabname     = fp_ref_tab.
      wl_fieldcat-ref_fieldname   = fp_ref_fld.
      wl_fieldcat-seltext_l       = fp_seltext.
      wl_fieldcat-col_pos         = fp_col_pos.
    *-- Update Field Catalog Table
      APPEND wl_fieldcat  TO  fpt_fieldcat.
    ENDFORM.

  • Display 2 different structured internal tables in single screen using ALV

    Hi,
    I have two internal tables. Both has different structures. My requirement is to display both the internal tables in single screen using ALV Grid but NOT using OO ALV Grid display.
    Is there any way of spliting the Final ALV display screen into two with two different headers and details as shown below.
    Header1 for internal table 1
    Data of internal table 1
    Header1 for internal table 2
    Data of internal table 2
    Can anyone suggest a better way to display this.
    Regards,
    Senthil

    hi
    first think i can say ALV GRID means only for OO ALV it is not possible to display two I.T. data in singr report screen.
    better to use of the fm: REUSE_ALV_BLOCK_LIST_DISPLAY
    so that u can display both I.T. data in separate report list under single screen
    Check the example programs:
    BALVBT01 Testprogram ALV: Block list
    BCALV_TEST_BLOCK_LIST Program BCALV_TEST_BLOCK_LIST
    Regards,
    deepak

  • Regarding output using alv grid display

    Hi experts,
        i have a program
    FS_TAB1-A = P_T1.
    IF P_T1 = 0.
      TEMP1 = 1.
      DO TEMP1 TIMES.
        FS_TAB1-A = P_T1 * DUMMY1.
        APPEND FS_TAB1 TO T_TAB1.
        DUMMY1 = DUMMY1  + 1.
      ENDDO.
    now i have to diplay the p_t1*dummy1 using alv grid display like it goes into thew  loop for ten times then i have to show it 10 times like
    10 1  102 103 104 111 112  like that can u help me

    hi,
        you have to get the result of the multiplication at each row and then concatenate the result and the factor to show the final result in multiples value and multiplication factor...

  • How can I disenable the EXCEL field format when use ALV download to excel ?

    Dear friends,
         I have a problem with the ALV download to EXCEL. One field Value in ALV is like u2018-abcdeu2026u2019.the character u201C-u201Cis the first   position  in field value.when I download  the value to EXCEL,the field value u2018-abcdeu2026u2019 changed u2018=-abcdeu2026u2019 in EXCEL.how can I remove u2018=u2019 in EXCEL when I down to excel used ALV.
    I add a space in u2018  -abcdeu2026u2019,So this value can be download to Excel .
    Have you any solve method?
    User does not use excel logo button to download.
    User use Local fileu2026 button to download
    Thanks
    Sun

    add a single quote to the beginning of the field.
    like:  '-abcde
    in excel it will be shown as : -abcde

  • Req:Download of purchase order item details using ALV oops

    Hi all,
    How to download the purchase order item details using ALV oops from the output of header details

    Hi all,
    How to download the purchase order item details using ALV oops from the output of header details

  • Using ALV as a search Help

    Has anyone used ALV as a search help presentation/selection method.  I'm thinking, in a simplistic sense, it would be just creating an itab and presenting it on a grid in a container on a new screen called by an exit....
    Probably too simple, huh?    Pointers to any snippets that implement this would be welcome. 
    (additionally, might have a need to save user layouts of this info as well)
    Thoughts, comments, pitfalls.... ?
    Thanks...
    ...Mike

    Hey Michael a working example I just made for some1
    thought u might be interested
    Q. i_checkbox_fieldname = 'CHECKBOX'
    A. If the table output in the popup has checkboxes at the beginning of the rows (e.g. for multiple selection), the internal table must contain a field containing the value of the checkbox.
    Assign the name of this field to the parameter I_CHECKBOX_FIELDNAME.
    Q. i_tabname = 'TLINE'
    A.  This is the name of ur input help internal table
    Q. it_fieldcat = fieldcat[]
    A  The table u gonna display has to have a fieldcat.
    Q. it_excluding = extab[].
    A. In case u wanna exclude some functions.
    Below is a working example, paste it in se38 and activate.
    !!! Warning SAVE IT AS A LOCAL OBJECT !!!
    report ztests1.
    type-pools: slis.
    data: index type i.
    data: l_kunnr like kna1-kunnr.
    data: input(10) type c,
           text(4) type c,
           text1(5) type c.
    data: begin of itab occurs 10,
           kunnr like kna1-kunnr,
           name1 like kna1-name1,
          end of itab.
    data: e_exit.
    data: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    parameter: p_kunnr(10) type c.
    at selection-screen on value-request for p_kunnr.
      select kunnr name1 up to 10 rows
        from kna1
        into table itab.
      fieldcat-tabname = 'ITAB'.
      fieldcat-fieldname = 'KUNNR'.
      fieldcat-seltext_m = 'Cust'.
      fieldcat-ddictxt = 'M'.
      fieldcat-outputlen = 10.
      APPEND fieldcat.
      CLEAR fieldcat.
      fieldcat-tabname = 'ITAB'.
      fieldcat-fieldname = 'NAME1'.
      fieldcat-seltext_m = 'Cust Name'.
      fieldcat-ddictxt = 'M'.
      fieldcat-outputlen = 30.
      APPEND fieldcat.
      CLEAR fieldcat.
        CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
          EXPORTING
            I_TITLE                       = 'Customer Selection'
          I_SELECTION                   = 'X'
          I_ALLOW_NO_SELECTION          =
          I_ZEBRA                       = ' '
          I_SCREEN_START_COLUMN         = 0
          I_SCREEN_START_LINE           = 0
          I_SCREEN_END_COLUMN           = 0
          I_SCREEN_END_LINE             = 0
          I_CHECKBOX_FIELDNAME          =
          I_LINEMARK_FIELDNAME          =
          I_SCROLL_TO_SEL_LINE          = 'X'
            i_tabname                     = 'ITAB'
          I_STRUCTURE_NAME              =
            IT_FIELDCAT                   = fieldcat[]
          IT_EXCLUDING                  =
          I_CALLBACK_PROGRAM            =
          I_CALLBACK_USER_COMMAND       =
          IS_PRIVATE                    =
          IMPORTING
          ES_SELFIELD                   =
            E_EXIT                        = e_exit
          tables
            t_outtab                      = itab
        EXCEPTIONS
          PROGRAM_ERROR                 = 1
          OTHERS                        = 2
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.

  • Want to display more than 300 charcters in a column using ALV grid display

    Hi Guru's,
    I am trying to display more than 500 charcters in a column using alv grid display but it in the output it is showing only 128 characters. Can you help me to display all the characters in particular column Or is there any limitation in maximum of no of charcters for a column?
    Thanks,
    Radha.

    Hi Paurl,
    Define a work area say
    wa_layout type slis_layout_alv.
    then fill this work area as
    wa_layout-zebra = X
    wa_layout-colwidth_optimize = X.
    wa_layout-max_linesize = 300.
    Then in FM 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    is_layout = wa_layout
    etc.
    you provided this for the field which is displayed in alv grid will have more than 128 characters.
    from this code i want,how it refers to particular field.
    when i mentioned field catalog-OUTPUTLEN = '300'.
    it is not displayed the field morethan 128 characters.
    it only displays 128 characters.
    please provide me clear and breif information with suitable code.
    i am trying what your sending but it is not displayed more than 128 characters.
    if you don't mind please spend for me some time for this and
    give me clear and breif information with suitable code.
    Thanks & Regards,
    Radhakrishna.

Maybe you are looking for

  • Random exception on wlps 3.2: please help me!!!

    Using wlps 3.2 and wls 5.1 sp8, driver oci that points to a oracle 8i database, only on a specific ruleset, sometimes, I find this error: ven nov 02 14:47:31 CET 2001:<E> <T3Services> COMMERCE_SERVER_FRAMEWORK,LOG_ERROR,"Error in AdvisorBean.advise()

  • How to remove eventreceiver when handling AppUninstalling in a RER without getting access denied

    I am trying to remove an eventreceiver from the clientContext.Web.EventReceivers by using DeleteObject() but I am getting Access Denied exception In my appmanifest.xml I already granted full control to the app Within my AppEventReceiver I have: if (p

  • Updating Zend Framework

    How can I update Zend Framework in Flash Builder 4? Flash Builder currently installs version 1.10.1 of the Framework, and I want to install version 1.10.7 I need to install the newest version of Zend Framework because I have a problem with Network Mo

  • Lost my movies off my library.

    I have lost all my movies off my iTunes library and I can't figure out how to get them back. Can anyone help me out with this problem?

  • Show Item depending on two conditions

    Hello, I have an item which have to display conditions. How can I realize this combined display option? The same problem I have for the computation. The computation depends on two conditions. Is there a possibility to realize this in ApEx? Thanks in