ALV not displaying zeros
Hi,
I am calling 'REUSE_ALV_GRID_DISPLAY' and it is not displaying zeros in two fields. I mean for all the values which are 0.00 it is just showing blanks in ALV.
Internal table is populated properly.
Pls help
try giving the datatye in fieldcatalog
wa_fieldcat-datatype = 'CURR'
Similar Messages
-
HI ALL,
MY ONE REPORT IS RUNNING IN SAP 4.7 SERVER. IT IS A ALV REPORT.
AFTER UPGRADING SAP 4.7 TO ECC 6.0 NOW I'M RUNNING THE SAME REPORT IN ECC 6.0 NOW IT IS NOT SHOWING DATA.
DATA IS COMMING IN INTERNAL TABLE UPTO ALV GRID DISPLAY FUNCTION
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_background_id = 'ALV_BACKGROUND'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_sort = gt_sort[]
i_save = 'A'
it_events = gt_events[]
TABLES
t_outtab = IT_TAB
EXCEPTIONS
program_error = 1
OTHERS = 3.
CAN ANY BODY SUGEST WHY THIS IS HAPPING.
MUKESHHI,
PROB. IS THE SAME CODE IS RUNNING IN 4.7 SERVER.
BUT IN ECC 6.0 IT DISPLAY ONLY REPORT HEADING PART.
I.E REPORT IS RUNNING NO ERROR COMMING DURING DUBEING INTERNAL TABLE CONTAIN DATA.
BUT OUTOUT IS ONLY COLUMN HEADING NO DATA.
MUKESH -
Spool ALV not displaying two column value
Hi,
In spool ALV is getting displayed. But the output is not printing the value of 2 columns , both are MATNR values. I checked the output table it is fetching the material number but ALV is not displaying it. please help its urgent. The GI material is not getting displayed.HI Aparjitha,
As per the above screenshot I assume there should be only 2 possible cases as said by Jyoti. Apart from that there is no other chance of missing data, especially for couple of columns in the output.
If you are passing the value at run-time to MATNR and you are able to see that in output, hence your final internal table which you are passing to the ALV is not filled appropriately with MATNR values. May be those values are cleared somewhere.
It would be better if you could share some piece of your subroutine FIELDCATFILL code. Also place a breakpoint before ALV display and check if the fieldcatalog and the final internal table are having the appropriate values.
Regards,
Naresh -
Alv not displaying top-of-page
hi every buddy,
i am workiong on report where there is a requirment of dislpaying alv
with top of page having some details . the event function mudule is calling the top-of-page fm properly
but perform for top-of page is not called up
i.e. controls are not goin to that point of perform
please give me your valuable suggestions
regards
prashantHi,
please check this code it is working
type-pools: slis.
* Including icon for icon display
include <icon>.
* Including symbol
include <symbol>.
* Declaring structure for vbak
types: begin of t_vbak,
vbeln type vbeln_va,
auart type auart,
netwr type netwr,
vkorg type vkorg,
vtweg type vtweg,
erdat type erdat,
vbtyp type vbtyp,
augru type augru,
icon type icon-id,
end of t_vbak.
* Declaring structure for vbap
types: begin of t_vbap,
vbeln type vbeln_va,
posnr type posnr,
matnr type matnr,
arktx type arktx,
lsmeng type dzmeng,
auart type auart,
netwr type netwr,
vkorg type vkorg,
vtweg type vtweg,
erdat type erdat,
vbtyp type vbtyp,
augru type augru,
icon type icon-id,
end of t_vbap.
* Declaring variables
data: v_vbeln type vbeln,
my_tab type sy-tabix.
* Declaring internal table and wa for vbak and vbap
data: i_vbak type table of t_vbak,
wa_vbak type t_vbak,
i_vbap type table of t_vbap,
i_pbo type table of t_vbap,
wa_vbap type t_vbap.
* Declaring internal table and wa for alv components(fieldcatalog,layout,events,header)
data: i_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv,
wa_layout type slis_layout_alv,
i_event type slis_t_event,
wa_event type slis_alv_event,
i_header type slis_t_listheader,
wa_header type slis_listheader,
wa_varient type disvariant,
wa_sort type slis_sortinfo_alv,
i_sort type slis_t_sortinfo_alv.
* Declaring selection-screen details
selection-screen: begin of block b1 with frame title text-001.
selection-screen skip.
select-options: s_vbeln for v_vbeln.
selection-screen: begin of block b2 with frame title text-008.
parameter: ch1 type c as checkbox, "check bos for Subtotal.
ch2 type c as checkbox. "check box for Grand total.
selection-screen: end of block b2.
selection-screen: end of block b1.
* Start of start-of-selection
start-of-selection.
* Fetching data from vbak table
select vbeln
auart
netwr
vkorg
vtweg
erdat
vbtyp
augru
from vbak into table i_vbak
where vbeln in s_vbeln.
if sy-subrc = 0.
* Fetching data for vbap table
select vbeln
posnr
matnr
arktx
lsmeng
from vbap into table i_vbap
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
* Looping data for final output
loop at i_vbak into wa_vbak.
* checking conditiions for icon
if wa_vbak-netwr < 10000.
wa_vbak-icon = '@08@'.
elseif wa_vbak-netwr < 15000.
wa_vbak-icon = '@09@'.
else.
wa_vbak-icon = '@0A@'.
endif.
modify i_vbak from wa_vbak index sy-tabix .
endloop.
*Looping data for final output
loop at i_vbap into wa_vbap.
my_tab = sy-tabix.
read table i_vbak into wa_vbak with key vbeln = wa_vbap-vbeln.
if sy-subrc = 0.
wa_vbap-auart = wa_vbak-auart.
wa_vbap-netwr = wa_vbak-netwr.
wa_vbap-vkorg = wa_vbak-vkorg.
wa_vbap-vtweg = wa_vbak-vtweg.
wa_vbap-erdat = wa_vbak-erdat.
wa_vbap-vbtyp = wa_vbak-vbtyp.
wa_vbap-augru = wa_vbak-augru.
wa_vbap-icon = wa_vbak-icon.
modify i_vbap from wa_vbap index my_tab transporting
auart netwr vkorg vtweg erdat vbtyp augru icon.
endif.
endloop.
* Preparing fieldcatalog for final output
perform main_fieldcat.
*Preparing final layout for final output
perform layout.
*Preparing list header for final output
perform list_header.
*Preaparing events for alv display
perform event.
*Getting subtotals for amount fields
if ch1 eq 'X'.
perform sub_total.
endif.
*Showing final output data
perform alv_display.
form main_fieldcat .
*Fieldcatalog for icon
wa_fieldcat-fieldname = 'ICON'.
* WA_FIELDCAT-TECH = 'X'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-icon = 'X'.
wa_fieldcat-seltext_l = 'ICON'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
* Fieldcatalog for salesorder
wa_fieldcat-fieldname = 'VBELN'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-seltext_l = 'Sales order NO'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
*Fieldcatalog for salesordertype
wa_fieldcat-fieldname = 'AUART'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C610'.
wa_fieldcat-seltext_l = 'Sales order type'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
*Fieldcatalog for netamount
wa_fieldcat-fieldname = 'NETWR'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-emphasize = 'C501'.
* wa_fieldcat-input = 'X'.
wa_fieldcat-seltext_l = 'Net Amount'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
*Fieldcatalog for salesorg
wa_fieldcat-fieldname = 'VKORG'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C310'.
wa_fieldcat-seltext_l = 'Sales Organization'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
*Fieldcatalog for salesdistribution
wa_fieldcat-fieldname = 'VTWEG'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C210'.
wa_fieldcat-seltext_l = 'Sales Distribution'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
*Fieldcatalog for date
wa_fieldcat-fieldname = 'ERDAT'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C110'.
wa_fieldcat-seltext_l = 'Sales OrderDate'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
*Fieldcatalog for salestype
wa_fieldcat-fieldname = 'VBTYP'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-seltext_l = 'Sales type'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
*Fieldcatalog for orderreason
wa_fieldcat-fieldname = 'AUGRU'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C710'.
wa_fieldcat-seltext_l = 'Order reason '.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
*Fieldcatalog for itemnum
wa_fieldcat-fieldname = 'POSNR'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C110'.
wa_fieldcat-seltext_l = 'Item No '.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
*Fieldcatalog for materialnum
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C710'.
wa_fieldcat-seltext_l = 'Material No '.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ARKTX'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C310'.
wa_fieldcat-seltext_l = 'Description'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
*Fieldcatalog for quantity
if ( ch1 = 'X' and ch2 = 'X' ) or ( ch1 = 'X' and ch2 = ' ' ) or ( ch2 = 'X' and ch1 = ' ' ).
wa_fieldcat-fieldname = 'LSMENG'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C510'.
wa_fieldcat-seltext_l = 'Quantity '.
* WA_FIELDCAT-edit = 'X'.
wa_fieldcat-do_sum = 'X'.
else.
wa_fieldcat-fieldname = 'LSMENG'.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-emphasize = 'C510'.
wa_fieldcat-seltext_l = 'Quantity '.
* WA_FIELDCAT-edit = 'X'.
endif.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
endform. " MAIN_FIELDCAT
form alv_display .
wa_varient-report = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_sort = i_sort
i_callback_pf_status_set = 'PF_STATUS'
i_save = 'X'
is_variant = wa_varient
it_events = i_event
tables
t_outtab = i_vbap
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. " ALV_DISPLAY
form layout .
wa_layout-colwidth_optimize = 'X'.
wa_layout-subtotals_text = 'SUBTOTAL SUM'.
wa_layout-totals_text = 'TOTAL'.
wa_layout-zebra = 'X'.
endform. " LAYOUT
form event .
call function 'REUSE_ALV_EVENTS_GET'
importing
et_events = i_event
exceptions
list_type_wrong = 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.
read table i_event into wa_event with key name = 'USER_COMMAND'.
if sy-subrc = 0.
wa_event-form = 'USER_COMMAND'.
modify i_event from wa_event transporting form where name = 'USER_COMMAND'.
endif.
read table i_event into wa_event with key name = 'TOP_OF_PAGE'.
if sy-subrc = 0.
wa_event-form = 'TOP_OF_PAGE'.
modify i_event from wa_event transporting form where name = 'TOP_OF_PAGE' .
endif.
endform. " EVENT
form user_command using ucomm type sy-ucomm
selfield type slis_selfield.
data: gstring type c.
constants: l_c_repid type sy-repid value 'ZCOE_ALV_SIMPLE'.
data: l_i_seltab type table of rsparams.
case ucomm.
when '&IC1'.
if selfield-fieldname = 'VBELN'.
set parameter id 'AUN' field selfield-value.
call transaction 'VA02' and skip first screen.
endif.
* * CASE ok_code.
when 'SAVE'.
* *A pop up is called to confirm the saving of changed data
call function 'POPUP_TO_CONFIRM'
exporting
titlebar = 'SAVING DATA'
text_question = 'Continue?'
icon_button_1 = 'icon_booking_ok'
importing
answer = gstring
exceptions
text_not_found = 1
others = 2.
if sy-subrc ne 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
* *When the User clicks 'YES'
if ( gstring = '1' ).
message 'Saved' type 'S'.
*Now the changed data is stored in the it_pbo internal table
i_pbo = i_vbap.
else.
*When user clicks NO or Cancel
message 'Not Saved' type 'S'.
endif.
**When the user clicks the 'EXIT; he is out
when 'EXIT'.
leave program.
* Clicking on refresh button at toolbar
when 'REF'.
* Calling fm to get refresh data
call function 'RS_REFRESH_FROM_SELECTOPTIONS'
exporting
curr_report = l_c_repid
tables
selection_table = l_i_seltab
exceptions
not_found = 1
no_report = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
* * Calling the screen after refreshing
submit zcoe_alv_simple with selection-table l_i_seltab.
endif.
endcase.
endform. " USER_COMMAND
form top_of_page .
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_header.
endform. " TOP_OF_PAGE
form list_header .
* Local data declaration
data: l_date type char10, "Date
l_time(8) type c. "Time
wa_header-typ = 'H'.
wa_header-info = 'Sales Order Information Report'.
append wa_header to i_header.
* Run date Display
clear l_date.
wa_header-typ = 'S'.
write: sy-datum to l_date dd/mm/yyyy.
wa_header-key = 'Run Date :'(002).
wa_header-info = l_date.
append wa_header to i_header.
clear: wa_header.
wa_header-typ = 'S'.
* WRITE: sy-uzeit TO l_time .
l_time+0(2) = sy-uzeit+0(2).
l_time+2(1) = ':'.
l_time+3(2) = sy-uzeit+2(2).
l_time+5(1) = ':'.
l_time+6(2) = sy-uzeit+4(2).
wa_header-key = 'Run Time :'(009).
wa_header-info = l_time.
append wa_header to i_header.
clear: wa_header.
endform. " LIST_HEADER
form pf_status using rt_extab type slis_t_extab.
set pf-status 'SSS'.
set titlebar 'MAIN100'.
endform. "pf_status
form sub_total .
wa_sort-fieldname = 'VBELN'.
wa_sort-tabname = 'I_VBAP'.
wa_sort-spos = 1.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
* wa_sort-group = 'X'.
* WA_SORT-EXPA = 'X'.
append wa_sort to i_sort.
endform. " SUB_TOTAL -
Problem in OOP ALV-ALV not displaying.
Hi Gurus,
Can we use OOP alv concept in normal executable program or we need to do it in module pool ?
I did an example alv program..but it is not exectuing .
Can anybody tell me the answer ?
Thanks.Hello,
To use OO ALV you need to create a container in module pool. But you can still call it from an executable program. Just create an executable program and use call screen 0100. Now double click on 0100 and create a screen which has a container on it then in the PBO module just caal the methods for the custom container and alv. Upon execution of the program, the alv will be displayed.
Regards,
Sachin -
How do I NOT display zeroes in my spreadsheet
I keep getting 0 in my spreadsheet and would prefer to show - as I was able to in Excel.
Any one know how?you can enter a formula the checks for a zero value and replaces zero with a "-":
=if(A1=0, "-", A1)
or you can use custom formatting using the cell inspector: -
ALV Title Not Display after transporting the Programme from DeV to Qlty
Hellow Experts,
i developed one ALV report with two screens, i transported the report from Development server to Qulaity server.
in Development server report are working fine but in Qulaity server after transporting the TiTle of ALV not display , plz give me some hint , below is my code to display alv title
DATA: alv_grid TYPE REF TO cl_gui_alv_grid.
DATA:alv_grid_ref type ref to CL_GUI_ALV_GRID.
DATA: layout TYPE lvc_s_layo.
layout-grid_title = 'Daily Material Reports.' .
DATA: fieldcat TYPE lvc_t_fcat.
I m using ALL METHOD alv_grid->set_table_for_first_display method for display alv .
Thanks,
Regards
Neha.Hi neha,
use the sap/help link to solve your issue,
[http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5533cd30911d2b467006094192fe3/content.htm]
if not use the below example code ,
Heading 3 :h3 Set the title of the grid
Fill the grid_title field of structure lvc_s_layo.
Note that the structure lvc_s_layo can be used for to customize the grid appearance in many ways.
DATA:
ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
For example :
Set grid title
gs_layout-grid_title = 'Flights'.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
is_layout =gs_layout*
CHANGING
it_outtab = gi_sflight.
Regards,
Saravana.S
Edited by: saravanasap on Dec 21, 2011 8:13 AM -
Hi,
I have applied a condition for Sorting in ascending order as Top % and 100 for the selected Key Figure.
However, the report does not display Zero values for the key Figure after sorting.
How can i take care of this limitation?
Regards
ShwetaHi Shweta,
if u r using condition for ascending then ur zeroes should come in that range , if it not then u have to increase your value limit . But this will depend on your requirement ..
Regards.. -
ALV grid is not displaying few fields of final internal table of type DMBTR
hello frnds,
i am displaying 10 fields in ALV grid using field catalog.
among them five fields are currency fields on which i doing some arithematic operations. but all these fields are not getting displayed in alv grid.
here is my code....
declaring final strucutre to generate report
TYPES:BEGIN OF ty_final,
gjahr TYPE gjahr, " Year
wwert TYPE wwert_d, " Traslation date
bukrs TYPE bukrs, " company code
hkont TYPE hkont, " General ledger account
txt20 TYPE txt20_skat, " Account name
belnr TYPE belnr_d, " Purchase order number
shkzg TYPE shkzg, " Dt/Cr indicator
dmbtr1 TYPE dmbtr, " Ammount in local currency
v_alc TYPE dmbtr, " Ammount in local currency
wrbtr TYPE wrbtr, " Ammount in foreign currency
ebeln TYPE ebeln, " Purchase order number
ebelp TYPE ebelp, " Item number
matnr TYPE matnr, " Material number
menge TYPE menge_d, " Qunatity
meins TYPE meins, " Unit of measure
stprs TYPE stprs, " Std material master
v_iv TYPE dmbtr, " Invoice value
pswsl TYPE pswsl, " Currency
v_erc TYPE dmbtr, " Exchange rate calculated
v_op TYPE dmbtr, " Order price
v_uos TYPE dmbtr, " Unit order to stock
v_io TYPE dmbtr, " Invoice to order
v_uv TYPE dmbtr, " Unit value
v_t TYPE dmbtr, " Total
v_d TYPE dmbtr, " Differecne
netpr TYPE bprei, " Net price in purchasing document
v_total TYPE dmbtr, " Total
v_os TYPE dmbtr, " Order to stock
v_ito TYPE dmbtr, " Invoice to order
saknr TYPE saknr, " G/L account number
END OF ty_final.
FORM move_data.
IF NOT i_bseg[] IS INITIAL.
LOOP AT i_bseg INTO wa_bseg.
wa_final-gjahr = wa_bseg-gjahr.
wa_final-bukrs = wa_bseg-bukrs.
wa_final-hkont = wa_bseg-hkont.
wa_final-belnr = wa_bseg-belnr.
wa_final-shkzg = wa_bseg-shkzg.
wa_final-wrbtr = wa_bseg-wrbtr.
wa_final-ebeln = wa_bseg-ebeln.
wa_final-ebelp = wa_bseg-ebelp.
wa_final-matnr = wa_bseg-matnr.
wa_final-menge = wa_bseg-menge.
wa_final-meins = wa_bseg-meins.
wa_final-pswsl = wa_bseg-pswsl.
wa_final-dmbtr1 = wa_bseg-dmbtr.
wa_final-saknr = wa_bseg-saknr.
wa_final-v_total = wa_bseg-dmbtr.
READ TABLE i_bkpf INTO wa_bkpf WITH KEY bukrs = wa_bseg-bukrs.
IF sy-subrc = 0.
wa_final-wwert = wa_bkpf-wwert.
ENDIF.
CLEAR wa_bkpf.
READ TABLE i_mbew INTO wa_mbew WITH KEY matnr = wa_bseg-matnr.
IF sy-subrc = 0.
wa_final-stprs = wa_mbew-stprs.
ENDIF.
CLEAR wa_mbew.
READ TABLE i_ekpo INTO wa_ekpo WITH KEY ebeln = wa_bseg-ebeln.
IF sy-subrc = 0.
wa_final-netpr = wa_ekpo-netpr.
ENDIF.
CLEAR wa_ekpo.
READ TABLE i_skat INTO wa_skat WITH KEY saknr = wa_bseg-saknr.
IF sy-subrc = 0.
wa_final-txt20 = wa_skat-txt20.
ENDIF.
calculating output values
IF wa_bseg-shkzg = 'H'.
wa_final-v_alc = -1 * wa_bseg-dmbtr.
ELSEIF wa_bseg-shkzg = 'S'.
wa_final-v_alc = 1 * wa_bseg-dmbtr.
ENDIF.
DATA : l_c_v_alc TYPE p DECIMALS 2,
l_c_v_iv TYPE p DECIMALS 2.
l_c_v_alc = wa_final-v_alc.
IF wa_bseg-menge NE 0.
wa_final-v_iv = wa_bseg-dmbtr / wa_bseg-menge.
ENDIF.
IF wa_bseg-dmbtr NE 0.
wa_final-v_erc = wa_bseg-wrbtr / wa_final-dmbtr1.
ENDIF.
IF wa_final-v_erc NE 0.
wa_final-v_op = wa_ekpo-netpr / wa_final-v_erc.
ENDIF.
wa_final-v_uos = wa_mbew-stprs - wa_final-v_op.
wa_final-v_io = wa_final-v_iv + wa_final-v_uos.
wa_final-v_uv = wa_final-v_uos + wa_final-v_io.
wa_final-v_t = wa_final-v_uv + wa_bseg-menge.
wa_final-v_d = wa_final-v_t - wa_final-v_alc.
wa_final-v_os = wa_final-v_uos * wa_bseg-menge.
wa_final-v_ito = wa_final-v_io * wa_bseg-menge.
CLEAR wa_bseg.
APPEND wa_final TO i_final.
CLEAR wa_final.
ENDLOOP.
ENDIF.
ENDFORM. "data_retrieval
*& Form build_fieldcat
text
--> p1 text
<-- p2 text
FORM build_fieldcat.
CLEAR wa_fieldcat.
* TYPES : v_alc TYPE dmbtr. "curr. " decimal 2.
DATA: l_c_v_alc TYPE p DECIMALS 2,
l_c_v_iv TYPE p DECIMALS 2 .
l_c_v_alc = v_alc.
l_c_v_iv = v_iv.
Constant Declarations.
CONSTANTS:
l_c_gjahr(5) TYPE c VALUE 'GJAHR', " Year
l_c_wwert(5) TYPE c VALUE 'WWERT', " Traslation date
l_c_bukrs(5) TYPE c VALUE 'BUKRS', " company code
l_c_hkont(5) TYPE c VALUE 'HKONT', " General ledger account
l_c_txt20(10) TYPE c VALUE 'TXT20', " Account name
l_c_belnr(5) TYPE c VALUE 'BELNR', " Doc number
l_c_shkzg(5) TYPE c VALUE 'SHKZG', " Dt/Cr indicator
l_c_dmbtr(5) TYPE c VALUE 'DMBTR1', " Ammount in local currency
" l_c_v_alc TYPE c VALUE 'V_ALC', " Ammount in local currency
l_c_wrbtr(5) TYPE c VALUE 'WRBTR', " Ammount in foreign currency
l_c_ebeln(5) TYPE c VALUE 'EBELN', " Purchase order number
l_c_ebelp(5) TYPE c VALUE 'EBELP', " Item number
l_c_matnr(5) TYPE c VALUE 'MATNR', " Material number
l_c_menge(7) TYPE c VALUE 'MENGE', " Qunatity
l_c_meins(5) TYPE c VALUE 'MEINS', " Unit of measure
l_c_stprs(5) TYPE c VALUE 'STPRS', " Std material master
" l_c_v_iv(4) TYPE c VALUE 'V_IV', " Invoice value
l_c_pswsl(5) TYPE c VALUE 'PSWSL', " Currency
l_c_v_erc(5) TYPE c VALUE 'V_ERC', " Exchange rate calculated
l_c_v_op(4) TYPE c VALUE 'V_OP', " Order price
l_c_v_uos(5) TYPE c VALUE 'V_UOS', " Unit order to stock
l_c_v_io(4) TYPE c VALUE 'V_IO', " Invoice to order
l_c_v_uv(4) TYPE c VALUE 'V_UV', " Unit value
l_c_v_t(3) TYPE c VALUE 'V_T', " Total
l_c_v_d(3) TYPE c VALUE 'V_D', " Differecne
l_c_netpr(5) TYPE c VALUE 'NETPR', " Net price in purchasing document
l_c_v_total(7) TYPE c VALUE 'V_TOTAL', " Total
l_c_v_os(4) TYPE c VALUE 'V_OS', " Order to stock
l_c_v_ito(5) TYPE c VALUE 'V_ITO', " Invoice to order
l_c_saknr(5) TYPE c VALUE 'SAKNR', " G/L account number
l_c_i_final(7) TYPE c VALUE 'I_FINAL'. " Final internal table
Fieldcat for fiscal year
wa_fieldcat-col_pos = 1.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_gjahr.
wa_fieldcat-seltext_m = text-007.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Translation date
wa_fieldcat-col_pos = 2.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_wwert.
wa_fieldcat-seltext_m = text-008.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Company code
wa_fieldcat-col_pos = 3.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_bukrs.
wa_fieldcat-seltext_m = text-009.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for General ledger account
wa_fieldcat-col_pos = 4.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_hkont.
wa_fieldcat-seltext_m = text-010.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Account name
wa_fieldcat-col_pos = 5.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_txt20.
wa_fieldcat-seltext_m = text-011.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Doc number
wa_fieldcat-col_pos = 6.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_belnr.
wa_fieldcat-seltext_m = text-012.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Dt/Cr indicator
wa_fieldcat-col_pos = 7.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_shkzg.
wa_fieldcat-seltext_m = text-013.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Ammount in local currency
wa_fieldcat-col_pos = 8.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = 'DMBTR1'.
wa_fieldcat-seltext_m = text-014.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Ammount in local currency
wa_fieldcat-col_pos = 9.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = 'V_ALC'.
wa_fieldcat-seltext_m = text-015.
wa_fieldcat-ref_fieldname = 'DMBTR'.
wa_fieldcat-no_sign = 'X'.
wa_fieldcat-do_sum = c_x.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Ammount in foreign currency
wa_fieldcat-col_pos = 10.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_wrbtr.
wa_fieldcat-seltext_m = text-016.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Purchse order number
wa_fieldcat-col_pos = 11.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_ebeln.
wa_fieldcat-seltext_m = text-017.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Item No
wa_fieldcat-col_pos = 12.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_ebelp.
wa_fieldcat-seltext_m = text-018.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Material number
wa_fieldcat-col_pos = 13.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_matnr.
wa_fieldcat-seltext_m = text-019.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Qunatity
wa_fieldcat-col_pos = 14.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_menge.
wa_fieldcat-seltext_m = text-020.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Unit of measure
wa_fieldcat-col_pos = 15.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_meins.
wa_fieldcat-seltext_m = text-021.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Std material master
wa_fieldcat-col_pos = 16.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_stprs.
wa_fieldcat-seltext_m = text-022.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Invoice value,
wa_fieldcat-col_pos = 17.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = 'V_IV'.
wa_fieldcat-seltext_m = text-023.
wa_fieldcat-ref_fieldname = 'DMBTR'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Currency
wa_fieldcat-col_pos = 18.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_pswsl.
wa_fieldcat-seltext_m = text-024.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Exchange rate calculated
wa_fieldcat-col_pos = 19.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = 'V_ERC'.
wa_fieldcat-seltext_m = text-025.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Order price
wa_fieldcat-col_pos = 20.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_op.
wa_fieldcat-seltext_m = text-026.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Unit order to stock
wa_fieldcat-col_pos = 21.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_uos.
wa_fieldcat-seltext_m = text-027.
wa_fieldcat-do_sum = c_x.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Invoice to order
wa_fieldcat-col_pos = 22.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_io.
wa_fieldcat-seltext_m = text-028.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Unit value
wa_fieldcat-col_pos = 23.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_uv.
wa_fieldcat-seltext_m = text-029.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Total
wa_fieldcat-col_pos = 24.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_t.
wa_fieldcat-seltext_m = text-030.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Difference
wa_fieldcat-col_pos = 25.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_d.
wa_fieldcat-seltext_m = text-031.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Net Price in Purchasing Document
wa_fieldcat-col_pos = 26.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_netpr.
wa_fieldcat-seltext_m = text-032.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Total
wa_fieldcat-col_pos = 27.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_total.
wa_fieldcat-seltext_m = text-033.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Order to stock
wa_fieldcat-col_pos = 28.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_os.
wa_fieldcat-seltext_m = text-034.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Invoice to order
wa_fieldcat-col_pos = 29.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_ito.
wa_fieldcat-seltext_m = text-035.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
fieldcat for invoice to order
wa_fieldcat-col_pos = 30.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_saknr.
wa_fieldcat-seltext_m = text-035.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. "build_fieldcatHi romanch,
defining the field catalog you must reference all currency fields to the respective currency key field (type CUKY).
<alv_fieldcat>-cfieldname = 'HWAER'.
This is sample for alv output of a currency field. The alv structure has a field HWAER which carries the currency key, e.g. USD or so.
Obviously you do not provide a cutrrency key for your values. If they are initial (zero), ALV will not display them as 0,00 but leave the field empty if the reference too currency key is not established.
If you define a DDIC structure for the ALV output this refernce is enforced. You can pass the DDIC structure name to the ALV and don not have to create the field catalog manually.
Regards,
Clemens -
I have a strange problem with an ALV grid.
I have used the FM "LVC_FIELDCATALOG_MERGE" to create a fieldcatalog from a structure. The structure contains a field called NETWR that is based on the NETWR data element (which is a CURR data type).
When the grid is displayed, however, zero values are not displayed - the cell is blank.
I thought the default behaviour for a CURR field was to display zeros?
I have checked and the NO_ZERO field in the fieldcat is initial.
Any other ideas?According to this link, it has to be displayed. Check it one more time whether you set No_zero is initial or not.
http://help.sap.com/saphelp_erp2004/helpdata/en/ff/4649baf17411d2b486006094192fe3/frameset.htm
Warm Regards,
Vijay -
Dynamic ALV Grid is not displaying !!
Hi all,
I am trying to create dynamic alv grids and upto five levels(five grids) out put is displaying fine without any problem. But when I try to display the 6th grid, the program is going into infinite loop and getting timed out. Even I tried to increse the height of the grid even though it is not displaying.
Please correct me if any thing is wrong in below code.
*1st Level grid
IF <table1> IS ASSIGNED AND <table1> IS NOT INITIAL.
CREATE OBJECT ob_split1
EXPORTING
parent = ob_custom
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split1 '20'.
CREATE OBJECT ob_grid1
EXPORTING
i_parent = ob_split1->top_left_container.
ELSE.
CREATE OBJECT ob_split1
EXPORTING
parent = ob_custom
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split1 '0'.
ENDIF.
*2nd Level grid
IF <table2> IS ASSIGNED AND <table2> IS NOT INITIAL.
CREATE OBJECT ob_split2
EXPORTING
parent = ob_split1->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split2 '20'.
CREATE OBJECT ob_grid2
EXPORTING
i_parent = ob_split2->top_left_container.
ELSE.
CREATE OBJECT ob_split2
EXPORTING
parent = ob_split1->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split2 '0'.
ENDIF.
(Created 3rd,4th,5th same like above).
*6th Level grid
IF <table6> IS ASSIGNED AND <table6> IS NOT INITIAL.
CREATE OBJECT ob_split6
EXPORTING
parent = ob_split5->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split6 '20'.
CREATE OBJECT ob_grid6
EXPORTING
i_parent = ob_split6->top_left_container.
ELSE.
CREATE OBJECT ob_split6
EXPORTING
parent = ob_split5->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split6 '0'.
ENDIF.
Appreciated your reply. Please let me know for additional info.
Thanks,
Ranjith.
Edited by: Thomas Zloch on Dec 8, 2010 5:44 PM - please use code tagsHi romanch,
defining the field catalog you must reference all currency fields to the respective currency key field (type CUKY).
<alv_fieldcat>-cfieldname = 'HWAER'.
This is sample for alv output of a currency field. The alv structure has a field HWAER which carries the currency key, e.g. USD or so.
Obviously you do not provide a cutrrency key for your values. If they are initial (zero), ALV will not display them as 0,00 but leave the field empty if the reference too currency key is not established.
If you define a DDIC structure for the ALV output this refernce is enforced. You can pass the DDIC structure name to the ALV and don not have to create the field catalog manually.
Regards,
Clemens -
0.00 is currency not displaying in ALV REPORT......
Hi All,
There is a currency field in the internal table which is not displaying only value 0.00 if the value is 0.03 then it is displaying in ALV.
I have checked the Internal Table passed in the FM: REUSE_ALV_LIST_DISPLAY but it is carrying the value 0.00. But while displaying it is not displaying in the report.
I have also checked the Field catalogue there is no such conditions mentioned.
Kindly help me.
Thanks in Advance.
MPHi MP,
while handling witht eh currency fields make sure that the following are taken care of
in the field catalog use:
gs_field-datatype = 'CURR'.
gs_field-inttype = 'C'.
also the following
fieldcatalog-no_zero = 'X'. should be taken care of otherwise it will not display the zeros appearing in the final internal table for ALV display.
Hope its helpful
Thanks,
Srikanth.P -
Column Heading are not displayed in ALV Report using CL_SALV_DISPLAY?
Hi,
I am using CL_SALV_DISPLAY class to display data. I Created an Internal Table Dynamically based fieldcatalog which was prepared based data at run time. When i displayed data using CL_SALC_DISPALY data is display in output but column headings are not displayed.
can anyone suggest me how to display heading in ALV using CL_SALV_DISPLAY class, My code is
CLASS lcl_report DEFINITION
CLASS lcl_report DEFINITION.
PUBLIC SECTION.
METHODS:
display IMPORTING l_table TYPE string
l_fcat TYPE string.
ENDCLASS. "lcl_report DEFINITION
CLASS lcl_report IMPLEMENTATION
CLASS lcl_report IMPLEMENTATION.
METHOD display.
DATA: gr_table TYPE REF TO cl_salv_table.
DATA: gr_columns TYPE REF TO cl_salv_columns_table,
gr_column TYPE REF TO cl_salv_column_table,
ls_fcat TYPE slis_fieldcat_alv.
DATA: gr_display TYPE REF TO cl_salv_display_settings.
DATA: l_o_functions TYPE REF TO cl_salv_functions_list,
l_field TYPE string.
FIELD-SYMBOLS : <fs_table> TYPE STANDARD TABLE,
<ft_fcat> TYPE STANDARD TABLE.
Get the ALV object refering to the output table
ASSIGN (l_table) TO <fs_table>.
ASSIGN (l_fcat) TO <ft_fcat>.
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = <fs_table> ).
CATCH cx_salv_msg. "#EC NO_HANDLER
ENDTRY.
Add basic default functionality in the ALV report
Functions
l_o_functions = gr_table->get_functions( ).
l_o_functions->set_all( abap_true ).
gr_columns = gr_table->get_columns( ).
gr_columns->set_headers_visible( abap_true ).
Display the list
gr_table->display( ).
ENDMETHOD. "extract
ENDCLASS. "lcl_report IMPLEMENTATION
*& start-of-selection declaration
START-OF-SELECTION.
PERFORM :
get store codes
get_storecodes USING p_stfile
CHANGING it_t001w,
fetching mard data
read_mard_data,
preparing fieldcatalog for Final Data
create_filedcat USING it_t001w
it_site
CHANGING it_fieldcat,
preparing structure & internal table for Final Data
create_final_table_structure USING it_fieldcat,
prepare output data
prepare_final_data.
*& end-of-selection declaration
END-OF-SELECTION.
PERFORM :
display data
display_data USING l_table
l_fcat.
*& Form get_storecodes
FORM get_storecodes USING p_p_stfile
CHANGING p_it_t001w LIKE it_t001w[].
DATA :
internal table for RAW
lt_raw TYPE truxs_t_text_data,
rs_site LIKE LINE OF rt_site,
l_index LIKE sy-tabix.
FIELD-SYMBOLS :
field symbol for it_t001w
<fs_t001w> LIKE LINE OF p_it_t001w.
calling function module to get Stores Data from File
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_line_header = 'X'
i_tab_raw_data = lt_raw
i_filename = p_p_stfile
TABLES
i_tab_converted_data = p_it_t001w[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
EXIT.
ENDIF.
SORT p_it_t001w BY werks.
CLEAR rs_site.
rs_site-sign = 'I'.
rs_site-option = 'EQ'.
rs_site-low = p_dccode.
APPEND rs_site TO rt_site.
IF it_t001w[] IS NOT INITIAL.
LOOP AT p_it_t001w ASSIGNING <fs_t001w>.
l_index = sy-tabix.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = <fs_t001w>-werks
IMPORTING
output = <fs_t001w>-werks.
MODIFY p_it_t001w FROM <fs_t001w> INDEX l_index.
IF <fs_t001w>-werks GE s_site-low AND <fs_t001w>-werks LE s_site-high.
append site to ranges
CLEAR rs_site.
rs_site-sign = 'I'.
rs_site-option = 'EQ'.
rs_site-low = <fs_t001w>-werks.
APPEND rs_site TO rt_site.
CONTINUE.
ENDIF.
ENDLOOP.
SORT p_it_t001w BY werks.
SORT rt_site.
ENDIF.
ENDFORM. " get_storecodes
*& Form create_final_table_structure
FORM create_filedcat USING p_it_t001w LIKE it_t001w[]
p_it_site LIKE it_site[]
CHANGING p_it_fieldcat LIKE it_fieldcat[].
FIELD-SYMBOLS :
field symbol for p_it_t001w
<fs_t001w> LIKE LINE OF p_it_t001w,
field symbol for p_it_site
<fs_site> LIKE LINE OF p_it_site.
DATA :
fieldname
l_fieldname TYPE slis_fieldname,
workarea for site ranges
rs_site LIKE LINE OF rt_site.
CLEAR : l_fieldname, rs_site.
l_fieldname = p_dccode.
PERFORM
prepare fieldcatalog
build_fieldcatalog USING : 'MTART' 'CHAR' '5' ,
'MTBEZ' 'CHAR' '25' ,
'MATKL' 'CHAR' '6' ,
'WGBEZ' 'CHAR' '20' ,
'MATNR' 'CHAR' '18' ,
'MAKTX' 'CHAR' '30' ,
l_fieldname 'CHAR' '17' .
create header for excel
PERFORM create_excel_header USING : 'Division',
'Divsion Description',
'MC Code',
'MC Description',
'Article',
'Article Description',
l_fieldname.
loop for creating fieldcatalog
LOOP AT it_site ASSIGNING <fs_site>.
READ TABLE it_t001w ASSIGNING <fs_t001w> WITH KEY werks = <fs_site>-werks
BINARY SEARCH.
IF sy-subrc = 0 AND <fs_t001w> IS ASSIGNED AND
<fs_site> IS ASSIGNED AND <fs_site>-stock GT 0.
CLEAR : l_fieldname, rs_site.
l_fieldname = <fs_site>-werks.
prepare fieldcatalog
PERFORM build_fieldcatalog USING : l_fieldname 'CHAR' '17'.
create header for excel
PERFORM create_excel_header USING l_fieldname .
CONTINUE.
ENDIF.
ENDLOOP.
l_fcat = 'it_fieldcat[]'.
ENDFORM. " create_final_table_structure
*& Form build_fieldcatalog
FORM build_fieldcatalog USING p_fieldname TYPE slis_fieldname
p_datatype TYPE datatype_d
p_length TYPE intlen.
DATA : ls_fieldcat LIKE LINE OF it_fieldcat.
CLEAR : ls_fieldcat.
ls_fieldcat-fieldname = p_fieldname.
ls_fieldcat-datatype = p_datatype.
ls_fieldcat-intlen = p_length.
APPEND ls_fieldcat TO it_fieldcat.
ENDFORM. " build_fieldcatalog
*& Form create_final_table_structure
FORM create_final_table_structure USING p_it_fieldcat.
Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = t_table.
ASSIGN t_table->* TO <ft_final>.
ENDFORM. " create_final_table_structure
*& Form create_excel_header
FORM create_excel_header USING p_p_fieldname.
DATA : ls_header LIKE LINE OF it_header.
CLEAR ls_header.
ls_header-col_name = p_p_fieldname.
APPEND ls_header TO it_header.
ENDFORM. " create_excel_header
*& Form prepare_final_data
FORM prepare_final_data .
DATA : l_matnr LIKE g_matnr,
l_werks LIKE g_werks,
l_index LIKE sy-tabix.
FIELD-SYMBOLS : <fs_mard> LIKE LINE OF it_mard.
Getting No. of Lines in IT_MARD internal table
DESCRIBE TABLE it_mard LINES g_lines.
LOOP AT it_mard ASSIGNING <fs_mard>.
l_index = sy-tabix.
IF l_matnr IS INITIAL.
l_matnr = <fs_mard>-matnr.
CLEAR : l_werks.
l_werks = <fs_mard>-werks.
UNASSIGN : <fs_value>, <fs_final>.
Create dynamic work area and assign to FS
CREATE DATA t_line LIKE LINE OF <ft_final>.
ASSIGN t_line->* TO <fs_final>.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_mard>-matnr.
ASSIGN COMPONENT l_werks OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_value> + <fs_mard>-labst.
getting Article Type,MC & its Descriptions
PERFORM get_other_data USING l_matnr
l_werks.
ELSEIF l_matnr <> <fs_mard>-matnr.
APPEND <fs_final> TO <ft_final>.
CLEAR l_matnr.
l_matnr = <fs_mard>-matnr.
CLEAR : l_werks.
l_werks = <fs_mard>-werks.
UNASSIGN : <fs_value>, <fs_final>.
Create dynamic work area and assign to FS
CREATE DATA t_line LIKE LINE OF <ft_final>.
ASSIGN t_line->* TO <fs_final>.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_mard>-matnr.
ASSIGN COMPONENT l_werks OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_value> + <fs_mard>-labst.
getting Article Type,MC & its Descriptions
PERFORM get_other_data USING l_matnr
l_werks.
ELSE.
CLEAR : l_werks.
l_werks = <fs_mard>-werks.
ASSIGN COMPONENT l_werks OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_value> + <fs_mard>-labst.
ENDIF.
IF l_index = g_lines.
APPEND <fs_final> TO <ft_final>.
ENDIF.
ENDLOOP.
l_table = '<ft_final>[]'.
ENDFORM. " prepare_final_data
*& Form get_other_data
FORM get_other_data USING p_l_matnr
p_l_werks.
FIELD-SYMBOLS : <fs_mara> LIKE LINE OF it_mara,
<fs_t023t> LIKE LINE OF it_t023t,
<fs_t134t> LIKE LINE OF it_t134t,
<fs_makt> LIKE LINE OF it_makt.
READ TABLE it_mara ASSIGNING <fs_mara> WITH KEY matnr = p_l_matnr. " BINARY SEARCH.
IF sy-subrc = 0 AND <fs_mara> IS ASSIGNED.
ASSIGN COMPONENT 'MTART' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_mara>-mtart.
ASSIGN COMPONENT 'MATKL' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_mara>-matkl.
READ TABLE it_makt ASSIGNING <fs_makt> WITH KEY matnr = <fs_mara>-matnr BINARY SEARCH.
IF sy-subrc = 0 AND <fs_makt> IS ASSIGNED.
ASSIGN COMPONENT 'MAKTX' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_makt>-maktx.
ENDIF.
READ TABLE it_t023t ASSIGNING <fs_t023t> WITH KEY matkl = <fs_mara>-matkl BINARY SEARCH.
IF sy-subrc = 0 AND <fs_t023t> IS ASSIGNED.
ASSIGN COMPONENT 'WGBEZ' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_t023t>-wgbez.
ENDIF.
READ TABLE it_t134t ASSIGNING <fs_t134t> WITH KEY mtart = <fs_mara>-mtart BINARY SEARCH.
IF sy-subrc = 0 AND <fs_t134t> IS ASSIGNED.
ASSIGN COMPONENT 'MTBEZ' OF STRUCTURE <fs_final> TO <fs_value>.
<fs_value> = <fs_t134t>-mtbez.
ENDIF.
ENDIF.
ENDFORM. " get_other_data
*& Form display_data
text
FORM display_data USING p_l_table
p_l_fcat.
DATA:
Variable for Object Creation
o_report TYPE REF TO lcl_report.
CREATE OBJECT o_report.
o_report->display( EXPORTING l_table = p_l_table
l_fcat = p_l_fcat ).
ENDFORM. " display_dataI don't know how to read the code you pasted or I would have checked this myself.
Do your fields in the internal table reference dictionary objects or elementary types? If not using dictionary types, the column names will be blank by default. If you can't change your fields to be dictionary types, you can try this to change the column names:
I made a method inside my local class to add the names:
call method set_colname
EXPORTING iv_tab = alv_tab
iv_colid = 'xxxx' "fieldname from the table
iv_stxt = text-t54
iv_mtxt = text-t55
iv_ltxt = text-t55.
METHOD set_colname .
data:
alv_cols type REF TO cl_salv_columns_table,
alv_col type REF TO cl_salv_column.
TRY .
*... Change fieldnames
call METHOD iv_tab->get_columns RECEIVING value = alv_cols.
call method alv_cols->get_column EXPORTING columnname = iv_colid RECEIVING value = alv_col.
IF iv_stxt <> ''.
CALL METHOD alv_col->set_short_text EXPORTING value = iv_stxt.
ENDIF.
IF iv_mtxt <> ''.
CALL METHOD alv_col->set_medium_text EXPORTING value = iv_mtxt.
ENDIF.
IF iv_ltxt <> ''.
CALL METHOD alv_col->set_long_text EXPORTING value = iv_ltxt.
ENDIF.
CATCH cx_salv_not_found.
ENDTRY.
ENDMETHOD. "set_colname -
Hide delete option is not working in ALV List Display- urgent
Hi All,
In my program i am displaying the output by using alv list display. after displaying the data i am displaying my own pf status here. in this i have few pushbuttons like
selest all, deselect all, hide . first two options are working fine. when i click hide button selected records are going to be hide.but this is not happening in my program. any body cam send me the code plz.
i am sending my code below. if possible please modify and resend the code asap.
my code:
type-pools : slis.
tables : zuser_secobjects.
data : t_header1 like zuser_secobjects.
data : begin of it_secobjects occurs 0.
include structure t_header1.
*data : box,
input(1) type c,
data : checkbox type c,
flag type c,
end of it_secobjects.
data : wa_ita like line of it_secobjects.
*data : it_secobjects like zuser_secobjects occurs 0 with header line.
data : i_field type slis_t_fieldcat_alv with header line.
data : w_field like line of i_field.
data : i_sort type slis_t_sortinfo_alv.
data : w_sort like line of i_sort.
data : it_filt1 type slis_t_filter_alv with header line.
data:
i_tabname type tabname,
i_repid like sy-repid,
is_lout type slis_layout_alv.
data : it_filt type slis_t_filter_alv with header line,
it_evts type slis_t_event with header line.
DATA : is_vari type disvariant.
constants : c_default_vari value 'X',
c_save_vari value 'U',
c_checkfield type slis_fieldname value 'ACTION',
c_f2code type sy-ucomm value '&ETA'.
data : chk_box type slis_fieldname.
selection-screen: begin of block b1 with frame title text-t01.
parameters : p_appln type zuser_secobjects-appln.
parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
p_partnr type zuser_secobjects-appln_partner,
p_ptype type zuser_secobjects-partner_type default '02',
p_upostn type zuser_secobjects-user_position,
p_sdate like likp-erdat default sy-datum,
p_edate(10) default '12/31/9999',
p_revnum type zuser_secobjects-revnum,
p_cted type zuser_secobjects-created_by,
p_cdate type zuser_secobjects-creation_date,
p_ctime type zuser_secobjects-creation_time,
p_chnby type zuser_secobjects-changed_by,
p_cdate1 type zuser_secobjects-changed_date,
p_ctime1 type zuser_secobjects-changed_time.
selection-screen: end of block b1.
form user_command using p_ucomm like sy-ucomm
rs_selfield type slis_selfield.
*DATA : it_filt type slis_t_filter_alv with header line.
case p_ucomm.
when 'SELECT_ALL'. " SELALL is the FCODE of ur push button
loop at it_secobjects into wa_ita.
wa_ita-checkbox = 'X'.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
when 'DESLCT_ALL'.
loop at it_secobjects into wa_ita.
wa_ita-checkbox = ' '.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
is_lout-f2code = c_f2code.
is_lout-box_fieldname = c_checkfield.
is_lout-get_selinfos = 'X'.
is_lout-detail_popup = 'X'.
is_lout-detail_initial_lines = 'X'.
when 'HIDE_DEL'.
rs_selfield-exit = 'X'.
it_filt-fieldname = 'CHECKBOX'.
it_filt-tabname = '1'.
it_filt-valuf = 'X'.
it_filt-intlen = '1'.
it_filt-inttype = 'C'.
it_filt-datatype = 'CHAR'.
it_filt-valuf_int = 'X'.
it_filt-sign0 = 'E'.
it_filt-optio = 'EQ'.
if it_filt[] is initial.
append it_filt.
else.
modify it_filt index 1.
endif.
perform display using i_object.
PERForm ALV_LIST_DISPLAY.
WHEN 'SHOW_DEL'.
rs_selfield-exit = 'X'.
free it_filt.
PERForm ALV_LIST_DISPLAY.
when 'SAVE1'.
select * from zuser_secobjects where
appln = zuser_secobjects-appln
and appln_partner = zuser_secobjects-appln_partner
and partner_type = zuser_secobjects-partner_type
and start_date = zuser_secobjects-start_date
and end_date = zuser_secobjects-end_date.
endselect.
if sy-subrc eq 0.
message e000(ZV) with 'Duplicate Entry'.
endif.
endcase.
endform.
*& Form delete
form delete.
data : begin of is_secobjects occurs 0.
include structure zuser_secobjects.
data : checkbox type c.
data : end of is_secobjects.
is_secobjects-checkbox = 'X'.
modify is_secobjects
from it_secobjects
transporting checkbox
where checkbox = 'X'.
endform.
*& Form get_data
form get_data.
select * from zuser_secobjects
into table it_secobjects.
endform. " get_data
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
form prepare_fieldcatalog.
clear: w_field,i_field.
refresh:i_field.
i_field-key = 'X'.
i_field-col_pos = 1.
i_field-ddictxt = 'S'.
i_field-seltext_s = '@11@'.
i_field-checkbox = 'X'.
i_field-input = 'X'.
i_field-fieldname = 'HEADER'.
i_field-outputlen = 0.
append i_field.
clear i_field.
w_field-fieldname = 'APPLN'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-seltext_l = text-m01.
w_field-outputlen = '10'.
w_field-col_pos = 1.
append w_field to i_field.
clear w_field.
w_field-fieldname = 'APPLN_USER'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-just = 'C'.
w_field-seltext_l = text-m02.
w_field-outputlen = '7'.
w_field-col_pos = 2.
append w_field to i_field.
clear w_field.
endform. " prepare_fieldcatalog
*& Form ALV_LIST_DISPLAY
text
--> p1 text
<-- p2 text
form alv_list_display.
i_repid = sy-repid.
is_lout-box_fieldname = 'CHECKBOX'.
it_filt-fieldname = 'CHECKBOX'.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND'
is_layout = is_lout
it_fieldcat = i_field[]
it_filter = it_filt[]
it_events = it_evts[]
i_default = c_default_vari
i_save = c_save_vari
is_variant = is_vari
tables
t_outtab = it_secobjects.
endform. " ALV_LIST_DISPLAY
*& Form display
text
-->P_I_OBJECT text
form display using object.
case object.
ENDCASE.
endform. " display
thanks,
maheedhar.tHi,
What do you mean by Hiding the records.
Deleting completely from the screen.
You can just delete the records from the internal table and pass to field catalog before displaying again.
or serach in the slis structrue for hiding the contents of the output.
reward if useful
regards,
Anji -
New ALV field is not displaying
Hi
I have added the currency field in the existing ALV report.
The final internal table having the currency field and it has value. Curreny field is not displaying in output. Pls help
Below is my ALV code for currency.
PERFORM FILL_FIELDCAT USING
'WAERS' SPACE SPACE 'CURRENCY' 'CURRENCY' 'CURRENCY'.
READ TABLE GIT_FIELDCAT INTO LX_FIELDCAT
WITH KEY FIELDNAME = 'WAERS' .
LX_FIELDCAT-OUTPUTLEN = 5.
LX_FIELDCAT-JUST = 'L'.
MODIFY GIT_FIELDCAT FROM LX_FIELDCAT INDEX SY-TABIX.
FORM FILL_FIELDCAT USING P_FIELDNAME
P_NO_OUT
P_DO_SUM
P_SELTEXT_S
P_SELTEXT_M
P_SELTEXT_L. "#EC *
DATA: LX_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
CLEAR LX_FIELDCAT.
LX_FIELDCAT-TABNAME = 'GIT_LIST'.
LX_FIELDCAT-FIELDNAME = P_FIELDNAME.
LX_FIELDCAT-NO_OUT = P_NO_OUT.
LX_FIELDCAT-DO_SUM = P_DO_SUM.
LX_FIELDCAT-SELTEXT_S = P_SELTEXT_S.
LX_FIELDCAT-SELTEXT_M = P_SELTEXT_M.
LX_FIELDCAT-SELTEXT_L = P_SELTEXT_L.
APPEND LX_FIELDCAT TO GIT_FIELDCAT.
ENDFORM. " FILL_FIELDCATYou have to [maintain maintenance dialog|http://help.sap.com/SAPHELP_NWPI71/helpdata/EN/a7/513484407a11d1893b0000e8323c4f/frameset.htm] as described in the link.
Regards,
Raymond
Maybe you are looking for
-
S_ALR_87012168 - Amount difference
Hi Experts how can I know where I can check on standard program (S_ALR_87012168) on output type Graphical report-output last record value extraction. For example, next information how can I know where system extract the data, because in last record t
-
when i checked an ods i had created ,it showed a message:ods XXX is not consistent,i want to know what is it mean of this not consistent ?does it compare with something?if yes,what does it compare with and how can i correct this mistake?
-
Process flow - Mannual - How to interevene thru Control Center
I have Mannual process in my process flow. I know how to intervene thru Repository Browser. I go to repository browser and do expedite execution and process continues. In the user guide they tell this can be done thru control center also. Can anyone
-
In need of some help :( p55 big bang fuzion will not post
For some reason my system will not post. i switch my system on and everything on the board lights up all the drives spin up, gpu spins up, but it will still not post iv checked the gpu and it dose work fine, iv checked the ram to find out that one o
-
Why is all of my email being deleted from the server?
Hi Everyone! I am using an iPad Air 2, iOS version 8.1.2 (still have to perform the current update). When I download email from my ISP, Comcast, it gets deleted from their server. This never happened with my 2nd Generation iPad. I go to settings>Ma