SAP ABAP ALV Grid Reports (Easy ALV) by Goutham

Sdílet
Vložit
  • čas přidán 10. 09. 2024

Komentáře • 28

  • @HawkIjr
    @HawkIjr Před 3 lety +1

    Thank you SO MUCH for your help!

  • @pankajkumaram
    @pankajkumaram Před 7 lety +3

    it's very nice video. You have put great effort make it understand.
    Thank you very much

  • @spankdag2948
    @spankdag2948 Před 4 lety +1

    great job my man! greetings from Italy

  • @muralivijaydiary7713
    @muralivijaydiary7713 Před 5 lety

    Hii sir ur teaching is very nice .I can understand ur teaching.plz upload more videos and upload basic list and secondary list alv reports...

  • @cutegoutham0022
    @cutegoutham0022  Před 8 lety +1

    Report Code-
    *&-**--------------------------------------------------------------------*
    *& Report ZTEST_ALV_REPORTS
    *&
    *&-**--------------------------------------------------------------------*
    *&
    *&
    *&-**--------------------------------------------------------------------*
    REPORT ztest_alv_reports.
    TYPE-POOLS: slis.
    TYPES: BEGIN OF ty_mara,
    * check(1),
    matnr TYPE mara-matnr,
    matkl TYPE mara-matkl,
    mtart TYPE mara-mtart,
    meins TYPE mara-meins,
    menge TYPE menge_d,
    END OF ty_mara.
    DATA: it_mara TYPE TABLE OF mara,
    wa_mara TYPE mara,
    it_mara_1 TYPE TABLE OF ty_mara,
    wa_mara_1 TYPE ty_mara,
    it_fcat TYPE slis_t_fieldcat_alv,
    wa_fcat TYPE slis_fieldcat_alv,
    wa_layout TYPE slis_layout_alv,
    it_sort TYPE slis_t_sortinfo_alv,
    wa_sort TYPE slis_sortinfo_alv,
    it_events TYPE slis_t_event,
    wa_events TYPE slis_alv_event,
    it_header TYPE slis_t_listheader,
    wa_header TYPE slis_listheader.
    START-OF-SELECTION.
    ** Complete table
    SELECT *
    FROM mara
    INTO TABLE it_mara
    UP TO 100 ROWS.
    ** Partial data
    SELECT matnr
    matkl
    mtart
    meins
    FROM mara
    INTO CORRESPONDING FIELDS OF TABLE it_mara_1
    UP TO 100 ROWS.
    IF sy-subrc = 0.
    LOOP AT it_mara_1 INTO wa_mara_1.
    wa_mara_1-menge = sy-tabix.
    MODIFY it_mara_1 FROM wa_mara_1 TRANSPORTING menge.
    ENDLOOP.
    ENDIF.
    END-OF-SELECTION.
    ** Automatic
    * CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    * EXPORTING
    * i_program_name = sy-cprog
    ** I_INTERNAL_TABNAME = 'IT_MARA'
    * i_structure_name = 'MARA'
    ** I_CLIENT_NEVER_DISPLAY = 'X'
    ** I_INCLNAME =
    ** I_BYPASSING_BUFFER =
    ** I_BUFFER_ACTIVE =
    * CHANGING
    * ct_fieldcat = it_fcat
    * EXCEPTIONS
    * inconsistent_interface = 1
    * program_error = 2
    * OTHERS = 3.
    ***** Semi Automatic
    * LOOP AT it_fcat INTO wa_fcat.
    * IF wa_fcat-fieldname = 'MATNR'.
    * wa_fcat-hotspot = 'X'.
    * ENDIF.
    * MODIFY it_fcat FROM wa_fcat INDEX sy-tabix.
    * ENDLOOP.
    *
    ** Display full table with out building Field catalog
    * CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    * EXPORTING
    * i_callback_program = sy-cprog
    ** i_structure_name = 'MARA'
    * it_fieldcat = it_fcat
    * TABLES
    * t_outtab = it_mara
    * EXCEPTIONS
    * program_error = 1
    * OTHERS = 2.
    ** Types of Building Field catalog
    * 1) Automatic
    * 2) Semi Automatic
    * 3) Manual
    *
    *
    ** Manual Field catalog
    *CLEAR wa_fcat.
    * wa_fcat-fieldname = 'CHECK'.
    * wa_fcat-col_pos = 1.
    * wa_fcat-seltext_l = 'Sel'.
    * wa_fcat-seltext_m = 'Sel'.
    * wa_fcat-seltext_s = 'Sel'.
    * wa_fcat-edit = 'X'.
    * wa_fcat-checkbox = 'X'.
    * wa_fcat-outputlen = 20.
    * APPEND wa_fcat TO it_fcat.
    * CLEAR wa_fcat.
    CLEAR wa_fcat.
    wa_fcat-fieldname = 'MATNR'.
    wa_fcat-col_pos = 1.
    wa_fcat-seltext_l = 'Material Number in SAP'.
    wa_fcat-seltext_m = 'Material Number'.
    wa_fcat-seltext_s = 'Material No'.
    wa_fcat-hotspot = 'X'.
    wa_fcat-outputlen = 20.
    APPEND wa_fcat TO it_fcat.
    CLEAR wa_fcat.
    wa_fcat-fieldname = 'MATKL'.
    wa_fcat-col_pos = 2.
    wa_fcat-seltext_l = 'Material Group'.
    wa_fcat-seltext_m = 'Material Grp'.
    wa_fcat-seltext_l = 'Material Gp'.
    wa_fcat-outputlen = 20.
    APPEND wa_fcat TO it_fcat.
    CLEAR wa_fcat.
    wa_fcat-fieldname = 'MTART'.
    wa_fcat-col_pos = 3.
    wa_fcat-seltext_l = 'Material Type'.
    wa_fcat-seltext_m = 'Material Typ'.
    wa_fcat-seltext_l = 'Material Tp'.
    wa_fcat-ref_fieldname = 'MATNR'.
    wa_fcat-outputlen = 20.
    APPEND wa_fcat TO it_fcat.
    CLEAR wa_fcat.
    wa_fcat-fieldname = 'MEINS'.
    wa_fcat-col_pos = 4.
    wa_fcat-seltext_l = 'Unit Of Measurement'.
    wa_fcat-seltext_m = 'Unit Of Meas.'.
    wa_fcat-seltext_l = 'UOM'.
    wa_fcat-row_pos = '1'.
    wa_fcat-outputlen = 20.
    APPEND wa_fcat TO it_fcat.
    CLEAR wa_fcat.
    wa_fcat-fieldname = 'MENGE'.
    wa_fcat-col_pos = 5.
    wa_fcat-seltext_l = 'Quantity'.
    wa_fcat-seltext_m = 'Quantity'.
    wa_fcat-seltext_l = 'Qty'.
    wa_fcat-outputlen = 20.
    * wa_fcat-edit = 'X'.
    wa_fcat-do_sum = 'X'.
    APPEND wa_fcat TO it_fcat.
    CLEAR wa_fcat.
    **
    **
    ** Automatic sorting at layout
    * wa_sort-fieldname = 'MATKL'.
    * wa_sort-subtot = 'X'.
    * wa_sort-up = 'X'.
    * APPEND wa_sort TO it_sort.
    * CLEAR wa_sort.
    **
    * wa_sort-fieldname = 'MTART'.
    * wa_sort-subtot = 'X'.
    * wa_sort-down = 'X'.
    * APPEND wa_sort TO it_sort.
    * CLEAR wa_sort.
    **
    **
    * CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    * EXPORTING
    * i_list_type = 4
    * IMPORTING
    * et_events = it_events
    * EXCEPTIONS
    * list_type_wrong = 1
    * OTHERS = 2.
    * IF sy-subrc 0.
    ** Implement suitable error handling here
    * ENDIF.
    *
    wa_layout-colwidth_optimize = 'X'.
    wa_layout-zebra = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-cprog
    * i_callback_top_of_page = 'TOP_OF_PAGE'
    * i_callback_pf_status_set = 'PF_STATUS'
    * i_callback_user_command = 'USER_COMMAND'
    is_layout = wa_layout
    it_fieldcat = it_fcat
    it_sort = it_sort
    * it_events = it_events
    i_save = 'X'
    TABLES
    t_outtab = it_mara_1
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc 0.
    * Implement suitable error handling here
    ENDIF.
    *
    FORM pf_status USING it_ex TYPE kkblo_t_extab.
    * APPEND '&ETA' to it_ex.
    SET PF-STATUS 'ZSTATUS_COPY' EXCLUDING it_ex.
    ENDFORM.
    FORM top_of_page.
    REFRESH it_header.
    wa_header-info = 'Heading'.
    wa_header-typ = 'H'.
    APPEND wa_header TO it_header.
    CLEAR wa_header.
    wa_header-info = 'Heading'.
    wa_header-typ = 'A'.
    APPEND wa_header TO it_header.
    CLEAR wa_header.
    wa_header-key = 'Material'.
    wa_header-info = '100001'.
    wa_header-typ = 'S'.
    APPEND wa_header TO it_header.
    CLEAR wa_header.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = it_header
    * I_LOGO =
    * I_END_OF_LIST_GRID =
    * I_ALV_FORM =
    .
    ENDFORM.
    FORM user_command USING r_ucomm TYPE sy-ucomm
    r_selfield TYPE slis_selfield.
    DATA: lr_grid TYPE REF TO cl_gui_alv_grid.
    *
    *** To get the current ALV Control
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    * EXPORTING
    * IR_SALV_FULLSCREEN_ADAPTER =
    IMPORTING
    * ET_EXCLUDING =
    * E_REPID =
    * E_CALLBACK_PROGRAM =
    * E_CALLBACK_ROUTINE =
    e_grid = lr_grid
    * ET_FIELDCAT_LVC =
    * ER_TRACE =
    * E_FLG_NO_HTML =
    * ES_LAYOUT_KKBLO =
    * ES_SEL_HIDE =
    * ET_EVENT_EXIT =
    * ER_FORM_TOL =
    * ER_FORM_EOL =
    .
    *** To get the Grid data into Internal table
    IF lr_grid IS NOT INITIAL.
    CALL METHOD lr_grid->check_changed_data.
    ENDIF.
    * SET PARAMETER ID 'MAT' FIELD r_selfield-value.
    * CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    r_selfield-refresh = 'X'.
    ENDFORM.

  • @melindareiz7250
    @melindareiz7250 Před 6 lety

    Hi,
    am I the only one who get's an error, when declaring the it_fcat of type slis_t_fieldcat_alv?
    The error is telling me that the type is unknown. However, I checked that ct_fieldcat is of same type and that the type exists in the Type Group SLIS.

  • @pushpajha8257
    @pushpajha8257 Před 7 lety +1

    Hii Goutham,
    Can you please make a video for Interactive ALV plsssssssss......................... bcoz u have explained very nicely .

  • @sanjivranjan5782
    @sanjivranjan5782 Před 4 lety

    Nice job.. Appreciate your work.

    • @cutegoutham0022
      @cutegoutham0022  Před 4 lety

      Thanks a lot Sir..

    • @ss-de5mm
      @ss-de5mm Před 2 lety

      @@cutegoutham0022 hi bro ur number is not working I need ur help bro

    • @ss-de5mm
      @ss-de5mm Před 2 lety

      @@cutegoutham0022 am siva reddy

  • @br20htm4n
    @br20htm4n Před 7 lety

    Thank you for this super helpful video. Very easy to understand. But have you uploaded the video for Interactive ALV ? Really appreciate it.

  • @jayeshgala83
    @jayeshgala83 Před 7 lety

    Good one.Thx

  • @ibrahimelajroud7560
    @ibrahimelajroud7560 Před 8 lety

    Thank you Friend for your support. I will study this video tonight or tomorrow and will give you feedback.

    • @ibrahimelajroud7560
      @ibrahimelajroud7560 Před 8 lety

      I'm sorry for answering late, too much work. I found this video very detailed. So ,as much is i understand we can use conditions to define the colors of cells like "IF" or "Case" ?

    • @cutegoutham0022
      @cutegoutham0022  Před 8 lety

      Yes Ibrahim.
      General Requirement will be like this.
      If the user wants to see the amounts which are less than some amount in Highlighted color (ex: Red) if the amount is more then in Other color (Ex: Green).
      Then we need to check the condition like
      IF amount = 10000
      Fill Green.
      Endif.

  • @ibrahimelajroud7560
    @ibrahimelajroud7560 Před 8 lety

    Hello my friend , can you make videos about Dialog programming and SAP QUERY please?

  • @rowdyboy411
    @rowdyboy411 Před 5 lety

    Hi bro I want to learn ABAP on hana ..can u please teach me

  • @Vinay_Krishna
    @Vinay_Krishna Před 5 lety

    that's an error occurred . It_Mara_1 has more fields than selected. u can't execute using structure.

    • @cutegoutham0022
      @cutegoutham0022  Před 4 lety

      Hi Vinay,
      That means your internal table has more fields. So internal table stricture should have same fields in select statement. Please do change your select statement to * or change internal table structure.
      Thank you

  • @sonuYadav-or9lb
    @sonuYadav-or9lb Před 5 lety

    where is the next video???

  • @cutegoutham0022
    @cutegoutham0022  Před 7 lety +1

    Hi

    • @nokia5233able
      @nokia5233able Před 7 lety

      hiee goutham you should post more of your videos. your explanatory skills are very good. please we students want more of you.
      Do you teach online privately please mail me at darshanpawar003@gmail.com

  • @theoneandonly4486
    @theoneandonly4486 Před 3 lety

    EASY WTF