How to provide hyperlink for a particular field in ALV
Hi,
How to provide hyperlink for a particular field in alv report.
Regards,
Ramu.
Yes you can do that. using the fieldcatalog there is an option for that. give HOT_SPOT = 'X'. for the column you want.
wa_field-hotspot = 'X'.
REPORT ztest_alv.
TYPE-POOLS:slis.
DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
wa_field LIKE LINE OF it_fieldcat.
DATA: BEGIN OF it_likp OCCURS 0,
vbeln TYPE likp-vbeln,
END OF it_likp.
DATA: layout TYPE slis_layout_alv.
wa_field-fieldname = 'VBELN'.
wa_field-tabname = 'IT_LIKP'.
wa_field-hotspot = 'X'.
wa_field-outputlen = 10.
wa_field-no_zero = 'X'.
wa_field-seltext_l = 'Sales'.
APPEND wa_field TO it_fieldcat.
SELECT vbeln FROM likp
UP TO 10 ROWS
INTO TABLE it_likp.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_likp
EXCEPTIONS
program_error = 1.
*& Form user_Command
* text
* -->UCOMM text
* -->SELFIELD text
FORM user_command USING ucomm TYPE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm.
WHEN '&IC1'.
SET PARAMETER ID 'VL' FIELD selfield-value.
CALL TRANSACTION 'VL02N' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "user_Command
Similar Messages
-
How to provide validation for a particular field of screen
Hi Experts,
For my project, I have created a screen. In the screen, we have one field. For this field we have provided F4 help. When the user clicks on the F4 list of values is displayed.
I have to provide following condition for this field.
User should only select values from this F4 list only. If the user tries to enter any data which is not contained in the list, system should throw message that 'Invalid data. Select valid values".
Can you please let me know how I can do so?
The relevant portion of code is
CASE save_ok_code.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
PERFORM exit.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN 'SAVE'.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
PERFORM check_batch CHANGING fl_error.
IF fl_error IS INITIAL.
PERFORM save.
IF sy-subrc EQ 0.
CLEAR gv_deleted.
PERFORM update_alv_grid_display.
***for message display
CALL FUNCTION 'MESSAGES_SHOW'.
ENDIF.
ELSE.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'ZEX_MYPROJECT'
msgty = 'S'
txtnr = '053'
msgv1 = text-008
EXCEPTIONS
OTHERS = 3.
CHECK sy-subrc = 0.
CALL FUNCTION 'MESSAGES_SHOW'.
ENDIF.
WHEN OTHERS.
CALL METHOD cl_gui_cfw=>dispatch.
I am totally new for ABAP. So, please help me out.
Thanks
SmithHi,
Try this.
Create an internal table and populated it with the values present in the F4 help of the field. Then in AT SELECTION-SCREEN event check the value of the field with the values in the internal table and display the appropriate message.
Sharin. -
ALV Totals , Subtotals for a particular field in ALV Grid report
Hi,
I have an issue in ALV totals and subtotals.
Scenario is like this.
i have a vendor data to be pulled out of SAP and to be shown in the form of report.
i am populating all the data and doing do_sum based on Vendor ( has expansin & collapse option ) and display the number of reports .
Vendor -
100
Vendor1 -
1
Vendor2----
2.
Vendor100----
100.
but my problem is in the same report i have a date field .
if i have a five vendors created on 03/03/2008. in the same report for the date field having ( expansion & collapse ) , when i expand based on that date can i be able to sum up all the vendors created on 03/03/2008 and display in the same report along with the vendor count.
Let me know . Thank you in advance
Regards,
RyHi Roby,
Have a look at this sample code
It will help u,
REPORT ZIN_FI_AGEING
message-id zbdc
no standard page heading.
Title : For Ageing Details
Author :
Date : 22/11/2004
Transport/Correction Id :
Clarify case ID :
Application : FI
Program Type :
Frequency :
Purpose :
Comments :
Request No :
TABLES DELCARATIONS
Tables: zzgeinz9a, "Actual line item table
t001. "Plants/Branches
ALV TTPE DELCARATIONS
type-pools: slis.
*Type Declarations for Field Catalog
data : i_fldcat_head type slis_t_fieldcat_alv,
wa_fldcat_head type slis_fieldcat_alv.
*Type Declarations for ALV Events
data : i_events type slis_t_event,
wa_event like line of i_events.
*Type Declarations for Layout Design
data : wa_layout type slis_layout_alv.
*Type Declarations for Sorting Fields
data: it_sort type slis_sortinfo_alv occurs 0 with header line.
*Type Declarations for Displaying Images on Grid
data : i_comment type slis_t_listheader,
wa_comment type slis_listheader.
*Type Declarations for Grouping fields
data : wa_group type slis_sp_group_alv,
i_group type slis_t_sp_group_alv.
DATA DELCARATIONS
data: v_flag, "Status Flag
v_repid like sy-repid, "Program Name
p_year(4) type c, "Year
v_due_days type i. "To hold the due days
CONSTANTS DELCARATIONS
constants: c_x type c value 'X',
c_bukrs(4) type c value '0373'.
INTERNAL TABLES DELCARATIONS
*--Internal table to hold the required data
data: begin of it_final_vendor occurs 0,
rzzlifnr like zzgeinz9a-rzzlifnr, "Vendor
name1 like lfa1-name1, "Vendor Name
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
belnr like bkpf-belnr, "FI Doc No
doc_date like bkpf-awkey, "Document Date
zbd1t like bsik-zbd1t, "Cash discount days 1
bldat like bkpf-bldat, "Document Date
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
not_due like zzgeinz9a-hsl, "Not Yet Due
hsl like zzgeinz9a-hsl, "local currency
found type c, "Existance Flag
end of it_final_vendor.
data: begin of it_final_vendor_temp occurs 0,
rzzlifnr like zzgeinz9a-rzzlifnr, "Vendor
name1 like lfa1-name1, "Vendor Name
belnr like bkpf-belnr, "FI Doc No
bldat like bkpf-bldat, "Document Date
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
hsl like zzgeinz9a-hsl, "local currency
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
not_due like zzgeinz9a-hsl, "Not Yet Due
buck_0_30 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_31_60 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_61_90 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_91_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
doc_date like bkpf-awkey, "Document Date
found type c, "Existance Flag
end of it_final_vendor_temp.
data: begin of it_final_customer occurs 0,
rzzkunnr like zzgeinz9a-rzzkunnr, "Customer
name1 like kna1-name1, "Customer Name
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
belnr like bkpf-belnr, "FI Doc No
doc_date like bkpf-awkey, "Document Date
zbd1t like bsik-zbd1t, "Cash discount days 1
bldat like bkpf-bldat, "Document Date
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
not_due like zzgeinz9a-hsl, "Not Yet Due
hsl like zzgeinz9a-hsl, "local currency
found type c, "Existance Flag
end of it_final_customer.
data: begin of it_final_customer_temp occurs 0,
rzzkunnr like zzgeinz9a-rzzkunnr, "Customer
name1 like kna1-name1, "Customer Name
belnr like bkpf-belnr, "FI Doc No
bldat like bkpf-bldat, "Document Date
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
hsl like zzgeinz9a-hsl, "local currency
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
not_due like zzgeinz9a-hsl, "Not Yet Due
buck_0_30 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_31_60 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_61_90 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_91_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
doc_date like bkpf-awkey, "Document Date
found type c, "Existance Flag
end of it_final_customer_temp.
*--Internal Table to hold the Cash discount days 1 for Vendors
data: begin of it_final_bsik occurs 0,
belnr like bsik-belnr,
zbd1t like bsik-zbd1t,
end of it_final_bsik.
*--Internal Table to hold the Cash discount days 1 for Customers
data: begin of it_final_bsid occurs 0,
belnr like bsid-belnr,
zbd1t like bsid-zbd1t,
end of it_final_bsid.
INITIALIZATION
v_repid = sy-repid.
SELECTION SCREEN
selection-screen: begin of block b1 with frame title text-h01.
selection-screen skip.
select-options: s_vendor for zzgeinz9a-rzzlifnr modif id ven.
parameters: p_comp1 like t001-bukrs modif id ven.
parameters: p_rundt1 like bkpf-bldat modif id ven.
select-options: s_cust for zzgeinz9a-rzzkunnr modif id cst.
parameters: p_comp2 like t001-bukrs modif id cst.
parameters: p_rundt2 like bkpf-bldat modif id cst.
selection-screen skip.
selection-screen: begin of block b2 with frame title text-h02.
parameters : p_vendor radiobutton group gr1 default 'X'
user-command test,
p_cust radiobutton group gr1.
selection-screen: end of block b2.
selection-screen: end of block b1.
**************************AT Selection Screen OutPut ******************
at selection-screen output.
loop at screen.
if p_cust = 'X'.
if screen-group1 = 'VEN'.
screen-active = '0'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '0'.
endif.
elseif p_vendor = 'X'.
if screen-group1 = 'CST'.
screen-active = '0'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '0'.
endif.
endif.
modify screen.
endloop.
SELECTION SCREEN ON
at selection-screen on s_vendor.
*--Validating Vendor
if not s_vendor[] is initial.
perform validate_s_vendor.
endif.
at selection-screen on s_cust.
*--Validating Customer
if not s_cust[] is initial.
perform validate_s_cust.
endif.
at selection-screen on p_comp1.
*--Validating Company Code.
if not p_comp1 is initial.
perform validate_p_comp1.
endif.
at selection-screen on p_comp2.
*--Validating Company Code.
if not p_comp2 is initial.
perform validate_p_comp2.
endif.
START OF SELECTION
start-of-selection.
if p_vendor = 'X'.
perform get_vendor_data.
elseif p_cust = 'X'.
perform get_customer_data.
endif.
END OF SELECTION
end-of-selection.
if p_vendor = 'X'.
*--Generating the output for vendor
perform generate_field_catalog_vendor.
perform get_events_vendor.
perform generate_layout_vendor.
perform generate_sort_vendor.
perform generate_group_vendor.
perform disp_alv_grid_vendor.
elseif p_cust = 'X'.
*--Generating the output for customer
perform generate_field_catalog_cust.
perform get_events_customer.
perform generate_layout_customer.
perform generate_sort_customer.
perform generate_group_customer.
perform disp_alv_grid_customer.
endif.
*& Form validate_s_vendor
Validating the Vendor
form validate_s_vendor.
select rzzlifnr up to 1 rows
into (zzgeinz9a-rzzlifnr)
from zzgeinz9a
where rzzlifnr in s_vendor.
endselect.
if sy-subrc ne 0.
message e004 with 'Invalid Range of Vendor'(002)
s_vendor-low 'To'(006) s_vendor-high.
endif.
endform. " validate_s_vendor
*& Form validate_s_cust
Validating the Customer
form validate_s_cust.
select rzzkunnr up to 1 rows
into (zzgeinz9a-rzzkunnr)
from zzgeinz9a
where rzzkunnr in s_cust.
endselect.
if sy-subrc ne 0.
message e004 with 'Invalid Range of Customer'(005)
s_cust-low 'To'(006) s_cust-high.
endif.
endform. " validate_s_cust
*& Form validate_p_comp1
Validating the Company Code
form validate_p_comp1.
select single bukrs
into (t001-bukrs)
from t001
where bukrs eq p_comp1.
if sy-subrc ne 0.
message e004 with 'Company Code'(004) p_comp1 'Does not Exists'(003)
endif.
endform. " validate_p_comp1
*& Form validate_p_comp2
Validating the Company Code
form validate_p_comp2.
select single bukrs
into (t001-bukrs)
from t001
where bukrs eq p_comp2.
if sy-subrc ne 0.
message e004 with 'Company Code'(004) p_comp2 'Does not Exists'(003)
endif.
endform. " validate_p_comp2
*& Form get_vendor_data
Getting the Vendor Related Docs
form get_vendor_data.
select a~rzzlifnr
b~name1
a~docnr
a~refdocnr
a~rzz_ebeln
a~hsl
into corresponding fields of table it_final_vendor
from zzgeinz9a as a
inner join lfa1 as b
on arzzlifnr = blifnr
where rzzlifnr in s_vendor
and rbukrs eq p_comp1.
if sy-subrc eq 0.
v_flag = 'X'.
p_year = sy-datum+0(4).
perform get_doc_date using p_comp1
p_year.
perform move_records.
sort it_final_vendor by rzzlifnr.
perform generate_data.
else.
v_flag = space.
endif.
endform. " get_vendor_data
*& Form get_customer_data
Getting the Customer Related Docs
form get_customer_data.
select a~rzzkunnr
b~name1
a~docnr
a~refdocnr
a~rzz_ebeln
a~hsl
into corresponding fields of table it_final_customer
from zzgeinz9a as a
inner join kna1 as b
on arzzkunnr = bkunnr
where rzzkunnr in s_cust
and rbukrs eq p_comp2.
if sy-subrc eq 0.
v_flag = 'X'.
p_year = sy-datum+0(4).
perform get_doc_date_cust using p_comp2
p_year.
perform move_records_cust.
sort it_final_customer by rzzkunnr.
perform generate_data_cust.
else.
v_flag = space.
endif.
endform. " get_customer_data
*& Form get_doc_date
Getting the Document Date and FI Doc No
-->P_P_COMP1 Company Code
-->P_P_YEAR Fiscal Year
form get_doc_date using p_p_comp1
p_p_year.
loop at it_final_vendor.
concatenate it_final_vendor-refdocnr '*' into
it_final_vendor-doc_date.
modify it_final_vendor index sy-tabix.
endloop.
clear it_final_vendor.
data: v_doc_date(11) type c,
v_belnr like bkpf-belnr,
v_bldat like bkpf-bldat.
loop at it_final_vendor.
concatenate it_final_vendor-refdocnr '%' into v_doc_date.
select single belnr
bldat
into corresponding fields of it_final_vendor
from bkpf
where bukrs eq p_p_comp1
and gjahr eq p_p_year
and awkey like v_doc_date.
modify it_final_vendor.
endloop.
clear:it_final_vendor.
endform. " get_doc_date
*& Form move_records
Moving records to final internal table
form move_records.
*--Checking the existance of belnr in bsik
clear it_final_vendor.
select belnr
zbd1t
into table it_final_bsik
from bsik
for all entries in it_final_vendor
where belnr eq it_final_vendor-belnr
and bukrs eq c_bukrs.
clear it_final_bsik.
loop at it_final_vendor.
read table it_final_bsik with key belnr = it_final_vendor-belnr.
if sy-subrc eq 0.
it_final_vendor-zbd1t = it_final_bsik-zbd1t.
it_final_vendor-due_date = it_final_vendor-bldat +
it_final_bsik-zbd1t.
it_final_vendor-found = 'X'.
modify it_final_vendor.
endif.
endloop.
endform. " move_records
*& Form generate_data
Segregating the records based on due_date
form generate_data.
delete it_final_vendor[] where found ne 'X'.
sort it_final_vendor by belnr.
loop at it_final_vendor.
if it_final_vendor-due_date > p_rundt1.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-not_due.
elseif it_final_vendor-due_date < p_rundt1.
it_final_vendor-due_days = p_rundt1 - it_final_vendor-DUE_DATE.
endif.
*--filling 0-30 bucket.
if it_final_vendor-due_days ge 0 AND it_final_vendor-due_days le 30.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_0_30.
*--filling 31-60 bucket.
elseif it_final_vendor-due_days ge 31 AND it_final_vendor-due_days le 60
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_31_60.
*--filling 61-90 bucket.
elseif it_final_vendor-due_days ge 61 AND it_final_vendor-due_days le 90
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_61_90.
*--filling 91-180 bucket.
elseif it_final_vendor-due_days ge 91 AND it_final_vendor-due_days
le 180.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_91_180.
*--filling 180 bucket.
elseif it_final_vendor-due_days gt 180.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_180.
endif.
append it_final_vendor_temp.
clear it_final_vendor_temp.
endloop.
endform. " generate_data
*& Form DISP_ALV_GRID_VENDOR
Displaying the output in grid For Vendor
form DISP_ALV_GRID_VENDOR.
*--Generating the OUTPUT GRID FOR VENDOR
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = wa_layout
IT_FIELDCAT = i_fldcat_head
IT_EXCLUDING =
IT_SPECIAL_GROUPS = i_group
IT_SORT = it_sort[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = i_events
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = it_final_vendor_temp
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. " DISP_ALV_GRID
*& Form get_doc_date_cust
text
-->P_P_COMP2 Company Code
-->P_P_YEAR Fiscal Year
form get_doc_date_cust using p_p_comp2
p_p_year.
loop at it_final_customer.
concatenate it_final_customer-refdocnr '*' into
it_final_customer-doc_date.
modify it_final_customer index sy-tabix.
endloop.
clear it_final_customer.
data: v_doc_date(11) type c,
v_belnr like bkpf-belnr,
v_bldat like bkpf-bldat.
loop at it_final_customer.
concatenate it_final_customer-refdocnr '%' into v_doc_date.
select single belnr
bldat
into corresponding fields of it_final_customer
from bkpf
where bukrs eq p_p_comp2
and gjahr eq p_p_year
and awkey like v_doc_date.
modify it_final_customer.
endloop.
clear:it_final_customer.
endform. " get_doc_date_cust
*& Form move_records_cust
Moving Customer Data to Final Internal Table
form move_records_cust.
*--Checking the existance of belnr in bsid
select belnr
zbd1t
into table it_final_bsid
from bsid
for all entries in it_final_customer
where belnr eq it_final_customer-belnr
and bukrs eq c_bukrs.
clear it_final_bsid.
loop at it_final_customer.
read table it_final_bsid with key belnr = it_final_customer-belnr.
if sy-subrc eq 0.
it_final_customer-zbd1t = it_final_bsid-zbd1t.
it_final_customer-due_date = it_final_customer-bldat +
it_final_bsid-zbd1t.
it_final_customer-found = 'X'.
modify it_final_customer.
endif.
endloop.
endform. " move_records_cust
*& Form generate_data_cust
Generating the Customer Output
form generate_data_cust.
delete it_final_customer[] where found ne 'X'.
sort it_final_customer by belnr.
loop at it_final_customer.
if it_final_customer-due_date > p_rundt2.
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-not_due.
elseif it_final_customer-due_date < p_rundt2.
it_final_customer-due_days = p_rundt2 - it_final_customer-DUE_DATE.
endif.
*--filling 0-30 bucket.
if it_final_customer-due_days ge 0 AND it_final_customer-due_days le 30
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_0_30.
*--filling 31-60 bucket.
elseif it_final_customer-due_days ge 31 AND it_final_customer-due_days
le 60
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_31_60.
*--filling 61-90 bucket.
elseif it_final_customer-due_days ge 61 AND it_final_customer-due_days
le 90
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_61_90.
*--filling 91-180 bucket.
elseif it_final_customer-due_days ge 91 AND
it_final_customer-due_days
le 180.
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_91_180.
*--filling 180 bucket.
elseif it_final_customer-due_days gt 180.
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_180.
endif.
append it_final_customer_temp.
clear it_final_customer_temp.
endloop.
endform. " generate_data_cust
*& Form generate_field_catalog_vendor
Generating the Field Catalog for Vendor
form generate_field_catalog_vendor.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = v_repid
I_INTERNAL_TABNAME = 'IT_FINAL_VENDOR_TEMP'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = i_fldcat_head
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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.
endif.
if not i_fldcat_head[] is initial.
loop at i_fldcat_head into wa_fldcat_head.
case wa_fldcat_head-fieldname.
when 'RZZLIFNR'.
wa_fldcat_head-col_pos = '1'.
wa_fldcat_head-ref_tabname = ' '.
wa_fldcat_head-seltext_m = 'Vendor No'(001).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
when 'NAME1'.
wa_fldcat_head-col_pos = '2'.
wa_fldcat_head-seltext_m = 'Vendor Name'(007).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '35'.
when 'BELNR'.
wa_fldcat_head-col_pos = '3'.
wa_fldcat_head-seltext_m = 'Invoice No'(008).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-KEY = ' '.
when 'BLDAT'.
wa_fldcat_head-col_pos = '4'.
wa_fldcat_head-seltext_m = 'Document Date'(009).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'RZZ_EBELN'.
wa_fldcat_head-col_pos = '5'.
wa_fldcat_head-seltext_m = 'PO.Ref.No'(010).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'HSL'.
wa_fldcat_head-col_pos = '6'.
wa_fldcat_head-seltext_m = 'Invoice Amount'(011).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DUE_DATE'.
wa_fldcat_head-col_pos = '7'.
wa_fldcat_head-seltext_m = 'Due Date'(012).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-ref_tabname = ' '.
when 'DUE_DAYS'.
wa_fldcat_head-col_pos = '8'.
wa_fldcat_head-seltext_m = 'Due Days'(013).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '9'.
when 'NOT_DUE'.
wa_fldcat_head-col_pos = '9'.
wa_fldcat_head-seltext_m = 'Not Due'(014).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_0_30'.
wa_fldcat_head-col_pos = '10'.
wa_fldcat_head-seltext_m = '0 To 30'(015).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_31_60'.
wa_fldcat_head-col_pos = '11'.
wa_fldcat_head-seltext_m = '31 To 60'(016).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_61_90'.
wa_fldcat_head-col_pos = '12'.
wa_fldcat_head-seltext_m = '61 To 90'(017).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_91_180'.
wa_fldcat_head-col_pos = '13'.
wa_fldcat_head-seltext_m = '91 To 180'(018).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_180'.
wa_fldcat_head-col_pos = '14'.
wa_fldcat_head-seltext_m = 'Beyond 180'(019).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'REFDOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'DOC_DATE'.
wa_fldcat_head-no_out = 'X'.
when 'FOUND'.
wa_fldcat_head-no_out = 'X'.
endcase.
modify i_fldcat_head from wa_fldcat_head index sy-tabix.
endloop.
endif.
endform. " generate_field_catalog_vendor
*& Form get_events_vendor
Getting ALV Events
form get_events_vendor.
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
importing
et_events = i_events
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.
if not i_events[] is initial.
read table i_events into wa_event with key name = 'TOP_OF_PAGE'(024)
wa_event-form = 'GENERATE_USERCOMMAND'.
modify i_events from wa_event index sy-tabix.
read table i_events into wa_event with key name = 'END_OF_LIST'(025)
wa_event-form = 'GENERATE_USERCOMMAND_FOOTER'.
modify i_events from wa_event index sy-tabix.
endif.
endform. " get_events_vendor
*& Form GENERATE_USERCOMMAND
Displaying Header-Text and Logo on Grid
form generate_usercommand .
clear i_comment[].
wa_comment-typ = 'H'.
wa_comment-info = 'Vendor Ageing Report'(026).
append wa_comment to i_comment.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_comment
i_logo = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID = 'X'
endform. " GENERATE_USERCOMMAND
*& Form GENERATE_USERCOMMAND_FOOTER
Displaying Footer-Text on Grid
form generate_usercommand_footer.
clear i_comment[].
clear wa_comment.
wa_comment-typ = 'S'.
wa_comment-key = 'GE-Betz'(027).
append wa_comment to i_comment.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_comment
I_LOGO = ''
i_end_of_list_grid = 'X'.
endform. " GENERATE_USERCOMMAND_FOOTER
*& Form generate_layout_vendor
Generating the ALV Layout
form generate_layout_vendor.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'. "OPTIMIZING FIELD WIDTH
wa_layout-zebra = 'X'. "PUTTING ZEBRA COLORS
wa_layout-confirmation_prompt = 'X'. "DISPLAYS CONFIRMATION DIALOG
wa_layout-totals_text = 'Totals'(028). "DISPLAYS TOTALS TEXT
wa_layout-subtotals_text = 'Sub Totals'(029)."DISPLAYS SUBTOTALS TEXT
endform. " generate_layout_vendor
*& Form generate_sort_vendor
Sorting the Internal Table by Vendor
form generate_sort_vendor.
it_sort-fieldname = 'RZZLIFNR'.
it_sort-tabname = 'IT_FINAL_VENDOR_TEMP'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
append it_sort.
endform. " generate_sort_vendor
*& Form generate_group_vendor
Grouping the Data
form generate_group_vendor.
clear i_group.
wa_group-sp_group = 'A'.
wa_group-text = 'RZZLIFNR'.
append wa_group to i_group.
endform. " generate_group_vendor
*& Form GENERATE_FIELD_CATALOG_CUST
Generating Field Catalog for Customer
form GENERATE_FIELD_CATALOG_CUST.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = v_repid
I_INTERNAL_TABNAME = 'IT_FINAL_CUSTOMER_TEMP'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = i_fldcat_head
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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.
endif.
if not i_fldcat_head[] is initial.
loop at i_fldcat_head into wa_fldcat_head.
case wa_fldcat_head-fieldname.
when 'RZZKUNNR'.
wa_fldcat_head-col_pos = '1'.
wa_fldcat_head-ref_tabname = ' '.
wa_fldcat_head-seltext_m = 'Customer No'(020).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
when 'NAME1'.
wa_fldcat_head-col_pos = '2'.
wa_fldcat_head-seltext_m = 'Customer Name'(021).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '35'.
when 'BELNR'.
wa_fldcat_head-col_pos = '3'.
wa_fldcat_head-seltext_m = 'Invoice No'(008).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-KEY = ' '.
when 'BLDAT'.
wa_fldcat_head-col_pos = '4'.
wa_fldcat_head-seltext_m = 'Document Date'(009).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'RZZ_EBELN'.
wa_fldcat_head-col_pos = '5'.
wa_fldcat_head-seltext_m = 'PO.Ref.No'(010).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'HSL'.
wa_fldcat_head-col_pos = '6'.
wa_fldcat_head-seltext_m = 'Invoice Amount'(011).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DUE_DATE'.
wa_fldcat_head-col_pos = '7'.
wa_fldcat_head-seltext_m = 'Due Date'(012).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-ref_tabname = ' '.
when 'DUE_DAYS'.
wa_fldcat_head-col_pos = '8'.
wa_fldcat_head-seltext_m = 'Due Days'(013).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '9'.
when 'NOT_DUE'.
wa_fldcat_head-col_pos = '9'.
wa_fldcat_head-seltext_m = 'Not Due'(014).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_0_30'.
wa_fldcat_head-col_pos = '10'.
wa_fldcat_head-seltext_m = '0 To 30'(015).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_31_60'.
wa_fldcat_head-col_pos = '11'.
wa_fldcat_head-seltext_m = '31 To 60'(016).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_61_90'.
wa_fldcat_head-col_pos = '12'.
wa_fldcat_head-seltext_m = '61 To 90'(017).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_91_180'.
wa_fldcat_head-col_pos = '13'.
wa_fldcat_head-seltext_m = '91 To 180'(018).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_180'.
wa_fldcat_head-col_pos = '14'.
wa_fldcat_head-seltext_m = 'Beyond 180'(019).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'REFDOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'DOC_DATE'.
wa_fldcat_head-no_out = 'X'.
when 'FOUND'.
wa_fldcat_head-no_out = 'X'.
endcase.
modify i_fldcat_head from wa_fldcat_head index sy-tabix.
endloop.
endif.
endform. " GENERATE_FIELD_CATALOG_CUST
*& Form get_events_customer
Getting ALV Events
form get_events_customer.
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
importing
et_events = i_events
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.
if not i_events[] is initial.
read table i_events into wa_event with key name = 'TOP_OF_PAGE'(024)
wa_event-form = 'GENERATE_USERCOMMAND_CUST'.
modify i_events from wa_event index sy-tabix.
read table i_events into wa_event with key na -
How to provide hyperlink for CSN message in email notification
Hi,
I have the following requirement, could anyone provide some ideas/solution on this.
We integrated Change Notification Service to portal as transaction iView. once the CSN is raised and assigned to resopnsible person, the message will be notified through email. The requirement is in the email notification a hyperlink should be provided so that on clicking on the link it should open the page with respective CSN message.
Could any one provide solution how to achieve this?
Thanks in advance.
Regards,
Ravi.Yes you can do that. using the fieldcatalog there is an option for that. give HOT_SPOT = 'X'. for the column you want.
wa_field-hotspot = 'X'.
REPORT ztest_alv.
TYPE-POOLS:slis.
DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
wa_field LIKE LINE OF it_fieldcat.
DATA: BEGIN OF it_likp OCCURS 0,
vbeln TYPE likp-vbeln,
END OF it_likp.
DATA: layout TYPE slis_layout_alv.
wa_field-fieldname = 'VBELN'.
wa_field-tabname = 'IT_LIKP'.
wa_field-hotspot = 'X'.
wa_field-outputlen = 10.
wa_field-no_zero = 'X'.
wa_field-seltext_l = 'Sales'.
APPEND wa_field TO it_fieldcat.
SELECT vbeln FROM likp
UP TO 10 ROWS
INTO TABLE it_likp.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_likp
EXCEPTIONS
program_error = 1.
*& Form user_Command
* text
* -->UCOMM text
* -->SELFIELD text
FORM user_command USING ucomm TYPE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm.
WHEN '&IC1'.
SET PARAMETER ID 'VL' FIELD selfield-value.
CALL TRANSACTION 'VL02N' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "user_Command -
How to provide F4 for inputfield in ABAP Webdynpro ALV
Hi Friends,
I am displaying records in Editable ALV Gridd in webdynpro.
I need to provide search help(F4) for few fields which are editable.
Please help me, how I can achieve this functionality in ALV .
Regards,
Xavier.phi Xavier.
to display the data in alv you must have binded it to some context node / attribute rite?.......now to get an input help to the fields you can first make the search help using transaction se11...after making the search help return to the web dynpro component go to the conttext tab.... click on the particular attribut where you want to have the search help....check in the property below...you will find that the " INPUT SEARCH help" is set to automatic ....set it to " dictionary search help".....and below it mention the name of search help you created....save it and activate the component again...the search help will be reflected automatically in the output.
in case of any further query regarding this kindly reply.
thanks,
sahai.s -
Maintaing a default value for a particular field in the selection screen
Hi all,
How to maintain a default value for a particular field in the Selection Screen of a Standard report
Regards
Ajay>
ajay babu wrote:
> Hi all,
>
> How to maintain a default value for a particular field in the Selection Screen of a Standard report
>
> Regards
> Ajay
Create a variant for your standard program and assign this variant to the field 'Start with variant' while creating transaction code for the standard program in the transaction 'SE93'.
Regards
Rajesh. -
How to provide hyperlink in alv
Hi,
how to provide hyperlink only for one column in alv in webdynpro abap
Thanks and regards,
Sridevi.DDATA:
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_link_to_action TYPE REF TO cl_salv_wd_uie_link_to_action,
lr_col type ref to cl_salv_wd_column.
lr_column_settings ?= wd_this->alv_config_table.
lr_col = lr_column_settings->get_column( 'MATNR' ).
CREATE OBJECT lr_link_to_action.
lr_link_to_action1->SET_TEXT_FIELDNAME('MATNR').
lr_col->set_cell_editor( lr_link_to_action ).
The variable alv_config_table is defined in the attribute tab of the view which is reference to the class CL_SALV_WD_CONFIG_TABLE
Use this code in the init method of the View.
Reward points if helpful.
Thanks in advance. -
How to populate values for a new field in target infoprovider
Hi Experts,
am new to BI. i would like to know on how to populate values for a new field in the target cube with start rotuine.In my case, i have a source infoprovider, which has 3 fields and a target infoprovider, which has 5 fields. i need to populate the new 2 fields in start routine. i dont want to populate using Field routine and am using 3.5 version. please assist with code on how to solve this issue.
Thank you,
Chitra.
Edited by: Chitra_BI on Jun 13, 2011 10:23 AMDebug the standard code and see where the other fields are getting update. you can use the similar approach and area to code for the new field.
Regards,
Lalit Mohan Gupta. -
How to give comments for a particular table
hi..
how to give comments for a particular table ..
select * from user_tab_comments;
tx in advance..Try this.
SQL> COMMENT ON TABLE EMP IS 'THIS IS SAMPLE EMPLOYEE TABLE' ;
Comment created.
SQL> select * from user_tab_comments where table_name = 'EMP'
2 /
TABLE_NAME TABLE_TYPE
COMMENTS
EMP TABLE
THIS IS SAMPLE EMPLOYEE TABLE -
How to disable cache for a particular Report in obiee 10g?
HI
My name is Rani .Learning obiee10g ifaced 1 interview in that they asked me like how u disable cache for a particular report?In the advanced tab of the report, under prefix you need to mention:
SET VARIABLE DISABLE_CACHE_HIT=1;
Refer below link
http://tipsonobiee.blogspot.com/2009/06/step-by-step-to-bypass-all-caches.html
Thanks -
Code for reading particular fields from the file placed in application
hi,
code for reading particular fields from the file placed in application server in to the internal table.Hi,
Use the GUI_UPLOAD FM to upload the File into ur Internal Table.
DATA : FILE_TABLE TYPE FILE_TABLE OCCURS 0,
fwa TYPE FILE_TABLE,
FILENAME TYPE STRING,
RC TYPE I.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Open File'
DEFAULT_EXTENSION =
DEFAULT_FILENAME =
FILE_FILTER =
INITIAL_DIRECTORY =
MULTISELECTION =
WITH_ENCODING =
CHANGING
FILE_TABLE = FILE_TABLE
RC = RC
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
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 FILE_TABLE INDEX 1 into fwa.
FILENAME = fwa-FILENAME.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
FILETYPE = 'DAT'
IMPORTING
FILELENGTH =
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
OTHERS = 6 .
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Balakumar.G
Reward Points if helpful. -
How do I search for a particular song on iTunes ?
How do I search for a particular song on itunes - it used to be easy to go to search but that function seems to have disappeared
The search function is still very much there, upper right corner of the iTunes Window.
-
Deactivate the double click/ hot spot for a particular row in alv grid.
Hello,
As per a certain condition how to deactivate the double click/ hot spot for a particular row in alv grid.
Regards,
Sarojwhere u define layout there is a field hotspot.like
data: var.
if con is true
var = 'X'. (show hotspot)
else.
var = ' '. (deactive hotspot)
elseif ws_fieldcat-fieldname = 'DMBTR'
AND ws_fieldcat-tabname = 'T_MTAB'.
ws_fieldcat-do_sum = C_X.
<b>ws_fieldcat-hotsopts = var.</b>
MODIFY Wt_fieldcat FROM ws_fieldcat
TRANSPORTING DO_SUM.
It is helpful for u. if any problen send me ur coding i will change it.
Regards
Manish Kumar -
To calculate average for a currency field in alv
Hi,
I have a requirement in which i need to find the average of a currency field in alv. For the particular field, i'm passing the value of DO_SUM = 'C' in thr field catalog(as suggested in many threads); but I'm not able to calculate the average. it still shows me summation when i click on summation button.
What could be the possible error??? Is there any other method we can do the same??
Thanks in Advance.
JaspreetHi
U can try this way.
*& Report Z_DEMO_JG
*& Display average in ALV report
REPORT z_demo_jg LINE-SIZE 80 LINE-COUNT 50
NO STANDARD PAGE HEADING.
TABLES: sflight.
TYPE-POOLS: slis.
* Data declaration
DATA: i_flight TYPE STANDARD TABLE OF sflight,
i_catalog TYPE slis_t_fieldcat_alv,
w_flight TYPE sflight,
w_catalog TYPE slis_fieldcat_alv.
DATA: v_repid TYPE syrepid.
* Selection screen
SELECT-OPTIONS: s_carrid FOR sflight-carrid.
START-OF-SELECTION.
* Fetch data from sflight table
SELECT *
FROM sflight
INTO TABLE i_flight
WHERE carrid IN s_carrid.
CHECK sy-subrc = 0.
v_repid = sy-repid.
* Build field catalog for ALV report
PERFORM build_catalog.
* Display ALV report
PERFORM display_report.
*& Form build_catalog
* Build field catalog for ALV report
* None
FORM build_catalog .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = i_catalog
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
* For average populate 'C' as value in
* field DO_SUM
w_catalog-do_sum = 'C'. " C = Average
* Modify record with new value
MODIFY i_catalog FROM w_catalog TRANSPORTING
do_sum WHERE fieldname = 'PRICE'.
ENDIF.
ENDFORM. " build_catalog
*& Form display_report
* Display ALV report
* None
FORM display_report .
IF i_catalog[] IS NOT INITIAL.
* Call ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = i_catalog
TABLES
t_outtab = i_flight
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
ENDIF.
ENDIF.
ENDFORM. " display_report
Edited by: meetjoe on Sep 15, 2009 7:17 PM -
Total for a Numeric field in ALV Grid display
Hi all,
I am not getting the Total for a Numeric field in ALV Grid output. What might be the problem.
Regards,
Balavardhan.KCheck this code for subtotals and totals..
REPORT ZYFI_REPT007
NO STANDARD PAGE HEADING
LINE-SIZE 300
LINE-COUNT 50
MESSAGE-ID ZYFI.
TABLES : COOI, " Commitments Management: Line Items
LFA1, " Vendor master (general section)
VBEP,
RKPLN.
TABLE TYPES AND INTERNAL TABLES *
DATA : BEGIN OF TYP_COOI ,
OBJNR LIKE COOI-OBJNR,
SAKTO LIKE COOI-SAKTO,
MEGBTR LIKE COOI-MEGBTR,
MEINH LIKE COOI-MEINH,
WKGBTR LIKE COOI-WKGBTR,
REFBN LIKE COOI-REFBN,
RFPOS LIKE COOI-RFPOS,
SGTXT LIKE COOI-SGTXT,
BUDAT LIKE COOI-BUDAT,
LIFNR LIKE COOI-LIFNR,
END OF TYP_COOI.
DATA : BEGIN OF TYP_LFA1 ,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF TYP_LFA1.
DATA : BEGIN OF IT_OUTTAB OCCURS 0,
OBJNR LIKE COOI-OBJNR,
SAKTO LIKE COOI-SAKTO,
MEGBTR LIKE COOI-MEGBTR,
MEINH LIKE COOI-MEINH,
WKGBTR LIKE COOI-WKGBTR,
REFBN LIKE COOI-REFBN,
RFPOS LIKE COOI-RFPOS,
SGTXT LIKE COOI-SGTXT,
BUDAT LIKE COOI-BUDAT,
LIFNR LIKE COOI-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF IT_OUTTAB.
DATA : IT_COOI LIKE TYP_COOI OCCURS 0 WITH HEADER LINE,
IT_LFA1 LIKE TYP_LFA1 OCCURS 0 WITH HEADER LINE.
*-- ALV Declarations
TYPE-POOLS SLIS.
DATA: IT_EVENTS TYPE SLIS_T_EVENT,
GS_EVENT TYPE SLIS_ALV_EVENT,
wa_fldcat type slis_fieldcat_alv.
DATA: S_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_PRINT TYPE SLIS_PRINT_ALV.
DATA: IT_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: IT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: V_REPID LIKE SY-REPID.
SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_KOKRS FOR COOI-KOKRS NO-EXTENSION NO INTERVALS,
" Controlling Area
S_BUKRS FOR COOI-BUKRS NO-EXTENSION NO INTERVALS,
" Company code
S_GJAHR FOR COOI-GJAHR NO-EXTENSION NO INTERVALS,
" Fiscal Year
S_OBJNR FOR RKPLN-AUFNR MATCHCODE OBJECT ORDE,
" Internal order
S_SAKTO FOR COOI-SAKTO MATCHCODE OBJECT KART,
" Cost Element
S_BUDAT FOR COOI-BUDAT, " Debit Date
S_LIFNR FOR COOI-LIFNR. " Vendor
SELECTION-SCREEN END OF BLOCK B1.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
*-- Read data
PERFORM GET_DATA.
E N D O F S E L E C T I O N *
END-OF-SELECTION.
*-- Process the data and prepare the output data
PERFORM CALCULATE_FINAL_INFO.
*--Display Report output
PERFORM DISPLAY_REPORT.
FORM CALCULATE_FINAL_INFO *
Process the data and prepare final internal table *
FORM CALCULATE_FINAL_INFO.
DATA : L_OBJNR LIKE COOI-OBJNR.
SORT IT_LFA1 BY LIFNR.
DELETE ADJACENT DUPLICATES FROM IT_LFA1 COMPARING LIFNR.
LOOP AT IT_COOI.
L_OBJNR = IT_COOI-OBJNR+2(20).
SHIFT L_OBJNR LEFT DELETING LEADING '0'.
IF L_OBJNR IN S_OBJNR.
READ TABLE IT_LFA1 WITH KEY LIFNR = IT_COOI-LIFNR.
IF SY-SUBRC EQ 0.
IT_OUTTAB-NAME1 = IT_LFA1-NAME1.
ENDIF.
MOVE-CORRESPONDING IT_COOI TO IT_OUTTAB.
CLEAR IT_OUTTAB-OBJNR.
IT_OUTTAB-OBJNR = L_OBJNR.
APPEND IT_OUTTAB.
CLEAR IT_OUTTAB.
CLEAR IT_LFA1.
CLEAR L_OBJNR.
ENDIF.
ENDLOOP.
ENDFORM.
*& Form GET_DATA
Fetch the Data from the table COOI and LFA1
FORM GET_DATA.
SELECT OBJNR
SAKTO
MEGBTR
MEINH
WKGBTR
REFBN
RFPOS
SGTXT
BUDAT
LIFNR
FROM COOI
INTO TABLE IT_COOI
WHERE BUDAT IN S_BUDAT
AND LIFNR IN S_LIFNR
AND KOKRS IN S_KOKRS
AND BUKRS IN S_BUKRS
AND GJAHR IN S_GJAHR
AND SAKTO IN S_SAKTO.
IF SY-SUBRC EQ 0 .
Get the Vendor name from LFA1
SELECT LIFNR
NAME1
FROM LFA1
INTO TABLE IT_LFA1
FOR ALL ENTRIES IN IT_COOI
WHERE LIFNR EQ IT_COOI-LIFNR.
ELSE.
MESSAGE I999 WITH TEXT-013.
ENDIF.
ENDFORM. " GET_DATA
*& Form DISPLAY_REPORT
Display the output
FORM DISPLAY_REPORT.
PERFORM BUILD_CATALOG.
PERFORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS.
IF NOT IT_OUTTAB[] IS INITIAL.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FLDCAT
IT_SORT = IT_SORT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = IT_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ELSE.
MESSAGE I999 WITH TEXT-013.
ENDIF.
ENDFORM. " DISPLAY_REPORT
*& Form BUILD_CATALOG
Build the Field catalog for the ALV Report
FORM BUILD_CATALOG.
DATA: V_INDEX LIKE SY-TABIX.
V_REPID = SY-REPID.
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_OUTTAB'
I_INCLNAME = V_REPID
CHANGING
CT_FIELDCAT = IT_FLDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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.
ENDIF.
READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'WKGBTR'
TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
IF SY-SUBRC EQ 0.
WA_FLDCAT-DO_SUM = 'X'.
MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
ENDIF.
READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'OBJNR'
TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
IF SY-SUBRC EQ 0.
WA_FLDCAT-SELTEXT_L = 'Order'.
WA_FLDCAT-COL_POS = 1.
WA_FLDCAT-DDICTXT = 'L'.
MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
ENDIF.
LS_SORT-FIELDNAME = 'OBJNR'.
LS_SORT-SPOS = 1.
LS_SORT-UP = 'X'.
LS_SORT-SUBTOT = 'X'.
APPEND LS_SORT TO IT_SORT.
ENDFORM. " BUILD_CATALOG
*& Form FRM_PREPARE_EVENT_LIST
Build the Events
FORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS TYPE SLIS_T_EVENT.
CLEAR GS_EVENT.
GS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
GS_EVENT-FORM = 'TOP_OF_PAGE_REPORT'.
APPEND GS_EVENT TO IT_EVENTS.
ENDFORM. " FRM_PREPARE_EVENT_LIST
TOP OF PAGE
FORM TOP_OF_PAGE_REPORT.
CALL FUNCTION 'Z_YREPORT_HEADER'
EXPORTING
DL_TITLE = SY-TITLE
DL_REPID = SY-CPROG
DL_LINSZ = SY-LINSZ
EXCEPTIONS
OTHERS = 1.
ENDFORM. " FRM_TOP_OF_PAGE_REPORT
*& Form USER_COMMAND
Drill Down Functionality to Call the Transaction ME23
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
DATA : L_INDEX LIKE SY-INDEX,
L_REFBN LIKE COOI-REFBN.
L_INDEX = P_SELFIELD-TABINDEX. " holds the selected table index
CLEAR L_REFBN.
CASE P_UCOMM.
*-- On Double Click
WHEN '&IC1'.
CLEAR L_REFBN.
*-- Read the Current Line
READ TABLE IT_OUTTAB INDEX L_INDEX.
IF SY-SUBRC EQ 0.
L_REFBN = IT_OUTTAB-REFBN.
IF NOT L_REFBN IS INITIAL.
*-- Set the BES Paramater Id to the Current line Purchase Order Number
SET PARAMETER ID 'BES' FIELD L_REFBN.
*-- Call the Transaction Purchase Order Display with the above PO Number
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
ENDIF.
ELSE.
MESSAGE E999 WITH TEXT-014.
ENDIF.
ENDCASE.
ENDFORM. " USER_COMMAND
Maybe you are looking for
-
How to Connect a Sony Bravia TV to Time Capsule
I am trying to get a Sony Bravia KDL26EX553BU TV to use my Wireless Network which consists of an Apple iMac PC which is linked wirelessly to an Apple Time Capsule which has a wired connection to a Netgear DM111P ADSL2+ Modem. The Wireless Network is
-
Export error (-2126). What is it?
I am trying to export a movie in Quicktime Pro and I keep getting an Export error (-2126). What is this error? I am also not able to use iMovie to import an .avi movie so I can share it on the web. Any help is always appreciated. Rick
-
I have turned on my photo stream on my iphone, but when I open my Icloud in other computer I can´t acess my photos. There is not a icon to acess any photos. The icon that have in my Iclous are CONTACTS, FIND MY IPHONE, IWORK, CALENDAR AND MAIL. How
-
Image Capture not finding images taken under iOS 4
After updating to iOS4 I'm not able to download images from my phone via Image Capture. Image Capture simply doesn't show the images taken since the update, in the browse window of the application. So my question, with a conditioned subquestion is: -
-
Trying to create interactive navigation to bring you to a certain point in a page.
I'm creating an interactive file with indesign to be exported as an interactive PDF. I want to be able to click on an item and it bring you to its description on a separate page. All I'm getting online are tutorials on how to place navigation buttons