Problem in displaying sub-totals using a structure displayed as hierarchy
In a report, i'd like to display in rows a characteristic and a structure. All of that displayed as a 2 levels hierarchy.
Results on structure rows doesnt aggregate themselves on characteristic rows. I have no result on my first level of hierarchy?
Hi,
Write as :
loop at <internal_table> ....
V_TBL2 = V_TBL2 + SBL1.
V_PTBL2 = V_PTBL2 + PSBL1.
if....
ELSEIF ( PSCH EQ 'N' OR PSCH EQ 'O' OR PSCH EQ 'P' ).
AT END OF SG.
TBL2 = V_TBL2 .
PTBL2 = V_PTBL2 .
clear : V_TBL2 , V_PTBL2.
ENDAT.
ENDIF.
ENDLOOP.
Regards,
Srini.
Similar Messages
-
hi gurus,
In my report program i have a monthly report displaying the data for that month.
1. Now in my ALV grid i want The SUB-TOTALS for the work center wise data for a field of the alv. there are many workcenters data in my report. So after the end of each work center , i want the subtotal of a calculated TAT field.
2. At the end of the report, I want the average TAT(field calculated by my report program) for that month.
So how can i make the coding for the above.
Iam a fresher to this field, so give me in detail.
regards,
chaitanyaHi
i am giving a sample example for subtotals of alv.
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 width
ENDFORM. " 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. -
How to display sub total text in ALV grid display reporting
Hi,
I want to display a text 'SUB TOTAL' in Sub total row of an ALV report.
Presently I am getting the name of the field used in sorting to get sub totals. But I required to display own text. Could you please give me solution.
Thanks
Giridhar KarnamFor doing this u need to simply modify the layout properties, please award points if found helpful
DATA: L_LAYOUT TYPE SLIS_LAYOUT_ALV.
L_LAYOUT-SUBTOTALS_TEXT = 'GEN SUBTOT'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2. -
Totas and sub totals in ALV grid display
Hi all,
how can I get the total for an integer field in internal table. I am using the following code, but unable to display the total. Can anyone give the reason for the same.
Thank you,
Usha
REPORT ZTEST_SUB .
TABLES : vbak.
TYPE-POOLS: slis.
SELECT-OPTIONS : s_vkorg FOR vbak-vkorg,
s_kunnr FOR vbak-kunnr,
s_vbeln FOR vbak-vbeln.
SELECTION-SCREEN : SKIP,
BEGIN OF LINE,
COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '2' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
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.
DATA: BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg,
kunnr LIKE vbak-kunnr,
vbeln LIKE vbak-vbeln,
test type I,
END OF gt_vbak.
START-OF-SELECTION.
PERFORM f_read_data.
loop at gt_vbak.
gt_vbak-test = 1.
modify gt_vbak.
endloop.
PERFORM f_display_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.
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-ref_FIELDname = &2.
ls_fieldcat-do_sum = &3.
ls_fieldcat-cfieldname = &4.
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.
ls_sort-group = '*'.
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' 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' '' ''.
m_fieldcat 'VBELN' '' '' ''.
m_fieldcat 'TEST' '' 'X' ''.
m_sort 'VKORG' ''.
m_sort 'KUNNR' ''.
m_sort 'VBELN' ''.
m_sort 'TEST' 'X'.
ls_layout-cell_merge = 'X'.
LS_LAYOUT-WINDOW_TITLEBAR = 'test window'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_LAYOUT = ls_layout
IT_FIELDCAT = lt_fieldcat
IT_SORT = lt_sort
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = gt_vbak
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.hi
REPORT ZTEST_SUB .
TABLES : vbak.
TYPE-POOLS: slis.
SELECT-OPTIONS : s_vkorg FOR vbak-vkorg,
s_kunnr FOR vbak-kunnr,
s_vbeln FOR vbak-vbeln.
SELECTION-SCREEN : SKIP,
BEGIN OF LINE,
COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '2' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
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.
DATA: BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg,
kunnr LIKE vbak-kunnr,
vbeln LIKE vbak-vbeln,
test type I,
END OF gt_vbak.
START-OF-SELECTION.
PERFORM f_read_data.
loop at gt_vbak.
gt_vbak-test = 1.
modify gt_vbak.
endloop.
PERFORM f_display_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.
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-ref_FIELDname = &2.
ls_fieldcat-do_sum = &3.
ls_fieldcat-cfieldname = &4.
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.
ls_sort-group = '*'.
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' 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' '' ''.
m_fieldcat 'VBELN' '' '' ''.
m_fieldcat 'TEST' '' 'X' ''.
m_sort 'VKORG' ''.
m_sort 'KUNNR' ''.
<b> m_sort 'VBELN' 'X'.</b>
*m_sort 'TEST' 'X'.
ls_layout-cell_merge = 'X'.
LS_LAYOUT-WINDOW_TITLEBAR = 'test window'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_LAYOUT = ls_layout
IT_FIELDCAT = lt_fieldcat
IT_SORT = lt_sort
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = gt_vbak
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
Message was edited by: Ashok Parupalli -
How to Display Sub-Columns using ALV Grid
Hi ,
Could someone tell me how to display sub-columns under a parent column using ALV Grid. Do we have any standard Program which has this scenario. Please let me know.
Thanks,
Abaper.
Message was edited by:
ABAP'eryou can check all with <b>BCALV* or RSDEMO*</b> in SE38 for all Std
check below
BCALV_DND_01 Drag ALV Row to Tree Folder
BCALV_DND_02 Drag Icons from Tree to Rows of the Grid
BCALV_GRID_DND_TREE ALV Grid: Drag and Drop with ALV Tree
BCALV_GRID_DND_TREE_SIMPLE ALV GRID: Drag and drop with ALV tree (simple)
BCALV_TEST_COLUMN_TREE Program BCALV_TEST_COLUMN_TREE
Rewards if useful............
Minal -
Requirement - I am writing a very large reports from Hyperion Performance Cost management.
Account is in Row. We are taking all level0 members in Row. In columns we are taking Entity,Cost Centers
Current Structure of the Report
41100 Entity1 Cost center1 20
41100 Entity1 Cost center2 30
41100 Entity1 Cost cenetr3 40
41200 Entity 10 Cost center1 200
41200 Entity 10 Cost center2 210
41200 Entity 10 Cost center3 200
Grand Total 1000 ( For Example)
User wants to dynamically add a sub total into the report when account (41200,41100) changes i.e. This is because , its a very large report of 100's of pages,
Future State
41100 Entity1 Cost center1 20
41100 Entity1 Cost center2 30
41100 Entity1 Cost cenetr3 40
sub total 1 --------------------------90 ( This line should be automatically inserted here)
41200 Entity 10 Cost center1 200
41200 Entity 10 Cost center2 210
41200 Entity 10 Cost center3 200
sub total (n) -------------------------610 ( This line should be automatically inserted here)
Grand Total 1000 ( For Example)Hello,
maybe re-consider this approach and say no to the users who request this. Try to think about other solutions.
Sometimes a "no" helps them more than doing what they ask.
You might export the whole in Excel. Then they can make their subtotals at every line.
Regards,
Philip. -
How to Display Sub-Columns using ALV
Hi experts,
Could someone tell me how to display sub-columns under a parent column using ALV. Do we have any standard Program which has this scenario. points are guaranteed for the right answer.
Thanks in advance
Sreenivasyou can check all with <b>BCALV* or RSDEMO*</b> in SE38 for all Std
check below
BCALV_DND_01 Drag ALV Row to Tree Folder
BCALV_DND_02 Drag Icons from Tree to Rows of the Grid
BCALV_GRID_DND_TREE ALV Grid: Drag and Drop with ALV Tree
BCALV_GRID_DND_TREE_SIMPLE ALV GRID: Drag and drop with ALV tree (simple)
BCALV_TEST_COLUMN_TREE Program BCALV_TEST_COLUMN_TREE
Rewards if useful............
Minal -
Can I turn darken my MacBook display while I use a Cinema Display?
I have purchased a Cinema Display and external keyboard. I have tried to figure out how my MacBook display can be asleep while I use the Cinema display--I'm stuck!
<http://support.apple.com/kb/ht3131>
-
Sub total icon is not displaying in alv report output
Hi friends ,
In alv report display on menu bar the icon : subtotals is not displaying at the output , I should not give subtotal in each field catalog .
Plz give me solution, points will be rewarded.
with regards,
prasad.Hi,
I think u r using PF-STATUS parameter in function module,
if u use this parameter, you sholud give the icon name etc..
otherwise by default it will appear.
Check your code again.
Give me exact requirement, if possible paste the code.
Regards,
Chandu -
Sub Total display in Samrtforms
Hi ,
I need to display sub totals in my smartform.Infact I have used Calcualtions Tab Under TABLE with Operation "Total" and Time "After Loop" which is displaying wrong values when Internal Table values are spanned to multiple pages. Can any body help me.
Regards,
Srinivas>
SRINI VASA wrote:
> I can not create any text node after Main Window and according to my requirement, I need to display my sub total in footer of my table inside Main Window.
"..............Main window
".......................Table with loop
"...........................main area with flow logic calculate sum here in some temp variable
"..................................footer, print here your temp with text node
No need to create text node after main window -
Hi gurus,
I have a problem, please help me out.
Iam doing an report program with alv display. In that iam calculating the AVG for the workcenter wise for the field TAT.
please observe my below o/p in general ALv format.
work center-- TAT- Tat(Yes/no)
qm0010------ 1 -- yes
qm0010-------2 -- yes
qm0010------ 4 -- yes
qm0010------ 7 -- No (because >5)
Subtotal(qm0010)--3 (avg caluculated)
qm0020-- 4 --- yes
qm0020-7-- No (because >5)
qm0020--10 - No (because >5)
qm002010- No (because >5)
Subtotal(qm0020)-- 7 (avg caluculated).
this is the rough o/p iam getting . this is acheived by programming the Field catalog for TAT field i.e... do_sum = 'C'.
then giving the sort table to REUSE_ALV_GRID_DISPLAY.
Now my problem is:
I want the avg to be calcuted by the business formula which is:
avg = sum of(TAT within 5 days) / total no of the entries .
Ex:
work center-- TAT- Tat(Yes/no)
qm0010------ 1 -- yes
qm0010-------2 -- yes
qm0010------ 4 -- yes
qm0010------ 7 -- No (because >5)
Subtotal(qm0010)---*7/4=2 (avg caluculated for tat<5)*
qm0020-- 4 --- yes
qm0020-7-- No (because >5)
qm0020--10 - No (because >5)
qm002010- No (because >5)
Subtotal(qm0020)--4/4=1 (avg caluculated for tat<5).
How can i acheive the above, since in field catalog and alv, i think we cannot pass any conditions(like for TAT which is less than 5). So is there any other way to acheive the above.
Please understand the problem and give me(please directly dont suggest any programs , since iam not a expert to understand)..
Please explain me in detail. Points will be duly rewarded.
Thanks in advance........Chaitu
Edited by: chaitanya on May 30, 2008 12:33 PM
Edited by: chaitanya on May 30, 2008 12:38 PM
Edited by: chaitanya on May 30, 2008 12:39 PMHi Chaitanya,
You can display in your report with totals and sub-totals using alv, but not average. That functionality has not provided by sap. Do one thing add one more extra column Average in your output, do the calculation for average and pass the value in the coding itself. Then last display your report with Average field.
Rgds,
Bujji -
Totals and Sub-Totals in ALV GRID
Could anyone advice, how to display sub-totals and totals in ALV Grid(using FM).
Ex: value1 value2
100 50
200 50
subtotal 300 100
total 400
Thanks in advance...Refer below demo code and see perform Sort_list..
it wil serve ur purpose.
REPORT ZGILL_ALV message-id rp .
type-pools slis.
tables: zgill_main,zgill_details.
data z_fieldcat type slis_t_fieldcat_alv.
data begin of itab occurs 0.
DATA ICON TYPE ICON-ID.
include structure zgill_main.
data salary like zgill_details-salary.
data end of itab.
*data itab1 like table of itab with header line.
data : WA_SORT TYPE SLIS_SORTINFO_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
PARAMETERS: p_list radiobutton group A1,
P_GRID RADIOBUTTON GROUP A1.
SELECT-OPTIONS: S_PERNR FOR ZGILL_MAIN-PERNR.
start-of-selection.
perform fill_itab.
perform sort_list.
**************Start of scenario without container******************************************
*********Method 1***********
perform fill_fieldcat. " Manuallly Preparing Fiedl Catalog
*********Method 2***********
*perform fill_fieldcat1 changing z_fieldcat. "Preparing field catalog with merge function
perform display_alv.
*****************end of scenario without container*****************************************
*& Form fill_itab
text
--> p1 text
<-- p2 text
form fill_itab .
*select * from zgill_main up to 20 rows INTO CORRESPONDING FIELDS OF TABLE itab.
*ITAB1[] = ITAB[].
select apernr aname aorg adob b~salary INTO CORRESPONDING FIELDS OF TABLE itab
from zgill_main as a join zgill_details as b on apernr = bpernr
WHERE A~PERNR IN S_PERNR.
LOOP AT ITAB.
IF ITAB-PERNR < 1111.
ITAB-ICON = '@08@'.
ELSEIF ITAB-PERNR > 1111 AND ITAB-PERNR < 11111111.
ITAB-ICON = '@09@'.
ELSEIF ITAB-PERNR GE 11111111.
ITAB-ICON = '@0A@'.
ENDIF.
MODIFY ITAB INDEX SY-TABIX.
ENDLOOP.
endform. " fill_itab
*& Form display_alv
text
--> p1 text
<-- p2 text
form display_alv .
data repid like sy-repid.
REPID = SY-REPID.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.
WA_LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL'.
WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
IF P_GRID = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_FIELDCAT = IT_FIELDTAB
IT_SORT = IT_SORT
IS_LAYOUT = WA_LAYOUT
TABLES
t_outtab = itab[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF sy-subrc <> 0.
message e016 with 'Error in Display'.
ENDIF.
ELSEIF P_LIST = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_FIELDCAT = IT_FIELDTAB
IT_SORT = IT_SORT
IS_LAYOUT = WA_LAYOUT
TABLES
t_outtab = itab[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF sy-subrc <> 0.
message e016 with 'Error in Display'.
ENDIF.
ENDIF.
endform. " display_alv
*& Form fill_fieldcat1
text
--> p1 text
<-- p2 text
form fill_fieldcat1 changing d_fcat type slis_t_fieldcat_alv.
data repid like sy-repid.
data d_fcat1 type slis_t_fieldcat_alv with header line.
REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = repid
I_INTERNAL_TABNAME = 'ITAB'
I_STRUCTURE_NAME = 'ZGILL_MAIN'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = d_fcat[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF sy-subrc <> 0.
message e016 with 'Error in preparing fiedl catalog'.
ENDIF.
loop at d_fcat into d_fcat1.
case d_fcat1-fieldname.
when 'NAME'.
d_fcat1-reptext_ddic = 'Emp Name'.
MODIFY D_FCAT FROM D_FCAT1.
WHEN 'PERNR'.
d_fcat1-reptext_ddic = 'Emp Num'.
MODIFY D_FCAT FROM D_FCAT1.
WHEN 'ORG'.
d_fcat1-reptext_ddic = 'Org Unit'.
MODIFY D_FCAT FROM D_FCAT1.
endcase.
clear d_fcat1.
endloop.
endform. " fill_fieldcat1
*& Form sort_list
text
--> p1 text
<-- p2 text
form sort_list .
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'DOB'.
WA_SORT-SPOS = '1'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'NAME'.
WA_SORT-SPOS = '1'.
WA_SORT-UP = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
endform. " sort_list
*& Form fill_fieldcat
text
--> p1 text
<-- p2 text
form fill_fieldcat .
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'ICON'.
WA_FIELDCAT-SELTEXT_L = 'TRAFFIC'.
WA_FIELDCAT-ICON = 'X'.
WA_FIELDCAT-ddictxt = 'l'.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'PERNR'.
WA_FIELDCAT-SELTEXT_L = 'EMP NUMBER'.
WA_FIELDCAT-ddictxt = 'l'.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
when 'maktx'.
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'NAME'.
WA_FIELDCAT-SELTEXT_L = 'EMP NAME'.
WA_FIELDCAT-ddictxt = 'l'.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-OUTPUTLEN = 15.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'ORG'.
WA_FIELDCAT-SELTEXT_L = 'ORG UNIT'.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'DOB'.
WA_FIELDCAT-SELTEXT_L = 'BIRTH DATE'.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-OUTPUTLEN = 12.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'SALARY'.
WA_FIELDCAT-SELTEXT_L = 'SALARY'.
WA_FIELDCAT-COL_POS = 6.
WA_FIELDCAT-OUTPUTLEN = 25.
WA_FIELDCAT-do_sum = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
endform. " fill_fieldcat -
hi,
i am making report in alv in which i have to display the sub totals and den full total.
is it possible to display sub total in ALV acccording to material type wise or itemid wise.
plzz help me with some example.
If find useful he or she will definately rewarded.........Hi,
The following example for sub totall for ALV report..
u have to pass do_sum = 'X'. for perticuler fileds.
if it is use full answer reward me a points..
*& Report ZDEL_ALV1
*Description: This ALV interactive report is display Delivary
status
REPORT zdel_alv1 NO STANDARD PAGE HEADING LINE-SIZE 255 LINE-COUNT 60.
*TABLE DECLARATION
TABLES : likp, "Delivery Header Data
lips, "Delivery item Data
vbup. "sales document item status
TYPE-POOLS : slis.
*SRUCTURE DECLARATION
*THIS TABLE FOR HEADER DETAILS
TYPES : BEGIN OF t_likp ,
vbeln LIKE likp-vbeln, "Delivery number
kosta like vbup-kosta,
kunnr LIKE likp-kunnr, "Customer number
wadat LIKE likp-wadat, "Planned goods movement date
ernam LIKE likp-ernam, "Name of person
vkorg LIKE likp-vkorg, "Sales organization
lfart LIKE likp-lfart, "DELIVERY TYPE
ntgew LIKE likp-ntgew, "NET WEIGHT
END OF t_likp.
*THIS TABLE FOR ITEM DETAILS
TYPES : BEGIN OF t_lips ,
vbeln LIKE lips-vbeln, "Delivery number
posnr LIKE lips-posnr, "delivery item
matnr LIKE lips-matnr, "Material number
lfimg LIKE lips-lfimg, "Actual quantity delivered
ntgew LIKE lips-ntgew, "Net weight
exbwr LIKE lips-exbwr, "Externally entered posting amount
arktx LIKE lips-arktx, "Short text SO Item
END OF t_lips.
*THIS IS FOR FINAL OUTPUT
TYPES : BEGIN OF t_vbup ,
vbeln LIKE likp-vbeln, "Delivery number
kosta LIKE vbup-kosta, "Picking status/Putaway status
posnr LIKE vbup-posnr, "delivery item
matnr LIKE lips-matnr, "Material number
lfimg LIKE lips-lfimg, "Actual quantity delivered
ntgew LIKE lips-ntgew, "Net weight
exbwr LIKE lips-exbwr, "Externally entered posting amount
arktx LIKE lips-arktx, "SHORT text SO Item
description(20), "for display text
END OF t_vbup.
*INTERNAL TABLES
DATA : i_likp TYPE STANDARD TABLE OF t_likp.
DATA : i_lips TYPE STANDARD TABLE OF t_lips.
DATA : i_vbup TYPE STANDARD TABLE OF t_vbup.
DATA : repid LIKE sy-repid.
DATA : delivar1(10) TYPE c.
*WORK AREA
DATA : wa_likp TYPE t_likp.
DATA : wa_lips TYPE t_lips.
DATA : wa_vbup TYPE t_vbup.
DATA: i_vbup1 LIKE wa_vbup OCCURS 0 WITH HEADER LINE.
*SLIS TABLE DECLARATIONS
DATA: i_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
i_events TYPE slis_t_event,
w_events TYPE slis_alv_event,
i_fieldcat1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
i_layout TYPE slis_layout_alv.
*SELECTING RANGE OF VALUES
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_vbeln FOR likp-vbeln,
s_kunnr FOR likp-kunnr,
s_wadat FOR likp-wadat.
SELECTION-SCREEN END OF BLOCK b1 .
*CHOOSE ONE CHECK BOX FOR DISPLAYING THE DELIVARY STATUS
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS : cb_kostc AS CHECKBOX,"DEFAULT 'X',
cb_kosta AS CHECKBOX,
cb_kostb AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b2.
*INTIALIZATION CHECK
INITIALIZATION.
repid = sy-repid.
*START-OF-SELECTION
START-OF-SELECTION.
PERFORM get_data.
PERFORM get_field.
PERFORM GET_EVENTS.
PERFORM display.
*END-OF-SELECTION
END-OF-SELECTION.
*& Form RUCOMM
This form getting details from lips table for displaying
the item details and all select statements for delivary status
-->R_UCOMM text
-->RS_SELFIELDtext
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE
slis_selfield.
IF rs_selfield-fieldname = 'VBELN'.
delivar1 = rs_selfield-value.
ENDIF.
IF cb_kostc = 'X'.
SELECT VBELN KOSTA FROM VBUP
INTO TABLE I_VBUP
WHERE VBELN IN DELIVAR
AND KOSTA = 'C'.
SELECT VBELN MATNR LFIMG EXBWR INTO TABLE I_LIPS FROM LIPS
WHERE VBELN EQ DELIVAR1.
REFRESH i_vbup1[].
CLEAR i_vbup1.
SELECT avbeln akosta bposnr bmatnr blfimg bntgew b~exbwr
b~arktx
INTO TABLE i_vbup
FROM vbup AS a INNER JOIN lips AS b
ON avbeln = bvbeln
WHERE a~vbeln EQ delivar1
AND kosta = 'C'.
ELSEIF cb_kosta = 'X'.
SELECT VBELN KOSTA FROM VBUP
INTO TABLE I_VBUP
WHERE VBELN IN DELIVAR
AND KOSTA = 'A'.
SELECT avbeln akosta bposnr bmatnr blfimg bntgew b~exbwr
b~arktx
INTO TABLE i_vbup
FROM vbup AS a INNER JOIN lips AS b
ON avbeln = bvbeln
WHERE a~vbeln EQ delivar1
AND kosta = 'A'.
ELSEIF cb_kostb = 'X'.
SELECT VBELN KOSTA FROM VBUP
INTO TABLE I_VBUP
WHERE VBELN IN DELIVAR
AND KOSTA = 'B'.
SELECT avbeln akosta bposnr bmatnr blfimg bntgew b~exbwr
b~arktx
INTO TABLE i_vbup
FROM vbup AS a INNER JOIN lips AS b
ON avbeln = bvbeln
WHERE a~vbeln EQ delivar1
AND kosta = 'B'.
ENDIF.
CLEAR i_vbup1.
LOOP AT i_vbup INTO wa_vbup.
i_vbup1-vbeln = wa_vbup-vbeln.
i_vbup1-kosta = wa_vbup-kosta.
IF wa_vbup-kosta = 'C'.
i_vbup1-description = 'COMPLETELY PROCESSED'.
ELSEIF wa_vbup-kosta = 'B'.
i_vbup1-description = 'PARTIALLY PROCESSED'.
ELSEIF wa_vbup-kosta = 'A'.
i_vbup1-description = 'NOT YET PROCESSED'.
ENDIF.
i_vbup1-posnr = wa_vbup-posnr.
i_vbup1-matnr = wa_vbup-matnr.
i_vbup1-lfimg = wa_vbup-lfimg.
i_vbup1-ntgew = wa_vbup-ntgew.
i_vbup1-exbwr = wa_vbup-exbwr.
i_vbup1-arktx = wa_vbup-arktx.
APPEND i_vbup1 .
ENDLOOP.
SORT i_vbup1 BY vbeln matnr lfimg.
DELETE ADJACENT DUPLICATES FROM i_vbup1 COMPARING vbeln matnr lfimg.
SELECT VBELN MATNR LFIMG EXBWR INTO TABLE I_LIPS FROM LIPS
WHERE VBELN EQ DELIVAR1.
*This function module for displaying the item details
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
it_fieldcat = i_fieldcat1[]
i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_user_command = 'USER_COMMAND1'
it_events = i_events
TABLES
t_outtab = i_vbup1
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.
CLEAR i_vbup1.
ENDFORM. "RUCOMM
*& Form USER_COMMAND1
text
-->R_UCOMM1 text
-->RS_SELFIELDtext
FORM user_command1 USING r_ucomm1 LIKE sy-ucomm rs_selfield1 TYPE
slis_selfield.
DATA: deliv(10) TYPE c.
IF rs_selfield1 = 'VBELN'.
deliv = rs_selfield1-value.
ENDIF.
SET PARAMETER ID 'VL' FIELD delivar1.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDFORM. "USER_COMMAND1
*& Form GET_DATA
This form for getting the data from likp table
--> p1 text
<-- p2 text
FORM get_data .
SELECT VBELN KUNNR WADAT FROM LIKP INTO TABLE I_LIKP
WHERE VBELN IN S_VBELN
AND KUNNR IN S_KUNNR
AND WADAT IN S_WADAT.
REFRESH i_likp[].
CLEAR i_likp.
IF cb_kostc = 'X' AND cb_kosta = ' ' AND cb_kostb = ''.
SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
INTO TABLE i_likp
FROM vbup AS a INNER JOIN likp AS b
ON avbeln = bvbeln
WHERE
b~kunnr IN s_kunnr
AND b~vbeln IN s_vbeln
AND b~wadat IN s_wadat
AND a~kosta = 'C'.
ELSEIF cb_kosta = 'X' AND cb_kostb = ' ' AND cb_kostc = ''.
SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
INTO TABLE i_likp
FROM vbup AS a INNER JOIN likp AS b
ON avbeln = bvbeln
WHERE
b~kunnr IN s_kunnr
AND b~vbeln IN s_vbeln
AND b~wadat IN s_wadat
AND a~kosta = 'A'.
ELSEIF cb_kostb = 'X' AND cb_kosta = '' AND cb_kostc = ''.
SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
INTO TABLE i_likp
FROM vbup AS a INNER JOIN likp AS b
ON avbeln = bvbeln
WHERE
b~kunnr IN s_kunnr
AND b~vbeln IN s_vbeln
AND b~wadat IN s_wadat
AND kosta = 'B'.
ELSEIF cb_kostc = 'X' AND cb_kosta = 'X' AND cb_kostb = 'X'.
SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
INTO TABLE i_likp
FROM vbup AS a INNER JOIN likp AS b
ON avbeln = bvbeln
WHERE
b~kunnr IN s_kunnr
AND b~vbeln IN s_vbeln
AND b~wadat IN s_wadat
AND kosta NE ' '.
ENDIF.
DELETE ADJACENT DUPLICATES FROM i_likp.
ENDFORM. " GET_DATA
*& Form GET_FIELD
This form for defining the every fields from likp & lips tables
FORM get_field .
*This fields are retrieving from header table(likp)
CLEAR i_fieldcat.
i_fieldcat-fieldname = 'VBELN'.
i_fieldcat-seltext_m = 'SALES ORDER NO'.
APPEND i_fieldcat TO i_fieldcat.
CLEAR i_fieldcat.
i_fieldcat-fieldname = 'KUNNR'.
i_fieldcat-seltext_m = 'CUSTOMER NO'.
APPEND i_fieldcat TO i_fieldcat.
CLEAR i_fieldcat.
i_fieldcat-fieldname = 'WADAT'.
i_fieldcat-seltext_m = 'DATE'.
APPEND i_fieldcat TO i_fieldcat.
CLEAR i_fieldcat.
i_fieldcat-fieldname = 'ERNAM'.
i_fieldcat-seltext_m = 'NAME OF PERSON'.
APPEND i_fieldcat TO i_fieldcat.
CLEAR i_fieldcat.
i_fieldcat-fieldname = 'VKORG'.
i_fieldcat-seltext_m = 'SALES ORGANIZATION'.
APPEND i_fieldcat TO i_fieldcat.
CLEAR i_fieldcat.
i_fieldcat-fieldname = 'LFART'.
i_fieldcat-seltext_m = 'DELIVERY TYPE'.
APPEND i_fieldcat TO i_fieldcat.
CLEAR i_fieldcat.
i_fieldcat-fieldname = 'NTGEW'.
i_fieldcat-seltext_m = 'NET WEIGHT'.
i_fieldcat-do_sum = 'X'.
APPEND i_fieldcat TO i_fieldcat.
CLEAR i_fieldcat.
*This fields are retrieving from item table(lips)
CLEAR i_fieldcat1.
i_fieldcat1-fieldname = 'VBELN'.
i_fieldcat1-seltext_m = 'DELIVAR NO'.
APPEND i_fieldcat1 TO i_fieldcat1.
CLEAR i_fieldcat1.
i_fieldcat1-fieldname = 'POSNR'.
i_fieldcat1-seltext_m = 'DELIVERY ITEM'.
APPEND i_fieldcat1 TO i_fieldcat1.
CLEAR i_fieldcat1.
i_fieldcat1-fieldname = 'MATNR'.
i_fieldcat1-seltext_m = 'MATERIAL NO'.
APPEND i_fieldcat1 TO i_fieldcat1.
CLEAR i_fieldcat1.
i_fieldcat1-fieldname = 'LFIMG'.
i_fieldcat1-seltext_m = 'ACTUAL QUANTITY'.
i_fieldcat1-do_sum = 'X'.
APPEND i_fieldcat1 TO i_fieldcat1.
CLEAR i_fieldcat1.
i_fieldcat1-fieldname = 'NTGEW'.
i_fieldcat1-seltext_m = 'NET WEIGHT'.
i_fieldcat1-do_sum = 'X'.
APPEND i_fieldcat1 TO i_fieldcat1.
CLEAR i_fieldcat1.
i_fieldcat1-fieldname = 'EXBWR'.
i_fieldcat1-seltext_m = 'AMOUNT'.
APPEND i_fieldcat1 TO i_fieldcat1.
CLEAR i_fieldcat1.
i_fieldcat1-fieldname = 'ARKTX'.
i_fieldcat1-seltext_m = 'SHORT TEXT FOR so ITEM'.
APPEND i_fieldcat1 TO i_fieldcat1.
CLEAR i_fieldcat1.
i_fieldcat1-fieldname = 'DESCRIPTION'.
i_fieldcat1-seltext_m = 'PICKING STATUS'.
APPEND i_fieldcat1 TO i_fieldcat1.
CLEAR i_fieldcat1.
ENDFORM. " GET_FIELD
*& Form GET_EVENTS
This form defining the events
*FORM GET_EVENTS .
CLEAR W_EVENTS.
W_EVENTS-NAME = 'USER_COMMAND'.
W_EVENTS-FORM = 'RUCOMM'.
APPEND W_EVENTS TO I_EVENTS.
*ENDFORM. " GET_EVENTS
*& Form DISPLAY
This form is going to display header details from likp table
FORM display .
*This function module for displaying the header details
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = i_fieldcat[]
i_save = 'X'
it_events = i_events
TABLES
t_outtab = i_likp
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
*& Form TOP-OF-PAGE
This form is going to display top-of-page header text
FORM top-of-page.
DATA: i_list_comments TYPE slis_t_listheader.
DATA: w_list_comments TYPE slis_listheader.
CLEAR: i_list_comments[].
w_list_comments-typ = 'H'. "H=Header, S=Selection, A=Action
w_list_comments-info = 'DELIVERY ORDER DETAILS'.
APPEND w_list_comments TO i_list_comments.
w_list_comments-typ = 'A'. " H = Header, S = Selection, A = Action
w_list_comments-info = 'Basic list'.
APPEND w_list_comments TO i_list_comments.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'enjoy'
it_list_commentary = i_list_comments.
ENDFORM. "TOP-OF-PAGE
*& Form TOP_OF_PAGE
This form is going to display top-of-page item text
FORM top_of_page.
DATA: i_list_comments TYPE slis_t_listheader.
DATA: w_list_comments TYPE slis_listheader.
DATA : i_line LIKE w_list_comments-info.
CONCATENATE 'DELIVERY ITEM DETAILS :' delivar1 INTO i_line .
SEPARATED BY SPACE.
CLEAR: i_list_comments[].
w_list_comments-typ = 'H'. "H=Header, S=Selection, A=Action
w_list_comments-info = i_line.
APPEND w_list_comments TO i_list_comments.
w_list_comments-typ = 'A'. " H = Header, S = Selection, A = Action
w_list_comments-info = 'Secondary list'.
APPEND w_list_comments TO i_list_comments.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'enjoy'
it_list_commentary = i_list_comments.
ENDFORM. "TOP_OF_PAGE -
Need Help Creating A Sub-Total Box On 3 Page Invoice
I have a 3 page Invoice with Grand Total on the last page that already totals all three pages together. No Problem here.
I copied & pasted a Sub-Total box from the Template Manager and attached it to the bottom of the first two invoice pages.
The problem is, the Sub-Total amounts continue to add the other page amounts. It's like I have three Grand Total boxes instead of two individual Sub-Total boxes.
Any help would be greatly appreciated!Sorry for the delay in getting back to you ..... I was looking for a sample that I could provide.
The technique to use would be to get a list of all objects that are on the page that you want to create the subtotal on. Then with this reduced set of objects, search out the individual fields and add then together to make your total. In the example I have we created a function to do this and passed the object subtotal object itself to the function. The function then determines which page the object is on, gets all field objects from that page (in our case we are asking to add all fields called fldSavings), then cycles through each field and totals them and finally returns the sum back to the calling program. Hope this helps .... see the code below we call it in this way:
scoScript.getPageTotals(this.name);
Here is the function:
function getPageTotals(objFld){
var nPage = xfa.layout.absPage(objFld);
var oFields = xfa.layout.pageContent(nPage , "field");
var nFieldCount = oFields.length;
var numFldTotals = 0;
for (var nNodeCount = 0; nNodeCount < nFieldCount; nNodeCount++)
if (oFields.item(nNodeCount).name == "fldSavings")
numFldTotals = numFldTotals + oFields.item(nNodeCount).rawValue;
return numFldTotals; -
Sub total wise Grand total in ALV report
Dear All,
I am displaying a list of material through material group wise so for each material i want to display sub-total for stock and grand total of stock(material group wise).Here it is adding up all the stock displayed for different AUOM(alternative unit of measure ) which is for same material so i want to pick only the sub-total and sum up in my Grand total.
How to pick only the Sub-total Results and Add in ALV List for Grand total.
Thanks & Regards,
Arun.
Edited by: Arun Kumaran on Sep 24, 2008 7:46 AMHi arun,
check these links
total and subtotal in alv
ALV SUBTOTAL
Regards,
Anirban
Maybe you are looking for
-
When I click on photos in icloud it loads up a different photo to the one I clicked on
My icloud photos folder is out of sync with itself. If I take a photo it appears in the directory correctly but then if I open the photo it loads a completely different picture??
-
Hi, if there is any one who can help me solve the problem with my Nokia N9 I will very grateful. My phone got automatically lock and when I looked up on the discussions apparently if I put in my Nokia account password it will unlock but the problemit
-
Itunes download for Windows 98?
My boyfriend has an ipod shuffle but his computer doesnt have internet access and runs Windows 98. Is there a way for my to download on old version of itunes for him, burn it to a disc for him to use on his computer? Or any other ideas of how he coul
-
Could not connect to oracle OLAP
Hi when i connect to Disco. Plus for "OracleBI Discoverer for OLAP" and Database as "localhost:1521:orcl" i got this message: "D40-Could not connect to oracle OLAP" so i run a Quick Diagnosis and i got this report: JDK version = 1.4.2_04 BI Beans int
-
I have I PAD 1 , bought from sydney store on 2009 June . the warrnaty has finished . my son washed it with water so that he become more sparkel .i donot know what to do with it now . please can someone help. thank you