How to use subtotal in ALV report
hi all,
I need to find subtotal say for Event_ID(type numc) and this should come in the ALV grid intial screen itself.
I have coded like
gs_sort1-spos = '1'.
gs_sort1-fieldname = 'EVENT_ID'.
gs_sort1-up = 'X'.
gs_sort1-subtot = 'X'.
APPEND gs_sort1 TO gt_sort1.
and declare gt_sort1 in FM' REUSE_ALV_GRID_DISPLAY'.. but I am not getting the subtotal in the ALV screen
points will be rewarded
thanks in advance
it is urgent
Hi Jayasree,
Plerase check this program
REPORT z_demo_alv_sort.
* This program lists orders (VBAK) with sort and sub-total for *
* 'sold-to-party' (KUNNR) and 'Sales organization' (VKORG) *
TABLES : vbak.
TYPE-POOLS: slis. " ALV Global types
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
DATA:
BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg, " Sales organization
kunnr LIKE vbak-kunnr, " Sold-to party
vbeln LIKE vbak-vbeln, " Sales document
netwr LIKE vbak-netwr, " Net Value of the Sales Order
waerk LIKE vbak-waerk, " Document currency
END OF gt_vbak.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
* Form f_read_data
FORM f_read_data.
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
FROM vbak
UP TO p_max ROWS
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
* Form f_display_data
FORM f_display_data.
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA
Hope this helps...
Best regards,
raam
Similar Messages
-
How to use usercommand in alv report
pls let me know as soon as as possible
Hello Baig,
in function module...
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
<b>
* I_CALLBACK_USER_COMMAND = ' '
</b>
I_STRUCTURE_NAME =
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_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
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab =
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.
in bold parameters, you need to give one routine name in caps with single quotes.
and write your own user command in that routine.
Example:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
FORM USER_COMMAND USING R_COMMAND TYPE SY-UCOMM SELFLD TYPE SLIS_SELFIELD.
Statements.
ENDFORM.
Reward if Helpful
Regards
Sasidhar Reddy Matli.
Message was edited by:
Sasidhar Reddy Matli
Message was edited by:
Sasidhar Reddy Matli -
How to find out the total, subtotal in alv report
hi dears,
how to find out the total, subtotal in alv report?
pls tell me logic ,
i will be waiting for eply
regards
eswarHi,
<b>ALV Grid List with sub-totals</b>
REPORT z_demo_alv_sort.
* This program lists orders (VBAK) with sort and sub-total for *
* 'sold-to-party' (KUNNR) and 'Sales organization' (VKORG) *
TABLES : vbak.
TYPE-POOLS: slis. " ALV Global types
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
DATA:
BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg, " Sales organization
kunnr LIKE vbak-kunnr, " Sold-to party
vbeln LIKE vbak-vbeln, " Sales document
netwr LIKE vbak-netwr, " Net Value of the Sales Order
waerk LIKE vbak-waerk, " Document currency
END OF gt_vbak.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
* Form f_read_data
FORM f_read_data.
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
FROM vbak
UP TO p_max ROWS
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
* Form f_display_data
FORM f_display_data.
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA
***************** END OF PROGRAM Z_DEMO_ALV_SORT **********************
Regards
Sudheer -
How to devolped an Interactive ALV Report to display sales orders
hi,
how to devolped an Interactive ALV Report to display sales orders pertaining to the selected Customers and item details in the secondary list.For this report what are the tables and fields wehave to used give with example.
thank you
radhakrishnaHi,
look via se38 for BCALV* and SALV*.
Try ABAPDOCU.
Regards, Dieter -
How to upload logos in alv reports
how to upload logos in alv reports?
Hi Kishore,
ALV LOGO
Re: How do I insert a logo in ALV using Function Modules?
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid.htm
Steps for uploading Logo :-:
1. Goto the transaction OAER
2. Enter the class name as 'PICTURES'
3. Enter the class type as 'OT'
4. Enter the object key as the name of the logo you wish to give
5. Execute
6. Then in the new screen select Standard doc. types in bottom window
Click on the Screen icon
Now, it will ask for the file path where you have to upload the logo
7. Now you can use this logo in REUSE_ALV_COMMENTARY_WRITE
Here you go !!
*& Form TOP_OF_PAGE
text
FORM F_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo = Logo name
I_END_OF_LIST_GRID =.
ENDFORM. "TOP_OF_PAGE
Hope this helps.
Manish -
Hi,
How To add Logo in ALV Report?
I need step by step explanation.Hi uday,
go through this hope u can understand.
*&amp; Report Z_OOALV_LOGO
*&--Sample Program using ooalv-> by SrikanthV--
REPORT z_ooalv_logo.
****DECLARATION FOR LOGO INSERT
CONSTANTS: cntl_true TYPE i VALUE 1,
cntl_false TYPE i VALUE 0.
DATA:h_picture TYPE REF TO cl_gui_picture,
h_pic_container TYPE REF TO cl_gui_custom_container.
DATA: graphic_url(255),
graphic_refresh(1),
g_result LIKE cntl_true.
DATA: BEGIN OF graphic_table OCCURS 0,
line(255) TYPE x,
END OF graphic_table.
DATA: graphic_size TYPE i.
CALL SCREEN 100.
*&----
*& Module PICTURE OUTPUT
text
MODULE picture OUTPUT.
DATA: l_graphic_xstr TYPE xstring,
l_graphic_conv TYPE i,
l_graphic_offs TYPE i.
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = 'GRAPHICS'
p_name = 'EDS'"IMAGE NAME - Image name from SE78
p_id = 'BMAP'
p_btype = 'BCOL'
RECEIVING
p_bmp = l_graphic_xstr
EXCEPTIONS
not_found = 1
OTHERS = 2.
graphic_size = XSTRLEN( l_graphic_xstr ).
CHECK graphic_size > 0.
l_graphic_conv = graphic_size.
l_graphic_offs = 0.
WHILE l_graphic_conv > 255.
graphic_table-line = l_graphic_xstr+l_graphic_offs(255).
APPEND graphic_table.
l_graphic_offs = l_graphic_offs + 255.
l_graphic_conv = l_graphic_conv - 255.
ENDWHILE.
graphic_table-line = l_graphic_xstr+l_graphic_offs(l_graphic_conv).
APPEND graphic_table.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'
subtype = cndp_sap_tab_unknown " 'X-UNKNOWN'
size = graphic_size
lifetime = cndp_lifetime_transaction "'T'
TABLES
data = graphic_table
CHANGING
url = graphic_url
EXCEPTIONS
dp_invalid_parameter = 1
dp_error_put_table = 2
dp_error_general = 3
OTHERS = 4 .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
CREATE OBJECT h_pic_container
EXPORTING container_name = 'LOGO'.
CREATE OBJECT h_picture EXPORTING parent = h_pic_container.
CALL METHOD h_picture->load_picture_from_url
EXPORTING
url = graphic_url
IMPORTING
RESULT = g_result.
ENDMODULE. " PICTURE OUTPUT
Reward points if helpful.
Thanks -
How to find the customised alv reports
Hi guys,
I m working on a alv-grid report in PP.I want to know how can i find the alv reports already been created in the system.
Thanks in advance.hi,
GO to se37
give the fm name
reuse_alv_grid_display
reuse_alv_LIST_display
and clik the where used list
and select programs
and in that list check out the zprograms or y programs
then you can see it
regards,
Venkatesh -
hello freinds,
I am facing problem of subtotal in alv report.
I am explaining my problem.....................
In my report there are 8 columns...
in first colum there is <b>'Acount Number'</b> field. I have to sort out it.and I have done it succesfully. Now in my seventh and eighth column there are fields 'PAYMENT GROSS AMOUNT' and ' IVA AMOUNT' respectively.
Now I have to do subtotal of these two columns (7th & 8th) according to first column value i.e Acount Number.
Please send me solution.
Thanks in Advance........Hi,
try this code ,hope usefull to u, please reward point if usefull to u.
*& Report ZALV_SUBTOTAL
This program lists orders (VBAK) with sort and sub-total for *
'sold-to-party' (KUNNR) and 'Sales organization' (VKORG) *
REPORT ZALV_SUBTOTAL.
TABLES : vbak.
TYPE-POOLS: slis. " ALV Global types
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
DATA:
BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg, " Sales organization
kunnr LIKE vbak-kunnr, " Sold-to party
vbeln LIKE vbak-vbeln, " Sales document
netwr LIKE vbak-netwr, " Net Value of the Sales Order
waerk LIKE vbak-waerk, " Document currency
END OF gt_vbak.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
Form f_read_data
FORM f_read_data.
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
FROM vbak
UP TO p_max ROWS
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
Form f_display_data
FORM f_display_data.
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA
END OF PROGRAM Z_DEMO_ALV_SORT **********************
Regards
fareedas -
How to do subtotal in alv?
Hi,
I have a problem to do the subtotal in alv.
The outlook of alv now is as following:
Specimen Adversary Amount
ZZZ 300100089 1050
ZZZ 300100089 -1050
90256243 300100000 193410
90256242 300100000 173250
90256241 300100000 173250
90256240 300100000 173250
90256239 300100000 173250
90256238 300100000 173250
90256237 300100000 173250
What I need to do it to sum up the amount for same "ADVERSARY"
The out-come image should be
Specimen Adversary Amount
ZZZ 300100089 1050
ZZZ 300100089 -1050
subtotal 0
90256243 300100000 193410
90256242 300100000 173250
90256241 300100000 173250
90256240 300100000 173250
90256239 300100000 173250
90256238 300100000 173250
90256237 300100000 173250
subtotal 1232910
Question:
How can I add the subtotal in alv?
Please help!!
The following is the original coding:
END-OF-SELECTION.
SORT t.
LOOP AT t.
AT NEW bukrs.
CLEAR anz_dl.
CLEAR htext-anzahl.
CLEAR htext-datei.
htext-text1 = ' records writen in file '.
CLEAR p_pfad.
CONCATENATE
i_pfad
'CU_CC'
t-bukrs
sy-datum+6(2)
sy-datum+4(2)
sy-datum(4)
sy-uzeit
'.txt'
INTO p_pfad.
CLEAR outtab.
REFRESH outtab.
REFRESH: gt_outalv. "INS MG020207
ENDAT.
IF t-shkzg = 'H'.
h_betrg = t-wrbtr * -1.
ELSE.
h_betrg = t-wrbtr.
h_dmbtr = t-dmbtr.
ENDIF.
s-filler1 = s-filler2 = s-filler3 = s-filler4 = s-filler5 = ';'.
s-filler6 = s-filler7 = s-filler8 = ';'.
s-filler9 = s-filler10 = s-filler11 = s-filler12 = s-filler13 = ';'.
s-filler14 = ';'.
s-belnr = t-belnr.
IF t-xblnr NE space. "WD041005a
s-xblnr = t-xblnr. "WD041005a
ELSE. "WD041005a
s-xblnr = t-belnr. "WD041005a
ENDIF. "WD041005a
WHILE s-xblnr(1) EQ '0'. "INS MG130606
SHIFT s-xblnr LEFT. "INS MG130606
ENDWHILE. "INS MG130606
WRITE t-kunnr TO s-kunnr NO-ZERO.
s-lifn2 = s-kunnr.
shift s-lifn2 RIGHT.
s-lifn2(1) = 'R'.
S-KUNNR = T-KUNNR+5(5).
s-bldat+2(1) = '/'.
s-bldat+5(1) = '/'.
s-bldat0(2) = t-bldat4(2).
s-bldat3(2) = t-bldat6(2).
s-bldat6(4) = t-bldat0(4).
s-budat+2(1) = '/'.
s-budat+5(1) = '/'.
s-budat0(2) = t-budat4(2).
s-budat3(2) = t-budat6(2).
s-budat6(4) = t-budat0(4).
s-netdt+2(1) = '/'.
s-netdt+5(1) = '/'.
s-netdt0(2) = t-netdt4(2).
s-netdt3(2) = t-netdt6(2).
s-netdt6(4) = t-netdt0(4).
s-waers = t-waers.
s-dmbtr = t-dmbtr.
s-sgtxt = t-sgtxt.
CLEAR s-twaer.
SELECT SINGLE waers INTO s-twaer
FROM t001
WHERE bukrs = t-bukrs.
IF h_betrg < 0.
hs_betrg+0(1) = '-'.
ELSE.
hs_betrg+0(1) = ' '.
ENDIF.
WRITE h_betrg CURRENCY t-waers TO hs_betrg+1 NO-GROUPING
NO-SIGN
LEFT-JUSTIFIED.
REPLACE ',' WITH '.' INTO hs_betrg.
WRITE hs_betrg TO s-betrg.
IF h_dmbtr < 0.
hs_betrg+0(1) = '-'.
ELSE.
hs_betrg+0(1) = ' '.
ENDIF.
WRITE h_dmbtr CURRENCY t-waers TO hs_betrg+1 NO-GROUPING
NO-SIGN
LEFT-JUSTIFIED.
REPLACE ',' WITH '.' INTO hs_betrg.
WRITE hs_betrg TO s-dmbtr.
s-compcode = t-bukrs. "fw070905
IF p_downl = 'X'.
MOVE s TO outtab-s.
APPEND outtab.
ADD 1 TO anz_dl.
ENDIF.
gs_outalv-belnr = s-belnr. "INS MG020207
*<<<< CR01 START ADD as_outalv-zuonr
gs_outalv-zuonr = s-zuonr. "CR01
*>>>> CR01 EDD ADD as_outalv-zuonr
gs_outalv-kunnr = s-kunnr. "INS MG020207
gs_outalv-bldat = s-bldat. "INS MG020207
gs_outalv-netdt = s-netdt. "INS MG020207
gs_outalv-betrg = s-betrg. "INS MG020207
gs_outalv-waers = s-waers. "INS MG020207
gs_outalv-compcode = s-compcode. "INS MG020207
gs_outalv-budat = s-budat. "INS MG020207
gs_outalv-sgtxt = s-sgtxt.
gs_outalv-kmmnt = s-kmmnt.
gs_outalv-vbeln = s-vbeln.
gs_outalv-xblnr = s-xblnr.
gs_outalv-lifn2 = s-lifn2.
gs_outalv-dmbtr = s-dmbtr.
gs_outalv-twaer = s-twaer.
APPEND gs_outalv TO gt_outalv. "INS MG020207
AT END OF bukrs.
WRITE anz_dl TO htext-anzahl.
WRITE p_pfad TO htext-datei.
CONDENSE htext.
IF p_downl = 'X'.
SKIP 2.
WRITE: / htext.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = p_pfad
filetype = 'ASC'
TABLES
data_tab = outtab
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc 0.
write: / 'Error creating File:', P_Pfad, sy-subrc.
MESSAGE e405 WITH text-002 p_pfad.
ENDIF.
ENDIF.
*<<<<< INS MG020207
IF p_alvd EQ 'X'.
PERFORM build_layout_data.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = 'GT_OUTALV'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
i_callback_top_of_page = 'TOP-OF-PAGE'
TABLES
t_outtab = gt_outalv.
ENDIF.
*>>>>> INS MG020207
ENDAT.
ENDLOOP.Check this code....it will help you...reward if useful.
REPORT ZPP473_VEHICLE_REVERSAL_REP NO STANDARD PAGE HEADING
MESSAGE-ID ZPP.
TABLES:ZPP18_RT_CORR.
TYPE-POOLS:SLIS.
DATA:BEGIN OF WA_VEH_REV,
VEHNO TYPE ZPP18_RT_CORR-VEHNO,
MATNR TYPE ZPP18_RT_CORR-MATNR,
WERKS TYPE ZPP18_RT_CORR-WERKS,
MDV01 TYPE ZPP18_RT_CORR-MDV01,
ENGNO TYPE ZPP18_RT_CORR-ENGNO,
FRMNO TYPE ZPP18_RT_CORR-FRMNO,
ERFMG TYPE ZPP18_RT_CORR-ERFMG,
SHIFT TYPE ZPP18_RT_CORR-SHIFT,
ZUNAME TYPE ZPP18_RT_CORR-ZUNAME,
ZDATE TYPE ZPP18_RT_CORR-ZDATE,
MAKTX TYPE MAKT-MAKTX,
ZREASON_DES TYPE ZPP17_REASON_COD-ZREASON_DES,
*VTEXT TYPE T179T-VTEXT,
END OF WA_VEH_REV.
DATA:IT_VEH_REV LIKE STANDARD TABLE OF WA_VEH_REV.
DATA: ALVFLD TYPE SLIS_FIELDCAT_ALV,
FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: WK_LAYOUT TYPE SLIS_LAYOUT_ALV,
I_SORT TYPE SLIS_T_SORTINFO_ALV,
W_SORT LIKE LINE OF I_SORT.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:
SO_ZDATE FOR ZPP18_RT_CORR-ZDATE OBLIGATORY,
SO_WERKS FOR ZPP18_RT_CORR-WERKS,
SO_SHIFT FOR ZPP18_RT_CORR-SHIFT,
SO_MDV01 FOR ZPP18_RT_CORR-MDV01,
SO_MATNR FOR ZPP18_RT_CORR-MATNR,
SO_VEHNO FOR ZPP18_RT_CORR-VEHNO,
SO_ENGNO FOR ZPP18_RT_CORR-ENGNO,
SO_FRMNO FOR ZPP18_RT_CORR-FRMNO,
SO_UNAME FOR ZPP18_RT_CORR-ZUNAME.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
**GET REVERSAL,MATERIAL DESCRIPTIONS, REASON DESCRIPTIONS
SELECT ZPP18_RT_CORR~VEHNO
ZPP18_RT_CORR~MATNR
ZPP18_RT_CORR~WERKS
ZPP18_RT_CORR~MDV01
ZPP18_RT_CORR~ENGNO
ZPP18_RT_CORR~FRMNO
ZPP18_RT_CORR~ERFMG
ZPP18_RT_CORR~SHIFT
ZPP18_RT_CORR~ZUNAME
ZPP18_RT_CORR~ZDATE
MAKT~MAKTX
ZPP17_REASON_COD~ZREASON_DES
INTO TABLE IT_VEH_REV FROM
ZPP18_RT_CORR INNER JOIN MAKT
ON ( ZPP18_RT_CORRMANDT = MAKTMANDT AND
ZPP18_RT_CORRMATNR = MAKTMATNR )
INNER JOIN ZPP17_REASON_COD
ON ( ZPP18_RT_CORRMANDT = ZPP17_REASON_CODMANDT AND
ZPP18_RT_CORRZREASON = ZPP17_REASON_CODZREASON )
CLIENT SPECIFIED
WHERE ZPP18_RT_CORR~MANDT = SY-MANDT
AND ZPP18_RT_CORR~ZDATE IN SO_ZDATE
AND ZPP18_RT_CORR~WERKS IN SO_WERKS
AND ZPP18_RT_CORR~SHIFT IN SO_SHIFT
AND ZPP18_RT_CORR~MATNR IN SO_MATNR
AND ZPP18_RT_CORR~MDV01 IN SO_MDV01
AND ZPP18_RT_CORR~VEHNO IN SO_VEHNO
AND ZPP18_RT_CORR~ENGNO IN SO_ENGNO
AND ZPP18_RT_CORR~FRMNO IN SO_FRMNO
AND ZPP18_RT_CORR~ZUNAME IN SO_UNAME
AND MAKT~SPRAS = SY-LANGU.
IF SY-SUBRC = 0.
SORT IT_VEH_REV ASCENDING BY ZDATE SHIFT WERKS MDV01 MATNR.
ELSE.
MESSAGE I961 WITH 'No Data Found...Try Again !!!'.
STOP.
ENDIF.
**BUILD ALV DISPLAY.
DEFINE ALV_MACRO.
ALVFLD-FIELDNAME = &1.
ALVFLD-SELTEXT_M = &2.
ALVFLD-COL_POS = &3.
IF &1 = 'ERFMG'.
ALVFLD-DO_SUM = 'X'.
ENDIF.
APPEND ALVFLD TO FIELDCAT.
CLEAR ALVFLD.
END-OF-DEFINITION.
REFRESH FIELDCAT.
WK_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
ALV_MACRO 'ZDATE' 'Rev.Date' '1'.
ALV_MACRO 'SHIFT' 'Shift' '2'.
ALV_MACRO 'WERKS' 'Plant' '3'.
ALV_MACRO 'MDV01' 'Conveyor' '4'.
ALV_MACRO 'MATNR' 'Material.No' '5'.
ALV_MACRO 'MAKTX' 'Description' '6'.
ALV_MACRO 'VEHNO' 'Veh.No' '7'.
ALV_MACRO 'ENGNO' 'Eng.No' '8'.
ALV_MACRO 'FRMNO' 'Frame.No' '9'.
ALV_MACRO 'ERFMG' 'Qty' '10'. <----Do Sum Here
ALV_MACRO 'ZREASON_DES' 'Reason' '11'.
ALV_MACRO 'ZUNAME' 'User.Reversed' '12'.
REFRESH I_SORT.
W_SORT-SPOS = 1.
W_SORT-FIELDNAME = 'ZDATE'.
W_SORT-UP = 'X'.
APPEND W_SORT TO I_SORT.
CLEAR W_SORT.
W_SORT-SPOS = 6.
W_SORT-FIELDNAME = 'MAKTX'.
W_SORT-UP = 'X'.
W_SORT-SUBTOT = 'X'.
APPEND W_SORT TO I_SORT.
CLEAR W_SORT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_GRID_TITLE = 'Vehicle Reversal Report'
IS_LAYOUT = WK_LAYOUT
IT_FIELDCAT = FIELDCAT[]
IT_SORT = I_SORT[]
TABLES
T_OUTTAB = IT_VEH_REV[]
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.
END-OF-SELECTION. -
How to add button in ALV report (Class method )?
Hello experts,
I have developed one ALV report using classes.
I want to add one more button on the report like already is there named DISPLQUA
How ca i do that here?
Following the code of CLASS definition & implimentation
CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS:
handle_on_user_command FOR EVENT added_function OF cl_salv_events
IMPORTING e_salv_function.
ENDCLASS. "lcl_handle_events DEFINITION
CLASS lcl_handle_events IMPLEMENTATION
CLASS lcl_handle_events IMPLEMENTATION.
METHOD handle_on_user_command.
CASE e_salv_function.
WHEN 'DISPLQUA'.
PERFORM show_quant_record.
WHEN 'DISPQM03'. " Here i want to add button
PERFORM display_quality_notification.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "handle_on_user_command
ENDCLASS. "lcl_handle_events IMPLEMENTATIONHI Ronny.
Code snippet for reference.
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION.
METHODS :
*--Toolbar control
HANDLE_TOOLBAR FOR EVENT TOOLBAR
OF CL_GUI_ALV_GRID IMPORTING E_OBJECT
E_INTERACTIVE,
ENDCLASS
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*--handle toolbar
METHOD HANDLE_TOOLBAR.
* append a separator to normal toolbar
CLEAR G_TOOLBAR.
G_TOOLBAR-BUTN_TYPE = 3.
APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
CLEAR G_TOOLBAR.
G_TOOLBAR-FUNCTION = 'SAVE'.
G_TOOLBAR-ICON = ICON_SYSTEM_SAVE.
G_TOOLBAR-BUTN_TYPE = 0.
G_TOOLBAR-QUICKINFO = 'Save the Customer'(203).
APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD. "HANDLE_TOOLBAR
Hope this helps.
Gary.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 7, 2008 5:41 PM -
How to display icon in alv report output
hi,
my ewquirement in in alv report in one column to diaplay the icon(tickmark) based on some codition.
how to achieve it??
condition is
Affected (Locked on Current ECM) u2013 can use symbols for affected and for changing u2013
u2022 Lock AEOI u2013 CCLCK for AE01-OBJKT (Material) lock.
Condition:
If AEOI u2013 CCLCK is activated then display symbols (tickmark) in line of their AE01-OBJKT (Material). else display
(x mark)Hi,
In field catalog of grid set
Ex--
when 'Field'.
lwa_fcat-icon = c_true.
based on your condition
set the desired icon in table.
Ex.... lwa_table-field = icon_tick. -
How to create Status in ALV reports?
Hi experts,
I need to create a status in a alv report. but i am not getting how to create it. i have declared a variable type slis_formname. and appended the events with it. now how to create the status in form.answers will be rewarded.
Thanks in advance,
RamanaHello Venkat,
Copy the standard pf status of the ALV in SE41 and do the following.
DATA: IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS LIKE LINE OF IT_EVENTS.
REFRESH: IT_EVENTS.
CLEAR: WA_EVENTS,IT_EVENTS.
WA_EVENTS-NAME = 'PF_STATUS_SET'.
WA_EVENTS-FORM = 'STATUS'.
APPEND WA_EVENTS TO IT_EVENTS .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = IT_VARIANT-REPORT
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
I_SAVE = 'A'
IS_VARIANT = IT_VARIANT
IT_SORT = IT_SORT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = G_T_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
FORM status *
FORM STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STANDARD' EXCLUDING RT_EXTAB.
ENDFORM.
If useful reward.
Vasanth -
How to color row in ALV report?
hi
I am creating an ALV report using factory method.
my report is based on itab which contain 3 coulms, 1 column is ERROR_TYPE . how can i color all the rows which contain E in error_type ???
thanks
AmiTABLES:LFA1.
SELECT-OPTIONS:LIFNR FOR LFA1-LIFNR.
DATA:BEGIN OF ITAB OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
LAND1 LIKE LFA1-LAND1,
ORT01 LIKE LFA1-ORT01,
REGIO LIKE LFA1-REGIO,
SORTL LIKE LFA1-SORTL,
CFIELD(4) TYPE C,
END OF ITAB.
data:col(4).
data:num value '1'.
SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE LIFNR
IN LIFNR.
LOOP AT ITAB.
concatenate 'C' num '10' into col .
ITAB-CFIELD = col.
num = num + 1.
if num = '8'.
num = '1'.
endif.
MODIFY ITAB.
ENDLOOP.
TYPE-POOLS:SLIS.
DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
DATA:EVE TYPE SLIS_T_EVENT WITH HEADER LINE.
LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
LAYOUT-WINDOW_TITLEBAR = 'VENDORS DETAILS SCREEN'.
LAYOUT-EDIT = 'X'.
LAYOUT-info_fieldname = 'CFIELD'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'ITAB'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = FCAT.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FCAT
TABLES
T_OUTTAB = ITAB.
this is for coloring cols
REPORT ZBHCOLOR_COLS.
TABLES:LFA1.
SELECT-OPTIONS:C_LIFNR FOR LFA1-LIFNR. " FOR GRID ONLY
PARAMETERS:LIST RADIOBUTTON GROUP ALV DEFAULT 'X',
GRID RADIOBUTTON GROUP ALV.
DATA:BEGIN OF ITAB OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
LAND1 LIKE LFA1-LAND1,
ORT01 LIKE LFA1-ORT01,
SORTL LIKE LFA1-SORTL,
REGIO LIKE LFA1-REGIO,
COL TYPE LVC_T_SCOL,
END OF ITAB.
DATA:COLR TYPE LVC_S_SCOL.
SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB.
LOOP AT ITAB.
IF ITAB-LIFNR IN C_LIFNR.
COLR-FNAME = 'NAME1'.
COLR-COLOR-COL = '5'.
COLR-COLOR-INT = '1'.
COLR-COLOR-INV = '0'.
COLR-NOKEYCOL = 'X'.
APPEND COLR TO ITAB-COL.
COLR-FNAME = 'LIFNR'.
APPEND COLR TO ITAB-COL.
MODIFY ITAB.
ENDIF.
ENDLOOP.
TYPE-POOLS:SLIS.
DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
LAYOUT-ZEBRA = 'X'.
layout-coltab_fieldname = 'COL'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'ITAB'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = FCAT.
IF LIST = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FCAT
TABLES
T_OUTTAB = ITAB.
ELSEIF GRID = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FCAT
TABLES
T_OUTTAB = ITAB.
ENDIF.
Reward points if useful. -
How to Input Value in ALV report at reuntime...?
Dear All,
How to Input Value or change the value of a field in ALV report at runtime...?
regards,HI,
To input value in ALV you have to make it editable.
to change values at runtime you have to capture some events and then change your values in internal table which is used to display alv.
Here is an example of editable ALV.
<b>REPORT ZWA_ALV_EDITABLE_FM .
type-pools: slis.
data: gs_layout type slis_layout_alv.
DATA: d_ref TYPE REF TO data.
DATA: itab type table of fmfint.
SELECT * FROM fmfint
INTO TABLE itab.
gs_layout-edit = 'X'.
* Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = 'ZWA_ALV_EDITABLE_FM'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'fmfint'
is_layout = gs_layout
tables
t_outtab = itab.
form user_command using r_ucomm type sy-ucomm
rs_selfield type slis_selfield.
if r_ucomm = '&DATA_SAVE'.
message i000(SU) with 'saved'.
MODIFY fmfint FROM TABLE itab.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_structure_name = 'fmfint'
tables
t_outtab = itab.
endif.
endform.</b>
Regards,
Wasim Ahmed -
How to display subtotal in ALV, where the field is not a numeric.
Hi
We are having a requirement to display the sub total for a field using ALV grid display, where the field is not numeric.
The field is characte, Status field(consists of values Submit, Approve ,Reject), where the subtotal should be value of count of group by status .
say status with submit are 10 records, so after all records with submit status are, displyed, we need to display its subtotal as 10.
Thanks & AdvanceHi Satya,
REPORT z_alv_subtotal.*&---------------------------------------------------------------------*
*& Table declaration
*&---------------------------------------------------------------------*TABLES: ekko.*&---------------------------------------------------------------------*
*& Type pool declaration
TYPE-POOLS: slis. " Type pool for ALV*&---------------------------------------------------------------------*
*& Selection screen
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.*&---------------------------------------------------------------------*
*& Type declaration
*&---------------------------------------------------------------------** Type declaration for internal table to store EKPO data
TYPES: BEGIN OF x_data,
ebeln TYPE char30, " Document no.
ebelp TYPE ebelp, " Item no
matnr TYPE matnr, " Material no
matnr1 TYPE matnr, " Material no
werks TYPE werks_d, " Plant
werks1 TYPE werks_d, " Plant
ntgew TYPE entge, " Net weight
gewe TYPE egewe, " Unit of weight
END OF x_data.*&---------------------------------------------------------------------*
*& Internal table declaration
DATA:* Internal table to store EKPO data
i_ekpo TYPE STANDARD TABLE OF x_data INITIAL SIZE 0,
* Internal table for storing field catalog information
i_fieldcat TYPE slis_t_fieldcat_alv,
* Internal table for Top of Page info. in ALV Display
i_alv_top_of_page TYPE slis_t_listheader,
* Internal table for ALV Display events
i_events TYPE slis_t_event,
* Internal table for storing ALV sort information
i_sort TYPE slis_t_sortinfo_alv,
i_event TYPE slis_t_event.*&---------------------------------------------------------------------*
*& Work area declaration
*&---------------------------------------------------------------------*DATA:
wa_ekko TYPE x_data,
wa_layout TYPE slis_layout_alv,
wa_events TYPE slis_alv_event,
wa_sort TYPE slis_sortinfo_alv.*&---------------------------------------------------------------------*
*& Constant declaration
*&---------------------------------------------------------------------*CONSTANTS:
c_header TYPE char1
VALUE 'H', "Header in ALV
c_item TYPE char1
VALUE 'S'.*&---------------------------------------------------------------------*
*& Start-of-selection event
*&---------------------------------------------------------------------*START-OF-SELECTION.* Select data from ekpo
SELECT ebeln " Doc no
ebelp " Item
matnr " Material
matnr " Material
werks " Plant
werks " Plant
ntgew " Quantity
gewei " Unit
FROM ekpo
INTO TABLE i_ekpo
WHERE ebeln IN s_ebeln
AND ntgew NE '0.00'. IF sy-subrc = 0.
SORT i_ekpo BY ebeln ebelp matnr .
ENDIF.* To build the Page header
PERFORM sub_build_header.* To prepare field catalog
PERFORM sub_field_catalog.* Perform to populate the layout structure
PERFORM sub_populate_layout.* Perform to populate the sort table.
PERFORM sub_populate_sort.* Perform to populate ALV event
PERFORM sub_get_event.END-OF-SELECTION.* Perform to display ALV report
PERFORM sub_alv_report_display.
*& Form sub_build_header
* To build the header
* No Parameter
FORM sub_build_header .* Local data declaration
DATA: l_system TYPE char10 , "System id
l_r_line TYPE slis_listheader, "Hold list header
l_date TYPE char10, "Date
l_time TYPE char10, "Time
l_success_records TYPE i, "No of success records
l_title(300) TYPE c. " Title
* Title Display
l_r_line-typ = c_header. " header
l_title = 'Test report'(001).
l_r_line-info = l_title.
APPEND l_r_line TO i_alv_top_of_page.
CLEAR l_r_line.* Run date Display
CLEAR l_date.
l_r_line-typ = c_item. " Item
WRITE: sy-datum TO l_date MM/DD/YYYY.
l_r_line-key = 'Run Date :'(002).
l_r_line-info = l_date.
APPEND l_r_line TO i_alv_top_of_page.
CLEAR: l_r_line,
l_date.ENDFORM. " sub_build_header
*& Form sub_field_catalog
* Build Field Catalog
* No Parameter
FORM sub_field_catalog .* Build Field Catalog
PERFORM sub_fill_alv_field_catalog USING: '01' '01' 'EBELN' 'I_EKPO' 'L'
'Doc No'(003) ' ' ' ' ' ' ' ', '01' '02' 'EBELP' 'I_EKPO' 'L'
'Item No'(004) 'X' 'X' ' ' ' ', '01' '03' 'MATNR' 'I_EKPO' 'L'
'Material No'(005) 'X' 'X' ' ' ' ', '01' '03' 'MATNR1' 'I_EKPO' 'L'
'Material No'(005) ' ' ' ' ' ' ' ',
'01' '04' 'WERKS' 'I_EKPO' 'L'
'Plant'(006) 'X' 'X' ' ' ' ', '01' '04' 'WERKS1' 'I_EKPO' 'L'
'Plant'(006) ' ' ' ' ' ' ' ', '01' '05' 'NTGEW' 'I_EKPO' 'R'
'Net Weight'(007) ' ' ' ' 'GEWE' 'I_EKPO'.ENDFORM. " sub_field_catalog*&---------------------------------------------------------------------*
*& Form sub_fill_alv_field_catalog
*& For building Field Catalog
*& p_rowpos Row position
*& p_colpos Col position
*& p_fldnam Fldname
*& p_tabnam Tabname
*& p_justif Justification
*& p_seltext Seltext
*& p_out no out
*& p_tech Technical field
*& p_qfield Quantity field
*& p_qtab Quantity table
FORM sub_fill_alv_field_catalog USING p_rowpos TYPE sycurow
p_colpos TYPE sycucol
p_fldnam TYPE fieldname
p_tabnam TYPE tabname
p_justif TYPE char1
p_seltext TYPE dd03p-scrtext_l
p_out TYPE char1
p_tech TYPE char1
p_qfield TYPE slis_fieldname
p_qtab TYPE slis_tabname.* Local declaration for field catalog
DATA: wa_lfl_fcat TYPE slis_fieldcat_alv. wa_lfl_fcat-row_pos = p_rowpos. "Row
wa_lfl_fcat-col_pos = p_colpos. "Column
wa_lfl_fcat-fieldname = p_fldnam. "Field Name
wa_lfl_fcat-tabname = p_tabnam. "Internal Table Name
wa_lfl_fcat-just = p_justif. "Screen Justified
wa_lfl_fcat-seltext_l = p_seltext. "Field Text
wa_lfl_fcat-no_out = p_out. "No output
wa_lfl_fcat-tech = p_tech. "Technical field
wa_lfl_fcat-qfieldname = p_qfield. "Quantity unit
wa_lfl_fcat-qtabname = p_qtab . "Quantity table IF p_fldnam = 'NTGEW'.
wa_lfl_fcat-do_sum = 'X'.
ENDIF.
APPEND wa_lfl_fcat TO i_fieldcat.
CLEAR wa_lfl_fcat.
ENDFORM. " sub_fill_alv_field_catalog*&---------------------------------------------------------------------*
*& Form sub_populate_layout
* Populate ALV layout
* No Parameter
FORM sub_populate_layout . CLEAR wa_layout.
wa_layout-colwidth_optimize = 'X'." Optimization of Col widthENDFORM. " sub_populate_layout*&---------------------------------------------------------------------*
*& Form sub_populate_sort
* Populate ALV sort table
* No Parameter
FORM sub_populate_sort .* Sort on material
wa_sort-spos = '01' .
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.* Sort on plant
wa_sort-spos = '02'.
wa_sort-fieldname = 'WERKS'.
wa_sort-tabname = 'I_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.
ENDFORM. " sub_populate_sort*&---------------------------------------------------------------------*
*& Form sub_get_event
* Get ALV grid event and pass the form name to subtotal_text
* event
* No Parameter
FORM sub_get_event .
CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE
'SUBTOTAL_TEXT'. DATA: l_s_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 4
IMPORTING
et_events = i_event
EXCEPTIONS
list_type_wrong = 0
OTHERS = 0.* Subtotal
READ TABLE i_event INTO l_s_event
WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc = 0.
MOVE c_formname_subtotal_text TO l_s_event-form.
MODIFY i_event FROM l_s_event INDEX sy-tabix.
ENDIF.ENDFORM. " sub_get_event*&---------------------------------------------------------------------*
*& Form sub_alv_report_display
* For ALV Report Display
* No Parameter
FORM sub_alv_report_display .
DATA: l_repid TYPE syrepid .
l_repid = sy-repid .* This function module for displaying the ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_top_of_page = 'SUB_ALV_TOP_OF_PAGE'
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_sort = i_sort
it_events = i_event
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = i_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE i000 WITH 'Error in ALV report display'(055).
ENDIF.ENDFORM. " sub_alv_report_display*&---------------------------------------------------------------------*
* FORM sub_alv_top_of_page
* Call ALV top of page
* No parameter
*---------------------------------------------------------------------*FORM sub_alv_top_of_page. "#EC CALLED* To write header for the ALV
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_alv_top_of_page.
ENDFORM. "alv_top_of_page*&---------------------------------------------------------------------*
*& Form subtotal_text
* Build subtotal text
* P_total Total
* p_subtot_text Subtotal text info
FORM subtotal_text CHANGING
p_total TYPE any
p_subtot_text TYPE slis_subtot_text.
* Material level sub total
IF p_subtot_text-criteria = 'MATNR'.
p_subtot_text-display_text_for_subtotal
= 'Material level total'(009).
ENDIF.* Plant level sub total
IF p_subtot_text-criteria = 'WERKS'.
p_subtot_text-display_text_for_subtotal = 'Plant level total'(010).
ENDIF.
ENDFORM. "subtotal_text
Regards,
Pravin
Maybe you are looking for
-
Help, I am upgrading a PC for a friend and have replaced the standard 128Mb PC100 ram with a matched pair of 256Mb PC133 DIMMs but the PC refuses to see any more than 128Mb. I have flashed the BIOS to 1.7 without any difference. Is there a setting in
-
This is the first time this has ever happened- maybe I accidentally clicked something to make them disappear? Its just weird because even when I select a track and it is highlighted, it still says that no regions were ever selected.
-
Need Help, Upgrade or Not? Do I just WANT or really NEED a new Macbook Pro?
Good day everyone, I love these forums, so much valuable input and information from you all. My question is, *should I upgrade* to a new 13" early 2011 Macbook Pro, from my present computer, an early 2008 white Macbook 4.1 with 4gig RAM, 180g SSD Ver
-
I am a mac OS X 10.4.11 user and I have had adobe acrobat 8 professional over a year. Recently, I am unable to print pdfs. I can open them to read, but when I send them to the printer they won't print. The printer icon just jumps then nothing happens
-
Pictures loading with question marks
Lately whenever I load websites like pinterest or netflix the pictures never load. Instead blue boxes with white question marks load. My sister has a mac as well and this has been happening to her too. How do i fix this?