Totals in classical report
Hi,
Please tell how to get totals of a field in classical report.
please help with sample code.
thanks in advance.
HI,
refer the code:
reward fi help ful
Umakanth
*& Report ZSD_SALES_INTER_REPORT1
REPORT ZSD_SALES_INTER_REPORT1 NO STANDARD PAGE HEADING MESSAGE-ID ZMSG44
LINE-SIZE 230 LINE-COUNT 65(3).
Tables
TABLES : VBKD,VEPVG. "Sales document business data
"Delivery Index
Internal table
DATA : BEGIN OF I_SALES OCCURS 0,
CH TYPE CHECKBOX,
VBELN LIKE VBAK-VBELN, "Sales document no
NETWR LIKE VBAK-NETWR, "Net value of the sales order in Document currency
WAERK LIKE VBAK-WAERK, "SD Document currency
MATNR LIKE VBAP-MATNR, "Material no
AUDAT LIKE VAPMA-AUDAT, "DOCUMENT DATE
END OF I_SALES .
data : NEWSALES LIKE I_SALES OCCURS 0 WITH HEADER LINE.
DATA : AMOUNT LIKE VBAK-NETWR.
DATA : V_LIN TYPE I . "Screens vertical cursor position at PAI
DATA : CHECKBOX TYPE C.
DATA : DATE LIKE VAPMA-AUDAT.
DATA : V_SEL LIKE SY-LISEL.
SELECTION-SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_VKORG LIKE VEPVG-VKORG. "value check . "Sales organization
PARAMETERS : P_VTWEG LIKE VEPVG-VTWEG ."value check. "Distribution channel
PARAMETERS : P_SPART LIKE VEPVG-SPART ."Value check. "Division
SELECT-OPTIONS : S_DATE FOR VBKD-BSTDK DEFAULT SY-DATUM TO SY-DATUM OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : CHK AS CHECKBOX .
selection-screen comment 5(20) text-003 for field chk.
SELECTION-SCREEN END OF LINE.
PARAMETERS : P_KUNNR LIKE VBPA-KUNNR MODIF ID S2. "Customer
SELECTION-SCREEN END OF BLOCK B2.
START-OF-SELECTION.
set pf-status 'UKG9'.
IF CHK <> 'X'.
IF P_VKORG <> ''.
PERFORM ORGANIZATION.
ELSE.
PERFORM ORGANIZATION_ELSE.
ENDIF.
ELSE.
IF P_VKORG <> ''.
PERFORM CUST_ORGA.
ELSE.
PERFORM CUST_ORGA_ELSE.
ENDIF.
ENDIF.
Displaying the contents with some alterations
sort i_sales by AUDAT.
LOOP AT I_SALES.
WRITE : / I_SALES-CH,I_SALES-VBELN,I_SALES-NETWR,I_SALES-WAERK,I_SALES-MATNR,I_SALES-AUDAT.
ENDLOOP.
WRITE : / '******************************************************************************************'.
LOOP AT I_SALES.
ON CHANGE OF I_SALES-AUDAT.
IF SY-TABIX = 1.
WRITE : / SY-VLINE,I_SALES-CH AS CHECKBOX,I_SALES-AUDAT.
CLEAR AMOUNT.
ELSE.
WRITE : SY-VLINE,AMOUNT,60 sy-vline,/ SY-VLINE,I_SALES-CH AS CHECKBOX,I_SALES-AUDAT.
CLEAR AMOUNT.
ENDIF.
ENDON.
AMOUNT = AMOUNT + I_SALES-NETWR.
AT LAST.
WRITE : SY-VLINE,AMOUNT,60 sy-vline.
uline at /2(60).
ULINE.
SUM.
FORMAT COLOR = 3.
WRITE : /'TOTAL AMOUNT: ' ,I_SALES-NETWR UNDER AMOUNT .
ENDAT.
ENDLOOP.
top-of-page
top-of-page.
uline at /2(60).
write : / sy-vline,3 'Document date' ,16 sy-vline ,17 'Amount(net value of the sales document )' ,60 sy-vline .
uline at /2(60).
at user-command.
if sy-ucomm = 'DISP'.
LOOP AT I_SALES.
REFRESH NEWSALES.
V_LIN = SY-TABIX + 3.
READ LINE V_LIN FIELD VALUE I_SALES-CH INTO CHECKBOX.
IF CHECKBOX = 'X'.
newsales-ch = 'X'.
NEWSALES-VBELN = I_SALES-VBELN.
NEWSALES-NETWR = I_SALES-NETWR.
NEWSALES-WAERK = I_SALES-WAERK.
NEWSALES-MATNR = I_SALES-MATNR.
NEWSALES-AUDAT = I_SALES-AUDAT.
APPEND NEWSALES.
CLEAR NEWSALES.
LOOP AT NEWSALES where audat = i_sales-audat .
WRITE : / NEWSALES-CH as checkbox,NEWSALES-VBELN,NEWSALES-NETWR,NEWSALES-WAERK,NEWSALES-MATNR,NEWSALES-AUDAT.
ENDLOOP.
perform selection.
ENDIF.
ENDLOOP.
ENDIF.
*& Form ORGANIZATION
text
--> p1 text
<-- p2 text
FORM ORGANIZATION .
SELECT F~VBELN
C~NETWR
C~WAERK
P~MATNR
P~AUDAT
INTO CORRESPONDING FIELDS OF TABLE I_SALES
FROM ( VAKPA AS F INNER JOIN VBAK AS C ON FVBELN = CVBELN )
INNER JOIN VAPMA AS P ON FVBELN = PVBELN
WHERE P~AUDAT IN S_DATE
AND P~VKORG = P_VKORG.
ENDFORM. " ORGANIZATION
*& Form ORGANIZATION_ELSE
text
--> p1 text
<-- p2 text
FORM ORGANIZATION_ELSE .
SELECT F~VBELN
C~NETWR
C~WAERK
P~MATNR
P~AUDAT
INTO CORRESPONDING FIELDS OF TABLE I_SALES
FROM ( VAKPA AS F INNER JOIN VBAK AS C ON FVBELN = CVBELN )
INNER JOIN VAPMA AS P ON FVBELN = PVBELN
WHERE P~AUDAT IN S_DATE.
ENDFORM. " ORGANIZATION_ELSE
*& Form CUST_ORGA
text
--> p1 text
<-- p2 text
FORM CUST_ORGA .
SELECT F~VBELN
C~NETWR
C~WAERK
P~MATNR
P~AUDAT
INTO CORRESPONDING FIELDS OF TABLE I_SALES
FROM ( VAKPA AS F INNER JOIN VBAK AS C ON FVBELN = CVBELN )
INNER JOIN VAPMA AS P ON FVBELN = PVBELN
WHERE P~AUDAT IN S_DATE
AND P~VKORG = P_VKORG
and P~KUNNR = P_KUNNR.
ENDFORM. " CUST_ORGA
*& Form CUST_ORGA_ELSE
text
--> p1 text
<-- p2 text
FORM CUST_ORGA_ELSE .
SELECT F~VBELN
C~NETWR
C~WAERK
P~MATNR
P~AUDAT
INTO CORRESPONDING FIELDS OF TABLE I_SALES
FROM ( VAKPA AS F INNER JOIN VBAK AS C ON FVBELN = CVBELN )
INNER JOIN VAPMA AS P ON FVBELN = PVBELN
WHERE P~AUDAT IN S_DATE
AND P~KUNNR = P_KUNNR .
ENDFORM. " CUST_ORGA_ELSE
*& Form selection
text
--> p1 text
<-- p2 text
FORM selection .
LOOP AT NEWSALES.
ON CHANGE OF NEWSALES-AUDAT.
IF SY-TABIX <> 1.
WRITE : / SY-VLINE,NEWSALES-AUDAT,SY-VLINE,27 SY-VLINE,48 SY-VLINE.
ELSE.
WRITE : / SY-VLINE,NEWSALES-AUDAT,SY-VLINE,27 SY-VLINE,48 SY-VLINE.
ENDIF.
ENDON.
WRITE : / SY-VLINE,2 NEWSALES-VBELN,13 SY-VLINE,14 NEWSALES-NETWR,30 SY-VLINE,31 NEWSALES-WAERK,37 SY-VLINE ,38 NEWSALES-MATNR,57 SY-VLINE,58 NEWSALES-AUDAT.
at last.
sum .
uline.
format color = 3.
write : / sy-vline, 15 'Total amount:', newsales-netwr under newsales-netwr.
format color off.
uline.
endat.
ENDLOOP.
v_lin = 1.
free newsales.
ENDFORM. " SELECTION
Similar Messages
-
Hi Experts,
I am using calassical report in which i want a subtotal.
Example :
X
a 3
b 2
Subtotal : 5.
Y
a 4
b 5
Subtotal : 9
Report is OK but subtotal is not comming. Pl. see my loop and guide me. I want subtotal of itab_out-typedesc feild.
LOOP AT itab_out.
ON CHANGE OF itab_out-typedesc.
FORMAT COLOR COL_TOTAL.
WRITE:/1 sy-vline, 5 itab_out-typedesc, 130 sy-vline.
WRITE:/1 sy-vline, 5 '===============', 130 sy-vline.
FORMAT COLOR OFF.
ENDON.
ON CHANGE OF itab_out-srno.
ULINE.
FORMAT INTENSIFIED ON.
FORMAT COLOR COL_NORMAL.
WRITE :/1 sy-vline, 5 itab_out-matkl, 15 itab_out-desc.
WRITE : 63 itab_out-dailyqty LEFT-JUSTIFIED DECIMALS 0.
WRITE : 100 itab_out-erfmg LEFT-JUSTIFIED DECIMALS 0.
WRITE : 130 sy-vline.
FORMAT COLOR OFF.
AT END OF typedesc.
WRITE :/1 'Sub-Total :'.
ENDAT.
AT LAST.
ULINE.
SUM.
FORMAT INTENSIFIED ON.
FORMAT COLOR COL_POSITIVE ON.
WRITE:/1 sy-vline, 20 'Total : ' , itab_out-dailyqty UNDER 'Mfg. Qty.' LEFT-JUSTIFIED DECIMALS 0.
WRITE: itab_out-erfmg UNDER 'Cumm. Qty.' LEFT-JUSTIFIED DECIMALS 0.
WRITE: 130 sy-vline.
FORMAT INTENSIFIED OFF.
FORMAT COLOR OFF.
ULINE.
ENDAT.
ENDON.
YusufHi
remove ON CHANGE OF. Instead use AT NEW.
it is not required when using AT NEW and AT END OF .
try this...
AT END OF typedesc.
SUM.
WRITE :/1 'Sub-Total :',itab_out-typedesc .
ENDAT.
reward if useful
Edited by: Srikanth Kadiyala on May 30, 2008 9:27 AM -
Does Classic report provide facility to make report total to be hyperlink
Hi ,
Does Classic report in apex provide provision to make the report-total row editable(hyperlinked) ? if so how to implement that.
Acq WIP Closed
Abc 1 3
Def 2 5
report total : 3 8
Also is it possible to provide more than 2 downloadable options for classic report :
For eg: now i have provided options to export a report to csv and excel format, along with these two can i provide pdf option!!!!
Thanks in advanceYou didn't mention what version of Apex you are using. If you are on 4.0, this can be done easily using dynamic actions.
Here is an example http://apex.oracle.com/pls/apex/f?p=24317:92
One DA that looks like this http://screencast.com/t/djyAG6F4WFM
The first TRUE action (fire on page load) changes the cursor style to indicate that the row is clickable http://screencast.com/t/Z3YIXo6c
The second one actually does the redirect http://screencast.com/t/jHMtyDwK8lM in the example it just shows an alert message but you can modify it to pass in whatever parameters you need and construct the location.href to redirect to. -
Classical Report on clicking button on ALV Report
I have a requirement where I have to display a classical report based on the user-click on a "custom button" on my ALV. I am unable to display the classical report. Please help with code example..
Hi,
See the example.Change the code according to your requirement.
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
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,
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,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
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'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_ekko
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_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 table it_ekko.
endform. " DATA_RETRIEVAL
Form TOP-OF-PAGE *
ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
i_logo = 'Z_LOGO'.
endform.
FORM USER_COMMAND *
--> R_UCOMM *
--> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Check function code
CASE r_ucomm.
WHEN '&IC1'.
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
Pls. reward if useful... -
Triggering END_OF_PAGE IN CLASSIC REPORT
Hi Experts,
I have one classical reporting in that END_OF_PAGE is not Triggered At last Page due to Less No of Records in last Page,can anyone
tell me how to trigger END_OF_PAGE . i want to display the page total for every page but for last page i cant display Page total Due To Less
No Of Records can any one suggest how to solve this problem.
Thanks in advance.Hello,
If you read F1 help, it is mention as below.
Effect
This statement defines an event block that is raised by the ABAP-runtime during creation of a basic list, if there is a line reservation in the addition LINE-COUNT of the initiating statement for a page footer, which was reached while writing to this page. A list output that takes place in the event block, is placed in this area. Output statements that exceed the reserved area will be ignored. -
hi friends i need help on classical reports,
sold-party,
material
sales and distrubitutation channel ,division,
incoming orders,order number,invoice ,credit,
i need sub totals and final total of invoice and each customer should display in new page .Hi
Use the Tables KNA1,VBAk,VBAP,VBRK and VBRP and design the report
see the sample report using KNA1,VBAK and VBAP.
REPORT ZTEJ_INTAB1 LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE
HEADING.
*TABLES DECLARATION
TABLES : KNA1, VBAK, VBAP.
*SELECT OPTIONS
SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.
*INITIALIZATION
INITIALIZATION.
CUST_NO-LOW = '01'.
CUST_NO-HIGH = '5000'.
CUST_NO-SIGN = 'I'.
CUST_NO-OPTION = 'BT'.
APPEND CUST_NO.
*SELECTION SCREEN VALIDATION
AT SELECTION-SCREEN ON CUST_NO.
LOOP AT SCREEN.
IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.
MESSAGE E001(ZTJ1).
ENDIF.
ENDLOOP.
*BASIC LIST SELECTION
START-OF-SELECTION.
SELECT KUNNR NAME1 ORT01 LAND1 INTO
(KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
FROM KNA1
WHERE KUNNR IN CUST_NO.
WRITE:/1 SY-VLINE,
KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
KNA1-NAME1 UNDER 'NAME',
61 SY-VLINE,
KNA1-ORT01 UNDER 'CITY',
86 SY-VLINE,
KNA1-LAND1 UNDER 'COUNTRY',
103 SY-VLINE.
HIDE: KNA1-KUNNR.
ENDSELECT.
ULINE.
*SECONDARY LIST ACCESS
AT user-command.
IF SY-UCOMM = 'IONE'.
PERFORM SALES_ORD.
ENDIF.
IF SY-UCOMM = 'ITWO'.
PERFORM ITEM_DET.
ENDIF.
*TOP OF PAGE
TOP-OF-PAGE.
FORMAT COLOR 1.
WRITE : 'CUSTOMER DETAILS'.
FORMAT COLOR 1 OFF.
ULINE.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'NAME',
61 SY-VLINE,
63 'CITY',
86 SY-VLINE,
88 'COUNTRY',
103 SY-VLINE.
ULINE.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR SECONDARY LISTS
TOP-OF-PAGE DURING LINE-SELECTION.
*TOP OF PAGE FOR 1ST SECONDARY LIST
IF SY-UCOMM = 'IONE'.
ULINE.
FORMAT COLOR 1.
WRITE : 'SALES ORDER DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'SALES ORDER NO.',
40 SY-VLINE,
42 'DATE',
60 SY-VLINE,
62 'CREATOR',
85 SY-VLINE,
87 'DOC DATE',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR 2ND SECONDARY LIST
IF SY-UCOMM = 'ITWO'.
ULINE.
FORMAT COLOR 1.
WRITE : 'ITEM DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'SALES ORDER NO.',
40 SY-VLINE,
42 'SALES ITEM NO.',
60 SY-VLINE,
62 'ORDER QUANTITY',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*END OF PAGE
END-OF-PAGE.
ULINE.
WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
SY-PAGNO.
SKIP.
*& Form SALES_ORD
*& FIRST SECONDARY LIST FORM
FORM SALES_ORD .
SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO
(VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
FROM VBAK
WHERE KUNNR = KNA1-KUNNR.
WRITE:/1 SY-VLINE,
VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,
40 SY-VLINE,
VBAK-ERDAT UNDER 'DATE',
60 SY-VLINE,
VBAK-ERNAM UNDER 'CREATOR',
85 SY-VLINE,
VBAK-AUDAT UNDER 'DOC DATE',
103 SY-VLINE.
HIDE : VBAK-VBELN.
ENDSELECT.
ULINE.
ENDFORM. " SALES_ORD
*& Form ITEM_DET
*& SECOND SECONDARY LIST FORM
FORM ITEM_DET .
SELECT VBELN POSNR KWMENG INTO
(VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)
FROM VBAP
WHERE VBELN = VBAK-VBELN.
WRITE : /1 SY-VLINE,
VBAP-VBELN UNDER 'SALES ORDER NO.',
40 SY-VLINE,
VBAP-POSNR UNDER 'SALES ITEM NO.',
60 SY-VLINE,
VBAP-KWMENG UNDER 'ORDER QUANTITY',
103 SY-VLINE.
ENDSELECT.
ULINE.
ENDFORM. " ITEM_DET
REPORT demo_list_at_pf.
START-OF-SELECTION.
WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.
AT pf5.
PERFORM out.
AT pf6.
PERFORM out.
AT pf7.
PERFORM out.
AT pf8.
PERFORM out.
FORM out.
WRITE: 'Secondary List by PF-Key Selection',
/ 'SY-LSIND =', sy-lsind,
/ 'SY-UCOMM =', sy-ucomm.
ENDFORM.
After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:
Secondary List by PF-Key Selection
SY-LSIND = 14
SY-UCOMM = PF06
Example for AT USER-COMMAND.
REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
START-OF-SELECTION.
WRITE: 'Basic List',
/ 'SY-LSIND:', sy-lsind.
TOP-OF-PAGE.
WRITE 'Top-of-Page'.
ULINE.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-pfkey.
WHEN 'TEST'.
WRITE 'Self-defined GUI for Function Codes'.
ULINE.
ENDCASE.
AT LINE-SELECTION.
SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
PERFORM out.
sy-lsind = sy-lsind - 1.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'FC1'.
PERFORM out.
WRITE / 'Button FUN 1 was pressed'.
WHEN 'FC2'.
PERFORM out.
WRITE / 'Button FUN 2 was pressed'.
WHEN 'FC3'.
PERFORM out.
WRITE / 'Button FUN 3 was pressed'.
WHEN 'FC4'.
PERFORM out.
WRITE / 'Button FUN 4 was pressed'.
WHEN 'FC5'.
PERFORM out.
WRITE / 'Button FUN 5 was pressed'.
ENDCASE.
sy-lsind = sy-lsind - 1.
FORM out.
WRITE: 'Secondary List',
/ 'SY-LSIND:', sy-lsind,
/ 'SY-PFKEY:', sy-pfkey.
ENDFORM.
When you run the program, the system displays the following basic list with a the page header defined in the program:
You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
Reward points for useful Answers
Regards
Anji -
Hi Experts,
I hv been used the COL_NEGATIVE and COL_TOTAL in my classical report for the SubTotal purpose. On the screen, they r looking fine.
But,
When am printing it on SAP Printer, am getting like, /////////////////////// over my totals!
So,
Is it my printer fault?
OR it is a property of theses clours? I mean, I need to change the clour to like, CLO_KEY!
thanq.Hi
No doubt it is purely a Printer problem
certain printers will behave like that for colors
I hope there is some OSS note also reg this
If you wants to take out print of the Report
better don't give colors to the fields and the data
Reward points for useful Answers
Regards
Anji -
Hi all,
I want to know how to write the code in calssical reporting to get field headngs.
In ALV means we use Field catalog merge FM, But in classical it is differnt.
I want one example program to get field catalog in classical Reporting out put,
My out put looks like XL sheet. I want to know how to get that grids in Classical reporting.
Regards,
sarathHi
Using Sy-Vline, and Sy-Uline we can design the Field catalog like Excel like output in the Classical reporting
see the sample code and the output
REPORT zfi_customer_ageing
NO STANDARD PAGE HEADING
LINE-COUNT 58
line-size 168
MESSAGE-ID zh_msg.
D A T A B A S E T A B L E S D E C L A R A T I O N
TABLES: kna1, " Customer Master (General)
t001, " Company Codes
rfpdo.
I N T E R N A L T A B L E S D E C L A R A T I O N S *
Internal Table for Customer Open Items Data
DATA: BEGIN OF int_bsid OCCURS 0,
kunnr LIKE bsid-kunnr, " Customer Number
name1 LIKE kna1-name1, " Customer Name
shkzg LIKE bsid-shkzg, " Dr/Cr Indicator
belnr LIKE bsid-belnr, " Document Number
xblnr LIKE bsid-xblnr, " Ref Doc No
blart LIKE bsid-blart, " Document Type
zfbdt LIKE bsid-zfbdt, " Base Line Date
zbd1t LIKE bsid-zbd1t, " Due date1
zbd2t LIKE bsid-zbd2t, " Due Date2
zbd3t LIKE bsid-zbd3t, " Due Date3
waers LIKE bsid-waers, " Currency
dmbtr LIKE bsid-dmbtr, " Amount in Local Curr
END OF int_bsid.
Internal Table for Amounts Sum Up Data
DATA: BEGIN OF int_final OCCURS 0,
kunnr LIKE bsid-kunnr, " Customer Number
name1 LIKE kna1-name1, " Customer Name
total1 LIKE bsid-dmbtr, " Amount in Local Curr
total2 LIKE bsid-dmbtr, " Amount in Local Curr
total3 LIKE bsid-dmbtr, " Amount in Local Curr
total4 LIKE bsid-dmbtr, " Amount in Local Curr
total5 LIKE bsid-dmbtr, " Amount in Local Curr
total6 LIKE bsid-dmbtr, " Amount in Local Curr
total LIKE bsid-dmbtr, " Amount in Local Curr
END OF int_final.
D A T A D E C L A R A T I O N S
DATA : v_flag, " Flag
v_gtotal1 LIKE bsid-dmbtr, " Amount Totals
v_gtotal2 LIKE bsid-dmbtr, " Amount Totals
v_gtotal3 LIKE bsid-dmbtr, " Amount Totals
v_gtotal4 LIKE bsid-dmbtr, " Amount Totals
v_gtotal5 LIKE bsid-dmbtr, " Amount Totals
v_gtotal6 LIKE bsid-dmbtr, " Amount Totals
v_gtotal LIKE bsid-dmbtr, " Amount Totals
v_subtotal1 LIKE bsid-dmbtr, " Amount Totals
v_subtotal2 LIKE bsid-dmbtr, " Amount Totals
v_subtotal3 LIKE bsid-dmbtr, " Amount Totals
v_subtotal4 LIKE bsid-dmbtr, " Amount Totals
v_subtotal5 LIKE bsid-dmbtr, " Amount Totals
v_subtotal6 LIKE bsid-dmbtr, " Amount Totals
v_subtotal LIKE bsid-dmbtr, " Amount Totals
v_date LIKE bsid-zfbdt, " Due Date
v_tage1(4), " Age 30 days
v_tage2(4), " Age 60 days
v_tage3(4), " Age 90 days
v_fir(15), " Column Text1
v_sec(15), " Column Text2
v_thir(15), " Column Text3
v_four(17), " Column Text4
v_fidd(4), " Days field1
v_sedd(4), " Days field2
v_thdd(4), " Days field3
v_fodd(4), " Days field4
v_str TYPE SY-LISEL, " String
v_str1(11), " String
v_tage(3), " String
v_date1(10). " Date field
R A N G E D E C L A R A T I O N S
RANGES: r_date1 FOR bsid-zfbdt, " Date Range 1
r_date2 FOR bsid-zfbdt, " Date Range 2
r_date3 FOR bsid-zfbdt, " Date Range 3
r_date4 FOR bsid-zfbdt. " Date Range 4
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-001.
SELECT-OPTIONS: s_kunnr FOR kna1-kunnr. "Customer account
PARAMETERS: p_bukrs LIKE t001-bukrs. "Co. Code
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: p_allgst LIKE rfpdo-allgstid OBLIGATORY DEFAULT sy-datum.
"Open items at key date
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETERS: p_tage1 LIKE rfpdo1-allgfael DEFAULT '30',
p_tage2 LIKE rfpdo1-allgfael DEFAULT '60',
p_tage3 LIKE rfpdo1-allgfael DEFAULT '90',
p_tage4 LIKE rfpdo1-allgfael DEFAULT '120'.
SELECTION-SCREEN END OF BLOCK b3.
A T S E L E C T I O N S C R E E N *
AT SELECTION-SCREEN.
Validate the screen fields
PERFORM validate_flds.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
Fetch main data
PERFORM fetch_data.
T O P O F P A G E
Header
TOP-OF-PAGE.
PERFORM header.
E N D O F P A G E
Footer
END-OF-PAGE.
ULINE.
T O P O F P A G E D U R I N G L I N E S E L E C T I O N *
Top of Page in Secondary List
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM header1.
A T L I N E S E L E C T I O N *
AT LINE-SELECTION.
Perform Line Selections
PERFORM line_selection.
E N D O F S E L E C T I O N
END-OF-SELECTION.
List generation
PERFORM basic_list.
*& Form validate_flds
Validation of Selection Screen fields
FORM validate_flds .
Validate Customer Code
CLEAR kna1-kunnr.
SELECT kunnr UP TO 1 ROWS
INTO kna1-kunnr
FROM kna1
WHERE kunnr IN s_kunnr AND
spras = sy-langu.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Invalid Customer Code range'(023).
ENDIF.
Validate Company Code
CLEAR t001-bukrs.
SELECT bukrs UP TO 1 ROWS
INTO t001-bukrs
FROM t001
WHERE bukrs = p_bukrs AND
spras = sy-langu.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e021. " Invalid Company Code range
ENDIF.
IF ( p_tage1 > p_tage2 ) OR ( p_tage1 > p_tage3 ) OR
( p_tage1 > p_tage4 ).
MESSAGE e999 WITH 'Column 1 greater'(004)
'than Column# 2 or 3 or 4'(005).
ENDIF.
*column 2
IF ( p_tage2 > p_tage3 ) OR ( p_tage1 > p_tage4 ).
MESSAGE e999 WITH 'Column 2 greater'(006)
'than Column# 3 or 4'(007).
ENDIF.
*column3
IF ( p_tage3 > p_tage4 ).
MESSAGE e999 WITH 'Column 3 greater'(008)
'than Column#4'(009).
ENDIF.
ENDFORM. " validate_flds
*& Form fetch_data
Fetching Data from Database Tables
FORM fetch_data .
Date Range Population
r_date1-sign = 'I'.
r_date1-option = 'BT'.
r_date1-low = p_allgst.
r_date1-high = r_date1-low + p_tage1.
APPEND r_date1.
r_date2-sign = 'I'.
r_date2-option = 'BT'.
r_date2-low = r_date1-high + 1.
r_date2-high = r_date1-low + p_tage2.
APPEND r_date2.
r_date3-sign = 'I'.
r_date3-option = 'BT'.
r_date3-low = r_date2-high + 1.
r_date3-high = r_date1-low + p_tage3.
APPEND r_date3.
r_date4-sign = 'I'.
r_date4-option = 'BT'.
r_date4-low = r_date3-high + 1.
r_date4-high = r_date1-low + p_tage4.
APPEND r_date4.
Select the Customer Open Items data from bsid
SELECT l~kunnr
l1~name1
b~waers
b~dmbtr
b~zfbdt
b~zbd1t
b~zbd2t
b~zbd3t
b~belnr
b~xblnr
b~shkzg
b~blart
INTO CORRESPONDING FIELDS OF TABLE int_bsid
FROM knb1 AS l INNER JOIN kna1 AS l1
ON lkunnr = l1kunnr
INNER JOIN bsid AS b
ON lkunnr = bkunnr AND
lbukrs = bbukrs
WHERE l~kunnr IN s_kunnr AND
l~bukrs = p_bukrs and
b~zfbdt le p_allgst.
IF SY-SUBRC <> 0.
MESSAGE i000 WITH 'No Data found'(027).
ENDIF.
Removing the date limit to get the due items in the past
DELETE int_bsid WHERE
( blart NE 'RE' AND blart NE 'KR' ) OR
shkzg NE 'H'.
SORT int_bsid BY kunnr.
ENDFORM. " fetch_data
*& Form header
Display the Report Columns
FORM header .
v_tage1 = p_tage1 + 1.
v_tage2 = p_tage2 + 1.
v_tage3 = p_tage3 + 1.
v_fidd = p_tage1.
v_sedd = p_tage2.
v_thdd = p_tage3.
v_fodd = p_tage4.
MOVE v_fodd0(4) TO v_fodd1(3).
v_fodd+0(1) = space.
CONCATENATE '1 to'(010) v_fidd INTO v_fir.
CONCATENATE v_tage1 ' to '(011) v_sedd INTO v_sec.
CONCATENATE v_tage2 ' to '(011) v_thdd INTO v_thir.
CONCATENATE v_tage3 ' to '(011) space v_fodd INTO v_four.
Standard header
clear: v_date1, v_str, v_str1, v_tage.
write p_allgst to v_date1.
Move p_tage4 to v_tage.
concatenate '>' v_tage text-025 into v_str1.
concatenate
'Summary of Ageing Analysis for Customer Open Invoices as on'(013)
v_date1 into v_str separated by space.
CALL FUNCTION 'Z_STANDARD_HEADER'
EXPORTING
title1 = 'Saudi International Petrochemical Company'(012)
title2 = v_str.
FORMAT COLOR OFF.
WRITE : /1(168) sy-uline.
FORMAT COLOR 1 INTENSIFIED.
WRITE :/1 sy-vline, 13 sy-vline, 49 sy-vline,
50(101) 'Invoices Due For(In Days)'(014) CENTERED,
151 sy-vline, 168 sy-vline .
WRITE :/1 sy-vline, 2(11) 'Customer#'(015) CENTERED,
13 sy-vline ,14(35) 'Customer Name'(016) CENTERED,
49 sy-vline,
50(101) sy-uline,151 sy-vline,
152(16) 'Total'(017) CENTERED,
168 sy-vline.
WRITE : /1 sy-vline,13 sy-vline, 49 sy-vline,
50(16) v_fir CENTERED, 66 sy-vline,
67(16) v_sec CENTERED, 83 sy-vline,
84(16) v_thir CENTERED, 100 sy-vline,
101(16) v_four CENTERED, 117 sy-vline,
118(16) v_str1 centered, 134 sy-vline,
135(16) 'Already Overdue'(018) CENTERED,151 sy-vline,
168 sy-vline.
FORMAT COLOR OFF.
WRITE : /1(168) sy-uline.
ENDFORM. " header
*& Form basic_list
Display the Basic List
FORM basic_list .
NEW-PAGE LINE-SIZE 168.
LOOP AT int_bsid.
CLEAR v_date.
IF int_bsid-zbd3t <> ' '.
v_date = int_bsid-zfbdt + int_bsid-zbd3t.
ELSE.
IF int_bsid-zbd2t <> ' '.
v_date = int_bsid-zfbdt + int_bsid-zbd2t.
ELSE.
v_date = int_bsid-zfbdt + int_bsid-zbd1t.
ENDIF.
ENDIF.
IF int_bsid-zbd1t = ' '.
v_date = int_bsid-zfbdt.
ENDIF.
IF v_date IN r_date1.
int_final-total1 = int_final-total1 + int_bsid-dmbtr.
ELSEIF v_date IN r_date2.
int_final-total2 = int_final-total2 + int_bsid-dmbtr.
ELSEIF v_date IN r_date3.
int_final-total3 = int_final-total3 + int_bsid-dmbtr.
ELSEIF v_date IN r_date4.
int_final-total4 = int_final-total4 + int_bsid-dmbtr.
ELSEif v_date > r_date4-high.
int_final-total5 = int_final-total5 + int_bsid-dmbtr.
ELSEif v_date < p_allgst.
int_final-total6 = int_final-total6 + int_bsid-dmbtr.
ENDIF.
AT END OF kunnr.
v_flag = 1.
ENDAT.
IF v_flag = 1.
int_final-kunnr = int_bsid-kunnr.
int_final-name1 = int_bsid-name1.
int_final-total = int_final-total1 + int_final-total2 +
int_final-total3 + int_final-total4 + int_final-total5 +
int_final-total6.
APPEND int_final.
v_gtotal1 = v_gtotal1 + int_final-total1.
v_gtotal2 = v_gtotal2 + int_final-total2.
v_gtotal3 = v_gtotal3 + int_final-total3.
v_gtotal4 = v_gtotal4 + int_final-total4.
v_gtotal5 = v_gtotal5 + int_final-total5.
v_gtotal6 = v_gtotal6 + int_final-total6.
v_gtotal = v_gtotal + int_final-total.
WRITE: /1 sy-vline,
2 int_final-kunnr COLOR 4 INTENSIFIED ON,
13 sy-vline,
14 int_final-name1 COLOR 4 INTENSIFIED ON,
49 sy-vline.
DATA : v_rem.
v_rem = sy-tabix MOD 2.
IF v_rem NE 0.
FORMAT COLOR 2 INTENSIFIED.
WRITE : 50 int_final-total1 CURRENCY int_bsid-waers,
66 sy-vline,
67 int_final-total2 CURRENCY int_bsid-waers,
83 sy-vline,
84 int_final-total3 CURRENCY int_bsid-waers,
100 sy-vline,
101 int_final-total4 CURRENCY int_bsid-waers,
117 sy-vline,
118 int_final-total5 CURRENCY int_bsid-waers,
134 sy-vline,
135 int_final-total6 CURRENCY int_bsid-waers,
151 sy-vline,
152 int_final-total CURRENCY int_bsid-waers,
168 sy-vline.
ELSE.
WRITE : 50 int_final-total1 CURRENCY int_bsid-waers,
66 sy-vline,
67 int_final-total2 CURRENCY int_bsid-waers,
83 sy-vline,
84 int_final-total3 CURRENCY int_bsid-waers,
100 sy-vline,
101 int_final-total4 CURRENCY int_bsid-waers,
117 sy-vline,
118 int_final-total5 CURRENCY int_bsid-waers,
134 sy-vline,
135 int_final-total6 CURRENCY int_bsid-waers,
151 sy-vline,
152 int_final-total CURRENCY int_bsid-waers,
168 sy-vline.
ENDIF.
FORMAT COLOR OFF.
HIDE int_final.
CLEAR int_final.
v_flag = 0.
ENDIF.
AT LAST.
WRITE : /1(168) sy-uline.
FORMAT COLOR 3 INTENSIFIED.
WRITE : /1 sy-vline, 2(47) 'GRAND TOTAL'(022) CENTERED,
49 sy-vline, 50 v_gtotal1 CURRENCY int_bsid-waers,
66 sy-vline, 67 v_gtotal2 CURRENCY int_bsid-waers,
83 sy-vline, 84 v_gtotal3 CURRENCY int_bsid-waers,
100 sy-vline,101 v_gtotal4 CURRENCY int_bsid-waers,
117 sy-vline,118 v_gtotal5 CURRENCY int_bsid-waers,
134 sy-vline,135 v_gtotal6 CURRENCY int_bsid-waers,
151 sy-vline,152 v_gtotal CURRENCY int_bsid-waers,
168 sy-vline.
HIDE : v_gtotal1,
v_gtotal2,
v_gtotal3,
v_gtotal4,
v_gtotal5,
v_gtotal6,
v_gtotal.
ENDAT.
FORMAT COLOR OFF.
ENDLOOP.
WRITE : /1(168) sy-uline.
ENDFORM. " basic_list
*& Form line_selection
When double clicked on the line display the seconday list
FORM line_selection .
NEW-PAGE LINE-SIZE 206.
Sy-lsind = 1.
DATA : v_rem,v_cnt LIKE sy-tabix.
v_cnt = 0.
SORT int_bsid BY belnr zfbdt.
LOOP AT int_bsid WHERE kunnr EQ int_final-kunnr.
v_rem = v_cnt MOD 2.
CLEAR v_date.
IF int_bsid-zbd3t <> ' '.
v_date = int_bsid-zfbdt + int_bsid-zbd3t.
ELSE.
IF int_bsid-zbd2t <> ' '.
v_date = int_bsid-zfbdt + int_bsid-zbd2t.
ELSE.
v_date = int_bsid-zfbdt + int_bsid-zbd1t.
ENDIF.
ENDIF.
IF int_bsid-zbd1t = ' '.
v_date = int_bsid-zfbdt.
ENDIF.
IF v_rem NE 0.
format color 2 intensified.
WRITE :/1 sy-vline, 2 int_bsid-belnr,
12 sy-vline,13 int_bsid-kunnr,
23 sy-vline,24 int_bsid-name1,
59 sy-vline,60 int_bsid-xblnr,
76 sy-vline,77 int_bsid-zfbdt,
87 sy-vline.
WRITE : 104 sy-vline,121 sy-vline,
138 sy-vline,155 sy-vline,
172 sy-vline, 189 sy-vline,
190 int_bsid-dmbtr CURRENCY int_bsid-waers,
206 sy-vline.
IF v_date IN r_date1.
v_subtotal1 = v_subtotal1 + int_bsid-dmbtr.
WRITE : 88 int_bsid-dmbtr CURRENCY int_bsid-waers.
ELSEIF v_date IN r_date2.
v_subtotal2 = v_subtotal2 + int_bsid-dmbtr.
WRITE : 105 int_bsid-dmbtr CURRENCY int_bsid-waers.
ELSEIF v_date IN r_date3.
v_subtotal3 = v_subtotal3 + int_bsid-dmbtr.
WRITE : 122 int_bsid-dmbtr CURRENCY int_bsid-waers.
ELSEIF v_date IN r_date4.
v_subtotal4 = v_subtotal4 + int_bsid-dmbtr.
WRITE : 139 int_bsid-dmbtr CURRENCY int_bsid-waers.
ELSEif v_date > r_date4-high.
v_subtotal5 = v_subtotal5 + int_bsid-dmbtr.
WRITE : 156 int_bsid-dmbtr CURRENCY int_bsid-waers.
ELSEif v_date < p_allgst.
v_subtotal6 = v_subtotal6 + int_bsid-dmbtr.
WRITE : 173 int_bsid-dmbtr CURRENCY int_bsid-waers.
ENDIF.
format color off.
ELSE.
WRITE :/1 sy-vline, 2 int_bsid-belnr,
12 sy-vline,13 int_bsid-kunnr,
23 sy-vline,24 int_bsid-name1,
59 sy-vline,60 int_bsid-xblnr,
76 sy-vline,77 int_bsid-zfbdt,
87 sy-vline.
WRITE : 104 sy-vline,121 sy-vline,
138 sy-vline,155 sy-vline,
172 sy-vline,189 sy-vline,
190 int_bsid-dmbtr CURRENCY int_bsid-waers,
206 sy-vline.
IF v_date IN r_date1.
v_subtotal1 = v_subtotal1 + int_bsid-dmbtr.
WRITE : 88 int_bsid-dmbtr CURRENCY int_bsid-waers.
ELSEIF v_date IN r_date2.
v_subtotal2 = v_subtotal2 + int_bsid-dmbtr.
WRITE : 105 int_bsid-dmbtr CURRENCY int_bsid-waers.
ELSEIF v_date IN r_date3.
v_subtotal3 = v_subtotal3 + int_bsid-dmbtr.
WRITE : 122 int_bsid-dmbtr CURRENCY int_bsid-waers.
ELSEIF v_date IN r_date4.
v_subtotal4 = v_subtotal4 + int_bsid-dmbtr.
WRITE : 139 int_bsid-dmbtr CURRENCY int_bsid-waers.
ELSEif v_date > r_date4-high.
v_subtotal5 = v_subtotal5 + int_bsid-dmbtr.
WRITE : 156 int_bsid-dmbtr CURRENCY int_bsid-waers.
ELSEif v_date < p_allgst.
v_subtotal6 = v_subtotal6 + int_bsid-dmbtr.
WRITE : 173 int_bsid-dmbtr CURRENCY int_bsid-waers.
ENDIF.
ENDIF.
FORMAT COLOR OFF.
v_cnt = v_cnt + 1.
ENDLOOP.
WRITE : /1(206) sy-uline.
v_subtotal = v_subtotal1 + v_subtotal2 + v_subtotal3
+ v_subtotal4 + v_subtotal5 + v_subtotal6.
FORMAT COLOR 3 INTENSIFIED.
WRITE : /1 sy-vline,
2(85) 'Total'(017) CENTERED CURRENCY int_bsid-waers ,
87 sy-vline,
88 v_subtotal1 CURRENCY int_bsid-waers,
104 sy-vline,
105 v_subtotal2 CURRENCY int_bsid-waers,
121 sy-vline,
122 v_subtotal3 CURRENCY int_bsid-waers,
138 sy-vline,
139 v_subtotal4 CURRENCY int_bsid-waers,
155 sy-vline,
156 v_subtotal5 CURRENCY int_bsid-waers,
172 sy-vline,
173 v_subtotal6 CURRENCY int_bsid-waers,
189 sy-vline,
190 v_subtotal CURRENCY int_bsid-waers,
206 sy-vline.
FORMAT COLOR OFF.
WRITE : /1(206) sy-uline.
CLEAR : v_subtotal,v_subtotal1,v_subtotal2,v_subtotal3,
v_subtotal4,v_subtotal5,v_gtotal1,v_gtotal2,v_gtotal3,
v_gtotal4, v_gtotal5,v_gtotal,v_subtotal6,v_gtotal6.
ENDFORM. " line_selection
*& Form header1
Secondary List Header
FORM header1 .
Standard header
clear: v_date1, v_str, v_str1, v_tage.
write p_allgst to v_date1.
Move p_tage4 to v_tage.
concatenate '>' v_tage text-025 into v_str1.
concatenate
'Details of Ageing Analysis for Customer Open Invoices as on'(024)
v_date1 into v_str separated by space.
CALL FUNCTION 'Z_STANDARD_HEADER'
EXPORTING
title1 = 'Saudi International Petrochemical Company'(012)
title2 = v_str.
FORMAT COLOR 1 intensified.
WRITE :/1(206) sy-uline.
WRITE :/1 sy-vline,12 sy-vline ,
23 sy-vline,59 sy-vline,76 sy-vline,87 sy-vline,
88(101) 'Invoices Due For(In Days)'(014) CENTERED,
189 sy-vline,206 sy-vline.
WRITE : /1 sy-vline, 2(10) 'Doc Number'(021) CENTERED,
12 sy-vline, 13(10) 'Customer#'(015) CENTERED,
23 sy-vline, 24(35) 'Customer Name'(016) CENTERED,
59 sy-vline, 60(16) 'Ref invoice#'(019) CENTERED,
76 sy-vline, 77(10) 'Inv dt'(020) CENTERED,
87 sy-vline, 88(101) sy-uline,
189 sy-vline,190(16) 'Total'(017) CENTERED,
206 sy-vline.
WRITE : /1 sy-vline, 12 sy-vline,
23 sy-vline,59 sy-vline,
76 sy-vline,87 sy-vline,
88(16) v_fir CENTERED, 104 sy-vline,
105(16) v_sec CENTERED, 121 sy-vline,
122(16) v_thir CENTERED, 138 sy-vline,
139(16) v_four CENTERED, 155 sy-vline,
156(16) v_str1 CENTERED,
172 sy-vline,
173(16) 'Already Overdue'(018) CENTERED,
189 sy-vline,
206 sy-vline.
format color off.
WRITE : /1(206) sy-uline.
ENDFORM. " header1
<b>Reward points for useful Answers</b>
Regards
Anji -
can anybody send coding for classical report?
hi,
check the code below
*& Report ZWK12346
REPORT zwk12346 LINE-SIZE 160 LINE-COUNT 35(3) NO STANDARD PAGE HEADING.
...............DECLARATION OF TABLES..................................
TABLES: mkpf,
mseg,
makt.
.............AT SELECTION SCREEN.....................................*
SELECT-OPTIONS b FOR mkpf-mblnr. "Document no.
PARAMETERS: a TYPE mkpf-mjahr. "Document year.
DATA: am TYPE mseg-dmbtr VALUE 0.
.................DECLARATION OF WORK AREA.............................
DATA: BEGIN OF wa,
mblnr TYPE mkpf-mblnr,
mjahr TYPE mkpf-mjahr,
budat TYPE mkpf-budat,
matnr TYPE mseg-matnr,
maktx TYPE makt-maktx,
werks TYPE mseg-werks,
dmbtr TYPE mseg-dmbtr,
END OF wa.
..............INTERNAL TABLE DELARATION..............................*
DATA: itab LIKE STANDARD TABLE OF wa.
...............CONSTANT...............................................
...............GLOBAL VARIABLES.......................................
..............TOP-OF-PAGE.............................................
TOP-OF-PAGE.
FORMAT COLOR COL_HEADING.
WRITE: / sy-uline(150).
WRITE:/ sy-vline,
3 'Document No.',
17 sy-vline,
20 'Document Year',
37 sy-vline,
38 'Posting Date',
54 sy-vline,
56 'Material No.',
72 sy-vline,
74 'Description',
118 sy-vline,
120 'Plant',
130 sy-vline,
132 'Amount',
150 sy-vline.
WRITE: / sy-uline(150).
FORMAT RESET.
.............END-OF-PAGE.............................................
END-OF-PAGE.
WRITE: / sy-uline(150).
FORMAT COLOR COL_TOTAL.
WRITE: /128 'Total', am.
......................START OF SELECTION.............................
START-OF-SELECTION.
SELECT mmblnr mmjahr mbudat qmatnr pmaktx qwerks q~dmbtr INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( ( mkpf AS m INNER JOIN mseg AS q ON mmblnr = qmblnr )
INNER JOIN makt AS p ON pmatnr = qmatnr )
WHERE m~mjahr = a.
..............Exit if Data is not fetched............................
IF sy-subrc NE 0.
WRITE: / 'No data selected'.
EXIT.
ENDIF.
.....................END OF SELECTION................................
LOOP AT itab INTO wa.
WRITE:/ sy-vline,
3 wa-mblnr COLOR COL_KEY,
17 sy-vline COLOR COL_KEY,
20 wa-mjahr COLOR COL_KEY,
37 sy-vline,
38 wa-budat,54 sy-vline,
56 wa-matnr COLOR COL_KEY,
72 sy-vline,
74 wa-maktx,
118 sy-vline,
120 wa-werks,
130 sy-vline,
132 wa-dmbtr,
150 sy-vline.
ENDLOOP.
WRITE: / sy-uline(150).
regards,
Navneeth.K -
Calculated field in classic report
I am trying to editable columnin classic report and based on the values that users fill in that filed calculate value in another column. I have seen something similar on the forum but nothing really worked for me.
My report is based on sql query.
select column1,
column2,
column3 from table
I want column2 to be updatable, and that column3=column2+column1Sorry, in this thread you can see better what I meant in the post above.
ROW-------Country-------LOB-------YTD_PURCHASES-------YTD_INCOME-------Manual -------Total
1-----------USA-----------Utilities-----------1000000-----------50000----------------0-----------50000
2-----------USA-----------Electric-----------1000000-----------70000-----------------0-----------70000
3-----------USA-----------Security-----------1000000-----------90000------------------0-----------90000
4-----------CAN-----------Utilities-----------1000000-----------110000---------------30000-----------140000
5-----------CAN-----------Magic-----------1000000-----------130000--------------25000-----------155000
6-----------CAN-----------Plumbing-------1000000-----------150000-----------------0-----------150000
Thanks,
Gagi -
Problem in classical report.
Dear all,
I am facing a problem with alignment in one classical report.
Requirement is debit ,credit amount's sum will at end of every g/l as new line.
Text will be closing balance - then amount.
My amount & text is coming ,but not properly.
All document will come & then closing balance will come as new line with ULINE.
Code part is: -
SORT it_bsas by hkont.
LOOP AT it_bsas INTO wa_bsas.
if wa_bsas-shkzg = 'H'.
WA_OUT-DMBTR = WA_BSaS-DMBTR.
WRITE : wa_out-dmbtr UNDER f LEFT-JUSTIFIED.
lv_sum1 = lv_sum1 + wa_out-dmbtr.
ELSEIF wa_bsas-shkzg = 'S'.
WA_OUT-DMBTR1 = WA_BSaS-DMBTR.
WRITE : wa_out-dmbtr1 UNDER g LEFT-JUSTIFIED.
lv_sum2 = lv_sum2 + wa_out-dmbtr1.
endif.
at END OF hkont.
ULINE at /93(50).
WRITE : /93 'Closing balance' ,
109 lv_sum1,
127 lv_sum2.
ULINE at /93(50).
CLEAR lv_sum1.
CLEAR lv_sum2.
endat.
Any help in this?Then use the same code as you are using to output dmbtr
WRITE : lv_sum1 UNDER f LEFT-JUSTIFIED.
WRITE : lv_sum2 UNDER g LEFT-JUSTIFIED.
Would recommend using pre-sorted ALV with sub-total on these amount fields
Regards -
hello experts,
how can i make subtotal in classical report,
scenario is like this,
say for a single likp-vbeln, there is lips-lfimg, i need to subtotal for lips-lfimg for each likp-vbeln,
how to du it?plz helpHi Rajdeep,
Add lifmg to a variable, then
at end of vbeln print the sum and clear it.
Check the below code for example, here field a is similar to your vbeln and c is
similar to your lifmg,
TYPES: BEGIN OF ty_tab,
a TYPE char2,
b TYPE char3,
c TYPE i,
END OF ty_tab.
DATA: it_tab TYPE TABLE OF ty_tab,
wa_tab TYPE ty_tab.
DATA: w_sum TYPE i.
wa_tab-a = 'A'.
wa_tab-b = 'AAA'.
wa_tab-c = 1.
APPEND wa_tab TO it_tab.
wa_tab-a = 'A'.
wa_tab-b = 'AAA'.
wa_tab-c = 1.
APPEND wa_tab TO it_tab.
wa_tab-a = 'A'.
wa_tab-b = 'AAA'.
wa_tab-c = 1.
APPEND wa_tab TO it_tab.
wa_tab-a = 'B'.
wa_tab-b = 'BBB'.
wa_tab-c = 1.
APPEND wa_tab TO it_tab.
wa_tab-a = 'B'.
wa_tab-b = 'BBB'.
wa_tab-c = 1.
APPEND wa_tab TO it_tab.
"Print the header
WRITE: sy-uline.
WRITE: /, 5 'A', 10 'B', 24 'C'.
WRITE: sy-uline.
"Print the values
LOOP AT it_tab INTO wa_tab.
ADD wa_tab-c TO w_sum. "calculating sub total for field c
WRITE: / ,5 wa_tab-a,
10 wa_tab-b,
15 wa_tab-c.
AT END OF a. "For each new a print the subtotal
WRITE: sy-uline.
WRITE: /, 5 'Sub total of C',
15 w_sum.
WRITE: sy-uline.
CLEAR w_sum.
ENDAT.
Regards,
Manoj Kumar P -
Footer problem in classical report
Hi experts,
I devloped a classical report but i want to display a footer deatail in all of my page.
But in my last page it doesn't come......
NOTE : i have reservered 12(2) line for each page. but total record is 100.
Regards
skmohantyHi,
I am hope this answer is very helpfull to u..
Declare one variable like
DATA: V.
V = sy-linct - sy-linno - 2.
skip V.
plz this code write after the endloop and before the end-of-selection
Thanks&Regards
Hari.. -
Hi,
I need to display classical report with following layout
Material Jan Feb march april -
Total
ABC
SD 10 20 30 60
SE 10 20 30
In my internal table I have month wise data.
How to display it in one line under respective months.
For e.g. in internal table I have two rows of SD with quantity is two different months. Now I need to display this in above format
Please help.Hi Vanita,
Check the following code, this is similar to your requirement...
Row wise output:
1.000 100.001
1.000 100.002
1.000 100.003
1.000 100.003
1.000 100.004
Column wise output:
1.000 1.000 1.000 1.000 1.000
100.001 100.002 100.003 100.003 100.004
TYPES: BEGIN OF ty_tab,
a TYPE i,
b TYPE i,
END OF ty_tab.
TYPES: BEGIN OF ty_fields,
field TYPE c,
END OF ty_fields.
DATA: it_tab TYPE STANDARD TABLE OF ty_tab WITH HEADER LINE,
it_fields TYPE STANDARD TABLE OF ty_fields, "Table which stores the field names
wa_fields TYPE ty_fields,
wa_tab TYPE ty_tab.
DATA: w_value TYPE ty_fields-field.
FIELD-SYMBOLS: <fs> TYPE ANY.
wa_tab-a = 1000.
wa_tab-b = 100001.
APPEND wa_tab TO it_tab.
wa_tab-a = 1000.
wa_tab-b = 100002.
APPEND wa_tab TO it_tab.
wa_tab-a = 1000.
wa_tab-b = 100003.
APPEND wa_tab TO it_tab.
wa_tab-a = 1000.
wa_tab-b = 100003.
APPEND wa_tab TO it_tab.
wa_tab-a = 1000.
wa_tab-b = 100004.
APPEND wa_tab TO it_tab.
wa_fields-field = 'A'. "In this example columns are A and B
APPEND wa_fields TO it_fields.
wa_fields-field = 'B'.
APPEND wa_fields TO it_fields.
WRITE:/ 'Row wise output:'.
LOOP AT it_tab.
WRITE: / it_tab-a,
it_tab-b.
ENDLOOP.
WRITE:/,/, 'Column wise output:',/.
LOOP AT it_fields INTO wa_fields. "Dispalying columnwise o/p
w_value = wa_fields-field.
LOOP AT it_tab INTO wa_tab.
ASSIGN COMPONENT w_value OF STRUCTURE wa_tab TO <fs>.
WRITE: <fs>.
UNASSIGN <fs>.
ENDLOOP.
WRITE: /.
ENDLOOP.
Modify this example to ur requirement.
Revert incase of any issues.
Regards,
Manoj Kumar P -
hi,
can any one of you send me the simple classical report using ALV functionality.
and if you can send me also an interactive report on ALV functionality plsssssss.
advance thanks and also i will give points .
yours,
sara.Hi,
For <b>Classical Report</b> Example refer to link,
http://www.sapmaterial.com/?gclid=CN322K28t4sCFQ-WbgodSGbK2g
For <b>Interactive Report</b> check the following Example,
Check this sample code which provides exact info.
REPORT YMS_ALVINTER1.
TABLE DECLARATION
TABLES: vbak , "Sales Document: Header Data
vbap , "Sales Document: Item Data
makt , "Material Descriptions
lips . "SD document: Delivery: Item data
DECLARATION OF TYPE-POOL
*THIS TYPE-POOL CONTAINS THE EVENTS,
TYPE-POOLS : slis.
DECLARATION OF EVENTS
DATA: i_event TYPE slis_t_event.
DATA: t_event TYPE slis_alv_event.
DECLARATION OF LIST HEADER
DATA: i_listheader TYPE slis_t_listheader.
DECLARATION OF FIELD CATALOG FOR SCREEN 1
DATA: i_fldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DECLARATION OF FIELD CATALOG FOR SCREEN 2
DATA: i_fldcat2 TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DECLARATION OF FIELD LAYOUT
DATA: i_layout TYPE slis_layout_alv.
SORTING OF OUTPUT
DATA: i_sort TYPE slis_t_sortinfo_alv.
*DATA DECLARATION
DATA: v_auart TYPE tvak-auart,
v_vkorg TYPE tvko-vkorg,
v_kunnr TYPE kna1-kunnr,
v_matnr TYPE mara-matnr ,
v_spart TYPE tvta-spart .
TYPES: BEGIN OF it_so ,
vbeln TYPE vbeln_va , "SALES ORDER NO.
auart TYPE auart , "SALES DOC. TYPE
vkorg TYPE vkorg , "SALES ORG.
spart TYPE spart , "DIVISION
kunnr TYPE kunag , "SOLD TO PARTY
posnr TYPE posnr_va , "SALES DOC. ITEM
matnr TYPE matnr , "MATERIAL NO
maktx TYPE maktx , "DESCRIPTION
kwmeng TYPE kwmeng , "QUANTITY
vrkme TYPE vrkme , "SALES UNIT
line_color(4) TYPE c ,
END OF it_so .
TYPES: BEGIN OF it_del ,
vbeln TYPE vbeln_vl , "SALES ORDER NO.
posnr TYPE posnr_vl , "SALES DOC. ITEM
matnr TYPE matnr , "MATERIAL NO
werks TYPE werks_d , "PLANT
lgort TYPE lgort_d , "STORAGE LOCATION
charg TYPE charg_d , "BATCH NO.
lfimg TYPE lfimg , "ACTUAL DELIVERY QTY.
vrkme TYPE vrkme , "SALES UNIT
END OF it_del .
TYPES: BEGIN OF type_vbfa ,
vbelv TYPE vbeln_von , "Preceding sales and distribution document
posnv TYPE posnr_von , "Preceding item of an SD document
vbeln TYPE vbeln_nach, "Subsequent sales and distribution document
posnn TYPE posnr_nach, "Document category of subsequent document
vbtyp_n TYPE vbtyp_n ,
END OF type_vbfa .
DATA: it_so1 TYPE STANDARD TABLE OF it_so ,
it_del1 TYPE STANDARD TABLE OF it_del ,
it_vbfa TYPE STANDARD TABLE OF type_vbfa,
it_del_ful TYPE STANDARD TABLE OF it_del.
DATA: wa_so TYPE it_so ,
wa_del TYPE it_del ,
wa_vbfa TYPE type_vbfa,
wa_it_del_ful TYPE it_del.
DATA: i_title_vbfa TYPE lvc_title VALUE 'SALES ORDER LIST DISPLAYED'.
DATA: i_title_vbpa TYPE lvc_title VALUE
'DELIVERY DETAILS DISPLAYED AGAINST GIVEN SALES ORDER'.
*SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-004 .
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln ,
s_auart FOR v_auart ,
s_vkorg FOR v_vkorg ,
s_spart FOR v_spart ,
s_kunnr FOR v_kunnr ,
s_matnr FOR v_matnr .
SELECTION-SCREEN END OF BLOCK blk1 .
*AT SELECTION SCREEN *
AT SELECTION-SCREEN.
SELECT SINGLE vbeln
FROM vbak INTO vbak-vbeln
WHERE vbeln IN s_vbeln.
IF sy-subrc <> 0.
MESSAGE e202.
ENDIF.
*START OF SELECTION *
START-OF-SELECTION .
PERFORM data_select.
PERFORM t_sort USING i_sort .
PERFORM event_cat USING i_event .
PERFORM fld_cat USING i_fldcat[] .
PERFORM t_layout USING i_layout .
PERFORM fld_cat2 USING i_fldcat2[] .
PERFORM call_alv.
DATA SELECT *
*& Form DATA_SELECT
text
--> p1 text
<-- p2 text
FORM data_select .
REFRESH: it_vbfa, it_so1, it_del_ful ,it_del1 .
BREAK-POINT.
SELECT
a~vbeln
a~auart
a~vkorg
a~spart
a~kunnr
b~posnr
b~matnr
c~maktx
b~kwmeng
b~vrkme
INTO TABLE it_so1 FROM vbak AS a
JOIN vbap AS b ON bvbeln = avbeln
JOIN makt AS c ON cmatnr = bmatnr
AND c~spras = sy-langu
WHERE a~vbeln IN s_vbeln .
COLURING DISPLAY *
DATA: ld_color(1) TYPE c .
LOOP AT it_so1 INTO wa_so.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE 'C' ld_color '10' INTO wa_so-line_color.
wa_ekko-line_color = 'C410'.
MODIFY it_so1 FROM wa_so.
ENDLOOP .
IF sy-subrc = 0.
SELECT vbelv
posnv
vbeln
posnn
vbtyp_n
INTO TABLE it_vbfa
FROM vbfa
FOR ALL ENTRIES IN it_so1
WHERE vbelv = it_so1-vbeln
AND posnn = it_so1-posnr
AND vbtyp_n ='J' .
IF sy-subrc = 0.
SELECT vbeln
posnr
matnr
werks
lgort
charg
lfimg
vrkme
FROM lips INTO TABLE it_del_ful
FOR ALL ENTRIES IN it_vbfa
WHERE vbeln = it_vbfa-vbeln
AND posnr = it_vbfa-posnn.
ENDIF.
ENDIF.
ENDFORM. " DATA_SELECT
EVENT CATALOG ****************************************
*& Form EVENT_CAT
text
-->P_I_EVENT text
FORM event_cat USING p_i_event TYPE slis_t_event .
REFRESH p_i_event .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
et_events = p_i_event
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE p_i_event WITH KEY name = slis_ev_top_of_page INTO t_event.
IF sy-subrc = 0.
MOVE 'TOP_OF_PAGE' TO t_event-form.
MODIFY p_i_event FROM t_event INDEX sy-tabix TRANSPORTING form.
ENDIF.
CLEAR t_event .
ENDFORM. " EVENT_CAT
*********FORM FOR EVENT TOP_OF_PAGE*********************************
FORM top_of_page .
REFRESH i_listheader.
DATA: t_header TYPE slis_listheader.
DATA: v_text(50).
WRITE sy-datum TO v_text.
CLEAR t_header.
t_header-typ = 'S'.
t_header-key = 'Date'.
t_header-info = v_text.
APPEND t_header TO i_listheader.
CLEAR t_header.
CLEAR v_text.
WRITE: 'SALES ORDER REPORT ' TO v_text .
t_header-typ = 'S'.
t_header-key = 'TITLE'.
t_header-info = v_text.
APPEND t_header TO i_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_listheader
I_LOGO = 'ENJOYSAP_LOGO' .
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
FIRST ALV GRID DISPLAY ***************************************
*& Form CALL_ALV
text
--> p1 text
<-- p2 text
FORM call_alv .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND1'
i_callback_top_of_page = 'TOP_OF_PAGE'
I_BACKGROUND_ID = 'ALV_BACKGROUND'
i_grid_title = i_title_vbfa
is_layout = i_layout
it_fieldcat = i_fldcat[]
it_sort = i_sort
it_events = i_event
TABLES
t_outtab = it_so1
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. " CALL_ALV
FIRST FIELDCATALOG *************************************
*& Form FLD_CAT
text
-->P_I_FLDCAT[] text
FORM fld_cat USING p_i_fldcat TYPE slis_t_fieldcat_alv.
CLEAR i_fldcat.
i_fldcat-fieldname = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'."TABLE NAME
i_fldcat-seltext_m = 'SALES ORDER NO.'.
i_fldcat-col_pos = 1. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'AUART'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'."TABLE NAME
i_fldcat-seltext_m = 'SALES DOC. TYPE'.
i_fldcat-col_pos = 2. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 15. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'VKORG'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'SALES ORG.'.
i_fldcat-col_pos = 3. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 12. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'SPART'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'DIVISION'.
i_fldcat-col_pos = 4. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 10. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'KUNNR'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'SOLD TO PARTY'.
i_fldcat-col_pos = 5. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 15. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'SALES DOC. ITEM'.
i_fldcat-col_pos = 6. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 17. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'MATERIAL NO.'.
i_fldcat-col_pos = 7. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'MAKTX'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'DESCRIPTION'.
i_fldcat-col_pos = 8. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'KWMENG'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'QUANTITY'.
i_fldcat-col_pos = 9. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 15. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-do_sum = 'X'. " For doing "SUM"
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'SALES UNIT'.
i_fldcat-col_pos = 10. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 10. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
ENDFORM. " FLD_CAT
ALV SORTING ***************************************
*& Form SORT
text
-->P_I_SORT text
FORM t_sort USING p_i_sort TYPE slis_t_sortinfo_alv .
DATA: i_sort TYPE slis_sortinfo_alv .
REFRESH p_i_sort .
CLEAR i_sort.
i_sort-spos = 1.
i_sort-tabname = 'IT_SO1'.
i_sort-fieldname = 'VBELN'.
i_sort-up = 'X'.
i_sort-subtot = 'X'.
i_sort-group = '*'.
APPEND i_sort TO p_i_sort.
ENDFORM. " SORT
*FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'.
*ENDFORM. "Set_pf_status
**********FORM FOR EVENT USER_COMMAND1*******************************
FORM user_command1 USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
*CASE R_UCOMM .
WHEN '&IC1' .
IF rs_selfield-FIELDNAME = 'VBELN' .
ENDIF .
WHEN OTHERS .
ENDCASE .
CLEAR wa_so.
REFRESH: it_del1 .
IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
rs_selfield-value IS NOT INITIAL.
READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = wa_so-vbeln
AND posnv = wa_so-posnr.
READ TABLE it_del_ful INTO wa_it_del_ful
WITH KEY vbeln = wa_vbfa-vbelv
posnr = wa_vbfa-posnn.
IF sy-subrc = 0.
CLEAR wa_del.
MOVE wa_it_del_ful TO wa_del.
APPEND wa_del TO it_del1.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
SECOND ALV GRID DISPLAY ***********************************
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND2'
i_callback_top_of_page = 'TOP_OF_PAGE'
I_BACKGROUND_ID = 'ALV_BACKGROUND'
i_grid_title = i_title_vbpa
it_fieldcat = i_fldcat2[]
it_sort = i_sort
TABLES
t_outtab = it_del_ful
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 . "USER_COMMAND1
FORM FOR EVENT USER_COMMAND 2 ******************************
FORM user_command2 USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CLEAR wa_so.
REFRESH: it_del1 .
IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
rs_selfield-value IS NOT INITIAL.
READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
IF SY-SUBRC = 0.
LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = WA_SO-vbeln
AND posnv = WA_SO-posnr.
READ TABLE it_del_ful INTO wa_it_del_ful
WITH KEY vbeln = rs_selfield-value
posnr = wa_vbfa-posnn.
IF rs_selfield-fieldname = 'VBELN'.
SET PARAMETER ID 'VL' FIELD wa_vbfa-vbeln .
CALL TRANSACTION 'VL03' AND SKIP FIRST SCREEN.
ENDIF .
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM . "USER_COMMAND2
SECOND FIELDCATALOG ******************************************
*& Form FLD_CAT2
text
-->P_I_FLDCAT2[] text
FORM fld_cat2 USING p_i_fldcat2 TYPE slis_t_fieldcat_alv .
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-tabname = 'IT_DEL_FUL'."TABLE NAME
i_fldcat2-seltext_m = 'DELIVERY NO.'.
i_fldcat2-col_pos = 1. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-hotspot = 'X'.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'DELIVERY ITEM'.
i_fldcat2-col_pos = 2. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'MATERIAL NO.'.
i_fldcat2-col_pos = 3. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'WERKS'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'PLANT.'.
i_fldcat2-col_pos = 4. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'LGORT'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'ST. LOCATION'.
i_fldcat2-col_pos = 5. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'CHARG'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'BATCH NO.'.
i_fldcat2-col_pos = 6. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'LFIMG'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'ACT. DEL. QTY.'.
i_fldcat2-col_pos = 7. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'SALES UNIT.'.
i_fldcat2-col_pos = 8. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
ENDFORM. " FLD_CAT2
ALV LAYOUT *******************************************
*& Form LAYOUT
text
-->P_I_LAYOUT text
FORM t_layout USING p_i_layout TYPE slis_layout_alv .
p_i_layout-zebra = 'X'.
p_i_layout-totals_text = 'GRAND TOTAL ='.
p_i_layout-CONFIRMATION_PROMPT = 'X'.
p_i_layout-DEF_STATUS = ' '.
p_i_layout-info_fieldname = 'LINE_COLOR'.
ENDFORM. " LAYOUT
Regards,
Padmam.
Maybe you are looking for
-
Dear Gurus, We need to create a lot of Quotations each day and only few of them get converted to sales order. So if we create Customers Masters for the creation of Quotations, we will end up with a lot of useless customer masters. So we want to creat
-
In the following code, I can't figure out how to center the Button and Text components that have been added to a Panel. I can move things vertically by using a Spacer, but I can't figure out how to move them horrizontally. I want to center them in th
-
Eliminating the use of Activity Types -- what are the impacts and risks?
Our primary FI stakeholder wants to eliminate the use of Activity Types in our ERP 6.0 system. He would prefer the use of cost elements and cost centers. I know that the elimination of using Activity Types will impact our planning processes plus ou
-
Any tips on what I need? Do I need to fix my HD problem first, then do a clean install of Mavericks? I'm currently running 10.8.5 Any help would be greatly appreciated!
-
HP P7-1174 Pavilion Home Edition PC audio
Greetings, I thought I'd already posted this, but apparently not. I'm not familiar with this forum, so I apologize if I had. I have a new Windows 7, HP P7-1174 Pavilion Home Edition PC. It comes with "Integrated IDT 92HD89E Audio, Built-in High Defin