‎2006 Jan 25 1:13 PM
hi everyone,
i have a internal table of size 5 with 2 fields onit.
i'll display 1st field for 5 records. but when i click on 1st row 1st field we have to display 1st row second field.
and same as for 5 rows. i.e. when ever we click a rows first field we have to display second field.
how to achieve this problem....
plz help me if any one knows anser for this question
plz send ur answer to my id: prashanth_spl@yahoo.com
‎2006 Jan 25 2:14 PM
Hi again,
1. AT LINE-SELECTION
and
MODIFY CURRENT LINE
We have to use this logic.
2 use this code (just copy paste in new program)
it works fantastic !
3.
REPORT abc NO STANDARD PAGE HEADING.
*----
DATA : BEGIN OF itab OCCURS 0,
f1 TYPE i,
f2 TYPE i,
END OF itab.
DATA : BEGIN OF ptab OCCURS 0,
a(100) TYPE c,
END OF ptab.
*----
Data
itab-f1 = 101.
itab-f2 = 501.
APPEND itab.
itab-f1 = 102.
itab-f2 = 502.
APPEND itab.
itab-f1 = 103.
itab-f2 = 503.
APPEND itab.
*----
LOOP AT itab.
WRITE 😕 itab-f1.
ENDLOOP.
*----
AT LINE-SELECTION.
READ TABLE itab INDEX sy-curow.
CLEAR ptab.
ptab(11) = itab-f1.
ptab+15(15) = itab-f2.
MODIFY CURRENT LINE LINE VALUE FROM ptab-a.
regards,
amit m.
‎2006 Jan 25 1:27 PM
Hi prashanth,
1. How are u planning to display the data ?
2. In alv ?
regards,
amit m.
‎2006 Jan 25 1:27 PM
Here is a solution. This example uses the company code table. It presents the comany code, user can click on the company code and the corresponding text is displayed in the secondary list.
report zrich_0002.
data: it001 type table of t001 with header line.
start-of-selection.
select * into table it001 from t001.
loop at it001.
format hotspot on.
write:/ it001-bukrs.
hide: it001-bukrs, it001-butxt.
format hotspot off.
endloop.
at line-selection.
write:/ it001-butxt.
Regards,
Rich Heilman
‎2006 Jan 25 1:36 PM
check this report...
*&---------------------------------------------------------------------*
*& Report ZTEST_REPORT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report ztest_report.
data: begin of itab occurs 0,
field1(10),
field2(5),
end of itab.
data: field(20) type c,
value(5).
itab-field1 = 'test1'.
itab-field2 = 'abc1'.
append itab.
itab-field1 = 'test2'.
itab-field2 = 'abc2'.
append itab.
itab-field1 = 'test3'.
itab-field2 = 'abc3'.
append itab.
itab-field1 = 'test4'.
itab-field2 = 'abc4'.
append itab.
itab-field1 = 'test5'.
itab-field2 = 'abc5'.
append itab.
loop at itab.
write:/ itab-field1 ,
itab-field2.
endloop.
at line-selection.
get cursor field field value value.
if field = 'ITAB-FIELD1' and not value is initial .
read table itab with key field1 = value.
if sy-subrc = 0.
write : itab-field2.
endif.
endif.
‎2006 Jan 25 2:05 PM
hello Mr.Rich i want to display the 2nd field on the same page after the first field.not in secondary list.
and vijay ur program is isplaying both the fields. but the 2nd filed should be displayed only when we click the first field.
if i have internal table with 5 fields like this.
itab-field1 itab-field2
-
-
101
102
103
104
105
when we click on 101 it should display the corresponding field 2 value and so on for 102...105.
‎2006 Jan 25 2:12 PM
Oh, sorry about that. Check this sample program. Pretty slick it I do say so myself.
report zrich_0002 no standard page heading.
data: begin of it001 occurs 0,
bukrs type t001-bukrs,
butxt type t001-butxt,
check type c,
end of it001.
start-of-selection.
select * into corresponding fields of table it001 from t001.
perform write_list.
at line-selection.
read table it001 with key bukrs = it001-bukrs.
if sy-subrc = 0.
it001-check = 'X'.
modify it001 index sy-tabix.
endif.
sy-lsind = sy-lsind - 1.
perform write_list.
*&---------------------------------------------------------------------*
*& Form write_list
*&---------------------------------------------------------------------*
form write_list.
loop at it001.
format hotspot on.
write:/ it001-bukrs.
hide: it001-bukrs, it001-butxt.
format hotspot off.
if it001-check = 'X'.
write: it001-butxt.
endif.
endloop.
endform.
Regards,
Rich Heilman
‎2006 Jan 25 2:12 PM
Hi Prashanth,
I think you cannot have that in the same first page.
instead modify vijays code as follows.
REPORT YRT_TEST NO STANDARD PAGE HEADING .
data: begin of itab occurs 0,
field1(10),
field2(5),
check(1),
end of itab.
data: field(20) type c,
value(5).
itab-field1 = 'test1'.
itab-field2 = 'abc1'.
append itab.
itab-field1 = 'test2'.
itab-field2 = 'abc2'.
append itab.
itab-field1 = 'test3'.
itab-field2 = 'abc3'.
append itab.
itab-field1 = 'test4'.
itab-field2 = 'abc4'.
append itab.
itab-field1 = 'test5'.
itab-field2 = 'abc5'.
append itab.
loop at itab.
write:/ itab-field1 .
endloop.
at line-selection.
get cursor field field value value.
if field = 'ITAB-FIELD1' and not value is initial .
read table itab with key field1 = value.
if sy-subrc = 0.
itab-check = 'X'.
modify itab index sy-tabix.
endif.
endif.
loop at itab where check = 'X'.
write:/ itab-field1 ,
itab-field2.
endloop.
Regards,
ravi
‎2006 Jan 25 2:20 PM
*&---------------------------------------------------------------------*
*& Report ZTEST_REPORT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report ztest_report.
data: begin of itab occurs 0,
field1(10),
field2(5),
end of itab.
data: field(20) type c,
value(5).
data: click(1) .
itab-field1 = 'test1'.
itab-field2 = 'abc1'.
append itab.
itab-field1 = 'test2'.
itab-field2 = 'abc2'.
append itab.
itab-field1 = 'test3'.
itab-field2 = 'abc3'.
append itab.
itab-field1 = 'test4'.
itab-field2 = 'abc4'.
append itab.
itab-field1 = 'test5'.
itab-field2 = 'abc5'.
append itab.
data: itab1 like itab occurs 0 with header line.
loop at itab .
clear itab-field2.
move-corresponding itab to itab1.
append itab1.
clear itab1.
endloop.
perform popualate_data.
at line-selection.
click = 'X'.
get cursor field field value value.
if field = 'ITAB1-FIELD1' and not value is initial .
read table itab with key field1 = value.
if sy-subrc = 0.
read table itab1 with key field1 = value.
itab1-field2 = itab-field2.
modify itab1 index sy-tabix.
sy-lsind = 0.
perform popualate_data.
endif.
endif.
*&---------------------------------------------------------------------*
*& Form popualate_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form popualate_data .
loop at itab1.
write:/ itab1-field1,
itab1-field2.
endloop.
endform. " popualate_data
‎2006 Jan 25 2:14 PM
Hi again,
1. AT LINE-SELECTION
and
MODIFY CURRENT LINE
We have to use this logic.
2 use this code (just copy paste in new program)
it works fantastic !
3.
REPORT abc NO STANDARD PAGE HEADING.
*----
DATA : BEGIN OF itab OCCURS 0,
f1 TYPE i,
f2 TYPE i,
END OF itab.
DATA : BEGIN OF ptab OCCURS 0,
a(100) TYPE c,
END OF ptab.
*----
Data
itab-f1 = 101.
itab-f2 = 501.
APPEND itab.
itab-f1 = 102.
itab-f2 = 502.
APPEND itab.
itab-f1 = 103.
itab-f2 = 503.
APPEND itab.
*----
LOOP AT itab.
WRITE 😕 itab-f1.
ENDLOOP.
*----
AT LINE-SELECTION.
READ TABLE itab INDEX sy-curow.
CLEAR ptab.
ptab(11) = itab-f1.
ptab+15(15) = itab-f2.
MODIFY CURRENT LINE LINE VALUE FROM ptab-a.
regards,
amit m.
‎2006 Jan 25 3:48 PM
thanks to rich,amit and vijay.
all ur solutions giving the correct answers.
thanks a lot.
‎2006 Jan 25 3:51 PM