06-19-2012 4:35 PM
Hi experts,
I want to know how to hide or do not display the subtotal when its value is zero. I am using REUSE_ALV_HIERSEQ_LIST_DISPLAY. The header table is the customer information and item table is delivery information. When a certain customer information has no delivery information, it shouldn't display the subtotal. How to do it? Is it possible? Badly need all your help. Thanks.
Regards,
Lovely Hazel Oyao
06-19-2012 4:50 PM
Hi Lovely Hazel Oyao ,
You just need to check condition before displaying Subtotal.
Loop on gt_item into wa_item.
READ TABLE GT_CUST INTO WA_CUST WITH KEY VBELN = WA_ITEM-VBELN.
IF SY-SUBRC EQ 0.
CHECK <UR CONDITION> . "add your conditions if needed
CLEAR GV_SUBTOTAL. "if condn satisfies clear subtotal
ENDIF.
endloop.
06-19-2012 4:50 PM
Hi Lovely Hazel Oyao ,
You just need to check condition before displaying Subtotal.
Loop on gt_item into wa_item.
READ TABLE GT_CUST INTO WA_CUST WITH KEY VBELN = WA_ITEM-VBELN.
IF SY-SUBRC EQ 0.
CHECK <UR CONDITION> . "add your conditions if needed
CLEAR GV_SUBTOTAL. "if condn satisfies clear subtotal
ENDIF.
endloop.
06-19-2012 5:05 PM
Hi Sachin,
Thanks for your reply. I am new in ABAP and I really appreciate your reply.
I am using the sort-subtot. Do I have to clear the sort table if condition satisfies before I pass it to FM REUSE_ALV_HIERSEQ_LIST_DISPLAY? Can this affect the whole output?
Thanks.
Regards,
Lovely
06-19-2012 6:07 PM
hello lovely,
as you are using the SLIS_T_SORTINFO_ALV for sort-subtot you cannot restrict this.
Even though the subtotal is zero it will be printed by default.
So instead you have to write a classical report and after every group id subtotal is zero dont print it
06-19-2012 7:17 PM
Hi Lovely,
For
FM REUSE_ALV_HIERSEQ_LIST_DISPLAY , add below stmt to your fieldcatlog for which Sum needs to be displayed :
W_FCAT-DO_SUM = 'X'.
APPEND W_FCAT TO T_FCAT.
Note : The subtotal and grandtotal is available for CHAR fields not QUAN fields.
So check the data types of the fields for which sub total needs to be displayed. It should be CHAR only.
Now for Sort table, add below stmts:
W_SORT-UP = 'X'.
W_SORT-SUBTOT = 'X'.
APPEND W_SORT TO IT_SORT.
For layout
W_LAYOUT-TOTALS_TEXT = 'Total'. "TEXT at TOTAL
W_LAYOUT-SUBTOTALS_TEXT = 'Sub'. "TEXT AT SUB Total
Now pass above tables to FM as follows :
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = W_LAYOUT
IT_FIELDCAT = T_FCAT
IT_SORT = IT_SORT
I_TABNAME_HEADER = 'IT_HEADER'
I_TABNAME_ITEM = 'IT_ITEM'
IS_KEYINFO = W_KEYINFO
TABLES
T_OUTTAB_HEADER = INT_HEADER
T_OUTTAB_ITEM = INT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
06-19-2012 7:45 PM
Hi Ujwal,
Thank you so much for your response. A big help for me. I'll try to do it.
Regards,
Lovely
06-19-2012 7:48 PM