Column headings in Hierachical-Sequential ALV
Hi Friends,
I'm trying to display a Hierarchical-Sequential by:
1. Using the class 'cl_salv_hierseq_table' and method 'factory' to create the binding.
2. Using the method 'display' to display the report.
The issue I'm facing is that the column headings being displayed in the report output are the 'Field Label' maintained in the dictionary. I would like to change the same.
Could anyone please help me in this regard??
Thanks,
Anju
check this :
data: v_xfield_st type slis_t_fieldcat_alv.
edit the field catalog table.. by reading it...
read table v_xfield_st where FIELDNAME = 'WERKS' .
if sy-subrc eq 0.
v_xfield_st-SELTEXT_S = 'Rec. Plant'.
v_xfield_st-SELTEXT_m = 'Recv. plant'.
modify v_xfield_st index sy-index.
endif.
Similar Messages
-
Column headings are missing in the output for ALV?
Hi all,
i have coded a small report in ALV mode. i am getting the data but the column headings are missing.
iam not getting the column headings in the output. it is coming as blank. Could you all please help me out in this?
below is the code of my program:
Includes *
*---Standard header and footer routines
INCLUDE zsrepthd.
*--- ALV Routines
INCLUDE zvsdi_alv_routines_ver3.
*--- Authorization Check
INCLUDE z_selection_auth_check.
Types Declarations *
tables : ekpo.
Types Declarations *
TYPES: BEGIN OF ty_ekpo,
EBELN(18) TYPE C,
EBELP(20) TYPE C,
MATNR(18) TYPE C,
WERKS(11) TYPE C,
END OF ty_ekpo.
*-Output field name
TYPES: BEGIN OF ty_output,
EBELN(18) TYPE C,
EBELP(20) TYPE C,
MATNR(18) TYPE C,
WERKS(11) TYPE C,
END OF ty_output.
*-Output field name
TYPES: BEGIN OF ty_fields,
fname(60) TYPE c,
END OF ty_fields.
Internal Table Declarations *
DATA:it_ekpo TYPE STANDARD TABLE OF ty_ekpo,
*--- Alv parameters
it_out_alvp TYPE typ_alv_form_params, "for alv parameters
*-Field catalog for ALV display
it_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
*-Field names for Excel column headings
it_ekpo_fields TYPE STANDARD TABLE OF ty_fields WITH HEADER LINE.
**--To store output for Principial Pegging data
DATA: BEGIN OF it_output occurs 0,
EBELN(18) TYPE C,
EBELP(20) TYPE C,
MATNR(18) TYPE C,
WERKS(11) TYPE C,
END OF it_output.
**--To store output for 2nd
DATA: BEGIN OF it_output1 occurs 0,
text(2000),
END OF it_output1.
Data Declarations *
data: v_ebeln TYPE ekpo-ebeln,
v_ebelp TYPE ekpo-ebelp,
v_matnr TYPE ekpo-matnr,
v_werks TYPE ekpo-werks.
Constants Declarations *
CONSTANTS:
c_0 TYPE i VALUE 0,
c_x TYPE char1 VALUE 'X',
c_i TYPE char1 VALUE 'I',
c_eq TYPE char2 VALUE 'EQ',
c_ekpo TYPE char4 VALUE 'EKPO',
c_hyfn TYPE char1 VALUE '-'.
Work Area Declarations *
DATA: x_output_ekpo type ty_output,
x_ekpo type ty_ekpo.
Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-f01.
SELECT-OPTIONS:
s_ebeln FOR v_ebeln OBLIGATORY,
s_ebelp FOR v_ebelp,
s_matnr FOR v_matnr,
s_werks FOR v_werks.
SELECTION-SCREEN END OF BLOCK b1.
At Selection Screen *
AT SELECTION-SCREEN.
Start-of-Selection *
START-OF-SELECTION.
*--- Check Authorizations for Selection-screen
PERFORM z_selection_auth_check.
*--- Fetch Purchasing Document Item data
PERFORM fetch_status_pp.
End-of-Selection *
END-OF-SELECTION.
**-- Download data to final internal table.
PERFORM data_output.
IF NOT it_output[] IS INITIAL.
*--- Fill the structure for calling the ALV form
PERFORM initialize_alv_params.
**-- Display ALV Report
PERFORM setup_and_display_alv_ver2
USING
it_out_alvp "Parameter structure
it_output[] "Internal Data table(header table)
it_output[]. "Dummy table for Hierarchical ALV!!(item table)
ENDIF.
IF it_output[] IS INITIAL.
MESSAGE i999(zi) WITH 'No data found for selection'(i02).
ENDIF.
*& Form FETCH_STATUS_PP
Get data from ekpo table
FORM FETCH_STATUS_PP .
*-Fetch PP Data from ekpo table
REFRESH it_ekpo.
SELECT EBELN
EBELP
MATNR
WERKS
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln IN s_ebeln
AND ebelp IN s_ebelp.
IF sy-subrc = c_0.
SORT it_ekpo BY ebeln ebelp.
ENDIF.
ENDFORM. " FETCH_STATUS_PP
*& Form f_top_of_page
*This is to write the top of page
FORM top_of_page.
DATA: lt_list TYPE slis_t_listheader,
lx_list TYPE slis_listheader.
*--- Title name
CLEAR lx_list.
lx_list-typ = 'S'.
lx_list-key = 'Title name'(t13).
lx_list-info = sy-title.
APPEND lx_list TO lt_list.
IF NOT lt_list IS INITIAL.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_list.
ENDIF.
ENDFORM. "top_of_page
*& Form init_page_head
Description : This subroutine initializes the fields in table BHDGD *
for printing the report heading. *
FORM init_page_head.
bhdgd-line1 = 'SLA Status Report'(h04).
bhdgd-line2 = sy-title.
bhdgd-lines = sy-linsz.
bhdgd-fcpyrt = sy-uline.
bhdgd-inifl = '0'.
ENDFORM. "init_page_head
*& Form initialize_alv_params
Description : Form to initialize ALV Params
FORM initialize_alv_params.
CONSTANTS: lc_alv_grid TYPE char1 VALUE 'G', "Grid
lc_u TYPE char1 VALUE 'U'.
MOVE 'IT_OUTPUT' TO it_out_alvp-tablname. "final table
MOVE sy-repid TO it_out_alvp-repid.
MOVE lc_alv_grid TO it_out_alvp-alvtype.
MOVE c_x TO it_out_alvp-bringdefaultvar.
MOVE lc_u TO it_out_alvp-variantsavetype.
ENDFORM. " initialize_alv_params
FORM it_out_init_events *
-->this is form is to modify the events
FORM it_out_init_events
CHANGING
alevnts TYPE slis_t_event.
FIELD-SYMBOLS <alevnt> TYPE slis_alv_event.
LOOP AT alevnts ASSIGNING <alevnt>.
CASE <alevnt>-name.
WHEN slis_ev_top_of_page.
MOVE 'TOP_OF_PAGE' TO <alevnt>-form.
ENDCASE.
ENDLOOP.
ENDFORM. "it_out_init_events
*& Form DATA_OUTPUT
Download data to final internal table
FORM DATA_OUTPUT .
loop at it_ekpo into x_ekpo.
x_output_ekpo-ebeln = x_ekpo-ebeln.
x_output_ekpo-ebelp = x_ekpo-ebelp.
x_output_ekpo-matnr = x_ekpo-matnr.
x_output_ekpo-werks = x_ekpo-werks.
append x_output_ekpo to it_output.
endloop.
ENDFORM. " DATA_OUTPUT
FORM it_out_alv_fieldcat_before *
--> PT_FCAT *
--> ALVP *
FORM it_out_alv_fieldcat_before CHANGING
pt_fcat TYPE slis_t_fieldcat_alv
alvp TYPE typ_alv_form_params.
DATA: lx_fcat TYPE slis_fieldcat_alv.
CLEAR lx_fcat.
lx_fcat-tabname = 'IT_OUTPUT'.
lx_fcat-fieldname = 'EBELN'.
lx_fcat-col_pos = '1'.
lx_fcat-ddictxt = 'M'.
lx_fcat-seltext_l = 'Purchasing Doc No'(018).
lx_fcat-seltext_m = 'Purchasing Doc No'(018).
lx_fcat-seltext_s = 'Purchasing Doc No'(018).
lx_fcat-reptext_ddic = 'Purchasing Doc No'(018).
APPEND lx_fcat TO pt_fcat.
CLEAR lx_fcat.
lx_fcat-tabname = 'IT_OUTPUT'.
lx_fcat-fieldname = 'EBELP'.
lx_fcat-col_pos = '1'.
lx_fcat-ddictxt = 'M'.
lx_fcat-seltext_l = 'Item No Purchasing Doc'(020).
lx_fcat-seltext_m = 'Item No Purchasing Doc'(020).
lx_fcat-seltext_s = 'Item No Purchasing Doc'(020).
lx_fcat-reptext_ddic = 'Item No Purchasing Doc'(020).
APPEND lx_fcat TO pt_fcat.
CLEAR lx_fcat.
lx_fcat-tabname = 'IT_OUTPUT'.
lx_fcat-fieldname = 'MATNR'.
lx_fcat-col_pos = '1'.
lx_fcat-ddictxt = 'M'.
lx_fcat-seltext_l = 'Material'(010).
lx_fcat-seltext_m = 'Material'(010).
lx_fcat-seltext_s = 'Material'(010).
lx_fcat-reptext_ddic = 'Material'(010).
APPEND lx_fcat TO pt_fcat.
CLEAR lx_fcat.
lx_fcat-tabname = 'IT_OUTPUT'.
lx_fcat-fieldname = 'WERKS'.
lx_fcat-col_pos = '1'.
lx_fcat-ddictxt = 'M'.
lx_fcat-seltext_l = 'Supply plant'(013).
lx_fcat-seltext_m = 'Supply plant'(013).
lx_fcat-seltext_s = 'Supply plant'(013).
lx_fcat-reptext_ddic = 'Supply plant'(013).
APPEND lx_fcat TO pt_fcat.
ENDFORM. " it_out_alv_fieldcat_before.
Regards,
Shalini
Edited by: shalini reddy on Oct 7, 2008 5:08 PMHi,
The heading are in the table pt_fcat - you don't seem to be passing that in form....
PERFORM setup_and_display_alv_ver2
USING
it_out_alvp "Parameter structure
it_output[] "Internal Data table(header table)
it_output[]. "Dummy table for Hierarchical ALV!!(item table)
which I guessing in in one of the includes?
Saying that the extract pof code does not show where you are calling form it_out_alv_fieldcat_before ...which populates the headings...
Regards
Stu -
Hi Max,
If you remember in one of my last post I asked for changing the column headings in ALV display for example from 'Material' to 'Material used'.
I am using
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_FIELDCAT = field_body
I_SAVE = g_save
IS_VARIANT = g_variant
IT_EVENTS = events
TABLES
T_OUTTAB = itab.
And you suggested me the following way....
loop at field_body into field_wa.
case field_wa-fieldname.
when 'Material'.
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Material used'.
endcase.
modify field_body from field_wa.
endloop.
It is working well. In ALV display the column heading is changed to what I wanted. But the question is when I export the displayed ALV to Excel using ALV functionality, Export->Spreadsheet... I see that <b>I dont get the Column Heading into Excel as it was in the ALV display.</b>
I get in the Excel as 'Material u' or 'Mat. Used'. But when I add this line in the code.....
when 'Material'.
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Material used'.
<b> field_wa-outputlen = 20.</b>
Then I see that I get the complete heading in the Excel. But this way the columns with outputlen 20 are taking much space in ALV display.
Is there any fix for this. May be not mentioning the outputlen but still get the column headings into Excel as it was in ALV display.
Anyone with ideas please respond. Waiting for replies. ThanksHi
The labels have a fixed size:
seltext_l is long text: 20 char
seltext_m is medium text: 15 char
seltext_s is short text: 10 char
The text 'Material used' is long 13 char so you should write:
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Mat. used'.
You can try to set the field colwidth_optimize of parameter IT_LAYOUT.
This field should optimize the width of the colunm
So
data layout type SLIS_LAYOUT_ALV.
layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_LAYOUT = layout
IT_FIELDCAT = field_body
I_SAVE = g_save
IS_VARIANT = g_variant
IT_EVENTS = events
TABLES
T_OUTTAB = itab.
and you can decide which label has to be used:
field_wa-seltext_l = 'Material used'.
field_wa-seltext_m = 'Material used'.
field_wa-seltext_s = 'Mat. used'.
If you want to set the short text
field_wa-ddictxt = 'S'.
...medium
field_wa-ddictxt = 'M'.
...long
field_wa-ddictxt = 'L'.
Max -
ALV download to EXCEL with column headings etc.
Getting data from a grid to EXCEL can be done in "List" mode vis system==>save etc but it's not particularly user friendly and in any case if you are displaying a nice ALV why should the user have to switch into LIST mode anyway.
Anyway here's a decent way to do it and it gives great formatted column headings etc etc.
1) in the ON_TOOLBAR method add this code
method ON_TOOLBAR.
type-pools icon.
CLEAR ls_toolbar.
MOVE 0 TO ls_toolbar-butn_type.
MOVE 'EXCEL' TO ls_toolbar-function.
MOVE space TO ls_toolbar-disabled.
MOVE icon_xxl TO ls_toolbar-icon.
MOVE 'Excel' TO ls_toolbar-quickinfo.
MOVE 'EXCEL' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
2) In the ON_USER_COMMAND method add the following
(if you have a class defined with SE24 you don't need the commented code).
method ON_USER_COMMAND.
FOR EVENT before_user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm
sender.
CASE e_ucomm.
....... other toolbar funcs if you have any
WHEN 'EXCEL'.
CALL METHOD me->download_to_excel.
ENDCASE.
endmethod.
3) code this method to download to EXCEL
method DOWNLOAD_TO_EXCEL.
FIELD-SYMBOLS:
<fs0> TYPE STANDARD TABLE,
<fs1> TYPE STANDARD TABLE.
ASSIGN g_outtab1->* TO <fs0>.
ASSIGN g_fldcat1->* TO <fs1>.
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_fieldcat_lvc = <fs1>
is_layout_lvc = m_cl_variant->ms_layout
is_tech_complete = ' '
IMPORTING
es_layout_kkblo = ls_layout
et_fieldcat_kkblo = lt_fieldcat.
LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
CLEAR lt_fieldcat_wa-tech_complete.
IF lt_fieldcat_wa-tabname IS INITIAL.
lt_fieldcat_wa-tabname = '1'.
MODIFY lt_fieldcat FROM lt_fieldcat_wa.
ENDIF.
l_tabname = lt_fieldcat_wa-tabname.
ENDLOOP.
CALL FUNCTION 'ALV_XXL_CALL'
EXPORTING
i_tabname = l_tabname
is_layout = ls_layout
it_fieldcat = lt_fieldcat
i_title = sy-title
TABLES
it_outtab = <fs0>
EXCEPTIONS
fatal_error = 1
no_display_possible = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endmethod.
You get nice column headings etc and decently formatted EXCEL spreadsheet.
For Office 2007 I think you need to apply a SAP note but it certainly works with OFFICE 2003 which is what we are still using.
Cheers
jimboGetting data from a grid to EXCEL can be done in "List" mode vis system==>save etc but it's not particularly user friendly and in any case if you are displaying a nice ALV why should the user have to switch into LIST mode anyway.
Anyway here's a decent way to do it and it gives great formatted column headings etc etc.
1) in the ON_TOOLBAR method add this code
method ON_TOOLBAR.
type-pools icon.
CLEAR ls_toolbar.
MOVE 0 TO ls_toolbar-butn_type.
MOVE 'EXCEL' TO ls_toolbar-function.
MOVE space TO ls_toolbar-disabled.
MOVE icon_xxl TO ls_toolbar-icon.
MOVE 'Excel' TO ls_toolbar-quickinfo.
MOVE 'EXCEL' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
2) In the ON_USER_COMMAND method add the following
(if you have a class defined with SE24 you don't need the commented code).
method ON_USER_COMMAND.
FOR EVENT before_user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm
sender.
CASE e_ucomm.
....... other toolbar funcs if you have any
WHEN 'EXCEL'.
CALL METHOD me->download_to_excel.
ENDCASE.
endmethod.
3) code this method to download to EXCEL
method DOWNLOAD_TO_EXCEL.
FIELD-SYMBOLS:
<fs0> TYPE STANDARD TABLE,
<fs1> TYPE STANDARD TABLE.
ASSIGN g_outtab1->* TO <fs0>.
ASSIGN g_fldcat1->* TO <fs1>.
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_fieldcat_lvc = <fs1>
is_layout_lvc = m_cl_variant->ms_layout
is_tech_complete = ' '
IMPORTING
es_layout_kkblo = ls_layout
et_fieldcat_kkblo = lt_fieldcat.
LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
CLEAR lt_fieldcat_wa-tech_complete.
IF lt_fieldcat_wa-tabname IS INITIAL.
lt_fieldcat_wa-tabname = '1'.
MODIFY lt_fieldcat FROM lt_fieldcat_wa.
ENDIF.
l_tabname = lt_fieldcat_wa-tabname.
ENDLOOP.
CALL FUNCTION 'ALV_XXL_CALL'
EXPORTING
i_tabname = l_tabname
is_layout = ls_layout
it_fieldcat = lt_fieldcat
i_title = sy-title
TABLES
it_outtab = <fs0>
EXCEPTIONS
fatal_error = 1
no_display_possible = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endmethod.
You get nice column headings etc and decently formatted EXCEL spreadsheet.
For Office 2007 I think you need to apply a SAP note but it certainly works with OFFICE 2003 which is what we are still using.
Cheers
jimbo -
Alv grid background column headings
HI EVERYONE,
I was able to execute the ALV grid report in background .But columns heading is reeating for
each page.
Can't we just just have the Column Headings once for all pages.?For the IS_LAYOUT parameter it is possible to set NO_COLHEAD = 'X'. Then the header is gone. Then you have to create first line in table with texts. But then all fields must be character fields.
Regards
Roy -
Clasical Report column headings display
Hi ABAPERS
iam working on clasical report. in that i have to display 16 field headings.
when executing the report, the column headers should be frozen at the top so that when the user is scrolling down, they can see what the column title is.
how can i over come this problem.Hi,
you mean the column headings should be displayed even though
the user scrolls down the output.
For classical reports, according to me it is not possible.
We will be using the write statement to display the records,
so it is static for the report.
If you want the output what you are expecting then go for ALV's.
Regards,
Venkatesh -
Columns selection on a dynamic ALV (With Checkbox)
Hello all,
I have an ALV which display one column per day chosen by the user like that:
EMPLOYEE u2013 DAY01 u2013 DAY02 u2013 DAY03 u2026
Pernr/Name u2013 AUFNR1 u2013 AUFNR2 u2013 AUFNR3 u2026
Pernr/Name u2013 AUFNR1 u2013 AUFNR2 u2013 AUFNR3 u2026
Pernr/Name u2013 AUFNR1 u2013 AUFNR2 u2013 AUFNR3 u2026
My need is to allow the user to select several employees (lines) and several days (DAY1 and DAY3) or one period (DAY1 to DAY3).
After the selection, the user clicks on an ALV button to change the AUFNR data for all employees and days selected.
I'm trying to add a second u2018header lineu2019 or a first line with check box (only for u2018DAYu2019 columns) but I didnu2019t find the solution.
Could you help me?
If needed I can post my code sample.
Thanks in advance.
David
Edited by: David.pac on Dec 12, 2011 3:13 PMThanks for Your help.
The date is in fact a CHAR display (not really a date) so that is not the error.
For your information when i select a row in the list (format char YYYYMMDD_HHMM) it seems that Apex do not catch my select in the Session state.
I've change the item name with P2_DATE_FLOW but the problem remain.
This is the debug log if can help
0.03: Application 114, Authentication: CUSTOM2, Page Template: 3644802034190382
0.06: ...Session ID 1868105032215374 can be used
0.06: ...Application session: 1868105032215374, user=Neop
0.06: ...Determine if user "Neop" workspace "2859608277950243" can develop application "114" in workspace "2859608277950243"
0.06: Session: Fetch session header information
0.06: ...Metadata: Fetch page attributes for application 114, page 3
0.06: Fetch session state from database
0.06: Branch point: BEFORE_HEADER
0.06: Fetch application meta data
0.08: Computation point: BEFORE_HEADER
0.08: Processing point: BEFORE_HEADER
0.08: Show page template header
0.08: Computation point: AFTER_HEADER
0.08: Processing point: AFTER_HEADER
0.08: Computation point: BEFORE_BOX_BODY
0.08: Processing point: BEFORE_BOX_BODY
0.08: Region: Report 1
Report 1
0.08: show report
0.09: determine column headings
0.09: parse query as: CFM_MDRE
0.12: binding: ":P2_DATE_FLOW"="P2_DATE_FLOW" value="0"
0.14: print column headings
0.14: rows loop: 15 row(s)
No data found. -
How to download output data into Excel with all Column Headings
Hi Experts,
Please tell me How to download output data of ALV Grid into Excel file with all Column Headings and I want to do this using coding,
please send me if any solution is available.
Thanks & Regards,
YogeshVERSION CONTROL (Most recent on top): *
DATE(mm.dd.yyyy) AUTHOR *
06.25.2007 Pattan Naveen *
Hi yogesh,,
Go through this in this u find ur solution.
report ZTEst_programe no standard page heading
line-size 100
line-count 50(5)
message-id zz.
*--alv type declaration
type-pools: slis.
*--Tables:
tables: anla,
anlz,
anlh,
anlb,
anlc.
data: v_pos type i.
data: v_ndjar type i.
data: v_ndper type i,
v_ndperndabp type i,
v_ndjarndabp1 type i,
v_ndjarndabp type i,
value type i,
date(10) type c value '2006.12.04'.
data: c_0000(4) type c value '0000'.
data: begin of it_final occurs 0,
anlkl(8),
bukrs(4),
anln1 like anla-anln1,
anln2 like anla-anln2,
txt50 like anla-txt50,
txa50 like anla-txa50,
anlhtxt like anlh-anlhtxt,
sernr like anla-sernr,
invnr like anla-invnr,
menge like anla-menge,
meins like anla-meins,
inken like anla-inken,
ivdat like anla-ivdat,
aktiv like anla-aktiv,
gsber like anlz-gsber,
kostl like anlz-kostl,
kostlv like anlz-kostlv,
werks like anlz-werks,
stort like anlz-stort,
raumn like anlz-raumn,
txjcd like anlz-txjcd,
ord41 like anla-ord41,
ord44 like anla-ord44,
gdlgrp like anla-gdlgrp,
anlue like anla-anlue,
lifnr like anla-lifnr,
typbz like anla-typbz,
aibn1 like anla-aibn1,
aibn2 like anla-aibn2,
aibdt like anla-aibdt,
posnr like anla-posnr,
vmgli like anla-vmgli,
invzu like anla-invzu,
ernam like anla-ernam,
erdat like anla-erdat,
afabe like anlb-afabe,
afasl like anlb-afasl,
ndjar like anlb-ndjar,
ndper like anlb-ndper,
afabg like anlb-afabg,
ndabj like anlc-ndabj,
ndabp like anlc-ndabp,
andsj like anlc-andsj,
andsp like anlc-andsp,
safbg like anlb-safbg,
umjar like anlb-umjar,
inbda like anlb-inbda,
kansw like anlc-kansw,
knafa like anlc-knafa,
kaafa like anlc-kaafa,
deakt like anla-deakt,
kanza like anlc-kanza,
kaufw like anlc-kaufw,
kinvz like anlc-kinvz,
ksafa like anlc-ksafa,
kmafa like anlc-kmafa,
end of it_final.
data: begin of it_final_as91 occurs 0,
anlkl(8),
bukrs(4),
anln1 like anla-anln1,
anln2 like anla-anln2,
txt50 like anla-txt50,
txa50 like anla-txa50,
anlhtxt like anlh-anlhtxt,
sernr like anla-sernr,
invnr like anla-invnr,
menge like anla-menge,
meins like anla-meins,
inken like anla-inken,
ivdat like anla-ivdat,
aktiv like anla-aktiv,
gsber like anlz-gsber,
kostl like anlz-kostl,
kostlv like anlz-kostlv,
werks like anlz-werks,
stort like anlz-stort,
raumn like anlz-raumn,
txjcd like anlz-txjcd,
ord41 like anla-ord41,
ord44 like anla-ord44,
gdlgrp like anla-gdlgrp,
anlue like anla-anlue,
lifnr(10),
typbz(15),
aibn1 like anla-aibn1,
aibn2 like anla-aibn2,
aibdt like anla-aibdt,
posnr like anla-posnr,
vmgli like anla-vmgli,
invzu like anla-invzu,
ernam like anla-ernam,
erdat like anla-erdat,
end of it_final_as91.
data: it_download_as91 like it_final_as91 occurs 0
with header line."#EC NEEDED
data: begin of it_final_as92 occurs 0,
anlkl(8),
bukrs(4),
anln1 like anla-anln1,
anln2 like anla-anln2,
deakt like anla-deakt,
ernam like anla-ernam,
erdat like anla-erdat,
afabe like anlb-afabe,
afasl like anlb-afasl,
ndjar like anlb-ndjar,
ndper like anlb-ndper,
afabg like date,
ndabj(3) type c,
ndabp(3) type c,
kansw like anlc-kansw,
knafa like anlc-knafa,
kaafa like anlc-kaafa,
kanza like anlc-kanza,
kaufw like anlc-kaufw,
kinvz like anlc-kinvz,
ksafa like anlc-ksafa,
kmafa like anlc-kmafa,
end of it_final_as92.
data: it_download_as92 like it_final_as92 occurs 0
with header line."#EC NEEDED
data: begin of it_values occurs 0,
anlkl(8),
bukrs(4),
anln1 like anla-anln1,
anln2 like anla-anln2,
deakt like anla-deakt,
afabe like anlb-afabe,
afasl like anlb-afasl,
ndjar like anlb-ndjar,
ndper like anlb-ndper,
afabg like date,
ndabj(3) type c,
ndabp(3) type c,
afabe_02 like anlb-afabe,
afasl_02 like anlb-afasl,
ndjar_02 like anlb-ndjar,
ndper_02 like anlb-ndper,
afabg_02 like date,
ndabj_02 like anlc-ndabj,
ndabp_02 like anlc-ndabp,
kansw01 like anlc-kansw,
knafa01 like anlc-knafa,
kaafa01 like anlc-kaafa,
kansw02 like anlc-kansw,
knafa02 like anlc-knafa,
kaafa02 like anlc-kaafa,
kansw03 like anlc-kansw,
knafa03 like anlc-knafa,
kaafa03 like anlc-kaafa,
kansw04 like anlc-kansw,
knafa04 like anlc-knafa,
kaafa04 like anlc-kaafa,
kansw05 like anlc-kansw,
knafa05 like anlc-knafa,
kaafa05 like anlc-kaafa,
kansw06 like anlc-kansw,
knafa06 like anlc-knafa,
kaafa06 like anlc-kaafa,
kansw07 like anlc-kansw,
knafa07 like anlc-knafa,
kaafa07 like anlc-kaafa,
kansw08 like anlc-kansw,
knafa08 like anlc-knafa,
kaafa08 like anlc-kaafa,
kansw09 like anlc-kansw,
knafa09 like anlc-knafa,
kaafa09 like anlc-kaafa,
kanza01 like anlc-kanza,
kaufw01 like anlc-kaufw,
kinvz01 like anlc-kinvz,
ksafa01 like anlc-ksafa,
kmafa01 like anlc-kmafa,
end of it_values.
data: it_values_xls like it_values occurs 0
with header line."#EC NEEDED
data: begin of it_itab1 occurs 0,
bukrs like anla-bukrs,
anlkl like anla-anlkl,
anln1 like anla-anln1,
anln2 like anla-anln2,
txt50 like anla-txt50,
txa50 like anla-txa50,
invnr like anla-invnr,
ktogr like anla-ktogr,
sernr like anla-sernr,
menge like anla-menge,
meins like anla-meins,
ivdat like anla-ivdat,
inken like anla-inken,
aktiv like anla-aktiv,
deakt like anla-deakt,
zugdt like anla-zugdt,
zujhr like anla-zujhr,
zuper like anla-zuper,
gdlgrp like anla-gdlgrp,
anlue like anla-anlue,
xafabch like anla-xafabch,
aibn1 like anla-aibn1,
aibn2 like anla-aibn2,
aibdt like anla-aibdt,
posnr like anla-posnr,
ord41 like anla-ord41,
ord44 like anla-ord44,
vmgli like anla-vmgli,
invzu like anla-invzu,
typbz like anla-typbz,
lifnr like anla-lifnr,
ernam like anla-ernam,
erdat like anla-erdat,
end of it_itab1.
data: begin of it_itab2 occurs 0,
bukrs like anlz-bukrs,
anln1 like anlz-anln1,
anln2 like anla-anln2,
bdatu like anlz-bdatu,
werks like anlz-werks,
gsber like anlz-gsber,
kostl like anlz-kostl,
kostlv like anlz-kostlv,
stort like anlz-stort,
raumn like anlz-raumn,
txjcd like anlz-txjcd,
ipsnr like anlz-ipsnr,
end of it_itab2.
data: begin of it_itab3 occurs 0,
bukrs like anlh-bukrs,
anln1 like anlh-anln1,
anlhtxt like anlh-anlhtxt,
end of it_itab3.
data: begin of it_itab4 occurs 0,
bukrs like anlb-bukrs,
anln1 like anlb-anln1,
anln2 like anla-anln2,
afabe like anlb-afabe,
bdatu like anlb-bdatu,
afasl like anlb-afasl,
ndjar like anlb-ndjar,
ndper like anlb-ndper,
afabg like anlb-afabg,
ndurj like anlb-ndurj,
ndurp like anlb-ndurp,
umjar like anlb-umjar,
safbg like anlb-safbg,
zinbg like anlb-zinbg,
inbda like anlb-inbda,
end of it_itab4.
data: begin of it_itab5 occurs 0,
bukrs like anlc-bukrs,
anln1 like anlc-anln1,
anln2 like anla-anln2,
gjahr like anlc-gjahr,
afabe like anlc-afabe,
zujhr like anlc-zujhr,
zucod like anlc-zucod,
ndabj like anlc-ndabj,
ndabp like anlc-ndabp,
kansw like anlc-kansw,
knafa like anlc-knafa,
kaafa like anlc-kaafa,
ksafa like anlc-ksafa,
andsj like anlc-andsj,
andsp like anlc-andsp,
kanza like anlc-kanza,
kaufw like anlc-kaufw,
kinvz like anlc-kinvz,
kmafa like anlc-kmafa,
end of it_itab5.
ALV DECLARATIONS
*--declarations for Xls sheet header field names
data: begin of it_head occurs 0,
column(70).
data: end of it_head.
data: begin of it_head1 occurs 0,
column(70).
data: end of it_head1.
*--type declarations for field catalog for basic report
data: it_fldcat_head type slis_t_fieldcat_alv,
wa_fldcat_head type slis_fieldcat_alv."#EC NEEDED
data : w_field type slis_fieldcat_alv."#EC NEEDED
data: it_fldcat_head1 type slis_t_fieldcat_alv,
wa_fldcat_head1 type slis_fieldcat_alv."#EC NEEDED
*--type declarations for layout design
data: wa_layout type slis_layout_alv.
*--type declarations for list header on grid
*data: top_of_page type slis_t_listheader.
*--declaration of variables
data : w_repid like sy-repid.
**selection-screen
select-options: s_bukrs for anla-bukrs,
s_anln1 for anla-anln1.
select-options: s_deakt for anla-deakt,
s_gjahr for anlc-gjahr obligatory,
s_anlkl for anla-anlkl,
s_date for anla-aktiv.
*selection-screen
selection-screen begin of block blk1 with frame title text-022.
selection-screen begin of line.
parameters : r1 radiobutton group g1 default 'X'.
selection-screen comment 20(50) text-020.
selection-screen end of line.
selection-screen begin of line.
parameters : r2 radiobutton group g1.
selection-screen comment 20(50) text-021.
selection-screen end of line.
selection-screen end of block blk1.
selection-screen begin of block blk2 with frame title text-023.
select-options: s_ernam for anla-ernam,
s_erdat for anla-erdat .
selection-screen end of block blk2.
*--INITIALIZATION
initialization.
w_repid = sy-repid.
at selection-screen.
if r1 = 'X'.
perform selection_screen_validation.
endif.
if r2 = 'X'.
perform selection_screen_validation.
endif.
*--START-OF-SELCTION
start-of-selection.
if r1 = 'X'.
perform populate-data.
perform fill_finaldata.
perform comment_build using top_of_page.
perform xls_output.
perform download.
endif.
if r2 = 'X'.
perform populate-data.
perform fill_finaldata.
perform fill_as92data.
perform putdata_horizontal.
perform xls_output_as92.
perform download_as92.
endif.
*--END-OF-SELCTION
end-of-selection.
if r1 = 'X'.
perform build_layout.
perform build_fieldcatalog.
perform top_of_page.
perform list-display.
endif.
if r2 = 'X'.
perform build_layout.
perform build_fieldcatalog1.
perform list-display1.
endif.
*& Form SELECTION_SCREEN_VALIDATION
text
--> p1 text
<-- p2 text
form selection_screen_validation.
*--validating originating company code
data: l_bukrs like anla-bukrs."#EC NEEDED
if not s_bukrs[] is initial.
select single bukrs from anla
into l_bukrs
where bukrs in s_bukrs.
if sy-subrc <> 0.
message e000 with text-001 .
endif.
endif.
*--validating originating main asset no.
data: l_anln1 like anla-anln1."#EC NEEDED
if not s_anln1[] is initial.
select single anln1 from anla
into l_anln1
where anln1 in s_anln1.
if sy-subrc <> 0.
message e000 with text-002 .
endif.
endif.
*--validating originating Deactivation date
data: l_deakt like anla-deakt."#EC NEEDED
if not s_deakt[] is initial.
select single deakt from anla
into l_deakt
where deakt in s_deakt.
if sy-subrc <> 0.
message e000 with text-004 .
endif.
endif.
*--validating originating asset class.
data: l_anlkl like anla-anlkl."#EC NEEDED
if not s_anlkl[] is initial.
select single anlkl from anla
into l_anlkl
where anlkl in s_anlkl.
if sy-subrc <> 0.
message e000 with text-006 .
endif.
endif.
*--validating originating Date
data: l_date like anla-aktiv."#EC NEEDED
if not s_date[] is initial.
select single aktiv from anla
into l_date
where aktiv in s_date.
if sy-subrc <> 0.
message e000 with text-007 .
endif.
endif.
*--validating originating Fiscal year which first acquisition was posted
data: l_gjahr like anlc-gjahr."#EC NEEDED
if not s_gjahr[] is initial.
select single gjahr from anlc
into l_gjahr
where gjahr in s_gjahr.
if sy-subrc <> 0.
message e000 with text-008.
endif.
endif.
data: l_ernam like anla-ernam."#EC NEEDED
if not s_ernam[] is initial.
select single ernam from anla
into l_ernam
where ernam in s_ernam.
if sy-subrc <> 0.
message e000 with text-009.
endif.
endif.
data: l_erdat like anla-erdat."#EC NEEDED
if not s_erdat[] is initial.
select single erdat from anla
into l_erdat
where erdat in s_erdat.
if sy-subrc <> 0.
message e000 with text-010.
endif.
endif.
endform. " SELECTION_SCREEN_VALIDATION
*& Form POPULATE-DATA
text
--> p1 text
<-- p2 text
form populate-data.
select bukrs
anlkl
anln1
anln2
txt50
txa50
invnr
ktogr
sernr
menge
meins
ivdat
inken
aktiv
deakt
zugdt
zujhr
zuper
gdlgrp
anlue
xafabch
aibn1
aibn2
aibdt
posnr
ord41
ord44
vmgli
invzu
typbz
lifnr
ernam
erdat
from anla
into table it_itab1
where anlkl in s_anlkl and
anln1 in s_anln1 and
deakt in s_deakt and
bukrs in s_bukrs and
aktiv in s_date.
if sy-subrc ne 0.
message e000 with 'Data does not exist'(094).
endif.
if not it_itab1[] is initial.
select bukrs
anln1
anln2
bdatu
werks
gsber
kostl
kostlv
stort
raumn
txjcd
ipsnr
from anlz
into table it_itab2
for all entries in it_itab1
where bukrs = it_itab1-bukrs and
anln1 = it_itab1-anln1 and
anln2 = it_itab1-anln2.
anln2 = '0000'.
if sy-subrc ne 0.
message e000 with 'Data does not exist'(094).
endif.
endif.
if not it_itab2[] is initial.
select bukrs
anln1
anlhtxt
from anlh
into table it_itab3
for all entries in it_itab2
where bukrs = it_itab2-bukrs and
anln1 = it_itab2-anln1.
if sy-subrc ne 0.
message e000 with 'Data does not exist'(094).
endif.
endif.
if not it_itab1[] is initial.
select bukrs
anln1
anln2
afabe
bdatu
afasl
ndjar
ndper
afabg
ndurj
ndurp
umjar
safbg
zinbg
inbda
from anlb
into table it_itab4
for all entries in it_itab1
where bukrs = it_itab1-bukrs and
anln1 = it_itab1-anln1 and
anln2 = it_itab1-anln2.
anln2 = '0000'.
if sy-subrc ne 0.
message e000 with 'Data does not exist'(094).
endif.
endif.
sort it_itab4 by bukrs anln1 anln2 afabe.
if not it_itab4[] is initial.
select bukrs
anln1
anln2
gjahr
afabe
zujhr
zucod
ndabj
ndabp
kansw
knafa
kaafa
ksafa
andsj
andsp
kanza
kaufw
kinvz
kmafa
from anlc
into table it_itab5
for all entries in it_itab4
where bukrs = it_itab4-bukrs and
anln1 = it_itab4-anln1 and
anln2 = it_itab4-anln2 and
anln2 = '0000' and
gjahr in s_gjahr.
if sy-subrc ne 0.
message e000 with 'Data does not exist'(094).
endif.
endif.
sort it_itab5 by bukrs anln1 anln2 ndabj ndabp.
endform. " POPULATE-DATA
*& Form FILL_FINALDATA
text
--> p1 text
<-- p2 text
form fill_finaldata.
loop at it_itab5.
loop at it_itab4 where bukrs = it_itab5-bukrs and
anln1 = it_itab5-anln1 and
anln2 = it_itab5-anln2 and
afabe = it_itab5-afabe.
it_final-afabe = it_itab4-afabe.
it_final-afasl = it_itab4-afasl.
it_final-ndjar = it_itab4-ndjar.
it_final-ndper = it_itab4-ndper.
it_final-afabg = it_itab4-afabg.
it_final-umjar = it_itab4-umjar.
it_final-safbg = it_itab4-safbg.
it_final-inbda = it_itab4-inbda.
it_final-ndabj = it_itab5-ndabj.
it_final-ndabp = it_itab5-ndabp.
it_final-kansw = it_itab5-kansw.
it_final-knafa = it_itab5-knafa.
it_final-kaafa = it_itab5-kaafa.
it_final-andsj = it_itab5-andsj.
it_final-andsp = it_itab5-andsp.
it_final-kanza = it_itab5-kanza.
it_final-kaufw = it_itab5-kaufw.
it_final-kinvz = it_itab5-kinvz.
it_final-ksafa = it_itab5-ksafa.
it_final-kmafa = it_itab5-kmafa.
read table it_itab1 with key bukrs = it_itab5-bukrs
anln1 = it_itab5-anln1
anln2 = it_itab5-anln2.
if sy-subrc = 0.
it_final-anlkl = it_itab1-anlkl.
it_final-anln1 = it_itab1-anln1.
it_final-anln2 = it_itab1-anln2.
it_final-bukrs = it_itab1-bukrs.
it_final-txt50 = it_itab1-txt50.
it_final-txa50 = it_itab1-txa50.
it_final-invnr = it_itab1-invnr.
it_final-sernr = it_itab1-sernr.
it_final-menge = it_itab1-menge.
it_final-meins = it_itab1-meins.
it_final-ivdat = it_itab1-ivdat.
it_final-inken = it_itab1-inken.
it_final-aktiv = it_itab1-aktiv.
it_final-deakt = it_itab1-deakt.
it_final-gdlgrp = it_itab1-gdlgrp.
it_final-anlue = it_itab1-anlue.
it_final-aibn1 = it_itab1-aibn1.
it_final-aibn2 = it_itab1-aibn2.
it_final-aibdt = it_itab1-aibdt.
it_final-ord41 = it_itab1-ord41.
it_final-ord44 = it_itab1-ord44.
it_final-vmgli = it_itab1-vmgli.
it_final-typbz = it_itab1-typbz.
it_final-lifnr = it_itab1-lifnr.
it_final-posnr = it_itab1-posnr.
it_final-invzu = it_itab1-invzu.
endif.
read table it_itab2 with key bukrs = it_itab5-bukrs
anln1 = it_itab5-anln1
anln2 = it_itab5-anln2.
if sy-subrc = 0.
it_final-werks = it_itab2-werks.
it_final-gsber = it_itab2-gsber.
it_final-kostl = it_itab2-kostl.
it_final-kostlv = it_itab2-kostlv.
it_final-stort = it_itab2-stort.
it_final-raumn = it_itab2-raumn.
it_final-txjcd = it_itab2-txjcd.
endif.
read table it_itab3 with key bukrs = it_itab5-bukrs
anln1 = it_itab5-anln1.
if sy-subrc = 0.
it_final-anlhtxt = it_itab3-anlhtxt.
endif.
append it_final.
clear it_final.
endloop.
endloop.
loop at it_final.
move-corresponding it_final to it_final_as91.
append it_final_as91.
clear it_final_as91.
endloop.
delete adjacent duplicates from it_final_as91 comparing anlkl bukrs
anln1 anln2.
it_download_as91[] = it_final_as91[].
endform. " FILL_FINALDATA
*& Form BUILD_LAYOUT
text
--> p1 text
<-- p2 text
form build_layout.
wa_layout-zebra = 'X'.
endform. " BUILD_LAYOUT
*& Form BUILD_FIELDCATALOG
text
--> p1 text
<-- p2 text
form build_fieldcatalog.
if it_fldcat_head is initial.
v_pos = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ANLKL'.
wa_fldcat_head-seltext_l = 'Asset Class'(093).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'BUKRS'.
wa_fldcat_head-seltext_l = 'Company'(092).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ANLN1'.
wa_fldcat_head-seltext_l = 'Asset No'(091).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ANLN2'.
wa_fldcat_head-seltext_l = 'Asset Sub No'(090).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'TXT50'.
wa_fldcat_head-seltext_l = 'Asset Des.'(089).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'TXA50'.
wa_fldcat_head-seltext_l = 'Asset Des.'(088).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ANLHTXT'.
wa_fldcat_head-seltext_l = 'Asset main no txt'(087).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'SERNR'.
wa_fldcat_head-seltext_l = 's.no/Expl no.'(086).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'INVNR'.
wa_fldcat_head-seltext_l = 'Inv No'(085).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'MENGE'.
wa_fldcat_head-seltext_l = 'Qtty'(084).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'MEINS'.
wa_fldcat_head-seltext_l = 'Units'(083).
append wa_fldcat_head to it_fldcat_head.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'INKEN'.
wa_fldcat_head-seltext_l = 'Inv indi.'(082).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'IVDAT'.
wa_fldcat_head-seltext_l = 'Last inv date'(081).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'AKTIV'.
wa_fldcat_head-seltext_l = 'Asset Capital date'(080).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'GSBER'.
wa_fldcat_head-seltext_l = 'Busin. Area'(079).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'KOSTL'.
wa_fldcat_head-seltext_l = 'cost centre'(078).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'KOSTLV'.
wa_fldcat_head-seltext_l = 'CC respon.for asset'(077).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'WERKS'.
wa_fldcat_head-seltext_l = 'Plant'(076).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'STORT'.
wa_fldcat_head-seltext_l = 'Asset location'(075).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'RAUMN'.
wa_fldcat_head-seltext_l = 'Room'(074).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'TXJCD'.
wa_fldcat_head-seltext_l = 'Tax. Jur.'(073).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ORD41'.
wa_fldcat_head-seltext_l = 'Evaluation Grp 1'(072).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ORD44'.
wa_fldcat_head-seltext_l = 'Evaluation Grp 4'(071).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'GDLGRP'.
wa_fldcat_head-seltext_l = 'Evalu. group 5'(070).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'ANLUE'.
wa_fldcat_head-seltext_l = 'Asset Super No'(069).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'LIFNR'.
wa_fldcat_head-seltext_l = 'Vendor Acct. No.'(068).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'TYPBZ'.
wa_fldcat_head-seltext_l = 'Reference no'(067).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'AIBN1'.
wa_fldcat_head-seltext_l = 'Original Asset Trans.'(066).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'AIBN2'.
wa_fldcat_head-seltext_l = 'Original Asset Trans.'(065).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'AIBDT'.
wa_fldcat_head-seltext_l = 'Trans. Asset'(064).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'POSNR'.
wa_fldcat_head-seltext_l = 'WBS Elt. Invt. Proj.'(063).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'VMGLI'.
wa_fldcat_head-seltext_l = 'Property clas.key'(062).
append wa_fldcat_head to it_fldcat_head.
V_POS = 0.
v_pos = v_pos + 1.
w_field-col_pos = v_pos.
wa_fldcat_head-tabname = 'it_FINAL_AS91'.
wa_fldcat_head-fieldname = 'INVZU'.
wa_fldcat_head-seltext_l = 'suppl.inv spec.'(061).
append wa_fldcat_head to it_fldcat_head.
endif.
endform. " BUILD_FIELDCATALOG
*& Form COMMENT_BUILD
text
-->P_TOP_OF_PAGE text
*form comment_build using top_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
****Header
clear : ls_line.
ls_line-typ = 'H'.
LS_LINE-KEY: not used for this type
ls_line-info = 'ASSET MASTER DATA LIST'.
append ls_line to top_of_page.
****Selection
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Key 1'.
ls_line-info = 'Asset Records'.
append ls_line to top_of_page.
****Action
clear ls_line.
ls_line-typ = 'A'.
LS_LINE-KEY: not used for this type
ls_line-info = 'for AS91'.
append ls_line to top_of_page.
*endform. "comment_build
FORM top_of_page *
*form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = top_of_page.
*endform. "top_of_page
*& Form LIST-DISPLAY
text
--> p1 text
<-- p2 text
form list-display.
wa_layout-colwidth_optimize = 'X'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = w_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = wa_layout
it_fieldcat = it_fldcat_head
i_background_id = 'ALV_BACKGROUND'
tables
t_outtab = it_final_as91
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
write:/'No Top of Page'(098).
endif.
endform. " LIST-DISPLAY
*& Form DOWNLOAD
text
--> p1 text
<-- p2 text
form download.
perform setup_header.
call function 'DOWNLOAD'
exporting
filetype = 'DAT'
tables
data_tab = it_download_as91
fieldnames = it_head
exceptions
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
customer_error = 7
others = 8.
if sy-subrc <> 0.
write:/'Error in file Type'(097).
endif.
endform. " DOWNLOAD
*& Form setup_header
text -
Webforms - Wrap Text/Word Wrap for Column Headings
I have some member aliases that are set as my webform's column headings, but they are fairly long. Setting the column width to a custom value that fits most of the text in the heading makes the form very wide and ugly to work with. I don't see any option to Wrap Text or use Word Wrap in the column headings. Is there any way to do this?
Thanks!Hi,
I am not aware of any option which allows you to wrap the text, it may be possible customizing the [CSS |http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_hp_admin/ch12s03.html] though to be honest I am not even sure about that and even if it was possible it would apply to all apps.
Cheers
John
http://john-goodwin.blogspot.com/ -
LOV of column names with a report's custom column headings?
I have a list ov values definition that looks like this:
select column_name d, column_name r from all_tab_columns where table_name = 'DATABASE_LIST'
I'd like to list the custom column headings from a report as d, rather than repeating the column_name. How can I do this?As Anton said, the best thing is to store your custom headings in a table so that you can use the table for your LOV as well as for your report headings.
To use dynamic report headings, you can use the 'PL/SQL function body returning colon-delimited headings' feature on the Report Attributes page.
So, if your report headings are stored in table t that function body can be
declare
l_headings varchar2(4000)
begin
for rec in (select heading from t) loop
l_headings := l_headings||':'||rec.heading;
end loop;
return ltrim(l_heading,':');
end;Hope this helps. -
Dynamic crystal report generation - issues with column headings
Hi All,<br>
I'm trying to generate a crystal report dynamically based on a "result set" data(Query: select REPORT_ID, REPORT_NAME, REPORT_DESC, RPT_FILE_NAME, LOCATION from IRS_REPORT_DETAILS). I'm able to generate the report run time, But the report is without columns heads. I would like to include the column headings as well. <br><br>
I searched the API(RAS) and found that there is a 'add(java.lang.String fieldName, java.lang.String headingText) " method present in "ReportObjectController" using which we can add the headings.<br><br>
ReportDefController reportDefController = clientDoc.getReportDefController();
ReportObjectController reportObjectController = reportDefController.getReportObjectController();
reportObjectController.add( "{Table.Field}", "FieldName" );
<br><br>
I'm facing problems in using this code. When trying to use this function for my fields(Ex: reportObjectController.add( "{ IRS_REPORT_DETAILS.REPORT_ID}", "Report ID" );) it is giving me the following error:<br><br>"com.crystaldecisions.sdk.occa.report.lib.ReportSDKGroupException: The field was not found.---- Error code:-2147213310 Error code name:fieldNotFound"<br><br>
<b>The following is my dynamic crystal report generation code:</b><br><br>
public ReportClientDocument execute(String repName, String query) {
ReportClientDocument boReportClientDocument = null;
try {
boReportClientDocument = new ReportClientDocument();
boReportClientDocument.newDocument();
// Add a table based on the given Resultset to the report.
dbConnResultSet mySampleResultSet = new dbConnResultSet();
//mySampleResultSet.execute(query);
boReportClientDocument.getDatabaseController().addDataSource(
mySampleResultSet.execute(query));
IReportSource test = boReportClientDocument.getReportSource();
// Access all the database fields
DatabaseController databaseController = boReportClientDocument
.getDatabaseController();
IDatabase database = databaseController.getDatabase();
Tables tables = database.getTables();
ITable table = (Table) tables.getTable(0);
int NO_OF_FIELDS = table.getDataFields().size();
int LEFT_POSITION = 200;
// Add all the database fields to the report document
for (int i = 0; i < NO_OF_FIELDS; i++) {
IField field = table.getDataFields().getField(i);
FieldObject fieldObject = new FieldObject();
fieldObject.setFieldValueType(field.getType());
fieldObject.setDataSource(field.getFormulaForm());
IReportObject rep = (IReportObject) fieldObject;
IObjectFormat objformat = rep.getFormat();
objformat.setEnableCanGrow(true);
objformat.setHorizontalAlignment(Alignment.from_int(1));
rep.setFormat(objformat);
rep.setLeft(LEFT_POSITION);
rep.setWidth(1000);
LEFT_POSITION = LEFT_POSITION + 1000 + 50;
ISection section = boReportClientDocument
.getReportDefController().getReportDefinition()
.getDetailArea().getSections().getSection(0);
//***************** Data being added to the report here, But headings are not added*****************
boReportClientDocument.getReportDefController()
.getReportObjectController().add(rep, section, i);
boReportClientDocument.createReport();
/*Some report saving code is present down*/
} catch (ReportSDKException ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
return boReportClientDocument;
<br><br>
appreciate your help.IField field = table.getDataFields().getField(i);
Here you are getting the first field in the array. This may not be the field you want to add since we aren't sure how the arrays are ordered when retrieving fields from the report. It is better to retrieve the fields with the findObjectByName method, thus ensuring you are retrieving the field you want to add to your heading. -
How can i change the column label text in a alv table display
how can i change the column label text in a alv table display??
A similar kinda of question was posted previuosly where the requirement was the label text was needed and following below code was given as solution :
<i>* declare column, settings, header object
DATA: lr_column TYPE REF TO cl_salv_wd_column.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
DATA: lr_column_header type ref to CL_SALV_WD_COLUMN_HEADER.
get column by specifying column name.
lr_column = lr_column_settings->get_column( 'COLUMN_NAME1' ).
set Header Text as null
lr_column_header = lr_column->get_header( ).
lr_column_header->set_text( ' ' ).</i>
My specific requirement is i have an input field on the screen and i want reflect that value as the column label for one of the column in the alv table. I have used he above code with slight modification in the MODIFYVIEW method of the view since it is a process after input. The component gets activated without any errors but while run time i get an error stating
<i>"The following error text was processed in the system CDV : Access via 'NULL' object reference not possible."</i>
i have checked in debugging and the error occured at the statement :
<i>lr_column = lr_column_settings->get_column( 'CURRENT_YEAR' ).</i>Please can you provide me an alternative for my requirement or correct me if i have done it wrong.
Thanks,
SuriI found it myself how to do it. The error says that it is not able to find the reference object i.e it is asking us to refer to the table. The following piece of code will solve this problem. Have to implement this in WDDOMODIFYVIEW method of the view. This thing works comrades enjoy...
DATA : lr_cmp_usage TYPE REF TO if_wd_component_usage,
lr_if_controller TYPE REF TO iwci_salv_wd_table,
lr_cmdl TYPE REF TO cl_salv_wd_config_table,
lr_col TYPE REF TO cl_salv_wd_column.
DATA : node_year TYPE REF TO if_wd_context_node,
elem_year TYPE REF TO if_wd_context_element,
stru_year TYPE if_alv_layout=>element_importing,
item_year LIKE stru_year-i_current_year,
lf_string TYPE char(x),
DATA: lr_column TYPE REF TO cl_salv_wd_column.
DATA: lr_column_header TYPE REF TO cl_salv_wd_column_header.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
Get the entered value from the input field of the screen
node_year = wd_context->get_child_node( name = 'IMPORTING_NODE' ).
elem_year = node_year->get_element( ).
elem_year->get_attribute(
EXPORTING
name = 'IMPORT_NODE-PARAMETER'
IMPORTING
value = L_IMPORT_PARAM ).
WRITE L_IMPORT_PARAM TO lf_string.
Get the reference of the table
lr_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lr_cmp_usage->has_active_component( ) IS INITIAL.
lr_cmp_usage->create_component( ).
ENDIF.
lr_if_controller = wd_this->wd_cpifc_alv( ).
lr_column_settings = lr_if_controller->get_model( ).
get column by specifying column name.
IF lr_column_settings IS BOUND.
lr_column = lr_column_settings->get_column( 'COLUMN_NAME').
set Header Text as null
lr_column_header = lr_column->get_header( ).
lr_column_header->set_text( lf_string ).
endif. -
Column headings in a file extract to excel
I am writing a program that will extract data and download it as a tab delimited file which will be input to excel. I need to put column headings on the file and I have attached an sample of the code that I am using. It is working fine but I am not sure if this is the correct approach I have a file that has 87 columns in it.
thanks in advance for the help.
DATA: begin of header_line occurs 0,
line(50) type c,
end of header_line.
FORM build_header_line.
header_line-line = 'Vendor'.
append header_line.
header_line-line = 'CoCd'.
append header_line.
header_line-line = 'POrg'.
append header_line.
header_line-line = 'Group'.
append header_line.
header_line-line = 'Name'.
append header_line.
.(87 times)
ENDFORM. " build_header_line.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_path
write_field_separator = 'X'
TABLES
fieldnames = header_line
data_tab = it_extract_data
EXCEPTIONSHi Timothy,
The current approach of your code doesnt include a header to your file.
Header is used add information about the code page and the byte sequence if the internal table was created through a code page conversion using gui_convert_codepage and it is of type hexadecimal with a length of at most 1023 bytes.
1)Have a separate internal table for your structure and pass this internal table data to FM 'GUI_DOWNLOAD'.
2)Have a second internal table which holds your data and use FM 'GUI_DOWNLOAD' with Importing parameter APPEND as 'X' with the same FILENAME which you used in first GUI_DOWNLOAD function module.
Thanks,
Vinay -
How to haveour own titles/captions in selection screen & in column headings
we have SAP B1 2005 A, MS SQL 2005
though i am new to MSSQL/T-SQL programming, purely through lot of trials & errors i have learnt & managed to develop many reports/queries !
but, i am facing some problems : how to have our own captions/title for the options in selection screen & aso in reports/queries column headings.
e.g. :
for Customer Aging analysis, i would like to accept a set of 3 parameters (aging days) from the user. where the user may enter the values 30, 60 & 90 OR any other values.
i have the following codes for this purpose (considering my question's (over) size, only small portions of my program are given below)
declare @mdue1 int,
@mdue2 int,
@mdue3 int
set @mdue1 = [%1]
set @mdue2 = [%2]
set @mdue3 = [%3]
but, in the selection screen, the system displays "%1 Debit Amount Greater than" as the caption & 0.00 as the default value. the same is the case for the other two parameters [%2] & [%3] also.
i tried defining the variable @mdue1 as smallint & also tinyint, but the result is the same.
how to have our own captions/title for the options in selection screen instead of the ones displayed by t-sql based on our SELECT statement.
how to have our own column headings, dynamically defined/coined using variables instead of hard coded columns headings (within quotes).
e.g. in the select statement, instead of defining a column as '<= 30 Days' = T0.due_1
i would like to get the number of days from the user, who may enter 30 or 40 or whatever.
i would like to display the value that the user entered in the column heading using a variable say @mcol1
declare @mcol1 varchar(10)
set @mcol1 = '<= 'convert(varchar(10), @mdue1)' Days'
SELECT T0.CardCode,@mcol1 = T0.due_1 from #CustAging T0
but, this ends up in error.
i have already searched the net for ebooks, articles, etc. for a solution to this problem, but till now, i could not find any addressing these problems.
i have just registered in this forum with a hope to get a solution. thanks a lot in advance.
Thanks & Regards,
Raghu Iyer
Place : Vapi, Gujarat, Indiathanks a lot, lstvan.
i think, it i a good "trick" worth trying out.
well, i will now mark this question as answered, but still, if anyone has a direct solution "problem", please do share with us.
i am able to write queries (in fact, full fledged programs) in T-SQL & getting the desired output and for such a trivial thing i do not want to go for an add-on SDK module. but, considering the limitations of T-SQL and the complex requirements of real business world, i think, we have to go the .net way only.
regarding add-ons, i heard that add-ons will slow down SAP B1. is it true ?
Thanks & Regards,
Raghu iyer -
Using Excel 2008 for a Mac on my laptop
Part of toolbar has disappeared (windows, help, view, etc) --- want to restore
Need to freeze column headings but freezing option was not working prior to disappearance of tool barHi Alveretta,
Thanks for posting in MSDN forum.
This forum is for developers discussing developing issues on Windows platform. I suggest to get more effective response from
Office for mac forum.
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or
learn from your interaction with us.
Thanks for your understanding.
Best regards
Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Maybe you are looking for
-
Laptop shut down and now won't power back up. Getting flashing orange light on front of computer
-
Is it possible to use a smaller configuration
Hi everybody, I am new to OpenSparc community. I want to make a project which is using OpenSparc core, but there is one thing that I want to make sure. It is about which FPGA to choose to implement the core. First of all I checked the website http://
-
CF9 Not Rendering Flash Charts
We just upgraded two Windows Server 2008 R2 servers, one development, one production, from CF7 to CF9 (9.01). Did the same installation on both. For some reason, the Dev server will not render charts (created in Web Charts 3D) in Flash, but will us
-
RE.Can We do (MIGO) Batch No based Logistics Invoice Verification(MIRO)
Dear All While doing invoice verification reference to MIGO Doc. we are not able to see Vendor Batch No field in MIRO Screens. I.e Item No. 10 100No's as per DC/Invoice Received stores were Accepted. But in Production QC Accepted 80 No's 20 Rejected
-
Golden arrows in a formatted search
Hi I have a simple query that works fine and returns the golden arrows so I can drill into the documents. I then created a header UDF on the sales order and put a formatted search on that field. The formatted search is set to use that query with no