Unlocking the Power of HIDE Statements in Interactive Classical Reports: A Practical Guide with Examples

 Welcome back everyone, We were discussing about Interactive Classical Event and We had seen the functionality of At line Selection.

Now, Before jumping to next event, let’s discuss some important interactive classical report statements.


1. HIDE Statement :-

  • The HIDE statement is one of the fundamental statements for interactive reporting.
  • We can use HIDE statement to store the line-specific information while creating a basic list.
  • This stored information will be used while creating secondary list.
  • Syntax : HIDE<f>.
  • The above statement places the contents of the variable <f> into the HIDE area.
  • We can consider hide area as a table which stores the field name, field value and line number ( system variable SY-LINNO).

Pre-requisites for HIDE statements :-

  1. HIDE statement must be written after the WRITE statement.
  2. HIDE statement must be called inside the loop.

Working of the HIDE Statement :-

  • The user selects a line for which data has been stored in the HIDE area.
  • The system variable SY-LILLI determines the selected line.
  • The runtime system jumps to the point in the HIDE area where data for this line is stored.
  • The runtime system then inserts all values stored for the selected line into their corresponding fields.

let’s use HIDE statements in a requirement to understand it more clearly.

Requirement:-

  • Use HIDE statement inside the loop and store the header details.
  • For displaying the secondary list use the hidden area where you have stored the basic.
  • We will be using our same program which we have used in our previous blog.
  • We will achieve the same requirement that we have achieved in our last blog, So for more reference, refer to previous blog.

Solution :-

  • Step 1 :- Use HIDE statement inside the loop of basic list.



    • Now, above all line items will be stored into hide area.


    • Suppose, above is our HIDE area, then data would be stored in the above manner.
  • Step 2 :- Use the HIDE area to fetch the required data from header for item table.



Code :-

*************************************************************
*Start of Program
*Declaring Strcutrure for header
TYPES: BEGIN OF ty_header,
         order_number TYPE zar_order_number,
         order_date   TYPE zar_order_date,
         payment_mode TYPE zar_payment_mode,
         currency     TYPE zar_curency,
       END OF ty_header.

*********************
*Internal table and Work Area
DATA : lt_header TYPE TABLE OF ty_header,
       ls_header TYPE ty_header.

****************
*Declaring Strcuture for item table
TYPES: BEGIN OF ty_item,
         order_number      TYPE zar_order_number,
         order_item_number TYPE zar_order_item_number,
         item_cost         TYPE zar_total_amount,
       END OF ty_item.

************************************
*Declaring internal table and work area
DATA : lt_item TYPE TABLE OF ty_item,
       ls_item TYPE ty_item.

*******************************
*Select option Declaration
DATA : lv_order TYPE zar_order_number.
SELECT-OPTIONS : s_order  FOR lv_order.

*********************************
*Writing a select query for header
START-OF-SELECTION.
  SELECT order_number order_date
    payment_mode currency
    FROM zar_header INTO
    TABLE lt_header
    WHERE order_number IN s_order.

***************************************
*Displaying the data
  LOOP AT lt_header INTO ls_header.
    WRITE :/ ls_header-order_number,
             ls_header-order_date,
             ls_header-payment_mode,
             ls_header-currency.
*********************
*Using HIDE Statements
    HIDE : ls_header-order_number,
           ls_header-order_date,
           ls_header-payment_mode,
           ls_header-currency.

  ENDLOOP.

*********************************
AT LINE-SELECTION.
*******************
*Using stored data in HIDE.
  SELECT order_number
      order_item_number
      item_cost FROM zar_item
    INTO TABLE lt_item
    WHERE order_number = ls_header-order_number.

  IF lt_item IS NOT INITIAL.
****************************
*LOOP on item
    LOOP AT lt_item INTO ls_item.
      WRITE :/ ls_item-order_number,
               ls_item-order_item_number,
               ls_item-item_cost.
    ENDLOOP.
  ENDIF.

********************************************
*End of Program
************************************************************

Execute the Program :-



Basic List :-



  • Suppose, I double click on the fifth row.

Secondary List :-




Note :-

  • Here, We have achieved the same requirement, but we have used the HIDE area instead of SY-LISSEL.

Important Question

  1. Why Should we use HIDE statement after write statement in the loop ?

Ans :- This is because HIDE statement is used to store the value of a field in the hidden field area after it has been displayed using the WRITE statement.


So, that’s enough for today.

We will see GET CURSOR in our next blog.

Thanx a lot for being a part of this wonderful journey.

Comments

Popular posts from this blog

Understanding Different Types of SAP Function Modules: Normal, RFC, and Update

Unlocking SAP ABAP Secrets: Interactive Classical Reports with GET CURSOR, At User Command, and a Comparison of HIDE Statements

Mastering ABAP: A Step-by-Step Guide to Function Modules and Groups for Modularized Programming