No ALV output

Hi ALL
my Field Catalogue has been built and i am using the pollowing code on PBO module of screen
  IF g_container IS INITIAL.
    CREATE OBJECT g_container
      EXPORTING
        container_name = 'GRD_CNTRL'
    EXCEPTIONS
        cntl_system_error = 1
        cntl_error = 2
        create_error = 3
        lifetime_error = 4
        lifetime_dynpro_dynpro_link = 5
        OTHERS = 6.
    IF sy-subrc <> 0.
    ENDIF.
    CREATE OBJECT g_alvgrid
      EXPORTING
        i_parent = g_container.
* Set event handler
    SET HANDLER: lcl_eventhandler=>handle_double_click FOR g_alvgrid.
* set layout
    wa_layout-zebra      = 'X'.
    CALL METHOD g_alvgrid->set_table_for_first_display
      EXPORTING
        is_layout                     = wa_layout
      CHANGING
        it_outtab                     = it_out
        it_fieldcatalog               = it_fieldcat[]
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        OTHERS                        = 4.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
  ENDIF.
sy-subrc = 0 in all instances
I am getting a blanck screen. No Output. Why is that?

This is an example of the entire flow for the PBO of grid init
*       MODULE init_grid_0108 OUTPUT                                  *
MODULE init_grid_0108 OUTPUT.
  PERFORM init_grid_0108.
ENDMODULE.                 " init_grid_0108  OUTPUT
*&      Form  init_grid_0108
FORM init_grid_0108.
  DATA:
* Layout
    wa_layout_action_0108 TYPE lvc_s_layo,
* Field catalog
    it_fcat_action_0108 TYPE lvc_t_fcat.
  IF cust_cont_0108 IS INITIAL.          "CREATE: Yes
*   Create customer container
    CREATE OBJECT cust_cont_0108
      EXPORTING
*        PARENT                      =
         container_name              = 'CUST_CONT_0108'
*        STYLE                       =
*        LIFETIME                    = lifetime_default
*        REPID                       =
*        DYNNR                       =
*        NO_AUTODEF_PROGID_DYNNR     =
       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.
      MESSAGE e208(00) WITH 'Error: Create Cust Control CUST_CONT'.
    ENDIF.
*   Create grid
    CREATE OBJECT grid_action_0108
      EXPORTING
*        I_SHELLSTYLE      = 0
*        I_LIFETIME        =
         i_parent          = cust_cont_0108
*        I_APPL_EVENTS     = space
*        I_PARENTDBG       =
*        I_APPLOGPARENT    =
*        I_GRAPHICSPARENT  =
*        I_USE_VARIANT_CLASS = SPACE
*        I_NAME            =
       EXCEPTIONS
         error_cntl_create = 1
         error_cntl_init   = 2
         error_cntl_link   = 3
         error_dp_create   = 4
         others            = 5
    IF sy-subrc <> 0.
      MESSAGE e208(00) WITH 'Error: Create Grid GRID_ACTION'.
    ENDIF.
*   Build field catalog
    PERFORM build_fcat_action_0108 CHANGING it_fcat_action_0108.
*   Build layout
    PERFORM build_layout_action_0108 CHANGING wa_layout_action_0108.
*   Display grid (First)
    CALL METHOD grid_action_0108->set_table_for_first_display
       EXPORTING
*        I_BYPASSING_BUFFER            =
*        I_BUFFER_ACTIVE               =
*        I_CONSISTENCY_CHECK           =
*        I_STRUCTURE_NAME              =
*        IS_VARIANT                    =
*        I_SAVE                        =
*        I_DEFAULT                     = 'X'
         is_layout                     = wa_layout_action_0108
*        IS_PRINT                      =
*        IT_SPECIAL_GROUPS             =
*        IT_TOOLBAR_EXCLUDING          =
*        IT_HYPERLINK                  =
*        IT_ALV_GRAPHICS               =
*        IT_EXCEPT_QINFO               =
      CHANGING
         it_outtab                     = wt_zlmcont
         it_fieldcatalog               = it_fcat_action_0108
*        IT_SORT                       =
*        IT_FILTER                     =
*      EXCEPTIONS
*        INVALID_PARAMETER_COMBINATION = 1
*        PROGRAM_ERROR                 = 2
*        TOO_MANY_LINES                = 3
*        others                        = 4
    IF sy-subrc <> 0.
      MESSAGE e208(00) WITH 'Error: Display GRID_ACTION (first)'.
    ENDIF.
    CREATE OBJECT event_receiver_0108.
    SET HANDLER event_receiver_0108->handle_double_click_0108
            FOR grid_action_0108.
  ELSE.                             "CREATE: No
*   ----- Refresh ALV -----
    CALL METHOD grid_action_0108->refresh_table_display
*      EXPORTING
*        IS_STABLE      =
*        I_SOFT_REFRESH =
       EXCEPTIONS
         finished       = 1
         OTHERS         = 2
    IF sy-subrc <> 0.
      MESSAGE e208(00) WITH 'Error: Display GRID_ACTION_0108 (refresh)'.
    ENDIF.
  ENDIF.                            "CREATE
This code is in the Class Defintion.
*       CLASS lcl_event_receiver_0108 DEFINITION
CLASS lcl_event_receiver_0108 DEFINITION DEFERRED.
DATA:
  cust_cont_0108        TYPE REF TO cl_gui_custom_container,
  grid_action_0108      TYPE REF TO cl_gui_alv_grid,
  event_receiver_0108   TYPE REF TO lcl_event_receiver_0108,
  wa_row_no_0108        TYPE lvc_s_roid,
  it_row_no_0108        TYPE lvc_t_roid.
*       CLASS lcl_event_receiver_0108 DEFINITION
CLASS lcl_event_receiver_0108 DEFINITION.
  PUBLIC SECTION.
    METHODS:
    handle_double_click_0108
        FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING e_row e_column.
  PRIVATE SECTION.
ENDCLASS.
*       CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver_0108 IMPLEMENTATION.
  METHOD handle_double_click_0108.
* § 4.The event DOUBLE_CLICK provides parameters for row and column
*   of the click. Use row parameter to select a line of the
*   corresponding internal table.
* read selected row from internal table
    READ TABLE wt_zlmcont INTO wt_zlmcont_rec
      INDEX e_row-index.
    sub_mode = c_change.
    CALL SCREEN 208 STARTING AT 10 1.
  ENDMETHOD.                           "handle_double_click
ENDCLASS.
Edited by: Paul Chapman on Jun 13, 2008 6:27 AM

Similar Messages

  • Total is not getting displayed in the ALV output.

    Hi,
    Total is not getting displayed in the ALV output.
    I m using :REUSE_ALV_BLOCK_LIST_APPEND & REUSE_ALV_BLOCK_LIST_DISPLAY
    Are  there any issues with it as the same settings are working fine with REUSE_ALV_LIST_DISPLAY
    source code:
    DATA: layout TYPE slis_layout_alv,
          IT_eventS  TYPE slis_t_event,
          fcat   TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          rec_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    TYPES: BEGIN OF ty_tab,
          belnr TYPE dberchz-belnr,
          belzart TYPE dberchz-belzart,
          net TYPE dberchz-nettobtr,
          END OF ty_tab.
    DATA: lt_tab TYPE STANDARD TABLE OF ty_tab.
    SELECT belnr belzart nettobtr
      FROM dberchz
      INTO TABLE lt_tab[]
    WHERE belnr eq '000000000001'.
      if sy-subrc ne 0.
      ENDIF.
    *  defining layout
    layout-colwidth_optimize = 'X'.
    layout-def_status = 'X'.
    *defning event
    *event
    *defining field catalog
    fcat-col_pos = 1.
    fcat-fieldname = 'BELNR'.
    fcat-tabname  = 'LT_TAB'.
    APPEND fcat.
    fcat-col_pos = 2.
    fcat-fieldname = 'BELZART'.
    fcat-tabname  = 'LT_TAB'.
    APPEND fcat.
    fcat-col_pos = 3.
    fcat-fieldname = 'NET'.
    fcat-tabname  = 'LT_TAB'.
    fcat-do_sum = 'X'.
    APPEND fcat.
    *calling alv
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
      EXPORTING
        i_callback_program             = 'YZ_PLR'
    *   I_CALLBACK_PF_STATUS_SET       = ' '
    *   I_CALLBACK_USER_COMMAND        = ' '
    *   IT_EXCLUDING                   =
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        is_layout                        = layout
        it_fieldcat                      = fcat[]
        i_tabname                        = 'LT_TAB'
        it_events                        = IT_EVENTS[]
    *   IT_SORT                          =
    *   I_TEXT                           = ' '
      tables
        t_outtab                         = lt_tab[]
    * EXCEPTIONS
    *   PROGRAM_ERROR                    = 1
    *   MAXIMUM_OF_APPENDS_REACHED       = 2
    *   OTHERS                           = 3
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    Thanks,
    Gaurav

    Hi
    No I don't think, this is my code (based on your code) and it works fine:
    TYPE-POOLS SLIS.
    DATA: BEGIN OF LT_TAB OCCURS 0,
           BELNR LIKE BSEG-BELNR,
           GJAHR LIKE BSEG-GJAHR,
           WRBTR LIKE BSEG-WRBTR,
           WAERS LIKE BKPF-WAERS,
          END OF LT_TAB.
    DATA: LAYOUT     TYPE SLIS_LAYOUT_ALV,
          IT_EVENTS  TYPE SLIS_T_EVENT,
          FCAT       TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          REC_FCAT   TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
    START-OF-SELECTION.
      FCAT-COL_POS       = 1.
      FCAT-FIELDNAME     = 'BELNR'.
      FCAT-TABNAME       = 'LT_TAB'.
      FCAT-REF_FIELDNAME = 'BELNR'.
      FCAT-REF_TABNAME   = 'BSEG'.
      APPEND FCAT.
      FCAT-COL_POS       = 2.
      FCAT-FIELDNAME     = 'GJAHR'.
      FCAT-TABNAME       = 'LT_TAB'.
      FCAT-REF_FIELDNAME = 'GJAHR'.
      FCAT-REF_TABNAME   = 'BSEG'.
      APPEND FCAT.
      FCAT-COL_POS       = 3.
      FCAT-FIELDNAME     = 'WRBTR'.
      FCAT-TABNAME       = 'LT_TAB'.
      FCAT-CFIELDNAME    = 'WAERS'.
      FCAT-REF_FIELDNAME = 'WRBTR'.
      FCAT-REF_TABNAME   = 'BSEG'.
      FCAT-DO_SUM        = 'X'.
      APPEND FCAT.
      FCAT-COL_POS       = 4.
      FCAT-FIELDNAME     = 'WAERS'.
      FCAT-TABNAME       = 'LT_TAB'.
      FCAT-REF_FIELDNAME = 'WAERS'.
      FCAT-REF_TABNAME   = 'BKPF'.
      FCAT-DO_SUM        = SPACE.
      APPEND FCAT.
      SELECT * FROM BSEG INTO CORRESPONDING FIELDS OF TABLE LT_TAB
        WHERE BUKRS = 'MAAB'
          AND BELNR = '0000000001'.
      LT_TAB-WAERS = 'EUR'.
      MODIFY LT_TAB FROM LT_TAB TRANSPORTING WAERS WHERE WAERS = SPACE.
    *CALLING ALV
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          I_CALLBACK_PROGRAM = 'ZPROVAMAX5'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          IS_LAYOUT   = LAYOUT
          IT_FIELDCAT = FCAT[]
          I_TABNAME   = 'LT_TAB'
          IT_EVENTS   = IT_EVENTS[]
        TABLES
          T_OUTTAB    = LT_TAB[].
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
    I've also inserted a currency field
    Max

  • I am not getting the headings of the fields in ALV output.

    I am not getting ALV out put but  the headings of the fields in ALV output.
    Please see my below code .
    TYPES : BEGIN OF ty_zgxmit.
              INCLUDE STRUCTURE zgxmit.
    TYPES : END OF ty_zgxmit.
    DATA : gt_zgxmit TYPE TABLE OF ty_zgxmit.
    *&      Form  alv_display                                              *
    This subroutine is to display the out put in ALV.                    *
    FORM alv_display .
    Local data
      DATA: y_x          LIKE boole  VALUE 'X'.
    DATA: lt_fieldcat  TYPE slis_t_fieldcat_alv.
      DATA: lf_fieldcat  TYPE slis_fieldcat_alv.
      DATA: lh_index     LIKE lf_fieldcat-col_pos.
    For variant
    DATA: ws_repid LIKE sy-repid,
          g_save TYPE c VALUE 'A',
          g_exit TYPE c,
          g_variant LIKE disvariant,
          gx_variant LIKE disvariant.
      For 1st field.( RPT_LOC )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'RPT_LOC'.
        lf_fieldcat-tabname = 'GT_ZGXMIT'.
        lf_fieldcat-ref_tabname = 'RPT_LOC'.
        lf_fieldcat-ref_fieldname = 'ZGXMIT'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-key = y_x.
        lf_fieldcat-no_sum = y_x.
        APPEND lf_fieldcat TO lt_fieldcat.
    For 2nd field.( BAL_XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'BAL_XMIT'.
        lf_fieldcat-tabname = 'GT_ZGXMIT'.
        lf_fieldcat-ref_tabname = 'BAL_XMIT'.
        lf_fieldcat-ref_fieldname = 'ZGXMIT'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-key = y_x.
        lf_fieldcat-no_sum = y_x.
        APPEND lf_fieldcat TO lt_fieldcat.
    For 3rd field.( INC_XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'INC_XMIT'.
        lf_fieldcat-tabname = 'GT_ZGXMIT'.
        lf_fieldcat-ref_tabname = 'INC_XMIT'.
        lf_fieldcat-ref_fieldname = 'ZGXMIT'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-key = y_x.
        lf_fieldcat-no_sum = y_x.
        APPEND lf_fieldcat TO lt_fieldcat.
    For 4th field.( Z500_XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'Z500_XMIT'.
        lf_fieldcat-tabname = 'GT_ZGXMIT'.
        lf_fieldcat-ref_tabname = 'Z500_XMIT'.
        lf_fieldcat-ref_fieldname = 'ZGXMIT'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-key = y_x.
        lf_fieldcat-no_sum = y_x.
        APPEND lf_fieldcat TO lt_fieldcat.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program       = 'ZJV_2245'
                it_fieldcat              = lt_fieldcat
           TABLES
                t_outtab                 = gt_zgxmit
           EXCEPTIONS
                program_error            = 1
                OTHERS                   = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " alv_display

    You can force the headings like so.
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'RPT_LOC'.
    lf_fieldcat-tabname = 'GT_ZGXMIT'.
    lf_fieldcat-ref_tabname = 'RPT_LOC'.
    lf_fieldcat-ref_fieldname = 'ZGXMIT'.
    lf_fieldcat-reptext_ddic  = 'Whatever Heading'.    "<-  Right here
    lh_index = lh_index + 1.
    lf_fieldcat-col_pos = lh_index.
    lf_fieldcat-key = y_x.
    lf_fieldcat-no_sum = y_x.
    APPEND lf_fieldcat TO lt_fieldcat.
    Regards,
    Rich Heilman

  • Newly added field not getting displayed in ALV output

    Hi All,
       I'm adding one more field/column to be displayed in an old existing program that uses REUSE_ALV_FIELDCATALOG_MERGE to generate the ALV fieldcat.
    DATA: BEGIN OF it_salary OCCURS 0,
            pernr LIKE pa0000-pernr,
            ename LIKE pa0001-ename,
            rtext like lv_rtext, -
    added field
            waers LIKE pa0008-waers
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = driver
          i_internal_tabname     = 'IT_SALARY'
          i_client_never_display = 'X'
          i_inclname             = driver
        CHANGING
          ct_fieldcat            = lv_fieldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = driver
          it_fieldcat             = lv_fieldcat[]
          i_default               = 'X'
          i_save                  = 'A'
          is_variant              = lv_tmplt
          is_layout               = lv_ls_layout
         i_callback_user_command = 'USER_COMMAND'
        TABLES
          t_outtab                = it_salary
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
    The newly added field is not getting populated in the lv_fieldcat table. Tried running programs BALVBUFDEL,
    BCALV_BUFFER_DEL_SHARED then logging off and logging in but of no help.
    Please provide suggestion for this issue.
    Regards,
    Sridevi S

    Hi,
    Fieldcat is buffered - so use
    I_BYPASSING_BUFFER = 'X'
    Since a while CL_GUI_ALV_GRID is available which does NOT need any fieldcat (is determined internally using RTTI). It is worth playing around whith this class if you have some time. This class is recommended for ALV Output by SAP (but no edit is possible - was never supported officially).
    A simple use would be:
    data: gt_output type standard table of (adjust!).
    *simple ALV output
    data go_alv type ref to cl_salv_table.
    data go_functions type ref to cl_salv_functions_list.
    data go_columns type ref to cl_salv_columns_table.
    data go_column type ref to cl_salv_column_table.
    *Exceprion handlig
    data: go_exception  type ref to cx_root,
          gv_errortext   type string.
    ** fill table gt_output ...
    ** ALV output
    if not gt_output is initial.
        try.
            call method cl_salv_table=>factory
              importing
                r_salv_table = go_alv
              changing
                t_table      = gt_output.
          catch cx_salv_msg into go_exception.
            gv_errortext = go_exception->get_text( ).
            message gv_errortext type 'A'.
        endtry.
    * enable all standard ALV functions
        go_functions =  go_alv->get_functions( ).
        go_functions->set_all( ).
    * hide MANDT
        go_columns = go_alv->get_columns( ).
        go_column ?=  go_columns->get_column( columnname = 'MANDT' ).
        go_column->set_technical( ).
        go_alv->display( ).
    Kind regards,
    Holger

  • Problem with alv output export to text file

    hi experts,
    when iam exporting alv output to text file,
    some data is missing in text file.say for example sold-to-party value is 1155027 in alv out put,but in text file it is showeing only 115502 ,
    the last digit is missing,
    can anyone help urgent!!!!!

    and when you export it to excel?
    from here you could save it as text file too...
    A.

  • Negative sign for DMBTR field in ALV output

    Hi Experts,
    Before posting I have searched for more than 3 hours in the forums to get a solution for this.
    I did not get any solution so I am posting this problem which I need to resolve.
    I have to display the DMBTR field in ALV output for which a grand total will have to be displayed.
    Here for all the values in DMBTR which are negative are getting displayed as '-        6673.56','-       289956.23' as I am using the edit mask 'V_____________.__'.
    I have to get the value shown as '-6673.56', '-289956.23'.
    I tried to use convert this DMBTR to String and have successfully displayed the negative sign correctly in front of the value but I am not getting the totals which I need to have
    PLease check and suggest for a solution.
    Regards
    Kishore

    Hi,
      If this is the case, then you can use character field to display the sign on the left. Sum up the total and use the event end of list to display the same. Remember to set the TECH and NO_OUT in the field catalog.
    Hope this helps.
    Regards,
    Siva

  • Strange behaviour in alv output display for a date column!

    hi friends,
    my alv output list display contains a column for budat (posting date), if this field has no value, then it displays a blank cell (space) in the output in my user login...but when the same report is run in another user login, even though the value of the column is null, it displays 00000000 (8 zeroes) rather than displaying a blank cell...i have set the field catalog property NO_ZERO = 'X'; is this property has anything to do with authorization to achieve its funcionality? am not sure...this is strange, as it is the same report, same field catalog that is being used..need some inputs on this
    thanks in advance
    Sathish

    There are 2 solutions for an adhoc solution you can change the field to a char10 field, this will solve your immediate problem of the 0 display. For a permanent solution you can check the user profile setting for the date for you as well as the concerned user. 
    Hope That Helps
    Anirban M.

  • Co41 enhancement for add field in ALV output

    I must add a custom filed to ALV output of transaction CO41 and i trying to use all the 25 enhancements provided (that i find in other post CO41- Enhancement ), but i haven't found any way to get the desired results.
    Can any body help me?
    Thanks in advance.

    Hi,
    I had the same requirement to add a custom field to ALV output of transaction CO41.
    1. I first added the custom field to an new append-structure to the structure SFC_POCO.
    2. Then i added this field to the Dynpro-Screen 200 in the function-group COUP (by choosing the table control, pressing F6 and then adding the custom field of SFC_POCO).
    3. At last i added an Enhancement to the function CO_UP_PLANNED_ORDERS_SELECT and filled my custom field with data there.
    Please reward if useful.
    Regards,
    Henry

  • ALV output converted into PDF format and send that PDF to user through mail

    Hi Experts,
    I have report earlier its output was in alv grid.
    Now i want that ALV output converted into PDF format.And that PDF output send to user through mail.
    Can u please tell how to do?
    My code is here(output is displaying in ALV grid).
    INCLUDE <icon>.
    TYPE-POOLS: slis, kkblo.
    TABLES : zmsd_freight_hdr, zmsd_freight_det, zmsd_blinfo, zmsd_diheader.
    TABLES : lfa1.
    DATA : t_hdr   LIKE   zmsd_freight_hdr   OCCURS 0 WITH HEADER LINE,
           T_DET   LIKE   ZMSD_FREIGHT_DET   OCCURS 0 WITH HEADER LINE,
           t_bl    LIKE   zmsd_blinfo        OCCURS 0 WITH HEADER LINE,
           t_di    LIKE   zmsd_diheader      OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF t_det OCCURS 0.
            INCLUDE STRUCTURE zmsd_freight_det.
    DATA    type(30).
    DATA: END OF t_det.
    DATA: v_target2(30),
          v_zsammg LIKE t_det-zsammg,
          v_gsttotal LIKE t_det-zamount.
    DATA : BEGIN OF t_data OCCURS 0,
             zsammg       LIKE  zmsd_freight_hdr-zsammg,
             zdidbl       LIKE  zmsd_freight_hdr-zdidbl,
             zvkorg       LIKE  zmsd_freight_hdr-zvkorg,
             zinvno       LIKE  zmsd_freight_hdr-zinvno,
             zttlamt      LIKE  zmsd_freight_hdr-zttlamt,
             zstatus      LIKE  zmsd_freight_hdr-zstatus,
             ztype        LIKE  zmsd_freight_hdr-ztype,
             zconfirm     LIKE  zmsd_freight_hdr-zconfirm,
             zconfirmdate LIKE  zmsd_freight_hdr-zconfirmdate,
             erdat        LIKE  zmsd_freight_hdr-erdat,
             ernam        LIKE  zmsd_freight_hdr-ernam,
             erzet        LIKE  zmsd_freight_hdr-erzet,
             aedat(10),
             aenam        LIKE  zmsd_freight_hdr-aenam,
             aezet        LIKE  zmsd_freight_hdr-aezet,
             zline        LIKE  zmsd_freight_det-zline,
             zfptype      LIKE  zmsd_freight_det-zfptype,
             zchrcode     LIKE  zmsd_freight_det-zchrcode,
             zcurcode     LIKE  zmsd_freight_det-zcurcode,
             zqty         LIKE  zmsd_freight_det-zqty,
             zuom         LIKE  zmsd_freight_det-zuom,
             zrate        LIKE  zmsd_freight_det-zrate,
             zamount      LIKE  zmsd_freight_det-zamount,
             zexrate      LIKE  zmsd_freight_det-zexrate,
           zccode       LIKE  zmsd_blinfo-zccode,      "MADK991565
             zccode       like  ZMSD_FREIGHT_HDR-zfcode, "MADK991565
             zbldate(10),
             zbl          LIKE  zmsd_blinfo-zbl,
             type(3),
             waerk        LIKE  zmsd_freight_det-zcurcode,
             zamountl     LIKE  zmsd_freight_det-zamount,
           END OF t_data.
    DATA : w_layout      TYPE   slis_layout_alv,
           w_catalog     TYPE   slis_fieldcat_alv,
           t_catalog     TYPE   slis_t_fieldcat_alv,
           w_sort        TYPE   slis_sortinfo_alv,
           t_sort        TYPE   slis_t_sortinfo_alv.
    DATA   V_ZINVNO    like   T_HDR-ZINVNO.                   "MADK991565
    DATA : v_count  TYPE  i.
    SELECTION-SCREEN BEGIN OF BLOCK a0 WITH FRAME TITLE text-001.
    PARAMETERS     :  p_zvkorg LIKE zmsd_freight_hdr-zvkorg  OBLIGATORY .
    SELECT-OPTIONS :  s_zdidbl FOR  zmsd_freight_hdr-zdidbl             ,
                      s_zccode FOR  lfa1-lifnr                          ,
                      s_status FOR  zmsd_freight_hdr-zstatus            ,
                      s_ztype  FOR  zmsd_freight_hdr-ztype              ,
                      s_erdat  FOR  zmsd_freight_hdr-erdat              ,
                      s_ernam  FOR  zmsd_freight_hdr-ernam              ,
                      s_zconfd FOR  zmsd_freight_hdr-zconfirmdate       .
    PARAMETERS     :  p_zconf  AS   CHECKBOX                            .
    SELECTION-SCREEN END OF BLOCK a0.
    SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-002.
    PARAMETERS     :  p_hdr    RADIOBUTTON GROUP rad DEFAULT 'X'        ,
                      p_det    RADIOBUTTON GROUP rad                    .
    SELECTION-SCREEN END OF BLOCK a1.
    INITIALIZATION.
    AT SELECTION-SCREEN.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM process.
      PERFORM display.
    END-OF-SELECTION.
      PERFORM fm_get_num_pages.
    AT USER-COMMAND.
    AT LINE-SELECTION.
    TOP-OF-PAGE.
      PERFORM fm_top_of_page USING '7010' sy-title space.
    FORM get_data.
      SELECT   *
        FROM   zmsd_freight_hdr
        INTO   TABLE t_hdr
       WHERE   zvkorg        EQ  p_zvkorg
         AND   zdidbl        IN  s_zdidbl
         AND   zstatus       IN  s_status
         AND   ztype         IN  s_ztype
         AND   erdat         IN  s_erdat
         AND   ernam         IN  s_ernam
         AND   zconfirmdate  IN  s_zconfd
         AND   ZFCODE        IN  S_ZCCODE.                      "MADK991565
      IF p_zconf = 'X'.
        DELETE t_hdr WHERE zconfirm NE 'C'.
      ENDIF.
      CHECK NOT t_hdr[] IS INITIAL.
      SELECT   *
        FROM   zmsd_blinfo
        INTO   TABLE t_bl
         FOR   ALL ENTRIES IN t_hdr
       WHERE   zsammg = t_hdr-zsammg.
      SORT t_bl BY zsammg.
      SELECT   *
        FROM   zmsd_diheader
        INTO   TABLE t_di
         FOR   ALL ENTRIES IN t_hdr
       WHERE   zsammg = t_hdr-zsammg.
      SORT t_di BY zsammg.
    IF P_DET = 'X'. "MADK933361
      SELECT   *
        FROM   zmsd_freight_det
        INTO   TABLE t_det
         FOR   ALL ENTRIES IN t_hdr
       WHERE   zsammg  =  t_hdr-zsammg
       AND ZINVNO =  T_HDR-ZINVNO .                           "MADK991565
    SORT t_det BY zsammg zline.                            "MADK991565
       SORT T_DET BY ZSAMMG ZINVNO ZLINE.                     "MADK991565
    ENDIF. "MADK933361
    ENDFORM.
    FORM process.
      REFRESH t_data.
      CLEAR v_gsttotal.                                         "MADK933361
      LOOP AT t_hdr.
    Start of MADK933361
        CLEAR: v_target2.
        v_zsammg = t_hdr-zsammg.
        V_ZINVNO = T_HDR-ZINVNO.                                "MADK991565
       AT NEW zsammg.                                         "MADK991565
         AT NEW ZINVNO.                                         "MADK991565
          PERFORM get_gst_value.
        ENDAT.
    End of MADK933361
        PERFORM move_header.
        CHECK t_data-zccode IN s_zccode.
        IF p_det = 'X'.
    CSF Project Changes Starts   DEV34    MADK985782
        LOOP AT T_DET WHERE ZSAMMG = T_HDR-ZSAMMG..
          LOOP AT t_det WHERE zsammg = t_hdr-zsammg AND
                              zinvno = t_hdr-zinvno.
    CSF Project Changes Ends     DEV34    MADK985782
            PERFORM move_header.
            CHECK t_data-zccode IN s_zccode.
            MOVE-CORRESPONDING t_det TO t_data.
            t_data-zamountl = t_data-zamount * t_data-zexrate.
            APPEND t_data.
            CLEAR t_data.
          ENDLOOP.
        ELSE.
          APPEND t_data.
          CLEAR t_data.
        ENDIF.
        AT END OF zsammg.
          CLEAR v_gsttotal.
        ENDAT.
    *Start of changes for  IS090901289-PIA MADK991565
        AT END OF ZINVNO.
          CLEAR V_GSTTOTAL.
        ENDAT.
    *End of changes for  IS090901289-PIA MADK991565
      ENDLOOP.
    ENDFORM.
    FORM move_header.
      MOVE-CORRESPONDING t_hdr TO t_data.
      t_data-zttlamt = t_data-zttlamt + v_gsttotal.             "MADK933361
      t_data-waerk = 'SGD'.
      IF NOT t_hdr-aedat IS INITIAL.
        WRITE: t_hdr-aedat TO t_data-aedat.
      ELSE.
        CLEAR : t_data-aedat.
      ENDIF.
      READ TABLE t_bl WITH KEY zsammg = t_hdr-zsammg BINARY SEARCH.
      IF sy-subrc EQ 0.
      t_data-zccode  = t_bl-zccode.   "MADK991565
        T_DATA-ZCCODE = T_HDR-ZFCODE.   "MADK991565     
        IF NOT t_bl-zbldate IS INITIAL.
          WRITE: t_bl-zbldate TO t_data-zbldate.
        ENDIF.
        t_data-zbl     = t_bl-zbl.
        t_data-type    = 'DBL'.
      ELSE.
        READ TABLE t_di WITH KEY zsammg = t_hdr-zsammg BINARY SEARCH.
        IF sy-subrc EQ 0.
        t_data-zccode  = t_di-zdiforcode.     "MADK991565
          T_DATA-ZCCODE = T_HDR-ZFCODE.         "MADK991565
          t_data-type    = 'DI'.
        ENDIF.
      ENDIF.
    ENDFORM.
    FORM display.
      IF t_data[] IS INITIAL.
        MESSAGE s398(00) WITH 'No Data Selected'.
        EXIT.
      ENDIF.
      DATA : l_repid LIKE sy-repid.
      l_repid = sy-repid.
      REFRESH t_catalog.
      CLEAR   t_catalog.
      w_layout-cell_merge = 'X'.
      PERFORM map_fields.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = l_repid
                i_callback_user_command = 'ALV_USER_COMMAND'
                is_layout               = w_layout
                it_fieldcat             = t_catalog[]
                i_grid_title            = sy-title
                i_save                  = 'A'
                it_sort                 = t_sort[]
           TABLES
                t_outtab                = t_data
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.
    FORM map_fields.
    Sort Order
      CLEAR v_count.
      PERFORM sf USING 'ZDIDBL'   'X'  'X'.
    Fields to be displayed
      CLEAR v_count.
      IF p_hdr = 'X'.
        PERFORM af USING :
       DESCRIPTION       FIELD        LEN   RTABLE             RFIELD
        'DI/DBL         ' 'ZDIDBL'     '14' '                ' '        ',
        'Type           ' 'TYPE'       '04' '                ' '        ',
        'Forwarder Code ' 'ZCCODE'     '14' '                ' '        ',
        'BL Number      ' 'ZBL'        '14' '                ' '        ',
        'BL Date        ' 'ZBLDATE'    '10' '                ' '        ',
        'Invoice Number ' 'ZINVNO'     '15' '                ' '        ',
        'Extraction     ' 'ZSTATUS'    '05' 'ZMSD_FREIGHT_HDR' 'ZSTATUS ',
        'Freight Type   ' 'ZTYPE'      '05' 'ZMSD_FREIGHT_HDR' 'ZTYPE   ',
        'Confirmation   ' 'ZCONFIRM'   '05' 'ZMSD_FREIGHT_HDR' 'ZCONFIRM',
        'Confirm Date   ' 'ZCONFIRMDATE' '10' 'ZMSD_FREIGHT_HDR'
    'ZCONFIRMDATE',
        'Total Amount   ' 'ZTTLAMT'    '18' '                ' '        ',
        'Created On     ' 'ERDAT'      '10' '                ' '        ',
        'Created By     ' 'ERNAM'      '10' '                ' '        ',
        'Changed On     ' 'AEDAT'      '10' '                ' '        ',
        'Changed By     ' 'AENAM'      '10' '                ' '        '.
      ELSE.
        PERFORM af USING :
       DESCRIPTION         FIELD     LEN   RTABLE             RFIELD
        'DI/DBL           ' 'ZDIDBL'   '14' '                ' '        ',
        'Type             ' 'TYPE'     '04' '                ' '        ',
        'Forwarder Code   ' 'ZCCODE'   '14' '                ' '        ',
        'BL Number        ' 'ZBL'      '14' '                ' '        ',
        'BL Date          ' 'ZBLDATE'  '10' '                ' '        ',
        'Invoice Number   ' 'ZINVNO'   '15' '                ' '        ',
        'Extraction       ' 'ZSTATUS'  '05' 'ZMSD_FREIGHT_HDR' 'ZSTATUS ',
        'Freight Type     ' 'ZTYPE'    '05' 'ZMSD_FREIGHT_HDR' 'ZTYPE   ',
        'Confirmation     ' 'ZCONFIRM' '05' 'ZMSD_FREIGHT_HDR' 'ZCONFIRM',
        'Confirm Date     ' 'ZCONFIRMDATE' '10' 'ZMSD_FREIGHT_HDR'
    'ZCONFIRMDATE',
        'Total Amount     ' 'ZTTLAMT'  '18' '                ' '        ',
        'Freight Payment  ' 'ZFPTYPE'  '14' '                ' '        ',
        'Charge Code      ' 'ZCHRCODE' '10' '                ' '        ',
        'Currency         ' 'ZCURCODE' '08' '                ' '        ',
        'Quantity         ' 'ZQTY'     '13' '                ' '        ',
        'UoM              ' 'ZUOM'     '04' '                ' '        ',
        'Rate             ' 'ZRATE'    '15' '                ' '        ',
        'Amt(Foreign Curr)' 'ZAMOUNT'  '16' '                ' '        ',
        'Exchange Rate    ' 'ZEXRATE'  '13' '                ' '        ',
        'Amt(Local Curr)  ' 'ZAMOUNTL' '16' '                ' '        ',
        'Created On       ' 'ERDAT'    '10' '                ' '        ',
        'Created By       ' 'ERNAM'    '10' '                ' '        ',
        'Changed On       ' 'AEDAT'    '10' '                ' '        ',
        'Changed By       ' 'AENAM'    '10' '                ' '        '.
      ENDIF.
    ENDFORM.
    FORM af USING text
                  field
                  len
                  table
                  reffield.
      v_count = v_count + 1.
      w_catalog-col_pos       = v_count.
      w_catalog-fieldname     = field.
      w_catalog-ref_tabname   = table.
      w_catalog-ref_fieldname = reffield.
      w_catalog-seltext_s     = text.
      w_catalog-seltext_m     = text.
      w_catalog-seltext_l     = text.
      w_catalog-outputlen     = len.
      IF field = 'ZTTLAMT' OR field = 'ZAMOUNTL'.
        w_catalog-no_zero     = 'X'.
        w_catalog-cfieldname  = 'WAERK'.
        w_catalog-datatype    = 'CURR'.
      ENDIF.
    IF FIELD = 'ZRATE' OR FIELD = 'ZAMOUNT'.
      IF field = 'ZAMOUNT'.
        w_catalog-no_zero     = 'X'.
        w_catalog-cfieldname  = 'ZCURCODE'.
        w_catalog-datatype    = 'CURR'.
      ENDIF.
      IF field = 'ZQTY' OR field = 'ZRATE'.
        w_catalog-no_zero     = 'X'.
        w_catalog-datatype  =  'DEC'.
      ENDIF.
      APPEND w_catalog TO t_catalog.
      CLEAR  w_catalog.
    ENDFORM.
    FORM sf    USING   fieldname  sortup  group.
      v_count = v_count + 1.
      CLEAR w_sort.
      w_sort-fieldname = fieldname.
      w_sort-spos      = v_count.
      w_sort-up        = sortup.
      w_sort-group     = group.
      APPEND w_sort TO t_sort.
    ENDFORM.
    FORM alv_user_command USING  in_ucomm    LIKE sy-ucomm
                                 in_selfield TYPE slis_selfield.
      DATA: lfs_data LIKE t_data.
      IF in_ucomm = '&IC1'.
        READ TABLE t_data INDEX in_selfield-tabindex INTO lfs_data.
        CHECK NOT lfs_data-zdidbl IS INITIAL.
        IF lfs_data-type = 'DBL'.
          DATA: l_zdbl LIKE zmsd_diheader-zdinum.
          l_zdbl = in_selfield-value.
          EXPORT l_zdbl TO MEMORY ID 'VBL'.
          CALL TRANSACTION 'ZMSD_BL01'.
        ENDIF.
        IF lfs_data-type = 'DI'.
          DATA: v_dinum LIKE zmsd_diheader-zdinum.
          v_dinum = in_selfield-value.
          EXPORT v_dinum TO MEMORY ID 'VDI'.
          CALL TRANSACTION 'ZMSD_DI01'.
        ENDIF.
      ENDIF.
    ENDFORM.
    FORM get_gst_value.
      LOOP AT t_det WHERE zsammg = v_zsammg
         AND ZINVNO = V_ZINVNO.                              "MADK991565
        CHECK t_data-zccode IN s_zccode.
        t_det-zamount  = t_det-zamount * t_det-zexrate.
        SELECT SINGLE  y0mmtarget2
                INTO   v_target2
                FROM   y0mmipstranslate
                WHERE  y0mmdatatype = '70' AND
                       y0mmsource = t_det-zchrcode.
        SELECT SINGLE y0mmtarget1
               INTO   t_det-type
               FROM   y0mmipstranslate
               WHERE  y0mmdatatype = '76' AND
                      y0mmsource = v_target2.
        IF t_det-type NE '3Z'.
          v_gsttotal    = v_gsttotal +
                               ( t_det-zamount * 5 / 100 ).
        ENDIF.
      ENDLOOP.
    Regards,
    Raj.

    Hello,
    Following is the procedure to convert alv output to spool and then it to PDF Format.
    After we display the ALV, we can check whether it is running in the background using system field u2018sy-batchu2018. Then,we call an function module named u2018GET_JOB_RUNTIME_INFOu2019 to get the current job information. Then go to spool request table tbtcp to get the spool id.
    Get current job details
      CALL FUNCTION u2018GET_JOB_RUNTIME_INFOu2019
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                               AND jobcount = gd_jobcount
                               AND stepcount = gd_stepcount
                               AND listident <> u20180000000000u2032
                               ORDER BY   jobname
                                                   jobcount
                                                   stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
    Finally, we can call function module u2018CONVERT_ABAPSPOOLJOB_2_PDFu2018 to convert spool reqeust(which is stored in OTF format) to PDF format. Then we can call either function module u2018SO_DOCUMENT_SEND_API1u2032 or SAP BCS (Business Communication Service) to send the pdf as an email attachment.
    CALL FUNCTION u2018CONVERT_ABAPSPOOLJOB_2_PDFu2019
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount = gd_bytecount
           TABLES
                pdf = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
    Regards,
    Sayali
    Edited by: Sayali Paradkar on Apr 20, 2010 12:51 PM

  • Page-break in alv background job for alv output variant not coming correctl

    Hi,
    I have created an ALV grid report. When i run the report in background i get the output with correct page-break on FIELD1. Now when i run the report in background with an "ALV output variant" (its the ALV variant that controls the fields display in the output; this is not the program variant), i do not get the page-break on FIELD1.  I have already build the sort criteria and using:
    gs_sort-group = '* '.     "New-Page
    Please let me know what could be reason for not getting the page-break in background when i am using the alv output variant and how do i correct this problem.
    Regards,
    Rakesh

    Hello Everyone,
    I have solved the problem. While running the program in background, we get the page-breaks when we use the below part of code in the sort catalogue with the condition that the program variant should not use any ALV layout variant.
    gs_sort-group = '* '.     "New-Page
    If you are using the ALV layout variant in the program variant then we can check the ROWPOS, COLPOS, and NO_OUT for that ALV layout variant and pass them along in the fieldcatalog table. You should be careful with not to pass the layout variant in the DISVARIANT. You can notice that i have cleared it and simply passing the program name into that.
    *C-- Process separately for jobs running in Background. Actually
    *C-- sortcat-group solves the problem only in Foreground. In background
    *C-- when ALV layout variant is not selected then it works otherwise it
    *C-- fails. So for background jobs we are reading the fieldcat and then
    *C-- passing the same in the display FM.
      IF sy-batch = 'X'.
        CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
          EXPORTING
           i_dialog                  = ' '
           i_user_specific           = ' '
           i_default                 = ' '
    *   I_TABNAME_HEADER          =
    *   I_TABNAME_ITEM            =
            it_default_fieldcat       = gt_fieldcat
            i_layout                  = gs_layout
    *   I_BYPASSING_BUFFER        =
    *   I_BUFFER_ACTIVE           =
         IMPORTING
    *   E_EXIT                    =
           et_fieldcat               = lt_fieldcat
    *     et_sort                   = gt_sort[]
    *   ET_FILTER                 =
    *     es_layout                 = gs_layout
         CHANGING
           cs_variant                = gs_disvariant
         EXCEPTIONS
           wrong_input               = 1
           fc_not_complete           = 2
           not_found                 = 3
           program_error             = 4
           OTHERS                    = 5
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CLEAR gs_fieldcat.
        LOOP AT gt_fieldcat INTO gs_fieldcat.
    *C-- Transfer all position changes to gt_fieldcat from lt_fieldcat
          CLEAR ls_fieldcat.
          READ TABLE lt_fieldcat
                INTO ls_fieldcat
                WITH KEY fieldname = gs_fieldcat-fieldname.
          IF sy-subrc = 0.
            gs_fieldcat-row_pos = ls_fieldcat-row_pos.
            gs_fieldcat-col_pos = ls_fieldcat-col_pos.
            gs_fieldcat-no_out = ls_fieldcat-no_out.
            MODIFY gt_fieldcat FROM gs_fieldcat INDEX sy-tabix.
            CLEAR gs_fieldcat.
          ENDIF.
        ENDLOOP.
    *C-- Clear the disvariant for the background job as it contains the ALV
    *C-- layout varinat
        CLEAR gs_disvariant.
        gs_disvariant-report = 'ZGPPMP0001'.
    Then pass gt_fieldcat to 'REUSE_ALV_GRID_DISPLAY'.
    The reason i'm doing it this way is that when we pass the layout variant name, the contents in gt_fieldcat were getting modified.
    One more thing i'd like to point out is that that, i tried to delete the fields with no_out = 'x'. Now when i ran the program in background with all the fields in sort catalog (suppose there are 2 fields field1 and field2) also in fieldcatalog it ran fine. In the next run in background i removed one of the fields in sort catalog from the fieldcatalog (delete the fields with no_out = 'x') and i got dump. Basically i had hidden field1 and so the code which was deleting fields with no_out = 'x' deleted this field from gt_fieldcat. So basically we should not delete fields with no_out = 'x'.
    I was getting ABAP runtime errors    MESSAGE_TYPE_X in the following part of the standard code.
    000310     LOOP AT CT_SORT INTO LS_SORT.
    000320
    000330       READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
    000340            WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.
    000350       IF SY-SUBRC NE 0.
         >         MESSAGE X000(0K).
    000370       ENDIF.
    000380
    000390       LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
    i have just mentioned this part because when i checked the forum many people were getting such errors "MESSAGE_TYPE_X". This could also be one of the reasons.

  • ALV output problem in displaying the field lengths.( LONG_DES1 & LONG DES)

    I have  declared itab of ALV output like below...
    Internal table for ALV report generation***********
    DATA : Begin of pdet_otab_alv occurs 0,
            bukrs LIKE bsid-bukrs, "Company code
            postm(4),              "Posting month (YYMM format)
            xblnr LIKE bsid-xblnr, "Reference document number
            kunnr LIKE bsid-kunnr, "Customer (Supplier Billing Customer)
            name1 LIKE kna1-name1,                              "Name 1
            buzei like bsid-buzei,
            gjahr like bsid-gjahr,
            filkd like bsid-filkd, "Rep Number
            rname like kna1-name1, "Rep Name
            belnr LIKE bsid-belnr, "Document number (invoice number)
            blart LIKE bsid-blart, "Document type
            zfbdt LIKE bsid-zfbdt, "Baseline date
            zterm LIKE knb1-zterm, "Terms
            netdt LIKE bsega-netdt,"Due date
            sgtxt LIKE bsid-sgtxt, "Text
            agerg TYPE t_agerg,    "Age range of invoice
            wrbtr LIKE bsid-wrbtr, "Original invoice amount
            due   LIKE bsid-wrbtr, "Amount outstanding on invoice
           long_des(250) type c,   " Long description
    <b>            long_des  TYPE string,
                long_des1 TYPE string,</b>      
          date_s(10) type c,  " Date
            short_des(20) type c,  " Short Description
            counter type i,
           End of pdet_otab_alv.
    And after filling the internal table fields ( fields 'LONG_DES1' & 'LONG_DES'  from FM READ_TEXT 's longtext, which are  of 265 chars each )
    <b>'LONG_DES1' & 'LONG_DES' are trimmed  in ALV out put  WHY ?</b>
      w_fieldcat-fieldname = 'LONG_DES1'.
      w_fieldcat-tabname   = 'PDEL_OTAB_ALV'.
    w_fieldcat-ref_fieldname = 'SCRTEXT_L'.
    w_fieldcat-ref_tabname   = 'DD03P'.
      w_fieldcat-seltext_l = 'Original Note'.
      w_fieldcat-col_pos   = 17.
      APPEND w_fieldcat TO fieldcat.
      CLEAR w_fieldcat.
      w_fieldcat-fieldname = 'LONG_DES'.
      w_fieldcat-tabname   =  'PDEL_OTAB_ALV'.
    w_fieldcat-ref_fieldname = 'SCRTEXT_L'.
    w_fieldcat-ref_tabname   = 'DD03P'.
      w_fieldcat-seltext_l = 'Latest Note'.
      w_fieldcat-col_pos   = 18.
      APPEND w_fieldcat TO fieldcat.
      CLEAR w_fieldcat.
    <b>next part i.e.,   before passing fieldcat.... I have filled s_layout like below.</b>
    <b>  s_layout-max_linesize = 1000.
      s_layout-colwidth_optimize = 'X'.</b>
    Call the following function to display output in ALV form
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program = 'ZFRSBOI0'
                is_layout          = s_layout
                it_fieldcat        = fieldcat
                it_events          = p_events[]
               it_sort            = p_it_sort[]
                i_save             = 'A'
           TABLES
                t_outtab           = pdet_otab_alv1
           EXCEPTIONS
                program_error      = 1
                OTHERS             = 2.
    If the function call is not successful, raise error message
    and come out from the program
      IF sy-subrc <> 0.
        message e000(00) with
                          'Unable to display report'(e01).
        exit.
      ENDIF.

    some body suggested me....we can display full length of text by below coding ?
    Is that not correct - just asking....
    s_layout-max_linesize = 1000.
    s_layout-colwidth_optimize = 'X'.
    Call the following function to display output in ALV form
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = 'ZFRSBOI0'
    is_layout = s_layout
    it_fieldcat = fieldcat
    it_events = p_events[]
    it_sort = p_it_sort[]
    i_save = 'A'
    TABLES
    t_outtab = pdet_otab_alv1
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    If the function call is not successful, raise error message
    and come out from the program
    IF sy-subrc <> 0.
    message e000(00) with
    'Unable to display report'(e01).
    exit.
    ENDIF.

  • Need to read text from FM 'BBP_PD_CONF_GETDETAIL' in a single line of ALV output

    s
    Hello Gurus,          I have to read the attached text in which TDID and TDLINE need to read.Here i need to write logic like that in ALV output text of TDLINE related to TDID Htxt come in single line if there is more than 1 line used , same for NOTE and Itxt. Please help me out with some ogic to show data in alv output. I have used FM 'BBP_PD_CONF_GETDETAIL'. Thanks Sankil
    TDID TDLINE HTXT Supplier  Text HTXT Supplier  Text NOTE Note NOTE Note ITXT Supplier  Text ITXT Supplier  Text NOTE Note NOTE Note

    Hello Sankil
    This can be achieved by using event AFTER_LINE_OUTPUT and also search with keyword AFTER_LINE_OUTPUT to get more examples
    Please go through the below tutorial.
    http://www.****************/Tutorials/ALV/Wordwrap/Index.htm
    Thanks

  • How to get rid of the loop in ALV output from At selection screen event?

    I have several push buttons on a selection screen.
    Clikc on a button, then it pops up an editable ALV report. (This gets triggered AT SELECTION SCREEN event.). REUSE_ALV_GRID_DISPLAY_LVC..
    On the ALV output, I enabled F4 for a couple of fields. Once I click on the F4 button, ONF4 method gets triggerd and a pop up appears with custom search helps.
    choose a line and it fills the cell.
    Upto this it works fine.
    Now I click on the BACK button at the ALV output, it takes me to the selection screen. I click on the button again, it show the editable ALV. Now when I click on the F4 button, the pop up comes up twice and the cell gets filled from the second pop - up.
    How to control this?
    Probably I am not refreshing something?
    (I am using REUSE_ALV_GRID_DISPLAY_LVC and tooks ome code for ONF4 event from BCALV_*DATATYPES (forgot the exact name) program.)
    Thanks,
    Ven

    Hi,
    FORM refresh_grid USING  pw_grid TYPE REF TO cl_gui_alv_grid.
    *Work area
      DATA : wal_stable TYPE lvc_s_stbl.
      CHECK NOT pw_grid IS INITIAL.
      wal_stable-col = c_check.
      wal_stable-row = c_check.
    *Method to refresh grid
      CALL METHOD  pw_grid->refresh_table_display
           EXPORTING
             is_stable      = wal_stable
             i_soft_refresh = c_check
           EXCEPTIONS
             finished       = 1
             OTHERS         = 2.
    ENDFORM.                    " refresh_grid
    Thanks,
    Sree.

  • How to get check box in alv output

    hi gurus
    can anyone explian me how to get check box in alv output
    it should not be a pop up window
    i want to get in output itself
    tahnk you
    regards
    kals.

    Hi
    by using rs_selfield
    ty to call dynamic subroutine..
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield. "#EC CALLED
    read table rs-selfield with key cond = 'X'
    endform.
    see the below example
    REPORT Z_GET_REFRESH no standard page heading.
    type-pools : slis.
    tables : makt,
    mara.
    data : i_fieldcat type slis_t_fieldcat_alv.
    CONSTANTS :
    gc_refresh TYPE syucomm VALUE '&REFRESH'.
    data : begin of i_makt occurs 0,
    matnr like makt-matnr,
    maktx like makt-maktx,
    end of i_makt.
    data : v_repid like sy-repid,
    g_user_command type slis_formname value 'USER_COMMAND',
    g_status_set type slis_formname value 'SET_PF_STATUS',
    lt_event_exit TYPE slis_t_event_exit,
    ls_event_exit TYPE slis_event_exit.
    DATA:LC_GLAY TYPE LVC_S_GLAY.
    select-options s_matnr for mara-matnr .
    start-of-selection.
    select matnr maktx from makt into table i_makt
    where matnr in s_matnr.
    end-of-selection.
    Fill the fieldcatlog
    perform fill_field.
    Call the FM
    perform call_fm.
    *& Form fill_field
    text
    --> p1 text
    <-- p2 text
    FORM fill_field.
    data wa_fieldcat type slis_fieldcat_alv.
    clear : wa_fieldcat.
    wa_fieldcat-tabname = 'I_MAKT'.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-outputlen = '18'.
    wa_fieldcat-seltext_l = 'Material #'.
    wa_fieldcat-col_pos = '1'.
    append wa_fieldcat to i_fieldcat.
    clear : wa_fieldcat.
    wa_fieldcat-tabname = 'I_MAKT'.
    wa_fieldcat-fieldname = 'MAKTX'.
    wa_fieldcat-outputlen = '40'.
    wa_fieldcat-seltext_l = 'Material Desc'.
    wa_fieldcat-col_pos = '2'.
    append wa_fieldcat to i_fieldcat.
    ENDFORM. " fill_field
    *& Form call_fm
    text
    --> p1 text
    <-- p2 text
    FORM call_fm.
    v_repid = sy-repid.
    LC_GLAY-EDT_CLL_CB = 'X'.
    CLEAR ls_event_exit.
    ls_event_exit-ucomm = gc_refresh. " Refresh
    ls_event_exit-after = 'X'.
    APPEND ls_event_exit TO lt_event_exit.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = v_repid
    I_CALLBACK_PF_STATUS_SET = g_status_set
    I_CALLBACK_USER_COMMAND = g_user_command
    I_CALLBACK_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE =
    I_GRID_SETTINGS = LC_GLAY
    IS_LAYOUT =
    IT_FIELDCAT = i_fieldcat
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS =
    IT_EVENT_EXIT = lt_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
    IT_ALV_GRAPHICS =
    IT_ADD_FIELDCAT =
    IT_HYPERLINK =
    I_HTML_HEIGHT_TOP =
    I_HTML_HEIGHT_END =
    IT_EXCEPT_QINFO =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB = i_makt
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " call_fm
    FORM USER_COMMAND *
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield. "#EC CALLED
    data i_RSPARAMS like RSPARAMS occurs 0.
    CASE R_UCOMM.
    WHEN '&IC1'.
    read table i_makt index rs_selfield-tabindex.
    SET PARAMETER ID 'MAT' FIELD i_makt-matnr.
    if not i_makt-matnr is initial.
    call transaction 'MM02' and skip first screen.
    endif.
    when '&REFRESH'.
    CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
    EXPORTING
    CURR_REPORT = v_repid
    IMPORTING
    SP =
    TABLES
    SELECTION_TABLE = i_RSPARAMS
    EXCEPTIONS
    NOT_FOUND = 1
    NO_REPORT = 2
    OTHERS = 3
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    submit z_get_refresh with selection-table i_RSPARAMS.
    rs_selfield-refresh = 'X'.
    ENDCASE.
    MOVE '&REFRESH' TO r_ucomm.
    ENDFORM.
    FORM set_pf_status *
    FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
    DELETE Rt_extab WHERE fcode = gc_refresh.
    SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'
    EXCLUDING Rt_extab.
    *SET PF-STATUS 'STANDARD' EXCLUDING rt_extab.
    SET TITLEBAR sy-tcode.
    ENDFORM.

  • How to display Long text in alv output

    Hi,
    I have developed an ALV report.It is displaying the output.
    There is another requirment for alv output text field as below
    From the long text fields show only the first 20 characters and afterwards the long text icon. If the icon is clicked open the long text display screen.
    Please give your suggestion how to work on this requirement.
    Thanks in advance

    Hi,
    Create a hotspot for the long text column of ALV.
    When user clicks on the hotspot, handle the event to display long text screen.
    You may refer sample program of hotspot ALV :
    Goto SE38
    Type BCALV*
    Click F4
    search for HOTSPOT or EVENTS & you will get a sample program.
    Best regards,
    Prashant

  • How to display the fields in ALV Output without using Field catalog?

    How to display the fields in ALV Output without using Field catalog?
    Could you pls tell me the coding?
    Akshitha.

    Hi,
    u mean without building field catalog. is it? I that case, we can use the FM REUSE_ALV_FIELDCATALOG_MERGE.
    data: itab type table of mara.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_structure_name = itab
    CHANGING
    ct_fieldcat = lt_fieldcat[]
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    *Pass that field catalog into the fillowing FM
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_grid_title            = 'REPORTING'
                is_layout              = gt_layout
                it_fieldcat             = lt_fieldcat[]
           tables
                t_outtab                = itab.

Maybe you are looking for

  • Can I use icloud as a storage for photos from my PC without pushing all of them to my iphone?

    I thought the cloud could be a backup to my PC (files, pics, itunes...) that I could access from my iphone.  If my pics are pushed to my phone, my memory will be more than maxed out.  Same with itunes.  I would like to switch the tunes on my phone so

  • ADF_FACES 60097 /60096  error while opening process trace

    In em console, after opening the flow Trace popup I'm not able to oper the instance process popups because the server launches an exception ADF_FACES 60097. In server log I see errors like this: Caused by: java.lang.RuntimeException: Error initializi

  • I Can't Find My Product "Hp Pavilion Dv6-6c50se​" on PartSurfer​, I Need My Fan Part Number

    Hi, as i said in the Subject i can't find my product.. Pavilion Dv6-6c50se my S/N: [Edited for Personal Information] my P/N:  A7P18EA#ABV now what? i really need to change my Fan and i can't get the Part Number of it.. Please Help. This question was

  • Problem in changing the file sharing users

    When I change the the file sharing and add a new user or modify a users capablities (read, write, etc) the chagnes do not stay.  Upon opening a system prefences and sharing the old users and modifications are back...   I do all this as the administra

  • Workflow for invoice

    Hello Experts, My client has this requirement. For creating an invoice, they want some prior approvals/editions to be done and at the end the invoice has to be posted. For this though we can use the WFs, they want all this to be done through either o