Application Development 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: 

Hide statement not working

Former Member
0 Kudos

Hi experts,

i am using hide statement but it is not working..The problem with it is that after line selection the variable on which i have used hide is carrying the last value of internal table always..<< Removed >>

Regards,

Raman

Edited by: Rob Burbank on Jun 30, 2009 10:41 AM

19 REPLIES 19

Former Member
0 Kudos

Hi Raman,

It will be better if you paste your Loop code here so that your requirement will be more clear.

Use Hide statement in loop after write statement.

Regards,

Vijay

Former Member
0 Kudos

can you explain in detailed please...

former_member188685
Active Contributor
0 Kudos

Hint:

instead of Hide, use Get cursor always.

0 Kudos

BUT GET CURSOR IS SPECIFICALLY USED FOR ONLY PARTICULAR FIELD...IF USER SELECTS ANOTHER FIELD IN THE SAME LINE IT WILL GIVE DIFF DATA....

0 Kudos

thats true,

you can have case after

get cursor field <fname> value <value>.

based on fieldname you can have different logic. will it be a show stooper..??

0 Kudos

But i need the same output for the whole line selection.....

0 Kudos

Hi Raman,

Use this GET CURSOR command


GET CURSOR LINE <var_for_line_no> VALUE val.

<li> You can pass SY-LILLI system variable value to <var_for_line_no> at runtime

<li> SY-LILLI -Selected list row

Thanks

Venkat.O

venkat_o
Active Contributor
0 Kudos

Hi Raman,

Try this in AT LINE-SELECTION event


"Lets say field is Matnr in the table ITAB
GET CURSOR FIELD 'ITAB-MATNR' VALUE itab-matnr.

Thanks

Venkat.O

0 Kudos

are you sure..??

Former Member
0 Kudos

yaa vijay...m sure

Former Member
0 Kudos

You might have used your HIDE statment outside LOOP...ENDLOOP.

That is why you are getting always last value of ITAB.

use HIDE with in LOOP..ENDLOOP.

venkat_o
Active Contributor
0 Kudos

Hi Raman, Have a look at this sample program. It works fine. Can you try this way .


REPORT ztest_notepad.
DATA: BEGIN OF it_t001 OCCURS 0,
        bukrs TYPE t001-bukrs,
        butxt TYPE t001-butxt,
        ort01 TYPE t001-ort01,
      END OF it_t001.

START-OF-SELECTION.
  "Select data
  SELECT *
  FROM t001
  INTO CORRESPONDING FIELDS OF TABLE it_t001
  UP TO 20 ROWS.
  "Loop data and send it to Hide area
  FORMAT HOTSPOT.
  LOOP AT it_t001.
    WRITE:/ it_t001-bukrs,
            it_t001-butxt,
            it_t001-ort01.
    HIDE: it_t001-bukrs,
        it_t001-butxt,
        it_t001-ort01.
  ENDLOOP.
  "Secondary list

AT LINE-SELECTION.
  WRITE:/ it_t001-bukrs,
          it_t001-butxt,
          it_t001-ort01.
Thanks Venkat.O

Former Member
0 Kudos

I am sending a test program with same problem...iin this after line selection the field variable emp-name is displayin only last entry of internal table...

&----


*& Report ZBASICX12

*&

&----


*&

*&

&----


REPORT ZBASICX12.

INITIALIZATION.

DATA: BEGIN OF ITAB OCCURS 0,

EMPID TYPE ZTEMP-EMPID,

EMPNAME TYPE ZTEMP-EMPNAME,

END OF ITAB.

START-OF-SELECTION.

SELECT EMPID EMPNAME FROM ZTEMP INTO TABLE ITAB.

SORT ITAB BY EMPID.

LOOP AT ITAB.

WRITE: / ITAB-EMPID HOTSPOT.

HIDE ITAB-EMPID.

ENDLOOP.

END-OF-SELECTION.

AT LINE-SELECTION.

CASE SY-LSIND.

WHEN 1.

WRITE: ITAB-EMPNAME.

ENDCASE.

Former Member
0 Kudos

LOOP AT ITAB.
WRITE: / ITAB-EMPID HOTSPOT.

*HIDE ITAB-EMPID.

"Here you are hiding only EMPID and NOT EMPNAME.
"But in display you are using EMPNAME, so HIDE EMPNAME as well then it 'll work.
"OR you can hide whole work area as well 
"ex:  HIDE ITAB.

HIDE : ITAB-EMPID, ITAB-EMPNAME.

ENDLOOP.

Former Member
0 Kudos

Hi Raman,

try hiding the whole work area.

LOOP AT ITAB.

WRITE: / ITAB-EMPID HOTSPOT.

HIDE ITAB.

ENDLOOP.

Former Member
0 Kudos

Raman,

Perez answered your question in less than 10 minutes after you finally posted your code. This is a classic example of why it is so important to post your code, when there is a question about code.

Former Member
0 Kudos

Befor READ LINE statement did you use CLEAR <variable> Statement??

faisal_altaf2
Active Contributor
0 Kudos

Hi, Sharma

Please Test the following Sample Code Hope will help you to solve out your problem,

DATA: it_t247 LIKE STANDARD TABLE OF t247 WITH HEADER LINE,
      wa_t247 LIKE LINE OF it_t247.

SELECT * FROM t247
  INTO CORRESPONDING FIELDS OF TABLE it_t247
  WHERE spras = 'E'.

LOOP AT it_t247.
  WRITE: / it_t247-mnr HOTSPOT ON. HIDE it_t247.
ENDLOOP.

AT LINE-SELECTION.

  READ TABLE it_t247 INTO wa_t247 WITH KEY mnr = it_t247-mnr.
  IF sy-subrc EQ 0.
    WRITE: wa_t247-mnr, wa_t247-ktx, wa_t247-ltx.
  ENDIF.

Best Regards,

Faisal

0 Kudos

HI FAISAL,

I have also used hide statement like this..but after line selection the corresponding field is picking up the last value of internal table....

Regards,

Raman