Google Search - Blog...........

ABAP - Change The Layout Of The ALV List/Grid Display

REPORT ZDEMO_ALVGRID_EDIT .

TABLES: ekko.

TYPE-POOLS: slis.

"ALV Declarations
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
field_style TYPE lvc_t_styl,
END OF t_ekko.

DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.

*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: it_fieldcat TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE lvc_s_layo, "slis_layout_alv,
gd_repid LIKE sy-repid.

*Start-of-selection.
START-OF-SELECTION.

PERFORM data_retrieval.

PERFORM set_specific_field_attributes.

PERFORM build_fieldcatalog.

PERFORM build_layout.

PERFORM display_alv_report.
*&---------------------------------------------------------------------
**& Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------
***Build Fieldcatalog for ALV Report
*----------------------------------------------------------------------
FORM build_fieldcatalog.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-scrtext_m = 'Purchase Order'.
wa_fieldcat-col_pos = 0.
wa_fieldcat-outputlen = 10.
wa_fieldcat-emphasize = 'X'.
wa_fieldcat-key = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-scrtext_m = 'PO Item'.
wa_fieldcat-col_pos = 1.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'STATU'.
wa_fieldcat-scrtext_m = 'Status'.
wa_fieldcat-col_pos = 2.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'AEDAT'.
wa_fieldcat-scrtext_m = 'Item change date'.
wa_fieldcat-col_pos = 3.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-scrtext_m = 'Material Number'.
wa_fieldcat-col_pos = 4.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'MENGE'.
wa_fieldcat-scrtext_m = 'PO quantity'.
wa_fieldcat-col_pos = 5.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'MEINS'.
wa_fieldcat-scrtext_m = 'Order Unit'.
wa_fieldcat-col_pos = 6.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'NETPR'.
wa_fieldcat-scrtext_m = 'Net Price'.
wa_fieldcat-edit = 'X'.
"sets whole column to be editable
wa_fieldcat-col_pos = 7.
wa_fieldcat-outputlen = 15.
wa_fieldcat-datatype = 'CURR'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'PEINH'.
wa_fieldcat-scrtext_m = 'Price Unit'.
wa_fieldcat-col_pos = 8.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " BUILD_FIELDCATALOG
*&---------------------------------------------------------------------
**& Form BUILD_LAYOUT
*&---------------------------------------------------------------------
***Build layout for ALV grid report
*----------------------------------------------------------------------
FORM build_layout.
*Set layout field for field attributes(i.e. input/output)
gd_layout-stylefname = 'FIELD_STYLE'.
gd_layout-zebra = 'X'.
ENDFORM. " BUILD_LAYOUT

*&---------------------------------------------------------------------
**& Form DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------
*Display report using ALV grid
*----------------------------------------------------------------------
FORM display_alv_report.
gd_repid = sy-repid.
*call function 'REUSE_ALV_GRID_DISPLAY'CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'USER_COMMAND'
is_layout_lvc = gd_layout
it_fieldcat_lvc = it_fieldcat
i_save = 'X'
TABLES
t_outtab = it_ekko
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc ne 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------
**& Form DATA_RETRIEVAL
*&---------------------------------------------------------------------
***Retrieve data form EKPO table and populate itab it_ekko
*----------------------------------------------------------------------
FORM data_retrieval.
SELECT ebeln
ebelp
statu
aedat
matnr
menge
meins
netpr
peinh
UP TO 10 ROWS
FROM ekpo
INTO CORRESPONDING FIELDS OF TABLE it_ekko.

ENDFORM. " DATA_RETRIEVAL
*&---------------------------------------------------------------------
**& Form set_specific_field_attributes
*&---------------------------------------------------------------------
*populate FIELD_STYLE table with specific field attributes
*----------------------------------------------------------------------
form set_specific_field_attributes .
DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .
*The NETPR field/column has been set to editable in the fieldcatalog...
*The following code sets it to be disabled(display only) if 'NETPR'*is gt than 10.

LOOP AT it_ekko INTO wa_ekko.
IF wa_ekko-netpr GT 10.
ls_stylerow-fieldname = 'NETPR' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND ls_stylerow TO wa_ekko-field_style.
MODIFY it_ekko FROM wa_ekko.
ENDIF.
ENDLOOP.

endform. " set_specific_field_attributes

ALSO READ:

- Add Color In ALV List/Grid Display.

- Use Of Double Click On ALV Grid/List Display.

- Hierarchical ALV Grid/List Display Report Program.

- Header In Bold - ALV Grid/List Display.


- Use Of Double Click On ALV Grid/List Display.

..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.



ABAP - Example On Blocking ALV List/Grid Display

REPORT ZPR_02.

TYPE-POOLS: SLIS.

* Tables Declaration.
TABLES: MARA.

*Internal tables and data declaration.
DATA: BEGIN OF IT_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MBRSH LIKE MARA-MBRSH,
END OF IT_MARA,

BEGIN OF IT_MARC OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
EKGRP LIKE MARC-EKGRP,
END OF IT_MARC,

BEGIN OF IT_MARD OCCURS 0,
MATNR LIKE MARD-MATNR,
WERKS LIKE MARD-WERKS,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
END OF IT_MARD.

DATA: WA_FIELD_CAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELD_CAT1 TYPE SLIS_T_FIELDCAT_ALV,
IT_FIELD_CAT2 TYPE SLIS_T_FIELDCAT_ALV,
IT_FIELD_CAT3 TYPE SLIS_T_FIELDCAT_ALV,
WA_KEYINFO TYPE SLIS_KEYINFO_ALV,
IT_LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_EVENTS1 TYPE SLIS_T_EVENT WITH HEADER LINE,
IT_EVENTS2 TYPE SLIS_T_EVENT WITH HEADER LINE,
IT_EVENTS3 TYPE SLIS_T_EVENT WITH HEADER LINE.
*------------------------------------------------------------------------*
*Selection Screen.
*------------------------------------------------------------------------
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
*------------------------------------------------------------------------*
*Start Of selection.
*------------------------------------------------------------------------*
START-OF-SELECTION.

*Selecting the data.
PERFORM SELECT_DATA.

*Populating the field catelogue.
PERFORM BUILD_FIELD_CAT.

*Displaying the final output.
PERFORM DISPLY_OUTPUT.

*&---------------------------------------------------------------------
**& Form Select_data
*&---------------------------------------------------------------------*
* Selecting the data.
*----------------------------------------------------------------------*
FORM SELECT_DATA .
SELECT MATNR
MTART
MBRSH
FROM MARA
INTO TABLE IT_MARA
WHERE MATNR IN S_MATNR.

IF NOT IT_MARA[] IS INITIAL.
SELECT MATNR
WERKS
EKGRP
FROM MARC
INTO TABLE IT_MARC
FOR ALL ENTRIES IN IT_MARA
WHERE MATNR EQ IT_MARA-MATNR.
ENDIF.

IF NOT IT_MARC[] IS INITIAL.
SELECT MATNR
WERKS
LGORT
LABST
FROM MARD
INTO TABLE IT_MARD
FOR ALL ENTRIES IN IT_MARC
WHERE MATNR = IT_MARC-MATNR
AND WERKS = IT_MARC-WERKS.
ENDIF.
ENDFORM. " Select_data
*&---------------------------------------------------------------------
**& Form Build_field_cat
*&---------------------------------------------------------------------*
* Populating the field catelogue.
*----------------------------------------------------------------------*
FORM BUILD_FIELD_CAT .

DEFINE M_FIELDCAT1.
WA_FIELD_CAT-TABNAME = &1.
WA_FIELD_CAT-FIELDNAME = &2.
WA_FIELD_CAT-SELTEXT_L = &3.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT1.
END-OF-DEFINITION.

DEFINE M_FIELDCAT2.
WA_FIELD_CAT-TABNAME = &1.
WA_FIELD_CAT-FIELDNAME = &2.
WA_FIELD_CAT-SELTEXT_L = &3.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT2.
END-OF-DEFINITION.

DEFINE M_FIELDCAT3.
WA_FIELD_CAT-TABNAME = &1.
WA_FIELD_CAT-FIELDNAME = &2.
WA_FIELD_CAT-SELTEXT_L = &3.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT3.
END-OF-DEFINITION.

M_FIELDCAT1 'MARA' 'MATNR' 'Material No'.
M_FIELDCAT1 'MARA' 'MTART' 'Material type'.
M_FIELDCAT1 'MARA' 'MBRSH' 'Industry Sector'.
M_FIELDCAT2 'MARC' 'MATNR' 'Material No'.
M_FIELDCAT2 'MARC' 'WERKS' 'Plant'.
M_FIELDCAT2 'MARC' 'EKGRP' 'Purchasing Group'.
M_FIELDCAT3 'MARD' 'MATNR' 'Material No'.
M_FIELDCAT3 'MARD' 'WERKS' 'Plant'.
M_FIELDCAT3 'MARD' 'LGORT' 'Storage Loc'.
M_FIELDCAT3 'MARD' 'LABST' 'Valued Stock'.

IT_EVENTS1-NAME = 'TOP_OF_PAGE'.
IT_EVENTS1-FORM = 'F_TOP_OF_PAGE_ONE'.
APPEND IT_EVENTS1. CLEAR IT_EVENTS1.

IT_EVENTS2-NAME = 'TOP_OF_PAGE'.
IT_EVENTS2-FORM = 'F_TOP_OF_PAGE_TWO'.
APPEND IT_EVENTS2. CLEAR IT_EVENTS2.

IT_EVENTS3-NAME = 'TOP_OF_PAGE'.
IT_EVENTS3-FORM = 'F_TOP_OF_PAGE_THREE'.
APPEND IT_EVENTS3. CLEAR IT_EVENTS3.

ENDFORM. " Build_field_cat
*&---------------------------------------------------------------------
**& Form disply_output
*&---------------------------------------------------------------------
** Displaying the final output.
*----------------------------------------------------------------------*
FORM DISPLY_OUTPUT .

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING I_CALLBACK_PROGRAM = SY-REPID.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELD_CAT1[]
I_TABNAME = 'IT_MARA'
IT_EVENTS = IT_EVENTS1[]
TABLES
T_OUTTAB = IT_MARA .

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELD_CAT2[]
I_TABNAME = 'IT_MARC'
IT_EVENTS = IT_EVENTS2[]
TABLES T_OUTTAB = IT_MARC .

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELD_CAT3[]
I_TABNAME = 'IT_MARD'
IT_EVENTS = IT_EVENTS3[]
TABLES T_OUTTAB = IT_MARD .

*&---------------------------------------------------------------------*
*& Form top_of_page_one
*&---------------------------------------------------------------------
* * text
*----------------------------------------------------------------------*
FORM F_TOP_OF_PAGE_ONE.
WRITE: / 'Header details (MARA)'.
ENDFORM. "top_of_page_one

*&---------------------------------------------------------------------
**& Form top_of_page_one
*&---------------------------------------------------------------------
** text*----------------------------------------------------------------------*
FORM F_TOP_OF_PAGE_TWO.
WRITE: / 'Item details (MARC)'.
ENDFORM. "top_of_page_one

*&---------------------------------------------------------------------
**& Form top_of_page_one
*&---------------------------------------------------------------------
** text
*----------------------------------------------------------------------*
FORM F_TOP_OF_PAGE_THREE.
WRITE: / 'Item details (MARD)'.
ENDFORM. "top_of_page_one

ALSO READ:

- Change The Layout Of The ALV List/Grid Display.

- Add Color In ALV List/Grid Display.

- Use Of Double Click On ALV Grid/List Display.

- Hierarchical ALV Grid/List Display Report Program.

..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.

ABAP - Using Of At New, At End Of Commands (Report Programming)

REPORT ZR_A1 NO STANDARD PAGE HEADING.

*Tables declarations*
TABLES: VBAK, VBAP.

*Variable declarations*
DATA: C1 TYPE C.

*Internal Table declarations**
DATA: BEGIN OF IT_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN,
VKORG LIKE VBAK-VKORG,
VTWEG LIKE VBAK-VTWEG,
SPART LIKE VBAK-SPART,
END OF IT_VBAK.

DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
MATNR LIKE VBAP-MATNR,
NETWR LIKE VBAP-NETWR,
BRGEW LIKE VBAP-BRGEW,
NTGEW LIKE VBAP-NTGEW,
END OF IT_VBAP.

DATA: BEGIN OF IT_FINAL OCCURS 0,
VBELN LIKE VBAK-VBELN,
VKORG LIKE VBAK-VKORG,
VTWEG LIKE VBAK-VTWEG,
SPART LIKE VBAK-SPART,
POSNR LIKE VBAP-POSNR,
MATNR LIKE VBAP-MATNR,
NETWR LIKE VBAP-NETWR,
BRGEW LIKE VBAP-BRGEW,
NTGEW LIKE VBAP-NTGEW,
END OF IT_FINAL.

*Selection-screen design*
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-R01.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
SELECTION-SCREEN: END OF BLOCK B1.

TOP-OF-PAGE.
FORMAT INTENSIFIED ON COLOR 5.
WRITE:/7 'LIST TO DISPLAY SALES ITEM INFO'.

START-OF-SELECTION.

*Populating it_vbak table*
SELECT VBELN
VKORG
VTWEG
SPART
FROM VBAK
INTO TABLE IT_VBAK
WHERE VBELN IN S_VBELN.
*populating it_vbap table*
IF NOT IT_VBAK[] IS INITIAL.
SELECT VBELN
POSNR
MATNR
NETWR
BRGEW
NTGEW
FROM VBAP
INTO TABLE IT_VBAP
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN = IT_VBAK-VBELN.
ENDIF.
*populating the final list*
LOOP AT IT_VBAP.
READ TABLE IT_VBAK WITH KEY VBELN = IT_VBAP-VBELN.
IF SY-SUBRC = 0.
MOVE: IT_VBAK-VBELN TO IT_FINAL-VBELN,
IT_VBAK-VKORG TO IT_FINAL-VKORG,
IT_VBAK-VTWEG TO IT_FINAL-VTWEG,
IT_VBAK-SPART TO IT_FINAL-SPART,
IT_VBAP-POSNR TO IT_FINAL-POSNR,
IT_VBAP-MATNR TO IT_FINAL-MATNR,
IT_VBAP-NETWR TO IT_FINAL-NETWR,
IT_VBAP-BRGEW TO IT_FINAL-BRGEW,
IT_VBAP-NTGEW TO IT_FINAL-NTGEW.
APPEND IT_FINAL.
ENDIF.
ENDLOOP.
SORT IT_FINAL BY VBELN.
LOOP AT IT_FINAL.
AT FIRST.
FORMAT INTENSIFIED ON COLOR 1.
WRITE:/35 'SALES DOCUMENT ITEM LIST'.
ULINE AT (100).
FORMAT INTENSIFIED ON COLOR 5.
WRITE:/ SY-VLINE,
2 'SALES.DOCU.NO',
13 'ITEM',
21 'MATERIAL',
50 'NET-VAL',
65 'GROSS-WT',
82 'NET-WT',
100 SY-VLINE.
ENDAT.
FORMAT INTENSIFIED ON COLOR 2.
WRITE:/ SY-VLINE,
2 C1 AS CHECKBOX,
5 IT_FINAL-VBELN,
13 IT_FINAL-POSNR,
21 IT_FINAL-MATNR,
41 IT_FINAL-NETWR,
56 IT_FINAL-BRGEW,
71 IT_FINAL-NTGEW,
100 SY-VLINE.

AT END OF VBELN.
SUM.
FORMAT INTENSIFIED ON COLOR 3.
WRITE:/ SY-VLINE,
30 'SUB-TOTAL:',
41 IT_FINAL-NETWR,
56 IT_FINAL-BRGEW,
71 IT_FINAL-NTGEW.
WRITE:/100 SY-VLINE.
ENDAT.

AT LAST.
SUM.
FORMAT INTENSIFIED ON COLOR 6.
WRITE:/ SY-VLINE,
30 'GRAND-TOTAL:',
41 IT_FINAL-NETWR,
56 IT_FINAL-BRGEW,
71 IT_FINAL-NTGEW.
WRITE:/100 SY-VLINE.
ENDAT. ENDLOOP.

ABAP - ALV Pop Up To Select The Options & Display Them

report zalv_sample .

tables vbak.

data it_vbak like vbak occurs 0 with header line.

selection-screen begin of block b1 with frame.
parameters: alv1 radiobutton group alv, "REUSE_ALV_LIST_DISPLAY
alv2 radiobutton group alv, "REUSE_ALV_POPUP_TO_SELECT
alv3 radiobutton group alv, "REUSE_ALV_GRID_DISPLAY
alv4 radiobutton group alv. " NORMAL DISPLAY
selection-screen end of block b1.

select * from vbak
into corresponding fields of table it_vbak
up to 10 rows.
if alv1 = 'X'. perform alv_func1.
elseif alv2 = 'X'. perform alv_func2.
elseif alv3 = 'X'. perform alv_func3.
elseif alv4 = 'X'. perform norm.
endif.
*&---------------------------------------------------------------------
**& Form ALV_FUNC1
*&---------------------------------------------------------------------
*form alv_func1 .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_structure_name = 'VBAK'
tables
t_outtab = it_vbak
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " ALV_FUNC1

*&---------------------------------------------------------------------
**& Form ALV_FUNC2
*&---------------------------------------------------------------------
*form alv_func2 .
call function 'REUSE_ALV_POPUP_TO_SELECT'
exporting
i_title = 'SALES ORDER INFO'
i_zebra = 'X'
i_tabname = 1
i_structure_name = 'vbak'
tables
t_outtab = it_vbak
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.

endform. " ALV_FUNC2

*&---------------------------------------------------------------------
**& Form ALV_FUNC3
*&---------------------------------------------------------------------
*form alv_func3 .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_structure_name = 'vbak'
i_grid_title = 'SALES ORDER INFO'
tables
t_outtab = it_vbak
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif.
endform. " ALV_FUNC3
*&---------------------------------------------------------------------
**& Form NORM
*&---------------------------------------------------------------------
*form norm .
format intensified.
skip 1.
write: /'SALES DOC.',
' Created on ',
' Time',
' Created by',
' Valid from ',
' Sold-to party'.
format intensified off. skip 2.
loop at it_vbak.
write: / it_vbak-vbeln,
it_vbak-erdat,
it_vbak-erzet,
it_vbak-ernam,
it_vbak-angdt,
it_vbak-kunnr.
endloop.

endform. " FORM

ALSO READ:

- Example On Blocking ALV List/Grid Display.

- Change The Layout Of The ALV List/Grid Display.

- Add Color In ALV List/Grid Display.

- Use Of Double Click On ALV Grid/List Display.


..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.



Related Topics:

- ALV in a Pop up window and ALV in a dialog box.

- All About FM REUSE_ALV_POPUP_TO_SELECT.


ABAP - Display Amount In Words Using Function Module HR_IN_CHG_INR_WRDS.

report ztest.

data: word(20) type c.

CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
EXPORTING
AMT_IN_NUM = '10000000'
IMPORTING
AMT_IN_WORDS = word.

write:/ word.


Related Topic:

- Display Amount In Words Using FM SPELL_AMOUNT

ABAP - Display ALV Report In Different Language

REPORT ZVENKATTEST.

tables:mara,makt.

TYPE-POOLS:SLIS.

data:begin of it_mara occurs 0,
matnr like mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
end of it_mara.

data: begin of it_makt occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
SPRAS like makt-spras,
end of it_makt.

data:begin of it_final occurs 0,
matnr like mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
maktx like makt-maktx,
end of it_final.

DATA:IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_LAYOUT TYPE SLIS_LAYOUT_ALV.

select-options:s_matnr for mara-matnr.
parameters: p_lang like sy-langu.
parameters:p_rad1 radiobutton group g1 DEFAULT 'X',
p_rad2 radiobutton group g1,
p_rad3 radiobutton group g1.

AT SELECTION-SCREEN OUTPUT.

if p_rad1 = 'X'.
p_lang = 'EN'.
endif.

if p_rad2 = 'X'.
p_lang = 'DE'.
endif.

if p_rad3 = 'X'.
p_lang = 'FR'.
endif.

START-OF-SELECTION.

select matnr
meins
mtart
from mara
into table it_mara
where matnr in s_matnr.

select matnr
maktx
spras
from makt
into table it_makt
for all entries in it_mara
where matnr = it_mara-matnr
and spras = p_lang.

loop at it_mara.
it_final-matnr = it_mara-matnr.
it_final-meins = it_mara-meins.
it_final-mtart = it_mara-mtart.
read table it_makt with key matnr = it_mara-matnr.
it_final-maktx = it_makt-maktx.
append it_final.
clear it_final.
endloop.

WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-REF_FIELDNAME = 'MATNR'.
WA_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-REF_FIELDNAME = 'MEINS'.
WA_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'MTART'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-REF_FIELDNAME = 'MTART'.
WA_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'MAKTX'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-REF_FIELDNAME = 'MATKX'.
WA_FIELDCAT-REF_TABNAME = 'MAKT'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES T_OUTTAB = IT_FINAL.


ALSO READ:

- ALV Pop Up To Select The Options & Display Them.

- Example On Blocking ALV List/Grid Display.

- Change The Layout Of The ALV List/Grid Display.

- Add Color In ALV List/Grid Display.

- Use Of Double Click On ALV Grid/List Display.

..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.

ABAP - Traffic Light In An ALV Report Program

REPORT ALV_LIGHTS.

COMTYPES: BEGIN OF ty_alv,
lights(1) TYPE c, "Exception, Holding the value of the lights
text(20) TYPE c, "some text
END OF ty_alv.

DATA: gs_alv TYPE ty_alv,
gt_alv TYPE TABLE OF ty_alv,
gr_alv TYPE REF TO cl_salv_table,
gr_columns TYPE REF TO cl_salv_columns_table.

START-OF-SELECTION.

gs_alv-lights = '1'. "Color red
gs_alv-text = 'RED SIGNAL'.
APPEND gs_alv TO gt_alv.

gs_alv-lights = '2'. "Color yellow
gs_alv-text = 'YELLOW SIGNAL'.
APPEND gs_alv TO gt_alv.

gs_alv-lights = '3'. "Color green
gs_alv-text = 'GREEN SIGNAL'.
APPEND gs_alv TO gt_alv.

CALL METHOD cl_salv_table=>factory
IMPORTING r_salv_table = gr_alv
CHANGING t_table = gt_alv.

gr_columns = gr_alv->get_columns( ).
gr_columns->set_exception_column( value = 'LIGHTS' ).

CALL METHOD gr_alv->display.


Related Topic:

- ALV with Traffic Signals using classes.

- Traffic Light In An ALV Report Program.

- Display ALV Report In Different Language.

- ALV Pop Up To Select The Options & Display Them.

- Example On Blocking ALV List/Grid Display.

- Change The Layout Of The ALV List/Grid Display.

..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.


ABAP - Upload Data From Excel Sheet To Internal Table Using FM ALSM_EXCEL_TO_INTERNAL_TABLE.

REPORT ZTESTPROG.

TYPES: BEGIN OF ty_upload,
matnr like mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
mbrsh like mara-mbrsh,
END OF ty_upload.

DATA it_upload TYPE STANDARD TABLE OF ty_upload WITH header line.

DATA wa_upload TYPE ty_upload.

DATA: itab TYPE STANDARD TABLE OF alsmex_tabline WITH header line.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = 'C:\Documents and Settings\venkatapp\Desktop\venkat.xls'
i_begin_col = 1
i_begin_row = 1
i_end_col = 4
i_end_row = 65535
TABLES
intern = itab.

if not itab[] is initial.

loop at itab .

case itab-col.
when '0001'.
it_upload-matnr = itab-value.
when '0002'.
it_upload-meins = itab-value.
when '0003'.
it_upload-mtart = itab-value.
when '0004'.
it_upload-mbrsh = itab-value.
append it_upload.
clear it_upload.
clear itab.
endcase.

endloop.
endif.


ALSO READ:


RETURN TO MAIN INDEX