ALV Report Format Problem
Hi Experts
I am writing an ALV report for the following report below , I am not getting the output in the internal table
can anyone correct please
regards
Piroz
REPORT Z_ROLE LINE-SIZE 220 LINE-COUNT 75
NO STANDARD PAGE HEADING.
TABLES : agr_tcodes,
agr_users,
tstct.
TYPE-POOLS : slis.
DATA: repid LIKE sy-repid, "Report ID
is_layout TYPE slis_layout_alv, "Layout For ALV
it_fieldcat TYPE slis_t_fieldcat_alv, "ITAB for field
it_events TYPE slis_t_event, "ITAB for event
it_sub TYPE slis_layout_alv_spec1, "subtotals
i_header TYPE slis_t_listheader, "Itab for listheader
lt_sort TYPE slis_t_sortinfo_alv, "itab for sorting
wa_sort LIKE LINE OF lt_sort." slis_t_sortinfo_alv.
DATA: BEGIN OF itab OCCURS 0 ,
agr_tcodes type agr_tcodes-tcode , " Transaction code A
agr_name type agr_tcodes-agr_name, " Role Name B
END OF itab .
DATA: BEGIN of it_disp Occurs 0 ,
agr_tcodes type agr_tcodes-tcode , " Transaction code A
agr_name type agr_tcodes-agr_name, " Role Name B
agr_uname type agr_users-uname, " Short User Name B
ttext type tstct-ttext, " Description Name C
sprsl type tstct-sprsl , " Language c
END OF it_disp.
*DATA: i_data TYPE TABLE OF ty_data, " internal table
*wa_data TYPE ty_data. " work area
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: p_tcode FOR agr_tcodes-tcode OBLIGATORY, "no-extension no intervals,
u_name for agr_users-uname,
r_name for agr_users-uname .
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
SELECTION-SCREEN END OF BLOCK blk2.
SELECTION-SCREEN END OF BLOCK blk.
START-OF-SELECTION.
PERFORM get_data.
PERFORM modify_data.
PERFORM disp_data .
END-OF-SELECTION.
*& Form get_data
text
--> p1 text
<-- p2 text
FORM get_data .
select agr_tcodestcode agr_tcodesagr_name agr_usersuname tstctttext tstct~sprsl
into table it_disp
from agr_tcodes
inner join agr_users
on agr_tcodesagr_name = agr_usersagr_name
inner join tstct
on agr_tcodestcode = tstcttcode
and
tstct~sprsl eq 'E'.
ENDFORM. "get_data
*& Form modify_data
text
--> p1 text
<-- p2 text
FORM modify_data .
MOVE-CORRESPONDING itab TO it_disp.
APPEND it_disp.
CLEAR it_disp.
ENDFORM. " modify_data
*& Form Disp_data
text
--> p1 text
<-- p2 text
FORM disp_data .
PERFORM fill_layout_structure.
PERFORM fill_field_catalog_table.
PERFORM alv_header USING i_header.
PERFORM call_alv_function.
ENDFORM. " Disp_data
*& Form fill_layout_structure
text
--> p1 text
<-- p2 text
FORM fill_layout_structure .
CLEAR is_layout.
is_layout-colwidth_optimize = 'X'.
is_layout-zebra = 'X'.
is_layout-no_input = 'X'.
is_layout-colwidth_optimize = 'X'.
is_layout-totals_text = 'Totals'(201).
is_layout-totals_only = 'X'.
is_layout-zebra = 'X'.
is_layout-group_change_edit = 'X'.
is_layout-header_text = 'Wagners Users Transaction Code'.
ENDFORM. " fill_layout_structure
*& Form fill_field_catalog_table
text
--> p1 text
<-- p2 text
FORM fill_field_catalog_table .
DATA : gls1(10).
BREAK-POINT.
PERFORM fill_field_catalog USING :
'agr_tcode' 'Trans Code .' '10' 'IT_DISP' space space 'C11' ' ' ' ',
'agr_name' 'Name' '40' 'IT_FINAL' space space 'C11' ' ' ' ' ,
'agr_uname' 'Role' '60' 'IT_FINAL' space space 'C11' 'X' ' ',
'ttext' 'Descript' '80' 'IT_FINAL' space space 'C11' ' ' ' '.
ENDFORM. " fill_field_catalog_table
*& Form fill_field_catalog
text
FORM fill_field_catalog USING f d l t s z y a b.
DATA t_fld TYPE slis_fieldcat_alv.
STATICS pos LIKE sy-index VALUE 0.
pos = pos + 1.
CLEAR t_fld.
MOVE 1 TO t_fld-row_pos.
MOVE pos TO t_fld-col_pos.
MOVE f TO t_fld-fieldname.
MOVE d TO t_fld-seltext_m.
MOVE l TO t_fld-outputlen.
MOVE t TO t_fld-tabname.
MOVE s TO t_fld-do_sum.
MOVE z TO t_fld-no_zero.
MOVE y TO t_fld-emphasize.
MOVE a TO t_fld-no_out.
MOVE b TO t_fld-no_sum.
APPEND t_fld TO it_fieldcat.
ENDFORM. " fill_field_catalog
*& Form alv_header
text
-->P_I_HEADER text
FORM alv_header USING p_i_header.
DATA: wa_line TYPE slis_listheader.
CLEAR wa_line.
wa_line-typ = 'H'.
wa_line-info = 'Wagners Investment'.
APPEND wa_line TO i_header.
ENDFORM. " alv_header
*& Form call_alv_function
text
--> p1 text
<-- p2 text
FORM call_alv_function .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPID
I_CALLBACK_PF_STATUS_SET = ' '
IS_LAYOUT = IS_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
t_outtab = IT_DISP.
IF sy-subrc eq 0.
ENDIF.
ENDFORM. " call_alv_function
Hi Venkat
Thanks a lot for correcting and sending me the format , Now I can manage to change the other reports too.
I have one more report which is bashing my head like anything , This is basically a fuel calculation report for managment , I want to change this too in ALV FORMAT, I did all my efforts to correct but it is looping inside as i close the report.
Thanks in Advanced
REPORT Z_ESLP_ZFCR1 LINE-SIZE 220 LINE-COUNT 75
NO STANDARD PAGE HEADING.
TABLES : equi,
equz,
imptt,
imrg,
eqkt,
iloa.
type-pools: slis. "ALV Declarations
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
TYPES: BEGIN OF ty_data ,
equnr type equnr, " Euipment no
eqktx type eqkt-eqktx, " Equipment Text
eqfnr type iloa-eqfnr, " Equipment Sort field
idate type imrg-idate, " Measuring Date
recdu type imrg-recdu, " Unit of measuring ='KM','L','H'
recdv type imrg-recdv, " Counter reading data
cancl type imrg-cancl,
END OF ty_data.
TYPES: BEGIN OF ty_final,
equnr type equnr, " Equipment no
eqktx type eqkt-eqktx, " Equipment Text
eqfnr type iloa-eqfnr, " Equipment Sort field
idate type imrg-idate, " Measuring Date
min_date_km type imrg-idate, " Min Date
min_km type P DECIMALS 2, " Max Km
max_date_km type imrg-idate,
max_km type P DECIMALS 2, " Min km
t_max_min_km type P DECIMALS 2, " Total min_km-max_km
min_date_hr type imrg-idate, " Max Date
min_hr type P DECIMALS 2, " Max hr
max_date_hr type imrg-idate,
max_hr type P DECIMALS 2, " Min hr
t_max_min_hr type P DECIMALS 2, " Total min_hr-max_hr
min_date_lit type imrg-idate,
min_lit type P DECIMALS 2, " Min lit
max_date_lit type imrg-idate,
max_lit type P DECIMALS 2, " Max lit
fuel_con type imrg-recdv, " Total_hrs / t_max_min_hr
fuel_con2 type P DECIMALS 2, " Total_hrs / t_max_min_hr
km_l type P DECIMALS 2, " t max_min_km / t_max_min_lit
l_p type P DECIMALS 2 , " t_max_min_lit / t_max_min_hr
l_p2 type P DECIMALS 2 ,
END OF ty_final.
DATA: i_data TYPE TABLE OF ty_data, " internal table
wa_data TYPE ty_data, " work area
i_final TYPE TABLE OF ty_final, " internal table
wa_final TYPE ty_final. " work area
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: p_equnr FOR equi-equnr OBLIGATORY, "no-extension no intervals,
p_idate FOR imrg-idate. "NO-EXTENSION NO INTERVALS OBLIGATORY,
"p_recdu FOR imrg-recdu." NO-EXTENSION NO INTERVALS ."default 'M3'" OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
SELECTION-SCREEN END OF BLOCK blk2.
SELECTION-SCREEN END OF BLOCK blk.
TOP-OF-PAGE.
FORMAT INTENSIFIED ON.
WRITE:/55(40) ' WAGNERS INVESTMENT LIMITED '.
WRITE:/50(40) ' VEHICLE FUEL CONSUMPTION REPORT ' CENTERED ,
2 'Page', sy-pagno.
FORMAT INTENSIFIED OFF.
WRITE:/50(40) '----
' CENTERED .
FORMAT INTENSIFIED ON.
WRITE:/2 sy-datum COLOR 3, sy-uzeit .
"WRITE:/1 S903-SPMON ."p_yearf.
ULINE.
"CENTERED.
write: /2 'Equipment No :'left-justified,p_equnr-low color 2 , ' to ' , p_equnr-high color 2.
write: /2 'Date From :', p_idate-low color 2 , ' to ' , p_idate-high color 2.
END-OF-PAGE.
START-OF-SELECTION.
select aequnr deqktx feqfnr eidate erecdu erecdv
into table i_data
from equi AS a
inner join equz as b
on aequnr = bequnr
inner join iloa as f
on biloan = filoan
inner join imptt as c
on aobjnr = cmpobj
inner join eqkt as d
on aequnr = dequnr
inner join imrg as e
on epoint = cpoint
where a~equnr in p_equnr
and
e~idate in p_idate and
e~cancl ne 'X'.
loop at i_data into wa_data.
CLEAR: wa_final.
READ TABLE i_final into wa_final
with key equnr = wa_data-equnr." BINARY SEARCH.
if sy-subrc EQ 0.
PERFORM F_GET_MAX_DATA.
PERFORM F_GET_MAX_HOURS.
PERFORM F_GET_MAX_LIT.
PERFORM prepare_final_rec USING'M'. " Modify Existing Record
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
ElSE.
PERFORM prepare_final_rec USING'A'. " Append New Record.
ENDIF.
ENDLOOP.
LOOP AT i_final into wa_final.
on change of wa_final-equnr.
perform build_fieldcatalog.
endon.
uline.
endloop.
refresh i_final.
clear i_final.
FORM F_GET_MAX_DATA.
select single MAX( eidate ) Min( eidate ) MAX( erecdv ) MIN( erecdv )
into corresponding fields of (wa_final-max_date_km,wa_final-min_date_km,wa_final-max_km ,wa_final-min_km)
from equi AS a
inner join equz as b
on aequnr = bequnr
inner join iloa as f
on biloan = filoan
inner join imptt as c
on aobjnr = cmpobj
inner join eqkt as d
on aequnr = dequnr
inner join imrg as e
on epoint = cpoint
where a~equnr in p_equnr
and
e~idate in p_idate
and
e~cancl ne 'X' and
e~recdu = 'KM'
AND a~equnr = wa_data-equnr.
ENDFORM.
FORM F_GET_MAX_HOURS.
select single MAX( erecdv ) MIN( erecdv )
into corresponding fields of (wa_final-max_hr, wa_final-min_hr)
from equi AS a
inner join equz as b
on aequnr = bequnr
inner join iloa as f
on biloan = filoan
inner join imptt as c
on aobjnr = cmpobj
inner join eqkt as d
on aequnr = dequnr
inner join imrg as e
on epoint = cpoint
where a~equnr in p_equnr
and
e~idate in p_idate
and
e~cancl ne 'X' and
e~recdu = 'H'
AND a~equnr = wa_data-equnr .
ENDFORM.
FORM F_GET_MAX_LIT.
select SUM( e~recdv )
into corresponding fields of (wa_final-fuel_con2)
from equi AS a
inner join eqkt as b
on bequnr = aequnr
inner join imptt as c
on cmpobj = aobjnr
inner join imrg as e
on epoint = cpoint
where a~equnr in p_equnr
and
e~idate in p_idate
and
e~cancl ne 'X' and
e~recdu = 'L'
AND a~equnr = wa_data-equnr.
ENDFORM.
FORM prepare_final_rec USING p_mode TYPE char1.
wa_final-t_max_min_km = wa_final-max_km - wa_final-min_km .
wa_final-t_max_min_hr = wa_final-max_hr - wa_final-min_hr.
if wa_final-t_max_min_km eq 0 .
wa_final-km_l = ( wa_final-max_km - wa_final-min_km ) / ( wa_final-fuel_con2 ) .
ELSE.
wa_final-km_l = 0.
endif.
if wa_final-t_max_min_hr eq 0 .
wa_final-l_p2 = ( wa_final-fuel_con2 ) / ( wa_final-t_max_min_hr ) .
ELSE.
wa_final-l_p2 = 0.
endif.
IF p_mode = 'A'.
wa_final-equnr = wa_data-equnr.
wa_final-eqktx = wa_data-eqktx.
wa_final-eqfnr = wa_data-eqfnr.
wa_final-t_max_min_km = wa_final-min_km - wa_final-max_km .
wa_final-t_max_min_hr = wa_final-max_hr - wa_final-min_hr.
wa_final-km_l = ( wa_final-max_km - wa_final-min_km ) / ( wa_final-fuel_con2 ).
wa_final-l_p2 = ( wa_final-fuel_con2 ) / ( wa_final-t_max_min_hr ) .
APPEND wa_final TO i_final .
ELSE.
MODIFY i_final FROM wa_final
TRANSPORTING
eqfnr
max_date_km
min_date_km
max_date_lit
min_date_lit
max_date_hr
min_date_hr
max_km
min_km
max_hr
min_hr
t_max_min_km
t_max_min_hr
fuel_con2
km_l
l_p2
where equnr = wa_data-equnr.
ENDIF.
ENDFORM. " PREPARE_FINAL_REC
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EQUNR'.
fieldcatalog-seltext_m = 'Equip no'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EQKTX'.
fieldcatalog-seltext_m = 'Description'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 1.
fieldcatalog-outputlen = 40.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EQFNR'.
fieldcatalog-seltext_m = 'Sortfield'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MIN_DATE_KM'.
fieldcatalog-seltext_m = 'Min Date'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 3.
fieldcatalog-outputlen = 12.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MAX_DATE_KM'.
fieldcatalog-seltext_m = 'Max Date'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 4.
fieldcatalog-outputlen = 12.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MIN_KM' .
fieldcatalog-seltext_m = 'Min KM'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 5.
fieldcatalog-outputlen = 12.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MAX_KM' .
fieldcatalog-seltext_m = 'Max KM'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 6.
fieldcatalog-outputlen = 12.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'T_MAX_MIN_KM' .
fieldcatalog-tabname = 'i_final'.
fieldcatalog-seltext_m = 'Total KM'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 12.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MIN_HR' .
fieldcatalog-seltext_m = 'Min Hr'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 8.
fieldcatalog-outputlen = 12.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MAX_HR' .
fieldcatalog-seltext_m = 'Max Hr'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 9.
fieldcatalog-outputlen = 12.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'T_MAX_MIN_HR' .
fieldcatalog-seltext_m = 'Total HR'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 10.
fieldcatalog-outputlen = 12.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'FUEL_CON2' .
fieldcatalog-seltext_m = 'Fuel'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 11.
fieldcatalog-outputlen = 12.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'KM_L' .
fieldcatalog-seltext_m = 'Km/L'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 12.
fieldcatalog-outputlen = 12.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'L_P2' .
fieldcatalog-seltext_m = 'Lit/HR'.
fieldcatalog-tabname = 'i_final'.
fieldcatalog-col_pos = 13.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
tables
t_outtab = i_final
exceptions
program_error = 1
others = 2.
if sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
Similar Messages
-
ALV Report Print Problem.
Hi,
When I Print any ALV Report then In the First Row BackColor is white,
but in Second it is Gray,and this alternative for all remaining rows,
How Can I SET it to White For ALL Rows.
Thx,
Hitesh Jain.Hi Jain,
I'm not aware of a way to wrap the test or set break points in an ALV report. Typically I just try to reduce the number of columns to print and determine if the data is truly needed or just redundant.
To change the font, you need to change the Format setting. This setting is in the same popup box I described earlier. This time under General Properties, double click on Format. Just play around with the different Format options loaded. If you need additional formats, you should work with your BASIS team because it depends on the Output Devices that are loaded in your system.
Otherwise, you may just need to export the ALV report into Excel to make it "pretty". In Excel, you could create a macro to automate your formatting steps. Just a thought.
Good luck,
Cindy -
Urgent: regarding ALV report display problem
hi,
There are 3 problems:-
1.) I had made a ALV report in which i have to display 'POSTING DATE' (iseg-budat) when we execute the report i.e. it should be displayed as PERIOD :- _______ to _______ on alv report ..
2.)the 2nd problem is dat when i use the ' wa_fieldcat-no_zero = 'X'. It eliminates all the leading zeros which are present which is okay when i it displays material no.. but the problem is dat it also deletes the other fields where the values are to be zeros.
i had used this FM:-
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = ITS1-MATNR
IMPORTING
OUTPUT = ITS1-MATNR.
so that only matnr field are to be 0's.
3.) I want to delete the rows which use to contain the values 0's as there are no calculations are performing as these are displayed .
ANYbody having solution of this problem ,plzzzz provide the soluion of it as it is most urgent to me and dat person will definately rewarded.
regards,
ric.shi kiran,
thanks for ur response. here is d code which i am using it and plzz help me to figure out where i have to make changes:-
REPORT ZTEST03.
TABLES: ISEG,MARA.
TYPE-POOLS : SLIS.
INTERNAL TABLE FOR INVENTORY STOCK *****************
DATA: BEGIN OF ITS1 OCCURS 0,
MATNR LIKE ISEG-MATNR,
MEINS LIKE ISEG-MEINS,
MENGE LIKE ISEG-MENGE,
WRTZL LIKE ISEG-WRTZL,
BUCHM LIKE ISEG-BUCHM,
WRTBM LIKE ISEG-WRTBM,
WERKS LIKE ISEG-WERKS,
BUDAT LIKE ISEG-BUDAT,
MTART LIKE MARA-MTART,
ITEMDESC LIKE MAKT-MAKTX,
DIFFQTY LIKE ISEG-BUCHM,
DIFFVALUE LIKE ISEG-WRTBM,
END OF ITS1.
data: t_heading type slis_t_listheader.
SELECTION-SCREEN BEGIN OF BLOCK PAR1 WITH FRAME TITLE TEXT-001.
*********PARAMETERS*********
PARAMETERS : PLANT LIKE ISEG-WERKS OBLIGATORY.
*********SELECTION SCREEN OPTIONS*********
SELECT-OPTIONS : R_DATE FOR ISEG-BUDAT,
M_TYPE FOR MARA-MTART,
IT_M FOR MARA-MATNR.
*********DEFINING VARIABLES*********
SELECTION-SCREEN END OF BLOCK par1.
TOP-OF-PAGE.
PERFORM PG_HEADER.
START-OF-SELECTION.
SELECT DISTINCT A~MATNR A~MEINS A~MENGE A~WRTZL A~BUCHM A~WRTBM A~WERKS A~BUDAT B~MTART
FROM ISEG AS A INNER JOIN MARA AS B ON B~MATNR = A~MATNR
INTO CORRESPONDING FIELDS OF TABLE ITS1 WHERE B~MATNR = A~MATNR AND B~MEINS = A~MEINS AND A~WERKS = PLANT AND A~BUDAT IN R_DATE AND B~MTART IN M_TYPE AND B~MATNR IN IT_M.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = ITS1-MATNR
IMPORTING
OUTPUT = ITS1-MATNR.
SORT ITS1 BY MATNR.
DELETE ADJACENT DUPLICATES FROM ITS1 WHERE MENGE = 0 AND BUCHM = 0.
LOOP AT ITS1.
ITS1-DIFFQTY = ITS1-MENGE - ITS1-BUCHM.
ITS1-DIFFVALUE = ITS1-WRTZL - ITS1-WRTBM.
SELECT SINGLE MAKTX FROM MAKT INTO ITS1-ITEMDESC WHERE MATNR = ITS1-MATNR.
MODIFY ITS1.
ENDLOOP.
PERFORM PRN_SMSTOCK_ALV.
WRITING DATA FROM D TABLES**********
FORM PG_HEADER.
WRITE : 'PHYSICAL INVENTORY AUDIT REPORT PLANT : ', PLANT.
ENDFORM.
*& Form PRN_SMSTOCK_ALV
text
--> p1 text
<-- p2 text
form PRN_SMSTOCK_ALV .
data: w_title type lvc_title,
w_repid type syrepid,
w_comm type slis_formname,
w_status type slis_formname,
x_layout type slis_layout_alv,
t_event type slis_t_event,
t_fieldcat type slis_t_fieldcat_alv,
t_sort type slis_t_sortinfo_alv.
refresh t_fieldcat.
refresh t_event.
refresh t_sort.
clear x_layout.
clear w_title.
perform set_fieldcat2 using:
1 'MTART' 'MTART' 'MARA' '15' space 'MATERIAL TYPE' space space space space space space space space SPACE t_fieldcat 'L' 'C',
2 'MATNR' 'MATNR' 'MARA' '13' space 'MATERIAL NO. ' space space space space space space space space SPACE t_fieldcat 'R' 'C',
3 'ITEMDESC' 'MAKTX' 'MAKT' '25' space 'MATERIAL DESCRIPTION' space space space space space space space space SPACE t_fieldcat 'L' 'C',
4 'MEINS' 'MEINS' 'MARA' '5' space 'UOM' space space space space space space space space SPACE t_fieldcat 'C' 'C',
5 'MENGE' 'MENGE' 'ISEG' '13' space 'ORG.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
6 'WRTZL' 'WRTZL' 'ISEG' '13' space 'ORG.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',
7 'BUCHM' 'BUCHM' 'ISEG' '13' space 'PHY.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
8 'WRTBM' 'WRTBM' 'ISEG' '13' space 'PHY.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',
9 'DIFFQTY' 'MENGE' 'ISEG' '13' space 'DIFF.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
10 'DIFFVALUE' 'WRTZL' 'ISEG' '13' space 'DIFF.INV.VALUE' space space space space space space space space SPACE t_fieldcat SPACE 'P'.
x_layout-zebra = 'X'.
perform set_top_page_heading using t_heading t_event.
perform set_events using t_event.
w_status = ''.
w_repid = sy-repid.
w_comm = 'USER_COMMAND'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = w_repid
it_fieldcat = t_fieldcat
i_Callback_top_of_page = 'Top-of-page'
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
tables
t_outtab = ITS1
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
ENDFORM.
FORM set_fieldcat2 USING
p_colpos p_fieldname p_ref_fieldname p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
t_fieldcat TYPE slis_t_fieldcat_alv
P_JUST
P_FTYPE.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-no_zero = 'X'.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-hotspot = p_hotspot.
wa_fieldcat-checkbox = p_checkbox.
wa_fieldcat-icon = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
IF NOT P_JUST IS INITIAL.
WA_FIELDCAT-JUST = P_JUST.
ENDIF.
Set as editable or not.
IF NOT p_edit IS INITIAL.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
======================== Subroutines called by ALV ================
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_heading.
ENDFORM.
form set_top_page_heading using t_heading type slis_t_listheader
t_events type slis_t_event.
data: x_heading type slis_listheader,
x_event type line of slis_t_event.
Report title
clear t_heading[].
clear x_heading.
x_heading-typ = 'H'.
x_heading-info = 'PHYSICAL INVENTORY AUDIT REPORT'.
append x_heading to t_heading.
Plant Name
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'PLANT: '.
x_heading-info = its1-werks.
append x_heading to t_heading.
Posting Date
*clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'POSTING DATE: '.
x_heading-info = ITS1-BUDAT.
append x_heading to t_heading.
Control Date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL No: '.
x_heading-info = its1-werks.
append x_heading to t_heading.
Control date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL DATE: '.
x_heading-info = its1-werks.
append x_heading to t_heading.
User who is running the report
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'User: '.
x_heading-info = sy-uname.
append x_heading to t_heading.
Date of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Date: '.
write sy-datum to x_heading-info.
append x_heading to t_heading.
Time of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Time: '.
write sy-uzeit to x_heading-info.
append x_heading to t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
append x_event to t_events.
endform.
form set_events using t_events type slis_t_event.
data: x_event type line of slis_t_event.
endform.
plzzz help me out as it is most urgent to me.
regards,
ric.s -
Hi all,
I am working on a report, where I have created an ALV report, now the problem is when I run this report and get the output screen it shows me two buttons 1. change layout and 2. select layout but the third button is missing which is for "save layout". So can you please tell what I am missing? or what is required to be done !!!
Thanks,
Rajeevif you mention the is_layout and i_save option along with other parameters then it automatically enable that option too.
*" REFERENCE(IS_LAYOUT) TYPE SLIS_LAYOUT_ALV OPTIONAL
*" REFERENCE(I_SAVE) DEFAULT SPACE
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_GRID_TITLE = I_GRID_TITLE
I_GRID_SETTINGS = I_GRID_SETTINGS
IS_LAYOUT = IS_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
I_SAVE = 'X' " you can specify A , U also
TABLES
t_outtab = t_outtab
* EXCEPTIONS
* PROGRAM_ERROR = 1 -
ALV Report Print problem after 255 character line size
Hi ABAP Gurus,
I have created one alv report where i am getting output more then 255 character line size.
so whenever i tried to print this report it print only line upto first 255 character and truncated after it in printing.
is there any way i can print this report without truncation ....
Thanks,
Jackno there is no such way because you acan print at most 99 columns and utmost 255 characters .
and alternative is take your filed in separate screen and make it appear through hotspot in another filedcatalog.then u will get more space .
reward if useful
keep rockin
vivek -
Hi All,
I am working on ALV report. In that I am displying 20 columns. I am taking the first column for selecting row.
Suppose I have field1, 2 ,3 etc.
when i click on any field it will display the field description popup. It is working fine.After that in that popup, when i cancel it, the cursor is still on the selected field. I need the cursor to goto first column. Can anybody please help me out in this?
Thanks,
RaviHi,
Use the following syntax,
SET CURSOR FIELD <fname>.
Thanks,
Bhanu
Edited by: Bhanu P on Feb 3, 2008 6:17 AM -
Alv Report downloading problem
Dear Experts,
I'm using one pushbutton for downloading the alv report, into desktop
1). but in that file i need header information details also,
2). then my report contains 26 field but it is downloading upto some fields only,
3). then when my report contains null values for some columns that columns are not displaying in that file.
share some sample codes,
Thanks and Regards,
Thirukumaran. RHi,
1. For header fields, you need to enable one of the field, so that it will recognige the first row as header.
2. You should not consider only the field displayed at output, you should take all the values available in the internal table.
3. First take the record type as STRING. Now CONCATENATE all the fields available in the internal table to this RECORD and append it to some internal table. Now pass this internal table to the GUI_DOWNLOAD function module.
May be you can refer to the below code.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = p_file
filetype = 'ASC'
append = ' '
write_field_separator = ' '
write_lf = 'X'
confirm_overwrite = 'X'
ignore_cerr = 'X'
replacement = '#'
trunc_trailing_blanks_eol = 'X'
write_lf_after_last_line = 'X'
show_transfer_status = 'X'
TABLES
data_tab = lt_output_file
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Note: May be you need to modify few parameters.....
Regards,
Santhosh. -
Hi ,
I Created an ALV report in that I am getting the sales order details... and once I get the list I am moving to excel sheet ...
Once I moved to excel sheet by creating the layout , I am getting DAT colums as 00.00.0000 if the cell is empty.. how to avoide this ....Try with NO_ZERO = 'X'. for the Date field in the fieldcatalog.
I am not sure of this , Give a try once. -
When we run reports using report developed
using reports 6i and run into oracle report
server , then in some of the reports formatting is not coming properly.Insted
of data, stars(*) are coming.Same report
when run into client-server, it is coming
properly.
Is there any method , apart from changing
report manually, so that data comes properly?
Plz. do reply on [email protected]
Thx in advance.
Regards,
MilindI think all you need to do is widen out your columns. The stars generally mean that the field isn't wide enough.
-
In some of the reports when we view the ALV output in xls format(in GUI) the totals are not showing.The total are coming properly in theALV grid format and it is also showing correct when we download it into local file in xls format. Anyone please help me with this problem.
Thx to all in advanceAny filters set, sort criteria, totals calculated and subtotals are not taken into account for the transfer to the spreadsheet.
When you transfer to as local file then file is not generating as excel file its simple TXT only difference is extension will show as XLS, you can open this file in notepad also
a® -
Hi all
I have a problem when i print my alv grid report it first prints the title page then the revelent pages can i remove that title page.
thankshave you checked with your windows administrator??
-
Editing fields on output of alv report format
Dear friends,
I created on report in alv format but user wants to edit the field on the output of that format also it's effect is on the next field should br done.
e.g. if in first field is 10 in next field user edit and enter the value 20 then automatically next field will appered as a 20 * 10 = 200 i.e what to do to collect that 200 in the next field automatically.
how to do it?
Thanks ,
Vishal Bhagwat,Hi,
Refer these standard alv programs
BCALV_EDIT_01 Switch on and off the ready-for-input status of
BCALV_EDIT_02 Define ready-for-input status at cell level
BCALV_EDIT_03 Verification of modified cells
BCALV_EDIT_04 Delete and append rows
BCALV_EDIT_05 Checkboxes
BCALV_EDIT_06 Dropdown Listbox at Column Level
BCALV_EDIT_07 Dropdown Listbox at Cell Level
BCALV_EDIT_08 Integrate Non-Standard F4 Help
BCALV_FIELDCAT_TEST Edit field catalog online
BCALV_FULLSCREEN_GRID_EDIT
BCALV_GRID_EDIT
BCALV_GRID_EDIT_DELTA Example Report for F4 Help of the ALV Grid
BCALV_GRID_EDIT_DELTA_APPL
Regards,
Prashant -
Reports Format Problem URGENT!!! PLEASE!!!
Hi.
We have a customer who runs Application Server 10.1.2 on Windows2003. We deployed Forms & Reports 10.1.2 and it worked fine. Suddenly (since yesterday) all the reports generated in PDF and HTML format are UNFORMATTED, they look like character reports on the screen!
We have exactly the sabe configuration here but we just cannot reproduce de problem.
Here, on Reports Builder, if I choose Generate to File -> PDF, ite generates ok, but on the customer, it gererates unformatted too. It seems to me some environment issue, but I cannot find!
ANY HELP would be appreciated!
ThanksIt seems there is an issue with the printers. If we uninstall de default printer (a character printer), the problem disappears.
Still working on it.
Any help would be appreciated.
Thanks
Carlos Inglez -
VS2005 - Crystal Report Formatting Problem
Hi,
We have a text object in crystal report designer (ASP.NET) which has static content in bold and justified format.The report should be printed in Portrait mode. While printing the report, the space between the words in the static content is getting truncated. Please suggest a solution.
We are using crystal report that comes with VS2005.
Thanks.Make sure you are using SP 1:
https://smpdl.sap-ag.de/~sapidp/012002523100006007872008E/crvs05sp1.exe
See if using the option "No printer" helps (under Page Setup).
Make sure you are using the latest printer driver.
If the above does not help;
Are you seeing the issue on your development computer, or after you deploy to a server?
Does the worker process on the server "see" the printer driver? To check this, use the following code:
Dim myPrinter As String
For Each myPrinter In System.Drawing.Printing.PrinterSettings.InstalledPrinters
Response.Write(myPrinter)
Response.Write("<BR>")
Next
Search the [notes database|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_ossnotes&query=&adv=true] for similar issues.
Ludek -
9ias reports format problem PDF - HTML - HTMLCSS
I have a report to be printed in PDF Or HTML or HTMLCSS format. I am using Oralce 9ias and Reports 9i. PDF output is OK. But the same output in HTML and HTMLCSS are not coming properly.
For e.g. I have a field with size as 150. I am setting Vertical elasticity of the field as expand. But in HTMLCSS if the field size is 150 it merging and not displaying properly. In HTMl it is coming properly. But the date fields i display gets wrapped into two lines.
Is it a bug or any solution present for thisHi Srinivasan
Reports PDF output is high fidelity offering from Oracle Reports. I recommend you to use it as much as possible.
Regarding HTML/CSS, I feeling is that is not currently possible to format the way you say you want to. If this issue is very critical to your business, I suggest you to contact Oracle Support.
Regards
Sripathy
Maybe you are looking for
-
Any way to select which page printed with AirPrint ?
Got an HP 6250 with AirPrint which set up very easily and works well with my iPad 2. But how can you get it to print just 1 page or a selected portion of a page. It doesn't seem to offer those options. It prints the whole article wasting paper and i
-
Cannot mount any firewire/USB external drive after software update 10.5.4
After the last software update on 10.5.4 it did not complete the installation, and get stuck at the last step of running installation script for hours. So I have to restart the computer, and it restarted fine. Then I use Disk Utility to check my hard
-
Can't register with itunes with a credit card from outside the USA
Who do I write to, to complain that because I don't live in one of the countries listed in the drop down list on the Itunes store, I cannot register my credit card OR purchase from Itunes ? I am trying to register to buy online with ITUNES. However t
-
I've written a script, that monitors battery state and shuts down netbook when power is low to prevent hot power off. I've tested the script before running it in cron - everything works as it must: notification pops up, system shuts down. But when I'
-
Freezing PO attachment after approval
Hi, When a file is attached to PO, is it possible to freeze the attachment after approval? as the users are able to remove or change the attachment from PO even after approval. This should not be happened. Please help me to achieve this. Pavan