2013 Mar 19 5:51 AM
i have small dought, that is i created custom table with 3 fields
lowpercentage high.per user
1 10 GM
11 25 CFO
26 99999999 MD
--
Like this i prepared.
my dought is Iam storing the percentage value WA_FINAL-PERCENTAGE in this work area, and then i add the column in ALV grid column Name is 'CHANGED BY' in that column i want to display Who is changed by Throgh reffer the custom table(above table).
percentage changed by
11 % GM
45.32% MD like that i want to display out put screen.
how to display the alv output screen.
2013 Mar 19 11:48 AM
Please try this.
data: itab type table of <custom table>,
wa like line of itab.
data : lv_percentage. " Your value wa_final-percentage.
select * from custom table into itab.
loop at itab into wa.
IF lv_percentage between wa-lowerpercentage AND wa-high.per.
write : wa-user.
endif.
endloop.
Hope it solves your issue.
Regards,
J. Rajbarath
2013 Mar 19 6:26 AM
Declare the final output structure like this:
TYPES: BEGIN OF ty_final.
INCLUDE STRUCTURE <custom table>.
TYPES: percentage TYPE i,
changed_by TYPE bname,
end of ty_final.
data: wa_final type ty_final.
Pass the Percentage and User to workarea field. Append to internal table.. Then Display ALV.
-SS-
2013 Mar 19 6:32 AM
Hi Piya,
If you want to display the data from the workarea. if it is single record use write statement.
ex : write : / wa-name,
wa-no,
wa-address.
if the record are more in number to dispaly, append the workarea record to the internal table and then display the data using the function module ALV_GRID_DISPLAY.
Thanks.
Pavan.
2013 Mar 19 6:45 AM
Hi Priya,
take the final table inbelow type :
TYPES: BEGIN OF TY_FINAL,
PERCENTAGE TYPE CHAR20,
USER TYPE ZUSER,
END OF TY_FINAL.
DATA : I_FINAL TYPE STANDARD TABLE OF TY_FINAL,
W_FINAL TYPE TY_FINAL.
NOW LOOP THE CUSTOME TABLE.
AND CONCATENATE CUSTOMATABLE-PERCENTAGE '%' INTO WA_FINAL-PERCENTAGE SEPARATED BY SPACE.
APPEN W_FINAL TO I_FINAL.
ENDLOOP.
nOW DISPLAY INTO alv ,
It will work
Thanks
Tarak
2013 Mar 19 8:25 AM
Hi, i knw concattenate, my dought is if percentage is 12% means i want to select the data from custom table and display the changed by column.(12% means CFO changed, so i want to display below like this).custom table already i mentioned with my first dicussion forum
PERCENTAGE CHANGED BY
12 CFO
2013 Mar 19 7:02 AM
Hi,
As suggested above, store the value in the internal table and pass it to the FM 'REUSE_ALV_GRID_DISPLAY'.
Following is the sample for the fieldcatalog:
fieldcatalog-fieldname = 'LOWER'.
fieldcatalog-seltext_m = 'Lower Percentage'.
fieldcatalog-col_pos = 1.
fieldcatalog-row_pos = 2.
fieldcatalog-outputlen = 15.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'HIGHER'.
fieldcatalog-seltext_m = 'Higher Percentage'.
fieldcatalog-col_pos = 2.
fieldcatalog-row_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'USER'.
fieldcatalog-seltext_m = 'User'.
fieldcatalog-col_pos = 2.
fieldcatalog-row_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
Regards
Purnand
2013 Mar 19 8:27 AM
i dnt want to dispaly like that
custom table dnt have the percentage, i run time we willget %, and pick the changed by value from database in custom table based up on percentage(percentage 14% means CFO).
2013 Mar 19 9:14 AM
use the following
clear <customworkarea>.
loop at <customtable> into <customworkarea>
where lowpercentage LE <currentpercentage>
and highpercentage GT <currentpercentage>.
exit.
endloop.
if <customworkarea> is not initial.
<changedby> = <customworkarea>-user.
endif.
hope this helps.
2013 Mar 19 10:23 AM
2013 Mar 20 6:12 AM
then that is easier
clear <username>.
select user
up to 1 rows
from <customtable>
into <username>
where lowpercentage LE <currentpercentage>
and highpercentage GT <currentpercentage>.
endselect.
if sy-subrc = 0.
<changedby> = <username>.
endif.
2013 Mar 20 7:59 AM
Hello Ss priya,
if u need this database table then you have to use TMG event. select the event no 05. click on editor....
then put your logic like this:
screen-fieldname = sy-uname.
when some one created a new record or change a existing record then user name assigned.....
in Alv report,
fetch data from database table and processing......if you cant reach at TMG event then let me know......i will tell you..
Thanks
Sabyasachi
2013 Mar 19 11:48 AM
Please try this.
data: itab type table of <custom table>,
wa like line of itab.
data : lv_percentage. " Your value wa_final-percentage.
select * from custom table into itab.
loop at itab into wa.
IF lv_percentage between wa-lowerpercentage AND wa-high.per.
write : wa-user.
endif.
endloop.
Hope it solves your issue.
Regards,
J. Rajbarath
2013 Mar 20 9:40 AM