Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

HIDE STATEMENT

Former Member
0 Likes
8,907

hi,

I am in learning stage of ABAP. Please tell me, when we use hide statement and why we use hide statement ( instated of getcursor ). please explain with real time example.

Thanks

samba.

1 ACCEPTED SOLUTION
Read only

Former Member
3,098

Its simple Dear,

Hide is use when u want a specific field (irrespective of field selected /clicked) of the record clicked...

and get cursor is used when u wants the value/name of field (nt whole record) which a click. this one is more dymanic in nature...

No Rewards Plz...

9 REPLIES 9
Read only

Former Member
0 Likes
3,098

Hi,

Hide & Get Cursor is used in interactive programming ( in the event AT LINE-selection). Using Hide in Loop..Endloop, you can get the field name At Line-Select Event While Double Clicking That Line.

http://www.sap-img.com/abap/a-sample-hide-get-cursor-in-interactive-programming.htm

Regards

Sudheer

Read only

Former Member
0 Likes
3,098

hi

good

HIDE

The HIDE statement is one of the fundamental statements for interactive reporting. You use the HIDE technique when creating a basic list. It defines the information that can be passed to subsequent detail lists.

http://www.sapbrainsonline.com/ARTICLES/TECHNICAL/ABAP/HIDE_Technique.html

<b><REMOVED BY MODERATOR></b>

thanks

mrutyun^

Message was edited by:

Alvaro Tejada Galindo

Read only

Former Member
0 Likes
3,098

Hi Margani,

Check this out

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/hide.htm

Regards,

Santosh

Read only

Former Member
0 Likes
3,098

Hi

We can use HIDE technique while creating LIST level to store line -specific information for later use.

syntax: HIDE <variable>.

this statement place the contents of the variable <variable> for the current output line(SY-LINNO) into the HIDE area.

you can think of the HIDE area as a table, in which the system stores the field name, field contents and line number in which field exisisting. as soon as they are needed the system reads the values from the table(HIDE) using READ LINE statement.

Keep in mind while working with HIDE.

1) Allways keep HIDE <variable> statement after WRITE statement for more readable format.

2) All way keep HIDE <variable> statement inside the LOOP statement, because syatem stores all the hide variable in system genarated table space, we can process table data throug it's work area only.

Sample Program.

Report Zreport_hide.

*table work area

tables: lfa1,ekko,ekpo.

*selection-screen logic

select-options: s_lifnr for lfa1-lifnr obligatory.

*logic for creating internal table

data: begin of it _lfa1 occurs 0,

it_lifnr like lfa1-lifnr,

name1 like lfa1-name1,

end of it_lfa1.

data: begin of it _ekko occurs 0,

it_ebeln like ekko-ebeln,

aedat like ekko-aedat,

end of it_ekko.

  • logic for genarating basic list

start-of-selection.

select lifnr name1 from lfa1 into table it_lfa1 where lifnr in s_lifnr.

*processing the data.

loop at it_lfa1.

write:/ it_lfa1-lifnr,

it_lfa1-name1,'

HIDE it_lfa1-lifnr. "here hide the varible lifnr

endloop.

*logic for genarating secondary list

at line-selection.

case sy-lsind.

when 1.

select ebeln aedat from ekko into table it_ekko where lifnr = it_lfa1-lifnr.

*processing seconadry list data.

loop at it_ekko.

write:/ it_ekko-ebeln,

it_ekko-aedat,

endloop.

The HIDE statement is one of the fundamental statements for interactive reporting. You use the HIDE technique when creating a basic list. It defines the information that can be passed to subsequent detail lists.

GET CURSOR

Use the statements GET CURSOR FIELD und GET CURSOR LINE to pass the output field or output line on which the cursor was positioned during the interactive event to the ABAP program.

A Sample Hide & Get Cursor in Interactive Programming

Hide & Get Cursor is used in interactive programming ( in the event AT LINE-selection).

Using Hide in Loop..Endloop, you can get the field name At Line-Select

Event While Double Clicking That Line.

***PROG.BEGIN**************************************************************

&----


*& Report ZPREM_INTERACTIVE *

*& *

&----


*& *

*& *

&----


REPORT zprem_interactive .

TYPES : BEGIN OF ty_test,

code TYPE i,

name(10) TYPE c,

amount TYPE p DECIMALS 2,

END OF ty_test.

DATA : it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE INITIAL SIZE 10.

DATA : wa TYPE ty_test,

chk1 TYPE c,

fldname(30), fldval(50).

*set pf-status 'PF01'.

*set titlebar 'PF01'.

*

INITIALIZATION.

it_test-code = 300.

it_test-name = 'Ramesh'.

it_test-amount = 5500.

APPEND it_test.

wa-code = 207.

wa-name = 'Prem'.

wa-amount = 5000.

APPEND wa TO it_test.

it_test-code = 117.

it_test-name = 'James Bond'.

it_test-amount = 9900.

INSERT it_test INDEX 3.

it_test-code = 217.

it_test-name = 'Sivaraman'.

it_test-amount = 9900.

INSERT it_test INDEX 3.

it_test-code = 201.

it_test-name = 'Saravanan'.

it_test-amount = 1000.

APPEND it_test.

it_test-code = 210.

it_test-name = 'Shanmugam'.

it_test-amount = 6000.

APPEND it_test.

WRITE : / 'Loop Display ( Appended rows ) :-'.

LOOP AT it_test.

WRITE : / chk1 AS CHECKBOX,

sy-tabix, sy-vline, it_test-code, it_test-name, it_test-amount.

HIDE : it_test-code, it_test-name.

ENDLOOP.

SKIP.

END-OF-SELECTION.

CLEAR : it_test-code, it_test-name.

WRITE : / 'this from end of selection'.

&----


*& Form DISP1

&----


  • text

----


FORM disp1.

WINDOW STARTING AT 15 10

ENDING AT 80 15.

DO.

CLEAR chk1.

READ LINE sy-index FIELD VALUE chk1.

IF sy-subrc NE 0.

EXIT.

ELSE.

CHECK chk1 NE space.

WRITE : / it_test-code, it_test-name.

MODIFY CURRENT LINE :

FIELD VALUE chk1 FROM ' '

FIELD FORMAT chk1 INPUT OFF.

ENDIF.

ENDDO.

ENDFORM. "DISP1

***line double click ****

AT LINE-SELECTION.

CHECK sy-lsind = 1.

WINDOW STARTING AT 5 4

ENDING AT 85 20.

WRITE: / 'THE USER DOUBLE-CLICKED A LINE IN THE REPORT'.

WRITE: / sy-lisel.

WRITE : / 'Sometime ',it_test-name, ' is good '.

WRITE : / 'Sometime ',it_test-name, ' is bad '.

WRITE : / 'Sometime ',it_test-name, ' is rich '.

WRITE : / 'Sometime ',it_test-name, ' is poor '.

WRITE : / 'Who knows, who is ',it_test-name, ' ? '.

WRITE : /, / 'we can also use this in SELECT statement'.

CLEAR : it_test-code, it_test-name.

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ULINE.

SKIP.

SKIP.

WRITE : / 'Below from Get Cursor Field...'.

GET CURSOR FIELD fldname VALUE fldval.

CONDENSE fldname.

CONDENSE fldval.

WRITE : / 'You have clicked ', fldname, ' & its value is ', fldval.

***function key press F6 ****

AT PF06.

PERFORM disp1.

*AT USER-COMMAND.

  • CASE SY-UCOMM.

  • WHEN 'STOP' OR 'CANCEL'.

  • LEAVE TO SCREEN 0.

  • WHEN 'TESTME'.

  • PERFORM DISP1.

  • ENDCASE.

Hide & Get Cursor is used in interactive programming ( in the event AT LINE-selection).

Using Hide in Loop..Endloop, you can get the field name At Line-Select

Event While Double Clicking That Line.

***PROG.BEGIN**************************************************************

&----


*& Report ZPREM_INTERACTIVE *

*& *

&----


*& *

*& *

&----


REPORT zprem_interactive .

TYPES : BEGIN OF ty_test,

code TYPE i,

name(10) TYPE c,

amount TYPE p DECIMALS 2,

END OF ty_test.

DATA : it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE INITIAL SIZE 10.

DATA : wa TYPE ty_test,

chk1 TYPE c,

fldname(30), fldval(50).

*set pf-status 'PF01'.

*set titlebar 'PF01'.

*

INITIALIZATION.

it_test-code = 300.

it_test-name = 'Ramesh'.

it_test-amount = 5500.

APPEND it_test.

wa-code = 207.

wa-name = 'Prem'.

wa-amount = 5000.

APPEND wa TO it_test.

it_test-code = 117.

it_test-name = 'James Bond'.

it_test-amount = 9900.

INSERT it_test INDEX 3.

it_test-code = 217.

it_test-name = 'Sivaraman'.

it_test-amount = 9900.

INSERT it_test INDEX 3.

it_test-code = 201.

it_test-name = 'Saravanan'.

it_test-amount = 1000.

APPEND it_test.

it_test-code = 210.

it_test-name = 'Shanmugam'.

it_test-amount = 6000.

APPEND it_test.

WRITE : / 'Loop Display ( Appended rows ) :-'.

LOOP AT it_test.

WRITE : / chk1 AS CHECKBOX,

sy-tabix, sy-vline, it_test-code, it_test-name, it_test-amount.

HIDE : it_test-code, it_test-name.

ENDLOOP.

SKIP.

END-OF-SELECTION.

CLEAR : it_test-code, it_test-name.

WRITE : / 'this from end of selection'.

&----


*& Form DISP1

&----


  • text

----


FORM disp1.

WINDOW STARTING AT 15 10

ENDING AT 80 15.

DO.

CLEAR chk1.

READ LINE sy-index FIELD VALUE chk1.

IF sy-subrc NE 0.

EXIT.

ELSE.

CHECK chk1 NE space.

WRITE : / it_test-code, it_test-name.

MODIFY CURRENT LINE :

FIELD VALUE chk1 FROM ' '

FIELD FORMAT chk1 INPUT OFF.

ENDIF.

ENDDO.

ENDFORM. "DISP1

***line double click ****

AT LINE-SELECTION.

CHECK sy-lsind = 1.

WINDOW STARTING AT 5 4

ENDING AT 85 20.

WRITE: / 'THE USER DOUBLE-CLICKED A LINE IN THE REPORT'.

WRITE: / sy-lisel.

WRITE : / 'Sometime ',it_test-name, ' is good '.

WRITE : / 'Sometime ',it_test-name, ' is bad '.

WRITE : / 'Sometime ',it_test-name, ' is rich '.

WRITE : / 'Sometime ',it_test-name, ' is poor '.

WRITE : / 'Who knows, who is ',it_test-name, ' ? '.

WRITE : /, / 'we can also use this in SELECT statement'.

CLEAR : it_test-code, it_test-name.

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ULINE.

SKIP.

SKIP.

WRITE : / 'Below from Get Cursor Field...'.

GET CURSOR FIELD fldname VALUE fldval.

CONDENSE fldname.

CONDENSE fldval.

WRITE : / 'You have clicked ', fldname, ' & its value is ', fldval.

***function key press F6 ****

AT PF06.

PERFORM disp1.

*AT USER-COMMAND.

  • CASE SY-UCOMM.

  • WHEN 'STOP' OR 'CANCEL'.

  • LEAVE TO SCREEN 0.

  • WHEN 'TESTME'.

  • PERFORM DISP1.

  • ENDCASE.

*******************************************************************************************

<b>Reward if usefull</b>

Read only

0 Likes
3,098

Hi Naresh,

First tanks for ur response.. I have few douts on ur answer, please clarify these, Recording to ur document

<b>1.</b>

Using Hide in Loop..Endloop, you can get the <b>field name</b> At Line-Select

Event While Double Clicking That Line.

see this coding

*processing the data.

loop at it_lfa1.

write:/ it_lfa1-lifnr,

it_lfa1-name1,'

HIDE <b>it_lfa1-lifnr</b>. "here hide the varible lifnr

endloop.

*logic for genarating secondary list

at line-selection.

case sy-lsind.

when 1.

select ebeln aedat from ekko into table it_ekko where lifnr = <b>it_lfa1-lifnr</b>.

according to above ( 1 ) by using hide statement we got field name, but in our coding we will check ekko lifnr and lfa1 lifnr in where condition. Means when we double click on basic list on a perticular line, hide area capture the whole line or perticular clicked field ? please explain this recording to above coding.. & how HIDE <b>it_lfa1-lifnr</b>. will be usefull in 2nd and 3rd interactive lists.

<b>2.</b>

***function key press F6 ****

<b>AT PF06.</b>

PERFORM disp1.

in this i don't have idea about this <b>AT PF06.</b> . Please explain this statement and give little clear document, and some real time coding explanation.

Thanks

margani

Read only

Former Member
3,099

Its simple Dear,

Hide is use when u want a specific field (irrespective of field selected /clicked) of the record clicked...

and get cursor is used when u wants the value/name of field (nt whole record) which a click. this one is more dymanic in nature...

No Rewards Plz...

Read only

Former Member
0 Likes
3,098

Hi

<b>HIDE</b>

The HIDE keyword is used to store data objects and their values so they can be made available when the User selects a report line. When a line is selected, the fields that were hidden are filled with the values that you hid for that line.

The user selects a line for which data has been stored in the HIDE area. The runtime system evaluates field SY-LILLI to determine 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 in the HIDE area into their corresponding fields.

The runtime system processes the event AT LINE-SELECTION and its corresponding program processing block.

A detail list is created.

<b>Reward if usefull</b>

Read only

varma_narayana
Active Contributor
0 Likes
3,098

Hi..

HIDE: <fields> .

This statement is used to Generate a secondary list based on the Selected values of One or More fields in a list.

Get Cursor Field <Fname> Value <fval>.

This statement is used to generate the Secondary list based on the Field attributes where the cursor is positioned. It will not only give the Value of the field , but also gives the Name and Length of the field.

<b>REWARD IF HELPFUL.</b>

Read only

Former Member
0 Likes
3,098

This message was moderated.