Skip to Content
author's profile photo Former Member
Former Member

ALV Report

I need to create a new ALV report:

1) Create select screen and input selection criteria

2) Get data

3) List subtotal in ALV list

4) Double click any row to get into all details for this subtotal in new screen

5) Go back subtotal ALV screen to check any other subtotal details

Is there any example for this to speed up my job?!

Cheers

Edited by: abapsydney on Apr 9, 2008 3:48 AM

Edited by: abapsydney on Apr 9, 2008 3:50 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 01:52 AM

    Hi,

    Search the program SALVDEMO

    These are all the sample programs on ALV.

    Regards,

    Atish

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2008 at 02:37 AM

    Look at reports BCALV_GRID_02 and BCALV_GRID_03.

    Although they are not exactly similar to your requirement but they'll probably be useful to you as you can reuse some of their codes. The business logic will need to change as per your requirement but the guts of it can be very similar.

    Hope this helps.

    Sougata.

    p.s. if there's no FLIGHT model data in your system, you can use program SAPBC_DATA_GENERATOR to generate flight data in your dev system.

    Edited by: Sougata Chatterjee on Apr 9, 2008 12:37 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2008 at 03:40 AM

    Sydney,

    Just check this program.

    ZPRICES

    &----


    *& Report ZPRICES *

    *& *

    &----


    *& *

    *& *

    &----


    REPORT ZPRICES .

    tables:a304,konp.

    type-pools slis.

    data:begin of itab1 occurs 0,

    kappl like a304-kappl,

    kschl like a304-kschl,

    vkorg like a304-vkorg,

    vtweg like a304-vtweg,

    matnr like a304-matnr,

    kfrst like a304-kfrst,

    datbi like a304-datbi,

    datab like a304-datab,

    knumh like a304-knumh,

    kbetr like konp-kbetr,

    end of itab1.

    *Declarations for ALV

    DATA:itfieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

    DATA:itrepid TYPE sy-repid.

    itrepid = sy-repid.

    DATA:itevent TYPE slis_t_event.

    DATA:itlistheader TYPE slis_t_listheader.

    DATA:walistheader LIKE LINE OF itlistheader.

    DATA:itlayout TYPE slis_layout_alv.

    DATA:top TYPE slis_formname.

    DATA:itsort TYPE slis_t_sortinfo_alv WITH HEADER LINE.

    DATA :itsort1 TYPE slis_sortinfo_alv.

    DATA:itprintparams TYPE slis_print_alv.

    DATA:itvariant TYPE disvariant.

    data : title type lvc_title.

    field-symbols <fs> type LVC_TITLE.

    concatenate 'Price Extraction Report' ' ' into title separated by space.

    assign title to <fs>.

    Selection-screen begin of block b1 with frame title text-001.

    select-options: s_kschl for a304-kschl obligatory,

    s_vkorg for a304-vkorg obligatory,

    s_vtweg for a304-vtweg obligatory,

    s_matnr for a304-matnr obligatory,

    s_datbi for a304-datbi obligatory.

    selection-screen end of block b1.

    perform getdata.

    perform alv.

    &----


    *& Form getdata

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form getdata .

    select kappl

    kschl

    vkorg

    vtweg

    matnr

    kfrst

    datbi

    datab

    knumh

    from a304

    into table itab1

    where kschl IN s_kschl and

    vkorg IN s_vkorg and

    vtweg IN s_vtweg and

    matnr IN s_matnr and

    datbi IN s_datbi.

    if not itab1[] is initial.

    sort itab1 ascending by matnr knumh.

    loop at itab1.

    select kbetr

    from konp

    into itab1-kbetr

    where kappl = itab1-kappl and

    knumh = itab1-knumh and

    kschl = itab1-kschl and

    kfrst = itab1-kfrst.

    modify itab1.

    endselect.

    endloop.

    else.

    Message 'No Data' type 'S'.

    endif.

    endform. " getdata

    &----


    *& Form alv

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form alv .

    IF itab1[] IS INITIAL.

    MESSAGE 'No Values exist for the Selection.' TYPE 'S'.

    STOP.

    ENDIF.

    DEFINE m_fieldcat.

    itfieldcat-fieldname = &1.

    itfieldcat-col_pos = &2.

    itfieldcat-seltext_l = &3.

    itfieldcat-do_sum = &4.

    itfieldcat-outputlen = &5.

    append itfieldcat to itfieldcat.

    clear itfieldcat.

    END-OF-DEFINITION.

    m_fieldcat 'KSCHL' '' 'Condition Type' '' 04.

    m_fieldcat 'MATNR' '' 'Material Number' '' 18.

    m_fieldcat 'DATAB' '' 'Valid On' '' 08.

    m_fieldcat 'DATBI' '' 'Valid Till' '' 08.

    m_fieldcat 'KBETR' '' 'Rate' 'X' 11.

    itlayout-zebra = 'X'.

    itlayout-colwidth_optimize = 'X'.

    itlayout-no_subtotals = ' '.

    • itlayout-totals_text = ' '.

    • itlayout-subtotals_text = ' '.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = sy-repid

    is_layout = itlayout

    i_callback_user_command = 'LIST1'

    I_GRID_TITLE = <fs>

    • i_callback_top_of_page = ' '

    it_fieldcat = itfieldcat[]

    i_save = 'A'

    • is_variant = ITVARIANT

    it_events = itevent[]

    • is_print = ITPRINTPARAMS

    it_sort = itsort[]

    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.

    endform. " alv

    &----


    *& Form list1

    &----


    • ALV Interactive-

    ----


    • -->R_UCOMM text

    • -->RS_SELFIELDtext

    ----


    FORM list1 USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.

    CASE r_ucomm.

    WHEN '&IC1'.

    IF rs_selfield-fieldname = 'MATNR'.

    READ TABLE itab1 INDEX rs_selfield-tabindex.

    SET PARAMETER ID 'MAT' FIELD itab1-matnr.

    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

    ENDIF.

    ENDCASE.

    ENDFORM. "list1

    K.Kiran.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 04:22 AM

    Hi, Check the following sample program. Created with sample program. It works fine. It is suitable for your requirement. Just Execute and check. In the program everywhere comments have been given.

    REPORT zvenkat_test1.
    *&---------------------------------------------------------------------*
    " You program variables internal and Work area declarations.
    *----------------------------------------------------------------------*
    
    "Types
    TYPES:
          BEGIN OF t_detail_tab,
            werks TYPE mard-werks,
            lgort TYPE mard-lgort,
            matnr TYPE mard-matnr,
            labst TYPE mard-labst,
            umlme TYPE mard-umlme,
            insme TYPE mard-insme,
          END OF t_detail_tab,
          BEGIN OF t_subtot_tab,
            werks TYPE mard-werks,
            labst TYPE mard-labst,
            umlme TYPE mard-umlme,
            insme TYPE mard-insme,
          END OF t_subtot_tab.
    "work area
    DATA:
          w_detail_tab TYPE t_detail_tab,
          w_subtot_tab TYPE t_subtot_tab.
    "Internal tables
    DATA:
          i_detail_tab TYPE STANDARD TABLE OF t_detail_tab,
          i_subtot_tab TYPE STANDARD TABLE OF t_subtot_tab.
    *&---------------------------------------------------------------------*
    " ALV Declarations
    *----------------------------------------------------------------------*
    * Types Pools
    TYPE-POOLS:
       slis.
    * Types
    TYPES:
       t_fieldcat         TYPE slis_fieldcat_alv,
       t_events           TYPE slis_alv_event,
       t_layout           TYPE slis_layout_alv.
    * Workareas
    DATA:
       w_fieldcat         TYPE t_fieldcat,
       w_events           TYPE t_events,
       w_layout           TYPE t_layout,
       w_fieldcat1        TYPE t_fieldcat, "for detailed report
       w_events1          TYPE t_events.   "for detailed report
    * Internal Tables
    DATA:
       i_fieldcat         TYPE STANDARD TABLE OF t_fieldcat,
       i_events           TYPE STANDARD TABLE OF t_events,
       i_fieldcat1        TYPE STANDARD TABLE OF t_fieldcat,"for detailed report
       i_events1          TYPE STANDARD TABLE OF t_events.  "for detailed report
    *"&---------------------------------------------------------------------*
    *"Selection-screen.
    *"&---------------------------------------------------------------------*
    *SELECT-OPTIONS:s_werks FOR w_detail_tab-werks.
    
    "&---------------------------------------------------------------------*
    "START-OF-SELECTION.
    "&---------------------------------------------------------------------*
    
    START-OF-SELECTION.
    
    
      "You program Logic to fetch data from Database and do modifications and prepare \
      " final internal table to display using ALV.
    
      PERFORM get_data.
    
    
      "Once you get the data from the Database table and read to display
      " Follow the steps to create ALV.
      "&---------------------------------------------------------------------*
      "END-OF-SELECTION..
      "&---------------------------------------------------------------------*
    
    END-OF-SELECTION.
      "&---------------------------------------------------------------------*
      "     Fieldcatalog Internal table
      "     ------------
      "    1. It contains descriptions of the list output fields
      "       (usually a subset of the internal output table fields).
      "    2. A field catalog is required for every ALV list output.
      "&---------------------------------------------------------------------*
      PERFORM build_fieldcatalog_table.
      "&---------------------------------------------------------------------*
      "     Events
      "     ------
      "    1. When we use ALV,certain events TOP-OF-PAGE ,END-OF-PAGE,
      "       AT LINE-SELECTION,AT USER-COMMANDs are not triggered.
      "    2. To perform those Functions ,we have to build Events table and
      "       pass this table through REUSE_ALV_LIST_DISPALY Function.
      "&---------------------------------------------------------------------*
      PERFORM build_events_table.
      "&---------------------------------------------------------------------*
      "     Display ALV
      "     ------
      "    1. We use REUSE_ALV_LIST_DISPLAY function module to display as normal output
      "    2. We use REUSE_ALV_GRID_DISPLAY function module to display in grid format
      "&---------------------------------------------------------------------*
      PERFORM display_data.
    *&---------------------------------------------------------------------*
    *&      Form  build_fieldcatalog_table
    *&---------------------------------------------------------------------*
    FORM build_fieldcatalog_table .
    
      CLEAR :
        w_fieldcat,
       i_fieldcat[].
    
    
      w_fieldcat-col_pos = 1 .
      w_fieldcat-fieldname = 'WERKS' .       "Column name as it is in Final internal table
      w_fieldcat-tabname = 'I_SUBTOT_TAB'.   "Final Internal table which has to be displayed
      w_fieldcat-seltext_m = 'Plant'.        "Column text for the field above
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
    
    *  w_fieldcat-col_pos = 1 .
    *  w_fieldcat-fieldname = 'LGORT' .
    *  w_fieldcat-tabname = 'I_SUBTOT_TAB'.
    *  w_fieldcat-seltext_m = 'S.Location'.
    *  APPEND w_fieldcat TO i_fieldcat.
    *  CLEAR w_fieldcat.
    *
    *
    *  w_fieldcat-col_pos = 1 .
    *  w_fieldcat-fieldname = 'MATNR'.
    *  w_fieldcat-tabname = 'I_SUBTOT_TAB'.
    *  w_fieldcat-seltext_m = 'Mat No'.
    *  APPEND w_fieldcat TO i_fieldcat.
    *  CLEAR w_fieldcat.
    
      w_fieldcat-col_pos = 1 .
      w_fieldcat-fieldname = 'LABST' .
      w_fieldcat-do_sum = 'X'.                  "It gives grand total for all subtotals
      w_fieldcat-tabname = 'I_SUBTOT_TAB'.
      w_fieldcat-seltext_m = 'LABST'.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
    
      w_fieldcat-col_pos = 1 .
      w_fieldcat-fieldname = 'UMLME'.
      w_fieldcat-do_sum = 'X'.
      w_fieldcat-tabname = 'I_SUBTOT_TAB'.
      w_fieldcat-seltext_m = 'UMLME'.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
    
      w_fieldcat-col_pos = 1 .
      w_fieldcat-fieldname = 'INSME'.
      w_fieldcat-do_sum = 'X'.
      w_fieldcat-tabname = 'I_SUBTOT_TAB'.
      w_fieldcat-seltext_m = 'INSME'.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
    
    ENDFORM.                    " build_fieldcatalog_table
    *&---------------------------------------------------------------------*
    *&      Form  build_events_table
    *&---------------------------------------------------------------------*
    FORM build_events_table .
      CLEAR :w_events,
             i_events[].
    
      w_events-name = 'TOP_OF_PAGE' .
      w_events-form = 'TOP_OF_PAGE' .
      APPEND w_events TO i_events.
      CLEAR w_events.
    
      w_events-name = 'USER_COMMAND' .
      w_events-form = 'USER_COMMAND' .
      APPEND w_events TO i_events.
      CLEAR w_events.
      " You can what are all the events are available for the simple ALV and  GRID ALV
      " by running the function module in SE37. Among all TOP_OF_PAGE is one.
    
    ENDFORM.                    " build_events_table
    *&---------------------------------------------------------------------*
    *&      Form  display_data
    *&---------------------------------------------------------------------*
    FORM display_data .
      DATA:program TYPE sy-repid.
      program = sy-repid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK              = ' '
    *   I_BYPASSING_BUFFER             =
    *   I_BUFFER_ACTIVE                = ' '
      i_callback_program             = program
    *   I_CALLBACK_PF_STATUS_SET       = ' '
    *   I_CALLBACK_USER_COMMAND        = ' '
    *   I_STRUCTURE_NAME               =
    *    is_layout                      =
      it_fieldcat                    = i_fieldcat
    *   IT_EXCLUDING                   =
    *   IT_SPECIAL_GROUPS              =
    *  it_sort                        = i_sort1
    *   IT_FILTER                      =
    *   IS_SEL_HIDE                    =
    *  i_default                      = 'X'
    *  i_save                         = 'A'
    *  is_variant                     = variant1
      it_events                      = i_events
    *   IT_EVENT_EXIT                  =
    *   IS_PRINT                       =
    *   IS_REPREP_ID                   =
    *   I_SCREEN_START_COLUMN          = 0
    *   I_SCREEN_START_LINE            = 0
    *   I_SCREEN_END_COLUMN            = 0
    *   I_SCREEN_END_LINE              = 0
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER        =
    *   ES_EXIT_CAUSED_BY_USER         =
        TABLES
          t_outtab                   = i_subtot_tab  "This is Final internal table that is to be displayed.
     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.                    " display_data
    *&---------------------------------------------------------------------*
    *&      Form  get_data
    *&---------------------------------------------------------------------*
    FORM get_data .
    
    *  SELECT  matnr werks lgort labst umlme insme
    *    FROM mard
    *    INTO CORRESPONDING FIELDS OF TABLE i_detail_tab
    *    WHERE werks IN s_werks.
    
      w_detail_tab-werks = '2000'.
      w_detail_tab-lgort = '0400'.
      w_detail_tab-matnr = '00001'.
      w_detail_tab-labst = 1.
      w_detail_tab-umlme = 2.
      w_detail_tab-insme = 3.
      APPEND w_detail_tab TO i_detail_tab.
      CLEAR  w_detail_tab.
    
      w_detail_tab-werks = '2000'.
      w_detail_tab-lgort = '0500'.
      w_detail_tab-matnr = '00001'.
      w_detail_tab-labst = 1.
      w_detail_tab-umlme = 2.
      w_detail_tab-insme = 3.
      APPEND w_detail_tab TO i_detail_tab.
      CLEAR  w_detail_tab.
    
      w_detail_tab-werks = '3000'.
      w_detail_tab-lgort = '0500'.
      w_detail_tab-matnr = '00002'.
      w_detail_tab-labst = 2.
      w_detail_tab-umlme = 3.
      w_detail_tab-insme = 4.
      APPEND w_detail_tab TO i_detail_tab.
      CLEAR  w_detail_tab.
    
      w_detail_tab-werks = '3000'.
      w_detail_tab-lgort = '0500'.
      w_detail_tab-matnr = '00003'.
      w_detail_tab-labst = 3.
      w_detail_tab-umlme = 4.
      w_detail_tab-insme = 5.
      APPEND w_detail_tab TO i_detail_tab.
      CLEAR  w_detail_tab.
    
      SORT i_detail_tab BY werks.
      LOOP AT i_detail_tab INTO w_detail_tab .
        AT END OF werks.
          SUM.
          w_subtot_tab-werks = w_detail_tab-werks.
          w_subtot_tab-labst = w_detail_tab-labst.
          w_subtot_tab-umlme = w_detail_tab-umlme.
          w_subtot_tab-insme = w_detail_tab-insme.
          APPEND w_subtot_tab TO i_subtot_tab.
          CLEAR  w_subtot_tab.
        ENDAT.
      ENDLOOP.
    
    ENDFORM.                    " get_data
    
    *&---------------------------------------------------------------------*
    *&      Form  top_of_page
    *&---------------------------------------------------------------------*
    FORM top_of_page.
      DATA :
    i_header TYPE slis_t_listheader,
    w_header LIKE LINE OF i_header.
    
    
      w_header-typ = 'S'.
      w_header-info = sy-repid.
      APPEND w_header TO i_header.
      CLEAR w_header.
    
      w_header-typ = 'H'.
      WRITE sy-datum TO w_header-info.
      APPEND w_header TO i_header.
      CLEAR w_header.
    
      w_header-typ = 'A'.
      w_header-info = 'GRID Display TOP OF PAGE'.
      APPEND w_header TO i_header.
      CLEAR w_header.
    
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = i_header
          i_logo             = 'ENJOYSAP_LOGO'.
    ENDFORM.                    "top_of_page
    *&---------------------------------------------------------------------*
    *&      Form  user_Command
    *&---------------------------------------------------------------------*
    FORM user_command USING ucomm TYPE sy-ucomm selfield TYPE slis_selfield.
      IF ucomm = '&IC1'. " When you double click, Function code for double click.
        data: i_detail_tab1 TYPE STANDARD TABLE OF t_detail_tab.
        i_detail_tab1[] = i_detail_tab[].
        PERFORM build_events_table_det.
        PERFORM build_fieldcatalog_table_det.
        READ TABLE i_subtot_tab INTO w_subtot_tab INDEX selfield-tabindex.
        IF sy-subrc = 0.
          DELETE i_detail_tab1 WHERE werks <> w_subtot_tab-werks.
        ENDIF.
        PERFORM display_data_det TABLES i_detail_tab1.
        CLEAR i_detail_tab1[].
      ENDIF.
    ENDFORM.                    "user_Command
    *&---------------------------------------------------------------------*
    *&      Form  build_events_table_det
    *&---------------------------------------------------------------------*
    FORM build_events_table_det .
      CLEAR :w_events1,
             i_events1[].
    
      w_events1-name = 'TOP_OF_PAGE' .
      w_events1-form = 'TOP_OF_PAGE1' .
      APPEND w_events1 TO i_events1.
      CLEAR w_events1.
    
    ENDFORM.                    " build_events_table_det
    *&---------------------------------------------------------------------*
    *&      Form  build_fieldcatalog_table_det
    *&---------------------------------------------------------------------*
    FORM build_fieldcatalog_table_det .
      CLEAR:w_fieldcat1, i_fieldcat1[].
    
      w_fieldcat1-col_pos = 1 .
      w_fieldcat1-fieldname = 'WERKS' .       "Column name as it is in Final internal table
      w_fieldcat1-tabname = 'I_DETAIL_TAB'.   "Final Internal table which has to be displayed
      w_fieldcat1-seltext_m = 'Plant'.        "Column text for the field above
      APPEND w_fieldcat1 TO i_fieldcat1.
      CLEAR w_fieldcat1.
    
      w_fieldcat1-col_pos = 2 .
      w_fieldcat1-fieldname = 'LGORT' .
      w_fieldcat1-tabname = 'I_DETAIL_TAB'.
      w_fieldcat1-seltext_m = 'S.Locat1ion'.
      APPEND w_fieldcat1 TO i_fieldcat1.
      CLEAR w_fieldcat1.
    
    
      w_fieldcat1-col_pos = 3 .
      w_fieldcat1-fieldname = 'MATNR'.
      w_fieldcat1-tabname = 'I_DETAIL_TAB'.
      w_fieldcat1-seltext_m = 'Mat No'.
      APPEND w_fieldcat1 TO i_fieldcat1.
      CLEAR w_fieldcat1.
    
      w_fieldcat1-col_pos = 4 .
      w_fieldcat1-fieldname = 'LABST' .
      w_fieldcat1-do_sum = 'X'.                  "It gives grand total for all subtotals
      w_fieldcat1-tabname = 'I_DETAIL_TAB'.
      w_fieldcat1-seltext_m = 'LABST'.
      APPEND w_fieldcat1 TO i_fieldcat1.
      CLEAR w_fieldcat1.
    
      w_fieldcat1-col_pos = 5 .
      w_fieldcat1-fieldname = 'UMLME'.
      w_fieldcat1-do_sum = 'X'.
      w_fieldcat1-tabname = 'I_DETAIL_TAB'.
      w_fieldcat1-seltext_m = 'UMLME'.
      APPEND w_fieldcat1 TO i_fieldcat1.
      CLEAR w_fieldcat1.
    
      w_fieldcat1-col_pos = 6 .
      w_fieldcat1-fieldname = 'INSME'.
      w_fieldcat1-do_sum = 'X'.
      w_fieldcat1-tabname = 'I_DETAIL_TAB'.
      w_fieldcat1-seltext_m = 'INSME'.
      APPEND w_fieldcat1 TO i_fieldcat1.
      CLEAR w_fieldcat1.
    ENDFORM.                    " build_fieldcatalog_table_det
    *&---------------------------------------------------------------------*
    *&      Form  display_data_det
    *&---------------------------------------------------------------------*
    FORM display_data_det TABLES i_detail_tab1.
    
      DATA:program TYPE sy-repid.
      program = sy-repid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK              = ' '
    *   I_BYPASSING_BUFFER             =
    *   I_BUFFER_ACTIVE                = ' '
      i_callback_program             = program
    *   I_CALLBACK_PF_STATUS_SET       = ' '
    *   I_CALLBACK_USER_COMMAND        = ' '
    *   I_STRUCTURE_NAME               =
    *    is_layout                      =
      it_fieldcat                    = i_fieldcat1
    *   IT_EXCLUDING                   =
    *   IT_SPECIAL_GROUPS              =
    *  it_sort                        = i_sort1
    *   IT_FILTER                      =
    *   IS_SEL_HIDE                    =
    *  i_default                      = 'X'
    *  i_save                         = 'A'
    *  is_variant                     = variant1
      it_events                      = i_events1
    *   IT_EVENT_EXIT                  =
    *   IS_PRINT                       =
    *   IS_REPREP_ID                   =
    *   I_SCREEN_START_COLUMN          = 0
    *   I_SCREEN_START_LINE            = 0
    *   I_SCREEN_END_COLUMN            = 0
    *   I_SCREEN_END_LINE              = 0
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER        =
    *   ES_EXIT_CAUSED_BY_USER         =
        TABLES
          t_outtab                   = i_detail_tab1  "This is Final internal table that is to be displayed.
     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.                    " display_data_det
    *&---------------------------------------------------------------------*
    *&      Form  top_of_page1
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM top_of_page1.
    
      DATA :
    i_header TYPE slis_t_listheader,
    w_header LIKE LINE OF i_header.
    
    
      w_header-typ = 'S'.
      w_header-info = 'Detailed one'.
      APPEND w_header TO i_header.
      CLEAR w_header.
    
      w_header-typ = 'H'.
      WRITE sy-datum TO w_header-info.
      APPEND w_header TO i_header.
      CLEAR w_header.
    
      w_header-typ = 'A'.
      w_header-info = 'GRID Display TOP OF PAGE'.
      APPEND w_header TO i_header.
      CLEAR w_header.
    
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = i_header
          i_logo             = 'ENJOYSAP_LOGO'.
    
    ENDFORM.                    "top_of_page1
    . I hope that it solves ur problem. Regards, Venkat.O

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2008 at 05:02 AM
    REPORT  ZMM_PO_HISTORY_YS.
    
    **************************************************
    * Title                           :  Zmm_Rept_Pohistory_Rp                     *
    * Author                       :    kaushik datta                                     *
    * Type                           :  Report                                                *
    * Transaction                 :  ZMM                                                   *
    * Started on                   :  11.18.2006                                          *
    * Completed on             :  11.18.2006                                            *
    * Message                      :  zmsgrp                                               *
    * Development class      :  zpakgrp                                                 *
    * Description                 :  This interactive ALV report will                 *
                                              show history of  purchase orders          *
    ***************************************************
    *           M O D I F I C A T I O N    L O G                            *
    *----------------------------------------------------------------------*
    * USER ID  | DATE     |CHANGE #  | DESCRIPTION        *
    *----------|----------|----------|-------------------------------------  *
    *---------------------------------------------------------------------- *
    
    *---------------------------------------------------------------------  *
    *                        TABLES
    *---------------------------------------------------------------------  *
    
    TABLES: ekko,                                                      " Purchasing Document Header
                     ekpo,                                                      " Purchasing Document Item
                     mara.                                                      " Material Master
    
    *---------------------------------------------------------------------*
    *                        TYPE POOLS
    *---------------------------------------------------------------------*
    
    TYPE-POOLS : slis.                                               "Global type pool.
    
    *---------------------------------------------------------------------*
    *                        DATA DECLARATION
    *---------------------------------------------------------------------*
    
    DATA :  w_repid LIKE sy-repid,                             " Report name
                   w_po_unit_price TYPE p DECIMALS 3, " Variable to store the calculated PO unit price                                                                                
    w_chkflag TYPE i VALUE 0.
    
    *---------------------------------------------------------------------*
    *                        TYPES DECLARATION
    *---------------------------------------------------------------------*
    
    TYPES:BEGIN OF ty_phistory,
    
           ebeln LIKE ekko-ebeln,			" Purchasing Document Number
           bedat LIKE ekko-bedat,			" Purchasing document date
           ekgrp LIKE ekko-ekgrp,			" Buyer Number (Purchasing Group)
           lifnr LIKE ekko-lifnr,			" Supplier Number (vendor no)
           werks LIKE ekpo-werks,			" Plant
           matnr LIKE ekpo-matnr,			" Material Number
           txz01 LIKE ekpo-txz01,			" Material Description
           matkl LIKE ekpo-matkl,			" Material Group
           meins LIKE ekpo-meins,			" Unit of measure
           menge LIKE ekpo-menge,		" Line item quantity
           netpr LIKE ekpo-netpr,			" Net price in purchasing document
           peinh LIKE ekpo-peinh,			" Price unit
           ebelp LIKE ekpo-ebelp,			" Item no
           revlv LIKE ekpo-revlv,			" Revision level
           netwr LIKE ekpo-netwr,			" Item value
           eknam LIKE t024-eknam,		“ Buyer Name
           name1 LIKE lfa1-name1,			" Supplier Name
           pounit TYPE p DECIMALS 3,		" PO unit price
    
         END OF ty_phistory.
    
    *---------------------------------------------------------------------*
    *                        WORK AREA
    *---------------------------------------------------------------------*
    
    DATA :  wa_phistory TYPE ty_phistory.
    
    *---------------------------------------------------------------------*
    *                        INTERNAL TABLE DECLARATION
    *---------------------------------------------------------------------*
    
    DATA : it_phistory TYPE ty_phistory OCCURS 0 WITH HEADER LINE,                                                                                
    " internal table to store the selected records
          it_layout TYPE slis_layout_alv,                          " list layout specifications
          it_fieldcat TYPE slis_t_fieldcat_alv,                   " Field catalog with field descriptions
          it_events TYPE slis_t_event,                               " Table of events to perform
          it_t024e TYPE TABLE OF t024e WITH HEADER LINE.                                                                                
    " Internal table for Purchasing Organization
    
    *---------------------------------------------------------------------*
    *                        SELECTION SCREEN BLOCK B1
    *---------------------------------------------------------------------*
    
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    
    SELECT-OPTIONS: 
                    so_matnr FOR mara-matnr,		" Material Number
                    so_ebeln FOR ekko-ebeln,			" Purchasing document
                    so_lifnr FOR ekko-lifnr,			" Vendor
                    so_matkl FOR ekpo-matkl,			" Material Group
                    so_werks FOR ekpo-werks,		" Plant
                    so_lgort FOR ekpo-lgort,			" Storage Location
                    so_bedat FOR ekko-bedat,			" Document date
                    so_bsart FOR ekko-bsart,			" Document Type
                    so_bstyp FOR ekko-bstyp,			" Document category
                    so_ekgrp FOR ekko-ekgrp,			" Purchasing Group
                    so_ekorg FOR ekko-ekorg obligatory.	" Purchasing organization
    
    SELECTION-SCREEN END OF BLOCK b1.
    
    *---------------------------------------------------------------------*
    *                        INITIALIZATION
    *---------------------------------------------------------------------*
    
    INITIALIZATION.
    
      w_repid = sy-repid.
      PERFORM fill_fieldcat  USING it_fieldcat.                     "  subroutine to fill the field catalog
    
    *----------------------------------------------------------------------*
    *                        AT SELECTION-SCREEN
    *----------------------------------------------------------------------*
    
    AT SELECTION-SCREEN on so_ekorg.
    
            perform validate.
    
    *----------------------------------------------------------------------*
    *                        START-OF-SELECTION
    *----------------------------------------------------------------------*
    
    START-OF-SELECTION.
    
             PERFORM get_data.                                 " subroutine to select the data from tables
    
    *----------------------------------------------------------------------*
    *                        END-OF-SELECTION
    *----------------------------------------------------------------------*
    
    END-OF-SELECTION.
    
      SORT it_phistory BY ebeln.
    
      CHECK w_chkflag = 0.
    
      PERFORM list_display.                         " subroutine to display the ALV list
    
    
    *&---------------------------------------------------------------------*
    *&      Form  get_data
    *&---------------------------------------------------------------------*
    *       select the data from tables ekko,ekpo,t024,lfa1.
    *----------------------------------------------------------------------*
    *  -->  p1
    *  <--  p2
    *----------------------------------------------------------------------*
    FORM get_data.
    
      SELECT  	werks                                  "Select the data from table EKPO
              		matnr
              		txz01
              		matkl
             		meins
              		menge
              		netpr
             		peinh
              		ebeln
              		ebelp
              		revlv
              		netwr
                 	FROM ekpo
                    	INTO CORRESPONDING FIELDS OF TABLE it_phistory
                            WHERE ebeln IN so_ebeln AND
                                  Matnr IN so_matnr AND
                                  Matkl IN so_matkl AND
                                  Werks IN so_werks AND
                                  Lgort IN so_lgort.
    
      LOOP AT it_phistory.
    
        SELECT SINGLE                                   "Select the data from table EKKO
               bedat
               ekgrp
               lifnr
                   FROM ekko
                      INTO (it_phistory-bedat, it_phistory-ekgrp , it_phistory-lifnr)
                          WHERE ebeln = it_phistory-ebeln AND
                                lifnr IN so_lifnr AND
                                bedat IN so_bedat AND
                                bsart IN so_bsart AND
                                bstyp IN so_bstyp AND
                                ekgrp IN so_ekgrp AND
                                ekorg IN so_ekorg.
    
        IF sy-subrc = 0.
    
          SELECT SINGLE                                    " select the data from table T024
                 eknam
                    FROM t024
                        INTO  it_phistory-eknam
                             WHERE ekgrp = it_phistory-ekgrp.
    
    
          SELECT SINGLE                                   " select the data from table LFA1
                 name1
                    FROM lfa1
                       INTO it_phistory-name1
                          WHERE lifnr = it_phistory-lifnr.
    
    * calculating the PO unit price paid
    
          w_po_unit_price = ( it_phistory-netpr / it_phistory-peinh ).
          it_phistory-pounit = w_po_unit_price.
    
    * Modify the internal table contents
    
          MODIFY it_phistory INDEX sy-tabix TRANSPORTING werks matnr txz01
                   matkl meins menge netpr peinh eknam name1 pounit bedat ekgrp lifnr .
    
    
        ELSE.
          DELETE it_phistory INDEX sy-tabix.
        ENDIF.
    
      ENDLOOP.
    
      IF sy-subrc <> 0.
             MESSAGE i001(zmsgrp).
             w_chkflag = 1.
      ENDIF.
    
    ENDFORM.                    " get_data
    
    
    *&---------------------------------------------------------------------*
    *&      Form  list_display
    *&---------------------------------------------------------------------*
    *       Out put of a simple list
    *----------------------------------------------------------------------*
    *  -->  p1
    *  <--  p2
    *----------------------------------------------------------------------*
    FORM list_display.
    
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'                                                                                
    " call function module for report display
       EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                =
    *   I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = w_repid
    *   I_CALLBACK_PF_STATUS_SET          = ' '
         i_callback_user_command           = '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                      = text-014
    *   I_GRID_SETTINGS                   =
         is_layout                         = it_layout
         it_fieldcat                       = it_fieldcat
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
    *   IS_VARIANT                        =
         it_events                         = it_events
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_ADD_FIELDCAT                   =
    *   IT_HYPERLINK                      =
    *   I_HTML_HEIGHT_TOP                 =
    *   I_HTML_HEIGHT_END                 =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_phistory
    * 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.                                                " list_display
    
    *---------------------------------------------------------------------*
    *       FORM user_command                                             *
    *---------------------------------------------------------------------*
    *      Call Transaction ME23N                                         *
    *---------------------------------------------------------------------*
    *  -->  R_UCOMM                                                       *
    *  -->  RS_SELFIELD                                                   *
    *---------------------------------------------------------------------*
    FORM user_command  USING l_ucomm LIKE sy-ucomm
                                                        l_selfield TYPE slis_selfield.
    
      IF l_selfield-fieldname = 'EBELN'.
    
    * Get the record selected using TABIX
    
        READ TABLE it_phistory INTO wa_phistory INDEX l_selfield-tabindex.
           IF sy-subrc = 0.
               CASE l_ucomm.
                    WHEN '&IC1'.
    *Set parameter ID of document number
                       SET PARAMETER ID 'BES' FIELD wa_phistory-ebeln.
    *Call the Transaction VA43
                       CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
               ENDCASE.
           ENDIF.
      ENDIF.
    
    ENDFORM.
    
    *&---------------------------------------------------------------------*
    *&      Form  fill_fieldcat
    *&---------------------------------------------------------------------*
    *       subroutine to fill the field catalog
    *----------------------------------------------------------------------*
    *      -->P_IT_FIELDCAT
    *----------------------------------------------------------------------*
    FORM fill_fieldcat USING  l_gt_fieldcat TYPE slis_t_fieldcat_alv .
    
      DATA: l_wa_fieldcat TYPE slis_fieldcat_alv.
    
      CLEAR l_wa_fieldcat.                                                    "clear the field catalog
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.              "Name of inernal tab.
      l_wa_fieldcat-fieldname     = 'EBELN'.                          "Field name.
      l_wa_fieldcat-datatype      = 'CHAR'.                              "Type of the field
      l_wa_fieldcat-outputlen     = '10'.                                    "Lengh of the field
      l_wa_fieldcat-row_pos       = '0'.                                     "Output in row
      l_wa_fieldcat-col_pos       = '1'.                                       "Position of the column
      l_wa_fieldcat-input         = 'X'.                                         "Input
      l_wa_fieldcat-hotspot       = 'X'.                                        "Hotspot
      l_wa_fieldcat-seltext_l     = text-010.                               "Name of the text.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'BEDAT'.
      l_wa_fieldcat-datatype      = 'DATS'.
      l_wa_fieldcat-outputlen     = '8'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '2'.
      l_wa_fieldcat-seltext_l     = text-020.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'EBELP'.
      l_wa_fieldcat-datatype      = 'CHAR'.
      l_wa_fieldcat-outputlen     = '5'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '3'.
      l_wa_fieldcat-seltext_l     = text-030.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'WERKS'.
      l_wa_fieldcat-datatype      = 'CHAR'.
      l_wa_fieldcat-outputlen     = '4'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '4'.
      l_wa_fieldcat-seltext_l     = text-040.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'EKGRP'.
      l_wa_fieldcat-datatype      = 'CHAR'.
      l_wa_fieldcat-outputlen     = '3'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '5'.
      l_wa_fieldcat-seltext_l     = text-050.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'EKNAM'.
      l_wa_fieldcat-datatype      = 'CHAR'.
      l_wa_fieldcat-outputlen     = '18'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '6'.
      l_wa_fieldcat-seltext_l     = text-060.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'LIFNR'.
      l_wa_fieldcat-datatype      = 'CHAR'.
      l_wa_fieldcat-outputlen     = '10'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '7'.
      l_wa_fieldcat-seltext_l     = text-070.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'NAME1'.
      l_wa_fieldcat-datatype      = 'CHAR'.
      l_wa_fieldcat-outputlen     = '35'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '8'.
      l_wa_fieldcat-seltext_l     = text-080.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'MATNR'.
      l_wa_fieldcat-datatype      = 'CHAR'.
      l_wa_fieldcat-outputlen     = '18'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '9'.
      l_wa_fieldcat-seltext_l     = text-090.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'REVLV'.
      l_wa_fieldcat-datatype      = 'CHAR'.
      l_wa_fieldcat-outputlen     = '3'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '10'.
      l_wa_fieldcat-seltext_l     = text-100.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'TXZ01'.
      l_wa_fieldcat-datatype      = 'CHAR'.
      l_wa_fieldcat-outputlen     = '40'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '11'.
      l_wa_fieldcat-seltext_l     = text-110.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'MATKL'.
      l_wa_fieldcat-datatype      = 'CHAR'.
      l_wa_fieldcat-outputlen     = '9'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '12'.
      l_wa_fieldcat-seltext_l     = text-120.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'MEINS'.
      l_wa_fieldcat-datatype      = 'UNIT'.
      l_wa_fieldcat-outputlen     = '3'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '13'.
      l_wa_fieldcat-seltext_l     = text-130.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'MENGE'.
      l_wa_fieldcat-datatype      = 'QUAN'.
      l_wa_fieldcat-outputlen     = '13'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '14'.
      l_wa_fieldcat-seltext_l     = text-140.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'POUNIT'.
      l_wa_fieldcat-datatype      = 'CURR'.
      l_wa_fieldcat-outputlen     = '11'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '15'.
      l_wa_fieldcat-seltext_l     = text-150.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
      CLEAR l_wa_fieldcat.
      l_wa_fieldcat-tabname       = 'IT_PHISTORY'.
      l_wa_fieldcat-fieldname     = 'NETWR'.        "Net order value
      l_wa_fieldcat-datatype      = 'CURR'.
      l_wa_fieldcat-outputlen     = '13'.
      l_wa_fieldcat-row_pos       = '0'.
      l_wa_fieldcat-col_pos       = '16'.
      l_wa_fieldcat-seltext_l     = text-160.
      APPEND l_wa_fieldcat TO  l_gt_fieldcat.
    
    ENDFORM.                    " fill_fieldcat
    
    *&---------------------------------------------------------------------*
    *&      Form  validate
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    form validate .
    
      SELECT ekorg
               FROM t024e
                    INTO CORRESPONDING FIELDS OF TABLE
                         it_t024e WHERE ekorg in so_ekorg.
    
      IF sy-subrc ne 0.
    *        Error message if Purchase organization does not exist.
            MESSAGE e002(zmsgrp).
      ENDIF.
    
    endform.                    " validate
    
    form validate1 .
    
    SELECT ekgrp
               FROM t024
                    INTO CORRESPONDING FIELDS OF TABLE
                         it_t024 WHERE ekgrp in so_ekgrp.
    
      IF sy-subrc ne 0.
    *        Error message if Purchase group does not exist.
            MESSAGE e003(zmsgrp).
      ENDIF.
    
    
    endform.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.