Getting only one coloum in alv grid
hi ,
i m facing a very strange problem. in my report i m getting exect data in my final table but when i m going to show it, it is showing only first coloum. well problem is coming in field catalog merge, it is not appending the whole coloum heading except first one. i did right coding but failed to get the result.
plz if anybody faced the same problem suggest me the solution.
it's really urgent.
REPORT zfir_fix_ar NO STANDARD PAGE HEADING LINE-SIZE 255 LINE-COUNT 72.
Tables *
TABLES : t001,anla,anlb,anlc,bsis,t095t.
TYPE-POOL *
TYPE-POOLS: slis.
Internal Table Declaratin *
DATA: BEGIN OF i_anla OCCURS 0,
bukrs TYPE anla-bukrs,
anln1 TYPE anla-anln1,
aktiv TYPE anla-aktiv,
txt50 TYPE anla-txt50,
txa50 TYPE anla-txa50,
zugdt TYPE anla-zugdt,
abgdt TYPE anla-abgdt,
ktogr TYPE anla-ktogr,
sernr TYPE anla-sernr,
invnr TYPE anla-invnr,
menge TYPE anla-menge,
meins TYPE anla-meins,
lifnr TYPE anla-lifnr,
liefe TYPE anla-liefe,
afabg TYPE anlb-afabg,
END OF i_anla.
DATA:BEGIN OF i_anlc OCCURS 0,
bukrs TYPE anlc-bukrs,
anln1 TYPE anlc-anln1,
kansw TYPE anlc-kansw,
knafa TYPE anlc-knafa,
nafap TYPE anlc-nafap,
answl TYPE anlc-answl,
END OF i_anlc.
DATA:BEGIN OF i_anlz OCCURS 0,
bukrs TYPE anlz-bukrs,
anln1 TYPE anlz-anln1,
raumn TYPE anlz-raumn,
END OF i_anlz.
DATA: BEGIN OF i_bsis OCCURS 0.
INCLUDE STRUCTURE bsis.
DATA: END OF i_bsis.
DATA: BEGIN OF i_final OCCURS 0,
srno TYPE i, " Serial no
anln1 TYPE anla-anln1, " asset code no
txt50 TYPE anla-txt50, " Brief Description of Assets
txa50 TYPE anla-txa50, " Further Description
ktogr TYPE anla-ktogr, " Asset Class No.
ktgrtx TYPE t095t-ktgrtx, " Asset Class Name
sernr TYPE anla-sernr, " Serial Number
invnr TYPE anla-invnr, " Assets Identification No
menge TYPE anla-menge, " Qty
meins TYPE anla-meins, " UOM
raumn TYPE anlz-raumn, " Location
lifnr TYPE anla-lifnr, " Vendor
liefe TYPE anla-liefe, " Capitalisation Date
aktiv TYPE anla-aktiv, " Date put to use
g_kansw TYPE anlc-kansw, " Opening Gross Block
b_kansw TYPE anlc-kansw, " Additions during the period
b_answl TYPE anlc-answl," Deductions/ Adjustmentsduring d period
g_total TYPE bsis-dmbtr, " Closing Gross Block
d_open TYPE anlb-afabg, " Dep on opening block
d_sold TYPE anlb-afabg, " Dep on assets sold/written off
d_add TYPE anlb-afabg, " dep on additions during the period
afabg TYPE anlb-afabg, " Total dep for the period
cd_sold TYPE bsis-dmbtr, " *** Dep on assets sold
cd_asst TYPE bsis-dmbtr, " *** Dep on assets written off
cd_dep TYPE bsis-dmbtr, " Total *** dep on deductions
ccd_dep TYPE bsis-dmbtr, " Closing Acc Dep
a TYPE bsis-dmbtr, " WDV of assets sold
b TYPE bsis-dmbtr, " Selling Price
c TYPE bsis-dmbtr, " Profit / (Loss) on sale
d TYPE bsis-dmbtr, " Loss on write off
e TYPE bsis-dmbtr, " Opening WDV
f TYPE bsis-dmbtr, " Closing WDV
END OF i_final.
DATA : text(30).
DATA : b_date TYPE sy-datum.
Global variables
DATA: g_repid LIKE sy-repid,
g_events TYPE slis_t_event,
g_list_top_of_page TYPE slis_t_listheader,
g_exit_caused_by_caller,
g_exit_caused_by_user TYPE slis_exit_by_user,
g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
g_save TYPE c.
Declaration for Constants
CONSTANTS : c_x TYPE c VALUE 'X', " Flag
c_c TYPE c VALUE 'C', " Flag
c_l TYPE c VALUE 'L', " Flag
c_a TYPE c VALUE 'A', " Line Type
c_h TYPE c VALUE 'H', " Dr/Cr
c_s TYPE c VALUE 'S'. " Line Type
* Internal table to hold field catgory data
DATA: i_fldcat TYPE slis_t_fieldcat_alv. " Table - field catgory
Internal table to hold Sort/Subtotals criteria data
DATA: i_sort TYPE slis_t_sortinfo_alv. " Table - sort/Subtotals
Structure
DATA: x_layout TYPE slis_layout_alv, " Structure-layout
x_fldcat LIKE LINE OF i_fldcat, " Structure-field catagory
x_sort LIKE LINE OF i_sort. " Structure-Sort/Subtotals
s e l e c t i o n s c r e e n
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
SELECT-OPTIONS : s_bukrs FOR t001-bukrs OBLIGATORY NO INTERVALS
NO-EXTENSION.
SELECT-OPTIONS : s_anlkl FOR anla-anlkl.
SELECT-OPTIONS : s_anln FOR anla-anln1.
SELECT-OPTIONS : s_date FOR sy-datum OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.
Initialization
INITIALIZATION.
g_repid = sy-repid.
PERFORM layout_init USING x_layout.
PERFORM eventtab_build USING g_events[].
START OF SELECTION *
START-OF-SELECTION.
PERFORM calc_date.
PERFORM get_data.
PERFORM move_data.
*PERFORM display_data.
End of selection
END-OF-SELECTION.
Build layout report layout.
PERFORM populate_layout_stucture.
Perform build_field_catalog and Sort Table
PERFORM build_field_catalog.
PERFORM BUILD_SORT_TOTALS.
List Header for Top-Of-Page
PERFORM comment_build USING g_list_top_of_page[].
Call list viewer function module
PERFORM call_list_viewer .
****************Form - Routines************************************
Form : layout_init
Description : Form to Build layout for list display
FORM layout_init USING rs_layout TYPE slis_layout_alv.
rs_layout-detail_popup = c_x.
ENDFORM. "layout_init
Form : Eventtab_build
Description : Registration of events to happen during list display
FORM eventtab_build USING rt_events TYPE slis_t_event.
Registration of events to happen during list display
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = rt_events.
READ TABLE rt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE g_top_of_page TO ls_event-form.
APPEND ls_event TO rt_events.
ENDIF.
ENDFORM. "eventtab_build
Form : top_of_page
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = g_list_top_of_page.
ENDFORM. "top_of_page
*& Form GET_Data
text
--> p1 text
<-- p2 text
FORM get_data .
SELECT abukrs aanln1 aaktiv atxt50 atxa50 azugdt aabgdt aktogr
asernr ainvnr amenge ameins alifnr aliefe b~afabg
INTO TABLE i_anla
FROM anla AS a INNER JOIN anlb AS b
ON aanln1 EQ banln1 AND
abukrs EQ bbukrs
WHERE a~anln1 IN s_anln
AND a~anlkl IN s_anlkl
AND a~bukrs IN s_bukrs
AND b~afabe = '01'.
SELECT bukrs anln1 kansw knafa nafap answl INTO TABLE i_anlc
FROM anlc
FOR ALL ENTRIES IN i_anla
WHERE anln1 = i_anla-anln1
AND bukrs = i_anla-bukrs.
SELECT bukrs anln1 raumn FROM anlz INTO TABLE i_anlz
FOR ALL ENTRIES IN i_anla
WHERE anln1 = i_anla-anln1
AND bukrs = i_anla-bukrs.
ENDFORM. " GET_Data
*& Form Move_data
text
--> p1 text
<-- p2 text
FORM move_data .
LOOP AT i_anla.
MOVE i_anla-anln1 TO i_final-anln1.
MOVE i_anla-txt50 TO i_final-txt50.
MOVE i_anla-txa50 TO i_final-txa50.
MOVE i_anla-ktogr TO i_final-ktogr.
MOVE i_anla-sernr TO i_final-sernr.
MOVE i_anla-invnr TO i_final-invnr.
MOVE i_anla-menge TO i_final-menge.
MOVE i_anla-meins TO i_final-meins.
MOVE i_anla-afabg TO i_final-afabg.
MOVE i_anla-lifnr TO i_final-lifnr.
MOVE i_anla-liefe TO i_final-liefe.
MOVE i_anla-aktiv TO i_final-aktiv.
SELECT SINGLE * FROM t095t WHERE spras = 'E'
AND ktogr = i_anla-ktogr.
MOVE t095t-ktgrtx TO i_final-ktgrtx.
READ TABLE i_anlc WITH KEY anln1 = i_anla-anln1
bukrs = i_anla-bukrs.
IF sy-subrc EQ 0.
IF i_anla-zugdt LT s_date-low.
MOVE i_anlc-kansw TO i_final-g_kansw.
ELSEIF i_anla-abgdt BETWEEN s_date-low AND s_date-high.
MOVE i_anlc-kansw TO i_final-b_answl.
MOVE i_anlc-nafap TO i_final-d_add.
ELSEIF i_anla-aktiv BETWEEN s_date-low AND s_date-high.
MOVE i_anlc-kansw TO i_final-b_kansw.
MOVE i_anlc-nafap TO i_final-d_sold.
ELSE.
MOVE i_anlc-nafap TO i_final-d_open.
ENDIF.
i_final-cd_sold = i_final-d_open + i_final-d_sold.
i_final-cd_asst = i_final-d_open + i_final-d_sold.
i_final-cd_dep = i_final-cd_sold + i_final-cd_asst.
i_final-ccd_dep = i_final-afabg + i_final-d_open - i_final-cd_dep.
i_final-a = i_final-b_answl - i_final-cd_sold.
i_final-d = i_final-b_answl - i_final-cd_asst.
i_final-e = i_final-g_kansw - i_final-d_open.
i_final-f = i_final-g_kansw - i_final-ccd_dep.
i_final-afabg = i_final-d_sold + i_final-d_open +
i_final-d_add.
i_final-g_total = i_final-g_kansw + i_final-b_answl +
i_final-b_kansw.
ENDIF.
READ TABLE i_anlz WITH KEY anln1 = i_anla-anln1
bukrs = i_anla-bukrs.
IF sy-subrc EQ 0.
MOVE i_anlz-raumn TO i_final-raumn.
ENDIF.
APPEND i_final.
CLEAR i_final.
ENDLOOP.
ENDFORM. " Move_data
Form : populate_layout_stucture
Description : Populating the layout structure
FORM populate_layout_stucture.
CLEAR x_layout .
Layout properties
x_layout-zebra = c_x.
x_layout-detail_popup = c_x.
x_layout-detail_initial_lines = c_x.
x_layout-colwidth_optimize = c_x.
ENDFORM. " populate_layout_stucture
Form : build_field_catalog
Description : Building the field catalog data
FORM build_field_catalog.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = g_repid
i_internal_tabname = 'I_FINAL'
i_inclname = g_repid
CHANGING
ct_fieldcat = i_fldcat.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*DATA: SY-
Getting the Header text for the coloums
LOOP AT i_fldcat INTO x_fldcat WHERE fieldname = 'SRNO' OR
fieldname = 'ANLN1' OR
fieldname = 'TXT50' OR
fieldname = 'TXA50' OR
fieldname = 'KTOGR' OR
fieldname = 'KTGRTX' OR
fieldname = 'SERNR' OR
fieldname = 'INVNR' OR
fieldname = 'MENGE' OR
fieldname = 'MEINS' OR
fieldname = 'RAUMN' OR
fieldname = 'LIFNR' OR
fieldname = 'LIEFE' OR
fieldname = 'AKTIV' OR
fieldname = 'AFABG' OR
fieldname = 'G_KANSW' OR
fieldname = 'B_KANSW' OR
fieldname = 'B_ANSWL' OR
fieldname = 'G_TOTAL' OR
fieldname = 'D_OPEN' OR
fieldname = 'D_SOLD' OR
fieldname = 'D_ADD' OR
fieldname = 'AFABG' OR
fieldname = 'CD_SOLD' OR
fieldname = 'CD_ASST' OR
fieldname = 'CD_DEP' OR
fieldname = 'CCD_DEP' OR
fieldname = 'A' OR
fieldname = 'B' OR
fieldname = 'C' OR
fieldname = 'D' OR
fieldname = 'E' OR
fieldname = 'F'.
IF x_fldcat-fieldname = 'SRNO'.
x_fldcat-seltext_l = 'Sr. No'.
x_fldcat-outputlen = 6.
x_fldcat-just = 'C'.
x_fldcat-key = 'X'.
x_fldcat-inttype = c_c.
ENDIF.
IF x_fldcat-fieldname = 'ANLN1'.
x_fldcat-outputlen = 17.
x_fldcat-seltext_l = 'SAP Asset Code'.
x_fldcat-just = 'L'.
x_fldcat-key = 'X'.
x_fldcat-inttype = c_c.
x_fldcat-seltext_m = 'SAP Asset Code'.
x_fldcat-seltext_s = 'SAP Asset Code'.
x_fldcat-reptext_ddic = 'SAP Asset Code'.
ENDIF.
IF x_fldcat-fieldname = 'TXT50'.
x_fldcat-outputlen = 50.
x_fldcat-seltext_l = 'Brief Description of Assets'.
x_fldcat-just = 'L'.
x_fldcat-key = 'X'.
ENDIF.
IF x_fldcat-fieldname = 'TXA50'.
x_fldcat-outputlen = 60.
x_fldcat-seltext_l = 'Further Description'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'KTOGR'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'Acct determinat'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'KTGRTX'.
x_fldcat-outputlen = 30.
x_fldcat-seltext_l = 'Acct determinat Text'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'SERNR'.
x_fldcat-outputlen = 20.
x_fldcat-seltext_l = 'Serial number'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'INVNR'.
x_fldcat-outputlen = 25.
x_fldcat-seltext_l = 'Assets identification No'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'MENGE'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'Qty'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'MEINS'.
x_fldcat-outputlen = 10.
x_fldcat-seltext_l = 'UOM'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'RAUMN'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'Location'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'LIFNR'.
x_fldcat-outputlen = 20.
x_fldcat-seltext_l = 'Vendor'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'LIEFE'.
x_fldcat-outputlen = 30.
x_fldcat-seltext_l = 'Supplier Name'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'AKTIV'.
x_fldcat-outputlen = 20.
x_fldcat-seltext_l = 'Capitalisation Date'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'AFABG'.
x_fldcat-outputlen = 18.
x_fldcat-seltext_l = 'Date put to use'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'G_KANSW'.
x_fldcat-outputlen = 18.
x_fldcat-seltext_l = 'Opening Gross Block'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'B_KANSW'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'Addition'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'B_ANSWL'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'Deduction / Adj'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'G_TOTAL'.
x_fldcat-outputlen = 20.
x_fldcat-seltext_l = 'Closing Gross Block'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'D_OPEN'.
x_fldcat-outputlen = 20.
x_fldcat-seltext_l = 'Dep on opening block'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'D_SOLD'.
x_fldcat-outputlen = 20.
x_fldcat-seltext_l = 'Dep on assets sold/ written off'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'D_ADD'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'Addition During Year'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'AFABG'.
x_fldcat-outputlen = 20.
x_fldcat-seltext_l = 'Total dep for the period'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'CD_SOLD'.
x_fldcat-outputlen = 20.
x_fldcat-seltext_l = '*** Dep on assets sold'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'CD_ASST'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = '*** Dep on assets written off'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'CD_DEP'.
x_fldcat-outputlen = 20.
x_fldcat-seltext_l = 'Total *** dep on deductions'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'CCD_DEP'.
x_fldcat-outputlen = 20.
x_fldcat-seltext_l = 'Closing Acc Dep'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'A'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'WDV of assets sold'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'B'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'Selling Price'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'C'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'Profit / (Loss) on sale'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'D'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'Loss on Write off'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'E'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'Closing WDV'.
x_fldcat-just = 'L'.
ENDIF.
IF x_fldcat-fieldname = 'F'.
x_fldcat-outputlen = 15.
x_fldcat-seltext_l = 'Opening WDV'.
x_fldcat-just = 'L'.
ENDIF.
MODIFY i_fldcat FROM x_fldcat INDEX sy-tabix.
ENDLOOP.
ENDFORM. " build_field_catalog
Form : comment_build
Description : This form is used to display the Report Header(ALV)
FORM comment_build USING lt_top_of_page TYPE
slis_t_listheader.
DATA: l_line TYPE slis_listheader,
l_heading1 LIKE rs38m-repti.
CLEAR l_line.
l_heading1 =
'Asset Register Report'.
g_repid = sy-repid.
l_line-typ = c_h.
MOVE l_heading1 TO l_line-info.
APPEND l_line TO lt_top_of_page.
ENDFORM. "comment_build
*& Form calc_date
text
--> p1 text
<-- p2 text
FORM calc_date .
b_date = s_date-low - 1.
ENDFORM. " calc_date
Form : call_list_viewer
Description : This form is used to display the grid through ALV
FORM call_list_viewer.
*PERFORM header_prn.
LOOP AT i_final.
MOVE sy-tabix TO i_final-srno.
MODIFY i_final TRANSPORTING srno.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = x_layout
it_fieldcat = i_fldcat[]
it_sort = i_sort[]
i_default = c_x
i_save = g_save
it_events = g_events[]
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = g_exit_caused_by_user
TABLES
t_outtab = i_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: / 'Problem in calling the ALV report'(042).
ENDIF.
ENDFORM. " call_list_viewer
thanks in advance,
marks will b sure*
regards
vijay dwivedi
Change ur table declaration as shown below, replace the word <b>TYPE</b> with <b>LIKE</b>
DATA: BEGIN OF i_final OCCURS 0,
srno TYPE i, " Serial no
anln1 LIKE anla-anln1, " asset code no
txt50 LIKE anla-txt50, " Brief Description of Assets
txa50 LIKE anla-txa50, " Further Description
ktogr LIKE anla-ktogr, " Asset Class No.
ktgrtx LIKE t095t-ktgrtx, " Asset Class Name
sernr LIKE anla-sernr, " Serial Number
invnr LIKE anla-invnr, " Assets Identification No
menge LIKE anla-menge, " Qty
meins LIKE anla-meins, " UOM
raumn LIKE anlz-raumn, " Location
lifnr LIKE anla-lifnr, " Vendor
liefe LIKE anla-liefe, " Capitalisation Date
aktiv LIKE anla-aktiv, " Date put to use
g_kansw LIKE anlc-kansw, " Opening Gross Block
b_kansw LIKE anlc-kansw, " Additions during the period
b_answl LIKE anlc-answl," Deductions/ Adjustmentsduring d period
g_total LIKE bsis-dmbtr, " Closing Gross Block
d_open LIKE anlb-afabg, " Dep on opening block
d_sold LIKE anlb-afabg, " Dep on assets sold/written off
d_add LIKE anlb-afabg, " dep on additions during the period
afabg LIKE anlb-afabg, " Total dep for the period
cd_sold LIKE bsis-dmbtr, " *** Dep on assets sold
cd_asst LIKE bsis-dmbtr, " *** Dep on assets written off
cd_dep LIKE bsis-dmbtr, " Total *** dep on deductions
ccd_dep LIKE bsis-dmbtr, " Closing Acc Dep
a LIKE bsis-dmbtr, " WDV of assets sold
b LIKE bsis-dmbtr, " Selling Price
c LIKE bsis-dmbtr, " Profit / (Loss) on sale
d LIKE bsis-dmbtr, " Loss on write off
e LIKE bsis-dmbtr, " Opening WDV
f LIKE bsis-dmbtr, " Closing WDV
END OF i_final.
Similar Messages
-
Display value and description of one field in alv grid
Hi Folks,
I want to display value and description of one field as one column in alv grid.
for example iam having Xfield = 01,02,03.
and 01 iam having text value as xxx,
01 xxx
02 yyy
03 zzz
Im report display the values are displaying as 01,02,03..
but i want to display it as 01 xxx,02 yyy, 03 zzz.
Please do needful.
Thx.Hi, swetha
You can do this with "concatenate".
example:
In you code check where you final internal table is getting filled up before that do this concatenate and then append it.
data t_text type string.
t_text = textfield
CONCATENATE 'Xfield'
t_text
INTO wa_workarea SEPARATED BY space.
cheers,
Bhavana -
How to get Grand Total Text in ALV GRID
Hi Folks,
I am able to get the SUBTOTAL TEXT .....But i need...
How to get Grand Total Text in ALV GRID Display...
Can any one give a Solution for this...Hi Surendar,
Check out this code.. this is showing Total Text in Toal line in the very first column.
REPORT zsales_ord_det_1 .
TABLES: ztable_10.
TYPE-POOLS: slis.
DATA: BEGIN OF it OCCURS 0,
srno(6) type c,
name LIKE ztable_10-name,
age LIKE ztable_10-age,
END OF it.
DATA : BEGIN OF it_temp OCCURS 0,
name LIKE ztable_10-name,
age LIKE ztable_10-age,
END OF it_temp.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA: v_repid LIKE sy-repid,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
gs_layout TYPE slis_layout_alv,
gd_layout TYPE slis_layout_alv,
i_sort TYPE STANDARD TABLE OF slis_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
START-OF-SELECTION.
v_repid = sy-repid.
SELECT * FROM ztable_10 INTO TABLE it_temp.
LOOP AT it_temp .
it-srno = 'Total'.
it-name = it_temp-name.
it-age = it_temp-age.
APPEND it.
ENDLOOP.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'IT'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = i_fieldcat[]
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.
wa_fieldcat-row_pos = 1.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'SRNO'.
wa_fieldcat-tabname = it.
append wa_fieldcat to i_fieldcat.
LOOP AT i_fieldcat INTO wa_fieldcat.
IF wa_fieldcat-fieldname = 'AGE'.
wa_fieldcat-do_sum = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat.
ENDIF.
IF wa_fieldcat-fieldname = 'SRNO'.
Hide this field so that it can display it's content i.e.
Total text in Subtotal level
wa_fieldcat-tech = 'X'.
wa_fieldcat-no_out = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat TRANSPORTING tech no_out.
ENDIF.
ENDLOOP.
wa_sort-spos = 1.
wa_sort-fieldname = 'SRNO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort.
gd_layout-no_totalline = 'X'.
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 = '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 = gd_layout
it_fieldcat = i_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = i_sort
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_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_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it
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.
Regards,
Seema -
How we can get an interactive report in alv grid display?
Hi experts
Plz tell me how we can get an interactive report in alv grid disply pls send me one sample code to understand this
thanks in advancehi,
check this one
*& Report ZALV_FIELD_GRID1
REPORT ZALV_FIELD_GRID1
NO STANDARD PAGE HEADING.
TABLES MARA.
type-pools :slis.
TYPES : BEGIN OF TMARA ,
MATNR LIKE MARA-MATNR,
MEINS LIKE MARA-MEINS,
ERSDA LIKE MARA-ERSDA,
color(4) type c,
SEL type c,
LIGHT TYPE C,
END OF TMARA.
TYPES: BEGIN OF TMAKT,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
MAKTG LIKE MAKT-MAKTG,
SEL TYPE C,
COLOR(4),
END OF TMAKT.
DATA: ITAB TYPE TMARA OCCURS 0 WITH HEADER LINE,
ITAB1 TYPE TMAKT OCCURS 0 WITH HEADER LINE,
wa_fieldcat type slis_fieldcat_alv,
fieldcat type slis_fieldcat_alv occurs 0,
i_layout type slis_layout_alv,
WA_LISTHEADER TYPE SLIS_LISTHEADER,
i_LISTHEADER TYPE SLIS_LISTHEADER OCCURS 0,
V_EVENTS TYPE SLIS_T_EVENT ,
WA_EVENT TYPE SLIS_ALV_EVENT,
I_TITLE_MARA TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED',
I_TITLE_MAKT TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED',
SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE,
PRINT_CONT type slis_print_alv.
SELECTION SCREE
selection-screen begin of block screen1 with frame title TEXT-001.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT /32(35) COMM1.
SELECTION-SCREEN ULINE /27(35).
SELECTION-SCREEN SKIP.
SELECT-OPTIONS MATNR FOR MARA-MATNR.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN ULINE.
SELECTION-SCREEN COMMENT /30(50) COMM2.
SELECTION-SCREEN ULINE /27(40).
SELECTION-SCREEN SKIP.
SELECT-OPTIONS ERSDA FOR MARA-ERSDA.
SELECTION-SCREEN SKIP.
selection-screen end of block screen1.
INITIALIZATION
INITIALIZATION.
MATNR-low = '23'.
MATNR-high = '1000'.
MATNR-option = 'BT'.
MATNR-sign = 'I'.
APPEND MATNR.
ERSDA-low = '20030124'.
ERSDA-high = '20050302' .
APPEND ERSDA.
PERFORM FILLFIELD.
PERFORM FILLLAYOUT.
PERFORM build_print_params.
PERFORM FILL_SORT.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN OUTPUT.
comm1 ='SELECT MATERIAL NUMBER RANGE'.
comm2 ='SELECT MATERIAL CREATION DATE'.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM READDATA.
PERFORM POPDATA.
*& Form READDATA
text
FORM READDATA .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = MATNR-LOW
IMPORTING
OUTPUT = MATNR-LOW.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = MATNR-HIGH
IMPORTING
OUTPUT = MATNR-HIGH.
SELECT MATNR
ERSDA
MEINS
FROM MARA
INTO CORRESPONDING FIELDS OF
TABLE ITAB
WHERE MATNR IN MATNR AND ERSDA IN ERSDA.
LOOP AT ITAB.
data id_color type i VALUE 1.
data id_colors(2) type c.
IF ITAB-MATNR < '000000000000000100'.
ITAB-LIGHT = '1'.
ELSEIF ITAB-MATNR < '000000000000000150' AND ITAB-MATNR >
'000000000000000100' .
ITAB-LIGHT = '2'.
ELSE.
ITAB-LIGHT = '3'.
ENDIF.
id_color = id_color + 1.
if id_color > 7.
id_color = 1.
endif.
id_colors = id_color.
concatenate 'C' id_colors '10' into itab-color.
modify itab.
CLEAR ITAB.
endloop.
ENDFORM. " READDATA
Form FILLFIELD
FORM FILLFIELD .
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-COL_POS = '1'.
WA_FIELDCAT-outputlen = 20.
WA_FIELDCAT-HOTSPOT = 'X'.
wa_fieldcat-seltext_m = 'MATERIAL NUMBER'.
*WA_FIELDCAT-EMPHASIZE = 'C210'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-COL_POS = '2'.
*WA_FIELDCAT-EMPHASIZE = 'C510'.
WA_FIELDCAT-outputlen = 10.
wa_fieldcat-seltext_m = 'UNIT'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'ERSDA'.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-outputlen = 15.
*WA_FIELDCAT-EDIT_MASK = 'DD.MM.YYYY'.
*WA_FIELDCAT-EMPHASIZE = 'C710'.
wa_fieldcat-seltext_m = 'CREAT DATE'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
ENDFORM. "FILLFIELD
Setup print parameters
form build_print_params.
PRINT_CONT-reserve_lines = '3'. "Lines reserved for footer
PRINT_CONT-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
Form POPDATA
FORM POPDATA .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER-COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOPPAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_TITLE_MARA
I_GRID_SETTINGS =
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = V_EVENTS
IT_EVENT_EXIT =
IS_PRINT = PRINT_CONT
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ENDFORM. " POPDATA
Form TOPPAGE
FORM TOPPAGE.
REFRESH I_LISTHEADER.
DATA: ld_lines type i,
ld_linesc(10) type c,
I_DATE(10) TYPE C,
I_INFO LIKE WA_LISTHEADER-INFO.
WA_LISTHEADER-TYP = 'H'.
WA_LISTHEADER-INFO = 'MATERIAL DETAIL'.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'DATE :'.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO I_DATE.
WA_LISTHEADER-INFO = I_datE.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
describe table ITAB lines ld_lines.
ld_linesc = ld_lines.
concatenate 'TOTAL NUMBER OF RECORD SELECTED: ' ld_linesc
into I_INFO separated by space.
WA_LISTHEADER-TYP = 'A'.
WA_LISTHEADER-INFO = I_INFO.
append WA_LISTHEADER to I_LISTHEADER.
clear: WA_LISTHEADER , I_INFO.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LISTHEADER
I_LOGO = 'ENJOYSAP_LOGO'.
ENDFORM. "TOPPAGE
Form FILLLAYOUT
FORM FILLLAYOUT .
i_layout-zebra = 'X'.
i_layout-info_fieldname = 'COLOR'.
i_layout-box_fieldname = 'SEL'.
I_LAYOUT-lights_fieldname = 'LIGHT'.
I_LAYOUT-EDIT ='X'.
I_LAYOUT-colwidth_optimize = 'X'.
I_LAYOUT-window_titlebar = 'EXAMPLE FOR ALV GRID'.
I_LAYOUT-no_totalline = 'X'.
ENDFORM. "FILLLAYOUT
Form FILL_SORT
FORM FILL_SORT .
SORT-DOWN = 'X'.
SORT-SPOS = 1.
SORT-FIELDNAME = 'MATNR'.
SORT-tabname = 'MARA'.
APPEND SORT.
ENDFORM. " FILL_SORT
Form EVENT_CALL
FORM EVENT_CALL .
DATA: I_EVENT LIKE V_EVENTS.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS.
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. " EVENT_CALL
Form POPULATE_EVENT
FORM POPULATE_EVENT .
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
READ TABLE V_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO WA_EVENT.
IF SY-SUBRC = 0.
move 'END_OF_PAGE' to WA_EVENT-FORM.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
endif.
ENDIF.
ENDFORM. "POPULATE_EVENT
FORM END_OF_PAGE.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
ENDFORM.
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
CASE RS_SELFIELD-FIELDNAME.
when 'MATNR'.
read table itab with key matnr = RS_SELFIELD-VALUE.
if sy-subrc = 0.
PERFORM DATA_RETRIEVAL_MAKT USING RS_SELFIELD-VALUE.
PERFORM BUILD_FIELDCATLOG_MAKT.
PERFORM FILLLAYOUT_MAKT.
PERFORM DISPLAY_ALV_MAKT.
CLEAR RS_SELFIELD.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. "user_command
Form DATA_RETRIEVAL_MAKT
FORM DATA_RETRIEVAL_MAKT USING TMATNR .
SELECT MATNR
MAKTX
MAKTG
UP TO 100 ROWS
FROM MAKT
INTO TABLE ITAB1
WHERE SPRAS = 'EN' AND MATNR = TMATNR.
LOOP AT ITAB1.
data id_color type i VALUE 1.
data id_colors(2) type c.
id_color = id_color + 1.
if id_color > 7.
id_color = 1.
endif.
id_colors = id_color.
concatenate 'C' id_colors '10' into itab1-color.
modify itab1.
CLEAR ITAB1.
ENDLOOP.
ENDFORM. "DATA_RETRIEVAL_MAKT
Form FILLLAYOUT_MAKT
FORM FILLLAYOUT_MAKT .
CLEAR I_LAYOUT.
i_layout-zebra = 'X'.
i_layout-info_fieldname = 'COLOR'.
i_layout-box_fieldname = 'SEL'.
I_LAYOUT-EDIT ='X'.
I_LAYOUT-colwidth_optimize = 'X'.
I_LAYOUT-window_titlebar = 'EXAMPLE FOR ALV GRID'.
ENDFORM. " LAYOUT_MAKT
Form BUILD_FIELDCATLOG_MAKT
FORM BUILD_FIELDCATLOG_MAKT .
REFRESH FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-COL_POS = '1'.
*WA_FIELDCAT-EDIT_MASK = 'DD.MM.YYYY'.
WA_FIELDCAT-EMPHASIZE = 'C510'.
wa_fieldcat-seltext_m = 'MATERIAL NUMBER'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MAKTX'.
WA_FIELDCAT-COL_POS = '2'.
WA_FIELDCAT-EMPHASIZE = 'C710'.
wa_fieldcat-seltext_m = 'MATERIAL DESCRIPTION'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MAKTG'.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-EMPHASIZE = 'C210'.
wa_fieldcat-seltext_m = 'MATERIAL DESCRIPTION'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
ENDFORM. " BUILD_FIELDCATLOG_MAKT
Form DISPLAY_ALV_MAKT
FORM TOP-OF-PAGE.
REFRESH I_LISTHEADER.
DATA: ld_lines type i,
ld_linesc(10) type c,
I_DATE(10) TYPE C,
I_INFO LIKE WA_LISTHEADER-INFO.
WA_LISTHEADER-TYP = 'H'.
WA_LISTHEADER-INFO = 'MATERIAL DESCRIPTION FOR SELECTED NUMBER'.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'DATE :'.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO I_DATE.
WA_LISTHEADER-INFO = I_datE.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
describe table ITAB1 lines ld_lines.
ld_linesc = ld_lines.
concatenate 'TOTAL NUMBER OF RECORD SELECTED: ' ld_linesc
into I_INFO separated by space.
WA_LISTHEADER-TYP = 'A'.
WA_LISTHEADER-INFO = I_INFO.
append WA_LISTHEADER to I_LISTHEADER.
clear: WA_LISTHEADER , I_INFO.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LISTHEADER
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. "TOP-OF-PAGE
*& Form DISPLAY_ALV_MAKT
text
FORM DISPLAY_ALV_MAKT .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
I_GRID_TITLE = I_TITLE_MAKT
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = fieldcat
TABLES
T_OUTTAB = ITAB1
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. " DISPLAY_ALV_MAKT
Rewards points -
Add List box for one field in ALV GRID
Hi All,
I need to add drop down list box for one field in ALV Grid.
If any body knows, please help.
Thanks in advance.
Regards
MangleshHi,
Here is the ex where i have used for date parameter in the sel screen
type-pools: vrm.
data: name type vrm_id,
list type vrm_values,
value like line of list.
parameters : p_date like p_date2
as listbox visible length 15.
at selection-screen output.
name = 'P_DATE'.
value-key = '1'.
value-text = 'Today'.
append value to list.
value-key = '2'.
value-text = 'Last 7 days'.
append value to list.
value-key = '3'.
value-text = 'Last 30 days'.
append value to list.
value-key = '4'.
value-text = 'Last 90 days'.
append value to list.
value-key = '5'.
value-text = 'Last year'.
append value to list.
Call the ''VRM_SET_VALUES' to display the values in Listbox
call function 'VRM_SET_VALUES'
exporting
id = name
values = list.
at selection-screen.
if sy-ucomm = 'CLI1'.
sscrfields-ucomm = 'ONLI'(001).
endif.
if p_date = '1'.
p_date11 = sy-datum .
elseif p_date = '2'.
p_date11 = ( sy-datum - 7 ).
elseif p_date = '3'.
p_date11 = ( sy-datum - 30 ).
elseif p_date = '4'.
p_date11 = ( sy-datum - 90 ).
elseif p_date = '5'.
p_date11 = ( sy-datum - 365 ).
endif.
Hope this helps u..
Please reward points if useful.
Regards,
Sreenivas -
I have Office 2011 which includes Word. Ever since downloading Mavericks, when I try to send a two-page Word document by email, some recipients get only one page. Also when burning an image from iPhoto (usually no larger than 1mb) on to a disc, only part of it appears. It appears to have been magnified so that only a part of the image appears. Can anyone enlighten me as to what is happening? And how to fix it??
I have Office 2011 which includes Word. Ever since downloading Mavericks, when I try to send a two-page Word document by email, some recipients get only one page. Also when burning an image from iPhoto (usually no larger than 1mb) on to a disc, only part of it appears. It appears to have been magnified so that only a part of the image appears. Can anyone enlighten me as to what is happening? And how to fix it??
-
my problem is the following:
i want to get only ONE character from the input without pressing the "enter"-key. for example pressing ESC and doing something because it is ESC hit.
thank youYou can't. Either use a GUI or create a JNI DLL function that calls getch ().
Kind regards,
Levi -
How to get a Footer text in alv grid?
Hi,
am using RESUE_ALV_COMMENTARy_write... it is getting only on top of page..
suggest me to get Footer text in ALV GRiD.
Regards,
sodanapalli
Moderator message: please do more research before asking, all points removed (both replies were copy/pasted anyway)
Edited by: Thomas Zloch on May 19, 2011 5:41 PMStep1: Populate the ALV event table with 'END_OF_LIST' event
Step2: Populate the footer text in to an internal table which is of type
slis_t_listheader.
Step3: Create a subroutine with name 'END_OF_LIST' and with in this form we have to call the function module u2018REUSE_ALV_COMMENTARY_WRITEu2019.
Step4: Now call the function module REUSE_ALV_GRID_DISPLAYu2019 to display the ALV report. Whenever u2018END_OF_LIST' event is get fired it executes the subroutine END_OF_LIST and displays the text into the footer of the ALV GRID.
Code:
*& Report Z_TEST_ALV
REPORT z_test_alv.
TYPE-POOLS: slis.
DATA: i_mara TYPE STANDARD TABLE OF mara INITIAL SIZE 0,
i_events TYPE slis_t_event,
i_end_of_page TYPE slis_t_listheader,
w_events TYPE slis_alv_event,
v_repid LIKE sy-repid.
START-OF-SELECTION.
SELECT * FROM
mara INTO TABLE i_mara
UP TO 100 ROWS.
CHECK sy-subrc = 0.
PERFORM populate_alv_event.
PERFORM comment_build USING i_end_of_page[].
PERFORM display_grid.
*& Form POPULATE_ALV_EVENT
FORM populate_alv_event .
Populate event table
w_events-name = 'END_OF_LIST'.
w_events-form = 'END_OF_LIST'.
APPEND w_events TO i_events.
ENDFORM. " POPULATE_ALV_EVENT
*& Form COMMENT_BUILD
FORM comment_build USING p_i_end_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
REFRESH p_i_end_of_page.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = 'This is end of list'(001).
APPEND ls_line TO p_i_end_of_page.
ENDFORM. " COMMENT_BUILD
*& Form end_of_list
FORM end_of_list.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_end_of_page.
ENDFORM. "end_of_list
*& Form DISPLAY_GRID
FORM display_grid .
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_structure_name = 'MARA'
it_events = i_events
TABLES
it_outtab = i_mara
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " DISPLAY_GRID
Check the output where footer will be displayed as 'THIS IS END OF LIST' -
Getting runtime Error 'UC_OBJECTS_NOT_CHARLIKE' for ALV grid
Hi,
When I call method SET_TABLE_FOR_FIRST_DISPLAY of ALV I get runtime error 'UC_OBJECTS_NOT_CHARLIKE'.
Actually i have set in the fieldcatalog the field 'CHK' of internal table as checkbox.
wa_fcat-fieldname = 'CHK' .
wa_fcat-coltext = 'Clear' .
wa_fcat-seltext = 'Clear' .
wa_fcat-checkbox = 'X' .
wa_fcat-edit = 'X' .
APPEND wa_fcat to p_lt_fieldcatalog .
Field CHK is of type c.
when i dont set the field as checkbox, I stop getting the error.
Please find a solution.
regards,
auroRelevant parts of code are:
Data Declaration:
types: begin of tt_revenue_det,
chk type c,
budat like zefit0006-zefibudat,
racct_txt like skat-txt50,
amount like zefit0006-zefihsl,
pbar_txt like tgsbt-gtext,
sgtxt like zefit0006-zefisgtxt,
costcentertxt like cskt-ktext,
bar_txt like skat-txt50,
doctype like zefit0006-zefiblart,
ch_flag type c,
end of tt_revenue_det,
data: gt_revenue_det type table of tt_revenue_det.
FIELD CATALOG
*& Form set_fieldcatalog_rev_det
text
-->P_LT_FIELDCATALOG text
form set_fieldcatalog_rev_det using p_lt_fieldcatalog type lvc_t_fcat.
data:wa_fcat type lvc_s_fcat.
wa_fcat-fieldname = 'P_GT_REVENUE_DET-CHK' .
wa_fcat-coltext = 'Clear' .
wa_fcat-seltext = 'Clear' .
wa_fcat-checkbox = 'X' .
wa_fcat-edit = 'X' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'BUDAT' .
wa_fcat-coltext = 'Posting Date' .
wa_fcat-seltext = 'Posting Date' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'RACCT_TXT' .
wa_fcat-coltext = 'Account Item Text' .
wa_fcat-seltext = 'Account Item Text' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'AMOUNT' .
wa_fcat-coltext = 'Amount' .
wa_fcat-seltext = 'Amount' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'PBAR_TXT' .
wa_fcat-coltext = 'Partner Business Area' .
wa_fcat-seltext = 'Partner Business Area' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'SGTXT' .
wa_fcat-coltext = 'Item Text' .
wa_fcat-seltext = 'Item Text' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'COSTCENTERTXT' .
wa_fcat-coltext = 'Cost Center' .
wa_fcat-seltext = 'Cost Center' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'BAR_TXT' .
wa_fcat-coltext = 'Business Area' .
wa_fcat-seltext = 'Business Area' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'DOCTYPE' .
wa_fcat-coltext = 'Type' .
wa_fcat-seltext = 'Type' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'CH_FLAG' .
wa_fcat-coltext = 'Split' .
wa_fcat-seltext = 'Split' .
APPEND wa_fcat to p_lt_fieldcatalog .
endform. " set_fieldcatalog_rev_det
CREATE ALV
*& Form create_alv_revenue_det
text
-->P_GT_REVENUE_DET text
form create_alv_revenue_det using p_gt_revenue_det.
ALV related data declaration
DATA: lf_layout TYPE lvc_s_layo, "alv layout
lt_fieldcatalog type table of lvc_s_fcat, "field catalog internal table
wa_fieldcatalog type lvc_s_fcat. "work area for field catalog
create alv only if container is initial
IF G_CUSTOM_CONTAINER_REV_DET IS INITIAL.
lf_layout-no_toolbar = 'X'. " no toolbar
lf_layout-sel_mode = 'B'.
populate field catalog
perform set_fieldcatalog_rev_det using lt_fieldcatalog.
create instance of container class
CREATE OBJECT G_CUSTOM_CONTAINER_REV_DET
EXPORTING CONTAINER_NAME = G_CONTAINER_REV2.
create instance of alv grid class
CREATE OBJECT GR_ALVGRID_REV_DET
EXPORTING I_PARENT = G_CUSTOM_CONTAINER_REV_DET.
call method to display table in alv grid by passing layout and fieldcatalog
CALL METHOD GR_ALVGRID_REV_DET->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
is_layout = lf_layout
CHANGING
IT_OUTTAB = p_gt_revenue_det
IT_FIELDCATALOG = lt_fieldcatalog.
ENDIF.
endform. " create_alv_revenue_det -
Hotspot click for only some rows in ALV grid for a particular column ?
Hi there,
In ALV grid, we can make Hotspot enable for all rows in a specified column
by specifying in the fieldcatalog with Hotspot attribute set as true.
But I want to enable Hotspot only for certain rows in the particular column. I tried with MC_STYLE4_LINK , but I didnt got the required result.
So , how could I achieve that in ALV grid.
Points would be rewarded for helpful answers.
Regards,
Anil .Hi,
You can do it for a column. Please refer to the code snippet below,
DATA : it_fcat TYPE lvc_t_fcat,
wa_fcat LIKE LINE OF it_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'SMMW_ALERTS_ICON_S'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = it_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
LOOP AT it_fcat INTO wa_fcat.
IF wa_fcat-fieldname = 'STATUS'.
wa_fcat-hotspot = 'X'.
MODIFY it_fcat FROM wa_fcat.
CLEAR wa_fcat.
ENDIF.
ENDLOOP.
CALL METHOD l_obj_alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SMMW_ALERTS_ICON_S'
CHANGING
it_outtab = lt_alerts_st
it_fieldcatalog = it_fcat.
In the above replace the structure 'SMMW_ALERTS_ICON_S' with your structure and column 'STATUS' with your desired column.
Hope this helps,
Regards,
Vinodh -
Get only one row for each kind of a column
hi there!
i have a little problem.
I have a table with 10 columns. One of them has repeated values. My goal is to get all the rows with this column only one time for each values that it has.
Ex:
Col1 Col2 Col3
A A A
B B B
C A C
D C D
Column 2 has repeated values. My goal is to get:
A A A
B B B
D C D
Only one time each value of column 2.
Thanks guys! ;)SQL> CREATE TABLE Tbl (col1 VARCHAR2(1),col2 VARCHAR2(1),col3 VARCHAR2(1));
Table created.
SQL> INSERT INTO Tbl VALUES ('A','A','A');
1 row created.
SQL> INSERT INTO Tbl VALUES ('B','B','B');
1 row created.
SQL> INSERT INTO Tbl VALUES ('C','A','C');
1 row created.
SQL> INSERT INTO Tbl VALUES ('D','C','D');
1 row created.
SQL> commit;
Commit complete.
SQL> SELECT * FROM tbl t1
2 WHERE
3 rowid=(SELECT min(rowid)
4 FROM tbl t2
5 WHERE t1.col2=t2.col2);
C C C
A A A
B B B
D C D
SQL> SELECT * FROM tbl t1
2 WHERE
3 rowid=(SELECT max(rowid)
4 FROM tbl t2
5 WHERE t1.col2=t2.col2);
C C C
B B B
C A C
D C DEdited by: Saubhik on Aug 3, 2010 1:31 AM -
Sender file adapter Need to Get Only one record Using FCC
Hi All,
I am using File to ABAP Proxy interface, where i need to Trigger my proxy so in my sender file adapter , i need to configure as such it is should take only one record, from whole file i am using Key field parametrs in FCC but it is taking all the records which is not having the key fields also
please help me
Thanking you
Sridhar2A64310 1 6V83970 03751650016001154000 1 6V9961XT-3 13236157001160
2A64310 1 6V83970 000 1 6V9962XT-3 23236162
2A64730 1 6V83970 03751650016000106000 1 6V9962XT-3 13236162000112
2A64730 1 6V83970 000 1 6V9961XT-3 23236157
2A64741 6V99481 6V83971 4S541403751650016000152360 1 6V9964XT-3 13236168000166
2A64741 6V99471 6V83971 4S5414 000 1 6V9963XT-3 23236167
2A64772 6V99492 6V83982 3S860605001650017000244000 2 6V9965XT-3 13289090000248
2A65690 1 6V97460 07501226872000110000 11242153L&MP 1
2A65690 1 6V97460 000 11242121L&MP 2
EOF
this is sample file , i need to have any one line , cause i need to just trigger a proxy , i am not to going tp take entire file cause in real time i will getting 100 MB file which will be a performance issue -
To get own Filed Desc. like ALV Grid while exporting to ALV using standard
Hi all,
How to get the custom field heading when we export to XLS using the standard Functionality/button available in ALV grid to export to spread sheet.
I mean is there anything in ALV field catalog /something by which we can have our custom heading , the way we do in ALV grid output using the button available to do export .
Note: I am not talking about any FM , its the standrad button available in ALV grid by which we can do export to spread sheet , currently its taking the small text of the data element field level.
RegardsHi,
Modify your fieldcatelog before calling the grid display FM. Remove data element reference (ref_fieldname) and change ddictxt, seltext_s, seltext_m and seltext_l fields to the text you want.
Dataelement texts can be found in table DD04T.
Thanks,
Vinod. -
Reused alv grid - Sum one column of ALV Grid
I'd like that one column of my alv grid to be sum...
How can i do that abap'ly speaking...
regardshi,
DATA: lr_field type ref to cl_salv_wd_field.
*For total calculations...
if wd_comp_controller->gref_model_efforts is not initial.
CALL METHOD wd_comp_controller->gref_model_efforts->if_salv_wd_std_functions~set_aggregation_allowed
EXPORTING
value = abap_true.
lr_field = wd_comp_controller->gref_model_efforts->if_salv_wd_field_settings~get_field( 'BILLABLE_VALUE' ). "The column name for which total needs to be done.
lr_field->if_salv_wd_aggr~create_aggr_rule( aggregation_type =
if_salv_wd_c_aggregation=>aggrtype_total ).
endif.
Refer this :
Alv subtotal and total
Thanx. -
Years back I had installed Firefox 3.0 (at launch, so not beta) into a separate program folder. After installation, I expected to have my bookmarks saved. Recently I found out my bookmarks were in application data and I found out I had one profile. That meant that my firefox 2.0 bookmarks were replaced.
I read up on the FAQs and it stated that bookmark backups only save the previous 5 days or so, so I don't think they are usable though I have them saved. The bookmarks.html file in my profile shows only one bookmark after importing it into firefox 3.5 and firefox 2.0 (downgraded back to check it out), google chrome, and internet explorer. I still have the bookmarks.bak and bookmarks.html.bak files as well.
A little backstory before I got up to this point because it's a bit convoluted because I thought I could retrieve them like IE favorites which were easy:
1) Switched to Firefox 2.0 from Internet Explorer and got several hundred bookmarks.
2) Got HyperBookmarks add-on which bugged up and replaced my previous bookmarks folder though it stated in FAQs that my original Firefox 2.0 bookmarks were in a separate folder so I didn't worry about it.
3) Upgraded to Firefox 3.0 and it replaced all my bookmarks with nothing in bookmarks list. I thought it was saved because I installed Firefox 3.0 in a separate folder.
4) Retrieved 3.0 Bookmarks and Archived them, but wasn't able to find Firefox 2.0 Bookmarks (original) nor the HyperBK version, except in HyperBk Backups folder.In the "Edit this Bookmark" window, use the 2nd drop-down button, that is to the right of the "Folder", to open a larger window that will allow more folder to appear. See the sloppy red arrow on the screenshot below.
Maybe you are looking for
-
Lock language in the tp/R3trans
Hello, I'm installing the french in my system. During the transport I got a problem with a filesystem. It became 100 % used so one of the transport failed. I have extend the tablespaces and now we have free space, but: When I try to "Restart" I get t
-
Hi, I am very much new in OLAP. My question is that in the OLAP Analytics workspace, there is a node "OLAP DML Programs ". Could you please tell me when it is used ? Can this DML program use for calculating program ? Can we say , it is the language t
-
I always used internet explorer but after i downloaded windows vista service pack 2 i had a problem with the sound while playing any video , there is no sound but there is video so i switched to firefox and the same problem occurs. == This happened =
-
Why does the code look fine in Explorer and Chrome, and WAY off in Firefox?
Here is the example link, but there are a lot of pages that turn out like this. Help? http://www.rv-wireless-internet.com/RV_Wireless1.html As you can see, looks ok in chrome and IE, terrible in Firefox. ANyone have the tip? I am boggled. J
-
Can`t install FX 5200 capture driver-code 10
I`ve installed card driver normaly, but when I want to install capture driver an error apears.(code 10) Please someone help me.