ALV- HIERARCHAIL SEQUENTIAL
I am trying to create a ALV Hierarchial/Sequential report. I developed the code below and getting a error " T_VBAK" is not an internal table....Please let me know the errors and how to correct them.
REPORT Z_ALV_HIERSEQ_REPORT .
TYPE-POOLS: SLIS.
DATA: T_FCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: W_FCAT TYPE SLIS_FIELDCAT_ALV.
DATA: BEGIN OF T_VBAK OCCURS 0,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
NETWR TYPE VBAK-NETWR,
END OF T_VBAK.
DATA: BEGIN OF T_VBAP OCCURS 0,
VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,
ARKTX TYPE VBAP-ARKTX,
WERKS TYPE VBAP-WERKS,
END OF T_VBAP.
DATA: W_KEYINFO TYPE SLIS_KEYINFO_ALV.
*& FIELD CATALOG *
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'VBELN'.
W_FCAT-TABNAME = 'VBAK'.
W_FCAT-SELTEXT_M = 'ORDER NO'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'ERDAT'.
W_FCAT-TABNAME = 'VBAK'.
W_FCAT-SELTEXT_M = 'ORDER DATE'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'NETWR'.
W_FCAT-TABNAME = 'VBAK'.
W_FCAT-SELTEXT_M = 'ORDER VALUE'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'POSNR'.
W_FCAT-TABNAME = 'VBAP'.
W_FCAT-SELTEXT_M = 'ORDER ITEM'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'ARKTX'.
W_FCAT-TABNAME = 'VBAP'.
W_FCAT-SELTEXT_M = 'ORDER DESCRIPTION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'WERKS'.
W_FCAT-TABNAME = 'VBAP'.
W_FCAT-SELTEXT_M = 'PLANT'.
APPEND W_FCAT TO T_FCAT.
W_KEYINFO-HEADER01 = 'VBELN'.
W_KEYINFO-ITEM01 = 'VBELN'.
SELECT VBELN ERDAT NETWR FROM VBAK INTO TABLE T_VBAK.
SELECT VBELN POSNR ARKTX WERKS FROM VBAP INTO TABLE T_VBAP FOR ALL
ENTRIES IN T_VBAK WHERE VBELN = T_VBAK-VBELN.
*& FUNCTION MODULE CALL *
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = SY-CPROG
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT =
IT_FIELDCAT = T_FCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
I_TABNAME_HEADER = T_VBAK
I_TABNAME_ITEM = T_VBAP
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
IS_KEYINFO = W_KEYINFO
IS_PRINT =
IS_REPREP_ID =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB_HEADER = T_VBAK.
T_OUTTAB_ITEM = T_VBAP.
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.
Hi,
i corrected ur program.check itnow.
REPORT Z_ALV_HIERSEQ_REPORT.
TYPE-POOLS: SLIS.
DATA: T_FCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: W_FCAT TYPE SLIS_FIELDCAT_ALV.
DATA: BEGIN OF T_VBAK OCCURS 0,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
NETWR TYPE VBAK-NETWR,
END OF T_VBAK.
DATA: BEGIN OF T_VBAP OCCURS 0,
VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,
ARKTX TYPE VBAP-ARKTX,
WERKS TYPE VBAP-WERKS,
END OF T_VBAP.
DATA: W_KEYINFO TYPE SLIS_KEYINFO_ALV.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'VBELN'.
W_FCAT-TABNAME = 'VBAK'.
W_FCAT-SELTEXT_M = 'ORDER NO'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'ERDAT'.
W_FCAT-TABNAME = 'VBAK'.
W_FCAT-SELTEXT_M = 'ORDER DATE'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'NETWR'.
W_FCAT-TABNAME = 'VBAK'.
W_FCAT-SELTEXT_M = 'ORDER VALUE'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'POSNR'.
W_FCAT-TABNAME = 'VBAP'.
W_FCAT-SELTEXT_M = 'ORDER ITEM'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'ARKTX'.
W_FCAT-TABNAME = 'VBAP'.
W_FCAT-SELTEXT_M = 'ORDER DESCRIPTION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'WERKS'.
W_FCAT-TABNAME = 'VBAP'.
W_FCAT-SELTEXT_M = 'PLANT'.
APPEND W_FCAT TO T_FCAT.
W_KEYINFO-HEADER01 = 'VBELN'.
W_KEYINFO-ITEM01 = 'VBELN'.
SELECT VBELN ERDAT NETWR FROM VBAK INTO TABLE T_VBAK.
SELECT VBELN POSNR ARKTX WERKS FROM VBAP INTO TABLE T_VBAP FOR ALL
ENTRIES IN T_VBAK WHERE VBELN = T_VBAK-VBELN.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = SY-CPROG
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT =
IT_FIELDCAT = T_FCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
I_TABNAME_HEADER =<b> 'T_VBAK'</b>
I_TABNAME_ITEM = <b>'T_VBAP'</b>
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
IS_KEYINFO = W_KEYINFO
IS_PRINT =
IS_REPREP_ID =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB_HEADER = <b>T_VBAK[]</b>
T_OUTTAB_ITEM = <b>T_VBAP[].</b>
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.
rgds,
bharat.
Similar Messages
-
ALV hierarchical sequential list through oops
Hi ,
How to display ALV hierarchical sequential list through oops concept.
I looking for a method which is replacement for FM 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' in oops. if you can provide the sample code with that method will be really useful.
Thanks,
ShrinivasHi Shrinivas,
Check out these demo programs that are provided in SAP.
BALVHD01
BALVHD01_GROUP
<b>Reward points if this is helpful.</b>
Kiran -
ALV Examples?????
Hi experts,
could anyone please tell me about any sap standard alv interactive report, if there are any?
Thanks and Regards,
RamanaHi,
i've listed some standard ALV Reports.this may help you
BALVEX02 ALV demo program: Output flights (simplest version)
BALVEXTR Extract management
BALVHD01 Demo program ALV: Hierarchical-sequential list flight model
BALVHD01_GROUP Demo program ALV: Hierarchical-sequential list flight model
BALVHT01 Test program ALV: hierarchical-sequential list flight model
BALVHTMAINTENANCE Report for manipulating HTML templates
BALVHTTRANSLHTMPL ALV: Report for automatic HTML template translation
BALVSD01 Demo program ALV: Simple list flight model
BALVSD02 ALV demo program: Output flights (simplest version)
BALVSD02_GRID Simple ALV grid control call in fullscreen mode
BALVSD02_SAVE Simple ALV call with storage option
BALVSD03 Simple list
BALVSD04 Simple list (merged)
BALVSD06 Demoprogram ALV: Output flights (simple version + save)
BALVSD11 Demo program ALV: Simple list with interactions and variants
BALVST01 Test program ALV: Simple list flight model
BALVST02 Test program ALV: Simple list flight model
BCALV_TEST_BLOCK_LIST Program BCALV_TEST_BLOCK_LIST
BCALV_TEST_COLUMN_TREE Program BCALV_TEST_COLUMN_TREE
BCALV_TEST_EXCEL_DATATYPES FILTER Test Report
BCALV_TEST_FB_CREATE Test Report for Dynamic Generation of Tables
BCALV_TREE_01 ALV tree control: build up the hierarchy tree
BCALV_TREE_02 ALV tree control: event handling -
Hi,
I am working on a program which outputs ALV "Hierarchical sequential list output" by using function module "REUSE_ALV_HIERSEQ_LIST_DISPLAY"(pls see the code below for reference).
When i run this report with the menu option "Execute in Background", it is not generating any sort of spool.
My job is to make this report run in BACKGROUND as well.
Please suggest me which Function module i should use to generate spool for the Hierarchical sequential list.??
Please send me your valuable inputs.
Part of code of my program for your reference:
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = bhdgd-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
is_layout = wa_layout_d
it_fieldcat = wa_fieldcat_t
it_sort = wa_sort_t
I_DEFAULT = 'X'
i_save = 'X'
is_variant = wa_variant
it_events = wa_event_t
IT_EVENT_EXIT =
i_tabname_header = 'TB_HEAD'
i_tabname_item = 'TB_LINES'
is_keyinfo = wa_keyinfo_d
is_print = wa_print_d
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab_header = tb_head
t_outtab_item = tb_lines
EXCEPTIONS
program_error = 1
OTHERS = 2.
Thanks in advance,
Ram.Hi,
When you run this program in background, check if this program is creating any shortdumps in ST22. Lot of times, ALV programs can't be executed in background.
Regards,
Sumant. -
Hi ,
I want to display report output in the form of ALV tree.
Since I have data in 3 internal table for each hierarchial level, I can't use ALV hierarchial sequential list .
Please guide me how to implement the same.
Please share sample code other than SAP code if any.Hi Navdeep,
You have to use class CL_GUI_CUSTOM_CONTAINER to create three different containers.
A reference code on below link :-
[http://wiki.sdn.sap.com/wiki/display/ABAP/TREE+ALV]
Regards
Abhii -
Background report list download to excel
I run an ALV hierarchical sequential report in background. Then when I download the report output ( thro SM37 ) to excel, the whole output of the report comes in one cell ( excel ). In other words the columns of the report will not appear in excel.
for example:
I have 3 columns and 4 rows as the report output ( in SM37 ). When I download it to excel, the excel will have only 1 column and 4 rows.
I need info on making the excel output to look same as the report output; in terms of column.Hi Amit,
Actually I do have a similar issue. I have a report which output is in the form of excel sheet. I developed using ole2 objects. I have a lot of customization like colors, heading and different margins. Is there any way can I run it in background. I cannot save it in shared folders su01 because it does not support ole objects. Actually, If I run this program in foreground now, The form gets loaded with all the data, it saves the file in the given path , and then closes the file. But, when I run it in as a background job, the data is not getting loaded. Is there any other way to run this in background.
Krishna. -
Example for 4 or 3 level Hierarchail Seq ALV report?
i need the example for 4 or 3 level heirarchial sequential ALV report. ?
Hi,
Hierarchail Seq ALV may not support 3rd 4th levels.For this type of requirement you may go to tree report.
Refer the below links for tree report.
[http://www.****************/Tutorials/ALV/ALVTreeDemo/demo.htm|http://www.****************/Tutorials/ALV/ALVTreeDemo/demo.htm]
DWDM - transaction for sample/demo programs for controls
sample Program
BCALV_TREE_01 ALV Tree Control: Build Up the Hierarchy Tree
BCALV_TREE_02 ALV Tree Control: Event Handling
BCALV_TREE_03 ALV Tree Control: Use an Own Context Menu
BCALV_TREE_04 ALV Tree Control: Add a Button to the Toolbar
BCALV_TREE_05 ALV Tree Control: Add a Menu to the Toolbar
BCALV_TREE_06 ALV tree control: Icon column and icon for nodes/items
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_DND ALV tree control: Drag & Drop within a hierarchy tree
BCALV_TREE_DND_MULTIPLE ALV tree control: Drag & Drop within a hierarchy tree
BCALV_TREE_EVENT_RECEIVER Include BCALV_TREE_EVENT_RECEIVER
BCALV_TREE_EVENT_RECEIVER01
BCALV_TREE_ITEMLAYOUT ALV Tree: Change Item Layouts at Runtime
BCALV_TREE_MOVE_NODE_TEST Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO Program BCALV_TREE_SIMPLE_DEMO
BCALV_TREE_VERIFY Verifier for ALV Tree and Simple ALV Tree
Reward if found helpful.
Regards,
Boobalan Suburaj -
Top of Page Sequential/Hierarchical ALV using Class
Hi Experts.
I'd like to ask some codes on how to have the top-of-page function of the Sequential ALV using the CLASS cl_salv_hierseq_table.
Points would be rewarded.
Thanks!
Message was edited by:
Jay Cruz
Message was edited by:
Jay CruzHi Jay,
Plz check out this code.
REPORT BALVHT01 NO STANDARD PAGE HEADING.
ALV
TYPE-POOLS: SLIS.
DB-Table
TABLES: SCARR, SPFLI.
Includes
INCLUDE .
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GS_KEYINFO TYPE SLIS_KEYINFO_ALV,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,
GT_EVENTS TYPE SLIS_T_EVENT.
Data to be displayed
DATA: BEGIN OF GT_SPFLI OCCURS 0.
INCLUDE STRUCTURE SPFLI.
DATA: ADD1,
BOX,
WERT TYPE P,
LIGHTS.
DATA: END OF GT_SPFLI.
DATA: BEGIN OF GT_SCARR OCCURS 0.
INCLUDE STRUCTURE SCARR.
DATA: BOX,
LIGHTS,
EXPAND.
DATA: END OF GT_SCARR.
DATA: G_REPID LIKE SY-REPID.
DATA: GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
Report Selections
SELECT-OPTIONS CARRID FOR SCARR-CARRID.
SELECTION-SCREEN SKIP 1.
Parameters
PARAMETERS: P_MAXROW TYPE I DEFAULT 50.
SELECTION-SCREEN SKIP 1.
Variante
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE TEXT-064.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK 0.
Layout
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-060.
PARAMETERS:
P_ZEBRA AS CHECKBOX DEFAULT ' ',
P_NOCOLH AS CHECKBOX DEFAULT ' ',
P_COLOPT AS CHECKBOX DEFAULT ' ',
P_KEYHOT AS CHECKBOX DEFAULT ' ',
P_NOINPT AS CHECKBOX DEFAULT ' '.
SELECTION-SCREEN END OF BLOCK A.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME TITLE TEXT-061.
PARAMETERS:
P_LIGHTS AS CHECKBOX DEFAULT ' ',
P_LIGHTC AS CHECKBOX DEFAULT ' '.
SELECTION-SCREEN END OF BLOCK B.
SELECTION-SCREEN BEGIN OF BLOCK C WITH FRAME TITLE TEXT-062.
PARAMETERS:
P_TOTONL AS CHECKBOX DEFAULT ' ',
P_TOTEXT(60),
P_STTEXT(60).
SELECTION-SCREEN END OF BLOCK C.
SELECTION-SCREEN BEGIN OF BLOCK D WITH FRAME TITLE TEXT-063.
PARAMETERS:
P_GPCE AS CHECKBOX DEFAULT ' ',
P_CHKBOX AS CHECKBOX DEFAULT ' ',
P_EXPAND AS CHECKBOX DEFAULT ' ',
P_DETPOP AS CHECKBOX DEFAULT ' '.
SELECTION-SCREEN END OF BLOCK D.
DATA: G_BOXNAM TYPE SLIS_FIELDNAME VALUE 'BOX',
G_EXPANDNAME TYPE SLIS_FIELDNAME VALUE 'EXPAND',
P_F2CODE LIKE SY-UCOMM VALUE '&ETA',
P_LIGNAM TYPE SLIS_FIELDNAME VALUE 'LIGHTS',
G_SAVE(1) TYPE C,
G_TABNAME_HEADER TYPE SLIS_TABNAME,
G_TABNAME_ITEM TYPE SLIS_TABNAME,
g_default(1) type c,
G_EXIT(1) TYPE C,
GX_VARIANT LIKE DISVARIANT,
G_VARIANT LIKE DISVARIANT.
INITIALIZATION.
G_REPID = SY-REPID.
G_TABNAME_HEADER = 'GT_SCARR'.
G_TABNAME_ITEM = 'GT_SPFLI'.
define keyinfo
CLEAR GS_KEYINFO.
GS_KEYINFO-HEADER01 = 'CARRID'.
GS_KEYINFO-ITEM01 = 'CARRID'.
PERFORM E01_FIELDCAT_INIT USING GT_FIELDCAT[].
PERFORM E03_EVENTTAB_BUILD USING GT_EVENTS[].
PERFORM E04_COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
PERFORM E06_T_SORT_BUILD USING GT_SORT[].
PERFORM E07_SP_GROUP_BUILD USING GT_SP_GROUP[].
Schalter Varianten benutzerspezifisch/allgemein speicherbar setzen
Set Options: save variants userspecific or general
G_SAVE = 'A'.
PERFORM VARIANT_INIT.
Get default variant
GX_VARIANT = G_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 0.
P_VARI = GX_VARIANT-VARIANT.
ENDIF.
Process on value request
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
PERFORM F4_FOR_VARIANT.
PAI
AT SELECTION-SCREEN.
PERFORM PAI_OF_SELECTION_SCREEN.
START-OF-SELECTION.
PERFORM SELECTION.
END-OF-SELECTION.
PERFORM E05_LAYOUT_BUILD USING GS_LAYOUT. "wg. Parameters
Call ABAP/4 List Viewer
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS = GT_SP_GROUP[]
IT_SORT = GT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
i_default = g_default
I_SAVE = G_SAVE
IS_VARIANT = G_VARIANT
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
I_TABNAME_HEADER = G_TABNAME_HEADER
I_TABNAME_ITEM = G_TABNAME_ITEM
IS_KEYINFO = GS_KEYINFO
IS_PRINT =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
TABLES
T_OUTTAB_HEADER = GT_SCARR
T_OUTTAB_ITEM = GT_SPFLI.
FORM E01_FIELDCAT_INIT *
--> E01_LT_FIELDCAT *
FORM E01_FIELDCAT_INIT USING E01_LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'ADD1'.
LS_FIELDCAT-TABNAME = G_TABNAME_ITEM.
LS_FIELDCAT-REPTEXT_DDIC = '?'.
LS_FIELDCAT-OUTPUTLEN = 1.
LS_FIELDCAT-NO_OUT = 'X'.
LS_FIELDCAT-INPUT = 'X'.
LS_FIELDCAT-SP_GROUP = 'A'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME =
I_INTERNAL_TABNAME = G_TABNAME_HEADER
I_STRUCTURE_NAME = 'SCARR'
I_CLIENT_NEVER_DISPLAY = 'X'
CHANGING
CT_FIELDCAT = E01_LT_FIELDCAT[].
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME =
I_INTERNAL_TABNAME = G_TABNAME_ITEM
I_STRUCTURE_NAME = 'SPFLI'
I_CLIENT_NEVER_DISPLAY = 'X'
CHANGING
CT_FIELDCAT = E01_LT_FIELDCAT[].
geht am Anfang nicht !!!!
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'WERT'.
LS_FIELDCAT-TABNAME = G_TABNAME_ITEM.
LS_FIELDCAT-REPTEXT_DDIC = 'Wert'(070).
LS_FIELDCAT-OUTPUTLEN = 4.
LS_FIELDCAT-INTTYPE ='P'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
ENDFORM.
FORM E02_DATA_ADD *
--> E02_LT_SFLIGHT *
FORM E02_DATA_ADD TABLES E02_LT_SPFLI STRUCTURE GT_SPFLI.
LOOP AT E02_LT_SPFLI.
IF SY-TABIX > 10.
E02_LT_SPFLI-ADD1 = 'A'.
E02_LT_SPFLI-BOX = 'X'.
E02_LT_SPFLI-LIGHTS = '3'.
ELSE.
IF SY-TABIX = 1.
E02_LT_SPFLI-LIGHTS = '2'.
ELSE.
E02_LT_SPFLI-LIGHTS = '1'.
ENDIF.
ENDIF.
E02_LT_SPFLI-WERT = SY-TABIX MOD 5.
MODIFY E02_LT_SPFLI.
ENDLOOP.
ENDFORM.
FORM E03_EVENTTAB_BUILD *
--> E03_LT_EVENTS *
FORM E03_EVENTTAB_BUILD USING E03_LT_EVENTS TYPE SLIS_T_EVENT.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 1
IMPORTING
ET_EVENTS = E03_LT_EVENTS.
READ TABLE E03_LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO E03_LT_EVENTS.
ENDIF.
ENDFORM.
FORM E04_COMMENT_BUILD *
--> E04_LT_TOP_OF_PAGE *
FORM E04_COMMENT_BUILD USING E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: LS_LINE TYPE SLIS_LISTHEADER.
Listenüberschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-KEY: not used for this type
LS_LINE-INFO = TEXT-001.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = TEXT-050.
LS_LINE-INFO = TEXT-010.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
LS_LINE-KEY = TEXT-051.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
Aktionsinfo: Typ A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
LS_LINE-KEY: not used for this type
LS_LINE-INFO = TEXT-002.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
ENDFORM.
FORM E05_LAYOUT_BUILD *
<-> E05_LS_LAYOUT *
FORM E05_LAYOUT_BUILD USING E05_LS_LAYOUT TYPE SLIS_LAYOUT_ALV.
E05_LS_LAYOUT-F2CODE = P_F2CODE.
E05_LS_LAYOUT-ZEBRA = P_ZEBRA.
E05_LS_LAYOUT-COLWIDTH_OPTIMIZE = P_COLOPT.
IF P_CHKBOX = 'X'.
E05_LS_LAYOUT-BOX_FIELDNAME = G_BOXNAM.
E05_LS_LAYOUT-BOX_TABNAME = G_TABNAME_ITEM.
ELSE.
CLEAR E05_LS_LAYOUT-BOX_FIELDNAME.
CLEAR E05_LS_LAYOUT-BOX_TABNAME.
ENDIF.
IF P_EXPAND = 'X'.
E05_LS_LAYOUT-EXPAND_FIELDNAME = G_EXPANDNAME.
ELSE.
CLEAR E05_LS_LAYOUT-EXPAND_FIELDNAME.
ENDIF.
E05_LS_LAYOUT-NO_INPUT = P_NOINPT.
E05_LS_LAYOUT-NO_COLHEAD = P_NOCOLH.
IF P_LIGHTS = 'X' OR P_LIGHTC = 'X'.
E05_LS_LAYOUT-LIGHTS_FIELDNAME = P_LIGNAM.
E05_LS_LAYOUT-LIGHTS_TABNAME = G_TABNAME_ITEM.
ELSE.
CLEAR E05_LS_LAYOUT-LIGHTS_FIELDNAME.
CLEAR E05_LS_LAYOUT-LIGHTS_TABNAME.
ENDIF.
IF P_GPCE = 'X'.
E05_LS_LAYOUT-GROUP_CHANGE_EDIT = 'X'.
ENDIF.
E05_LS_LAYOUT-LIGHTS_CONDENSE = P_LIGHTC.
E05_LS_LAYOUT-TOTALS_TEXT = P_TOTEXT.
E05_LS_LAYOUT-SUBTOTALS_TEXT = P_STTEXT.
E05_LS_LAYOUT-TOTALS_ONLY = P_TOTONL.
E05_LS_LAYOUT-KEY_HOTSPOT = P_KEYHOT.
E05_LS_LAYOUT-DETAIL_POPUP = P_DETPOP.
ENDFORM.
FORM E06_T_SORT_BUILD *
--> E06_LT_SORT *
FORM E06_T_SORT_BUILD USING E06_LT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR LS_SORT.
LS_SORT-FIELDNAME = 'CARRID'.
LS_SORT-TABNAME = G_TABNAME_HEADER.
LS_SORT-SPOS = 1.
LS_SORT-UP = 'X'.
APPEND LS_SORT TO E06_LT_SORT.
CLEAR LS_SORT.
LS_SORT-FIELDNAME = 'CONNID'.
LS_SORT-TABNAME = G_TABNAME_ITEM.
LS_SORT-SPOS = 2.
LS_SORT-DOWN = 'X'.
APPEND LS_SORT TO E06_LT_SORT.
ENDFORM.
FORM E07_SP_GROUP_BUILD *
--> E07_LT_SP_GROUP *
FORM E07_SP_GROUP_BUILD USING E07_LT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV.
DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
CLEAR LS_SP_GROUP.
LS_SP_GROUP-SP_GROUP = 'A'.
LS_SP_GROUP-TEXT = TEXT-005.
APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
ENDFORM.
FORM SELECTION *
FORM SELECTION.
SELECT * FROM SCARR INTO CORRESPONDING FIELDS OF TABLE GT_SCARR
WHERE CARRID IN CARRID.
SELECT * FROM SPFLI INTO CORRESPONDING FIELDS OF TABLE GT_SPFLI
UP TO P_MAXROW ROWS
WHERE CARRID IN CARRID.
LOOP AT GT_SCARR.
READ TABLE GT_SPFLI WITH KEY CARRID = GT_SCARR-CARRID.
IF SY-SUBRC NE 0.
DELETE GT_SCARR.
ENDIF.
ENDLOOP.
PERFORM E02_DATA_ADD TABLES GT_SPFLI.
ENDFORM.
FORM TOP_OF_PAGE *
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM.
FORM F4_FOR_VARIANT *
FORM F4_FOR_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = G_VARIANT
I_SAVE = G_SAVE
I_TABNAME_HEADER = G_TABNAME_HEADER
I_TABNAME_ITEM = G_TABNAME_ITEM
it_default_fieldcat =
IMPORTING
E_EXIT = G_EXIT
ES_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 2.
MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF G_EXIT = SPACE.
P_VARI = GX_VARIANT-VARIANT.
ENDIF.
ENDIF.
ENDFORM.
*& Form PAI_OF_SELECTION_SCREEN
text
FORM PAI_OF_SELECTION_SCREEN.
IF NOT P_VARI IS INITIAL.
MOVE G_VARIANT TO GX_VARIANT.
MOVE P_VARI TO GX_VARIANT-VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT.
G_VARIANT = GX_VARIANT.
ELSE.
PERFORM VARIANT_INIT.
ENDIF.
ENDFORM. " PAI_OF_SELECTION_SCREEN
*& Form VARIANT_INIT
text
--> p1 text
<-- p2 text
FORM VARIANT_INIT.
CLEAR G_VARIANT.
G_VARIANT-REPORT = G_REPID.
ENDFORM. " VARIANT_INIT
Regards,
Kiran -
Hierarchical sequential display in ALV for webdynpro ABAP
Hello,
I am doing an ALV report WebDynpro for abap. I have a situation where I have to display Open Items and all the partial payments in the ALV report. In short. In summary, I have to display a Hierarchical Table of data which two different structures of data, but linked and displayed together.
The only information I have to go about this is [Table as Hierarchy|http://help.sap.com/saphelp_nw2004s/helpdata/EN/3e/904b2624534e0db707c7314a5e1e9d/frameset.htm] in SAP Help.
If you have any pointers for programming a Hierarchical Sequential report in Webdynpro alv that would be great. Any classes, methods etc I can use or , how I can do bindings to the context etc...
Thank you for all your help.
Sumit.Hello,
I am doing an ALV report WebDynpro for abap. I have a situation where I have to display Open Items and all the partial payments in the ALV report. In short. In summary, I have to display a Hierarchical Table of data which two different structures of data, but linked and displayed together.
The only information I have to go about this is [Table as Hierarchy|http://help.sap.com/saphelp_nw2004s/helpdata/EN/3e/904b2624534e0db707c7314a5e1e9d/frameset.htm] in SAP Help.
If you have any pointers for programming a Hierarchical Sequential report in Webdynpro alv that would be great. Any classes, methods etc I can use or , how I can do bindings to the context etc...
Thank you for all your help.
Sumit. -
Column headings in Hierachical-Sequential ALV
Hi Friends,
I'm trying to display a Hierarchical-Sequential by:
1. Using the class 'cl_salv_hierseq_table' and method 'factory' to create the binding.
2. Using the method 'display' to display the report.
The issue I'm facing is that the column headings being displayed in the report output are the 'Field Label' maintained in the dictionary. I would like to change the same.
Could anyone please help me in this regard??
Thanks,
Anjucheck this :
data: v_xfield_st type slis_t_fieldcat_alv.
edit the field catalog table.. by reading it...
read table v_xfield_st where FIELDNAME = 'WERKS' .
if sy-subrc eq 0.
v_xfield_st-SELTEXT_S = 'Rec. Plant'.
v_xfield_st-SELTEXT_m = 'Recv. plant'.
modify v_xfield_st index sy-index.
endif. -
Hierarchial alv in a sequential manner for 6 levels
Can we have hierarchial ALV with multiple levels.
I.e Header will have Item details -Item_01, on further clicking the item; it should further show item details , i.e Item_02.
It is something like folder inside a folder till 6 levels.
is it possible, if yes? then please suggest.
Thanks.Hi Mansi,
Thanks for the code.
I have tried this.This works fine for parent child relation.
My requirement is further drill down..for which I have tried to add one more bidning relation, but it didn't work.
Have you tried? -
Problem in Hierarchical sequential ALV
Hi all,
I am using REUSE_ALV_HIERSEQ_LIST_DISPLAY to display my ALV.. in this FM i have check box at header level and item level both. Now functionality i want is if user check the check box at header level all its items (i mean item-level check-boxes) should get selected(checked) automatically.. and from these item level user can un-check any entry he wants ...
what is the way to do it??...as in ALV upon checking header level check-box it should go to USER-COMMAND Subroutine but it is not in my case...so is ther any setting required for this...???Hi
Please Check this
ABAP TREE REPRT with check boxes
Regards
Rasheed -
Hi Expart,
In ALV report ,what is the work of
1) REUSE_ALV_VARIANT_DEFAULT_GET function module
2) SLIS_LAYOUT_ALV
Regards
BhabaniHi,
1.SELECTING THE VARIANTS FOR INITIAL LIST DISPLAY (DEFAULT VARIANT)
The variants in the list display can be both user-specific and general. The user can programmatically set the initial (default) variant for list display.
The default variant can be found using the function module 'REUSE_ALV_VARIANT_DEFAULT_GET'.
Sample code:
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = variant save condition ( A=all, U = user-specific )
CHANGING
cs_variant = internal table containing the program name (and the default variant---optional )
EXCEPTIONS
not_found = 2.
2.A layout is build for the report output list description USING the internal table declared above (I_LAYOUT).
Output list description structure.
The parameters are described under the following heads:
Display options
Exceptions
Totals
Interaction
Detail screen
Display variants (only for hierarchical-sequential lists)
Color
Other
The layout table is of type slis_layout_alv_spec and has the following fields:
Reward,if useful.
Thanks,
Chandu -
My ALV Report is taking too much time to execute
Hi Friends,
My ALV Report is taking long time for execution(more than 1.5 Hrs).Pls suggest the changes to be done to improove the performance.Its very urgent.Pls respond as soon as possible.
Thanks & Regards,
Sunil Maurya
Report is as follows :
REPORT YSEG_PROFIT.
TABLES : ZSEGMENT, coep.
TYPE-POOLS: slis.
DATA : BEGIN OF I_COEP OCCURS 0,
BELNR LIKE COEP-BELNR,
BUZEI LIKE COEP-BUZEI,
PERIO LIKE COEP-PERIO,
WOGBTR LIKE COEP-WOGBTR,
OBJNR LIKE COEP-OBJNR,
KSTAR LIKE COEP-KSTAR,
PAOBJNR LIKE COEP-PAOBJNR,
KVGR5 LIKE ZSEGMENT-KVGR5,
KAUFN LIKE CE4KBL1_ACCT-KAUFN,
END OF I_COEP.
DATA : BEGIN OF I_SECTOR OCCURS 0,
KVGR5 LIKE ZSEGMENT-KVGR5,
END OF I_SECTOR.
DATA : BEGIN OF I_AUFK OCCURS 0,
OBJNR LIKE AUFK-OBJNR,
PSPEL LIKE AUFK-PSPEL,
KDAUF LIKE AUFK-KDAUF,
KDPOS LIKE AUFK-KDPOS,
END OF I_AUFK.
DATA : BEGIN OF I_VBAKP OCCURS 0,
OBJNR LIKE VBAP-OBJNR,
KVGR5 LIKE VBAK-VBELN,
END OF I_VBAKP.
DATA : BEGIN OF I_PRPS OCCURS 0,
OBJNR LIKE PRPS-OBJNR,
PSPHI LIKE PRPS-PSPHI,
ASTNR LIKE PROJ-ASTNR,
END OF I_PRPS.
DATA : BEGIN OF I_OUTPUT OCCURS 0,
KSTAR LIKE COEP-KSTAR,
MCTXT LIKE CSKU-MCTXT,
S01 LIKE COEP-WOGBTR,
S02 LIKE COEP-WOGBTR,
S03 LIKE COEP-WOGBTR,
S04 LIKE COEP-WOGBTR,
S05 LIKE COEP-WOGBTR,
S06 LIKE COEP-WOGBTR,
S07 LIKE COEP-WOGBTR,
S08 LIKE COEP-WOGBTR,
S09 LIKE COEP-WOGBTR,
OTH like COEP-WOGBTR,
TOTAL LIKE COEP-WOGBTR,
END OF I_OUTPUT.
DATA : BEGIN OF I_AFVC OCCURS 0,
OBJNR LIKE AFVC-OBJNR,
PROJN LIKE AFVC-PROJN,
PROJ LIKE PROJ-PSPID,
PSPNR LIKE PROJ-PSPNR,
END OF I_AFVC.
DATA : BEGIN OF I_PROJ OCCURS 0,
PSPNR LIKE PROJ-PSPNR,
ASTNR LIKE PROJ-ASTNR,
END OF I_PROJ.
DATA : I_NP LIKE STANDARD TABLE OF I_COEP WITH HEADER LINE.
DATA : I_NV LIKE STANDARD TABLE OF I_COEP WITH HEADER LINE.
DATA : I_DETAIL LIKE STANDARD TABLE OF I_COEP WITH HEADER LINE.
DATA : I_WB LIKE STANDARD TABLE OF I_COEP WITH HEADER LINE.
DATA : I_PR LIKE STANDARD TABLE OF I_COEP WITH HEADER LINE.
data : t_fieldcat_sum_rep TYPE slis_t_fieldcat_alv.
data : t_fieldcat_det_rep TYPE slis_t_fieldcat_alv.
DATA: k_fieldcat TYPE slis_fieldcat_alv.
Declaration by Sunil Maurya for sorting
DATA : GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_SORT TYPE SLIS_SORTINFO_ALV.
DATA : GT_SORT1 TYPE SLIS_T_SORTINFO_ALV,
GS_SORT1 TYPE SLIS_SORTINFO_ALV.
*data : it_sortcat type slis_t_sortinfo_alv.
*DATA : k_sortcat like line of it_sortcat.
**data : wa_sort like line of it_sortcat.
Declaration by Sunil Maurya for sorting
constants : c_user_command TYPE char30 VALUE 'USER_COMMAND'.
*Selection screen
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
PARAMETER : P_PERIO1 LIKE COEP-PERIO obligatory,
P_PERIO2 LIKE COEP-PERIO MODIF ID D1,
P_GJAHR LIKE COEP-GJAHR obligatory.
select-options : P_KSTAR for COEP-KSTAR,
P_GSBER FOR COEP-GSBER.
SELECT-OPTIONS : S_KVGR5 FOR ZSEGMENT-KVGR5 MODIF ID D1.
SELECTION-SCREEN END OF BLOCK A.
INITIALIZATION.
S_KVGR5-OPTION = 'BT' .
S_KVGR5-LOW = 'S01'.
S_KVGR5-HIGH = 'S09'.
APPEND S_KVGR5.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'D1'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
PERFORM GET_SECTORS.
PERFORM GET_DATA_COEP.
PERFORM VALIDATE_SECTOR.
PERFORM GROUP_OUTPUT.
PERFORM BUILD_SORTCAT. " Inserted by by Sunil Maurya for sorting
PERFORM BUILD_CATLOG.
PERFORM DISPLAY_OUTPUT.
*& Form GET_DATA_COEP
text
--> p1 text
<-- p2 text
FORM GET_DATA_COEP .
SELECT BELNR BUZEI PERIO WOGBTR OBJNR KSTAR PAOBJNR
FROM COEP INTO TABLE I_COEP WHERE
KOKRS = 'KBL' AND
PERIO >= P_PERIO1 AND
PERIO <= P_PERIO2 AND
PERIO = P_PERIO1 AND
GJAHR = P_GJAHR AND
KSTAR NE '' AND
OBJNR NE '' AND
KSTAR in P_KSTAR AND
GSBER IN P_GSBER. "AND
BELNR = '0103991827' .
SORT I_COEP BY OBJNR.
DELETE I_COEP WHERE OBJNR+0(2) <> 'VB' AND
OBJNR+0(2) <> 'PR' AND
OBJNR+0(2) <> 'NV' AND
OBJNR+0(2) <> 'NP' AND
OBJNR+0(2) <> 'AO'.
SORT I_COEP BY KSTAR.
DELETE I_COEP WHERE KSTAR+0(5) <> '00003' AND
KSTAR+0(5) <> '00004'.
LOOP AT I_COEP WHERE OBJNR+0(2) = 'NP'.
MOVE I_COEP TO I_NP.
APPEND I_NP.
CLEAR : I_NP, I_COEP.
ENDLOOP.
LOOP AT I_COEP WHERE OBJNR+0(2) = 'NV'.
MOVE I_COEP TO I_NV.
APPEND I_NV.
CLEAR : I_NV, I_COEP.
ENDLOOP.
LOOP AT I_COEP WHERE OBJNR+0(2) = 'VB' .
MOVE I_COEP TO I_WB.
APPEND I_WB.
CLEAR : I_WB, I_COEP.
ENDLOOP.
LOOP AT I_COEP WHERE OBJNR+0(2) = 'PR' .
MOVE I_COEP TO I_PR.
APPEND I_PR.
CLEAR : I_PR, I_COEP.
ENDLOOP.
*Inserted by Sunil Maurya for PAOBJNR = "AO....."
Data : ind type sy-tabix.
loop at i_coep where OBJNR+0(2) = 'AO'.
ind = sy-tabix.
select single KAUFN into i_coep-KAUFN from CE4KBL1_ACCT where PAOBJNR =
i_coep-PAOBJNR.
select single KVGR5 into i_coep-kvgr5 from vbak where vbeln =
i_coep-kaufn.
modify i_coep index ind.
clear i_coep.
endloop.
*Inserted by Sunil Maurya for PAOBJNR = "AO....."
*LOOP AT I_COEP WHERE OBJNR+0(2) = 'AO' .
MOVE I_COEP TO I_AO.
APPEND I_AO.
CLEAR : I_AO, I_COEP.
*ENDLOOP.
ENDFORM. " GET_DATA_COEP
*& Form GET_SECTORS
text
--> p1 text
<-- p2 text
FORM GET_SECTORS .
DATA : L_FR TYPE I,
L_TO TYPE I.
DATA : L_CH1(1).
LOOP AT S_KVGR5.
IF S_KVGR5-OPTION = 'EQ'.
I_SECTOR-KVGR5 = S_KVGR5-LOW.
APPEND I_SECTOR.
CLEAR : I_SECTOR.
CONCATENATE '5' S_KVGR5-LOW+1(2) INTO I_SECTOR-KVGR5.
APPEND I_SECTOR.
CLEAR : I_SECTOR.
ENDIF.
IF S_KVGR5-OPTION = 'BT'.
L_FR = S_KVGR5-LOW+1(2).
L_TO = S_KVGR5-HIGH+1(2).
WHILE L_FR <= L_TO.
L_CH1 = L_FR.
CONCATENATE 'S0' L_CH1 INTO I_SECTOR-KVGR5.
APPEND I_SECTOR.
CONCATENATE '50' L_CH1 INTO I_SECTOR-KVGR5.
APPEND I_SECTOR.
CLEAR : I_SECTOR, L_CH1.
L_FR = L_FR + 1.
ENDWHILE.
ENDIF.
ENDLOOP.
ENDFORM. " GET_SECTORS
*& Form VALIDATE_SECTOR
text
--> p1 text
<-- p2 text
FORM VALIDATE_SECTOR .
*get data from AUFK for NP & NV type intab
IF I_NP[] IS NOT INITIAL.
SELECT OBJNR PSPEL KDAUF KDPOS FROM AUFK
INTO TABLE I_AUFK
FOR ALL ENTRIES IN I_NP
WHERE OBJNR = I_NP-OBJNR.
*Push this data in I_WB where order no exist in AUFK
LOOP AT I_AUFK WHERE KDAUF NE ''.
I_WB-OBJNR = I_AUFK-OBJNR.
APPEND I_WB.
CLEAR : I_AUFK, I_WB.
ENDLOOP.
*Push this data in I_PR where order no exist in AUFK
LOOP AT I_AUFK WHERE PSPEL NE ''.
I_PR-OBJNR = I_AUFK-OBJNR.
APPEND I_PR.
CLEAR : I_AUFK, I_PR.
ENDLOOP.
ENDIF.
SELECT BOBJNR AKVGR5 FROM VBAK AS A INNER JOIN VBAP AS B
ON AVBELN = BVBELN
INTO TABLE I_VBAKP
FOR ALL ENTRIES IN I_WB
WHERE B~VBELN = I_WB-OBJNR+2(10).
SORT I_VBAKP BY OBJNR.
SORT I_COEP BY OBJNR.
LOOP AT I_WB.
READ TABLE I_VBAKP WITH KEY OBJNR = I_WB-OBJNR.
IF SY-SUBRC = 0.
READ TABLE I_SECTOR WITH KEY KVGR5 = I_VBAKP-KVGR5.
IF SY-SUBRC <> 0.
DELETE I_COEP WHERE OBJNR = I_WB-OBJNR.
loop at i_coep where objnr = i_wb-objnr.
i_coep-kvgr5 = 'OTH'.
modify i_coep.
clear : i_coep.
endloop.
ELSE.
READ TABLE I_COEP WITH KEY BELNR = I_WB-BELNR BUZEI = I_WB-BUZEI.
READ TABLE I_COEP WITH KEY OBJNR = I_WB-OBJNR.
IF SY-SUBRC = 0.
I_COEP-KVGR5 = I_SECTOR-KVGR5.
MODIFY I_COEP INDEX SY-TABIX.
LOOP AT I_COEP WHERE OBJNR = I_WB-OBJNR.
I_COEP-KVGR5 = I_SECTOR-KVGR5.
MODIFY I_COEP.
CLEAR : I_COEP.
ENDLOOP.
ENDIF.
ENDIF.
ELSE.
DELETE I_COEP WHERE OBJNR = I_WB-OBJNR.
loop at i_coep where objnr = i_wb-objnr.
i_coep-kvgr5 = 'OTH'.
modify i_coep.
clear : i_coep.
endloop.
ENDIF.
CLEAR : I_VBAKP, I_SECTOR, I_COEP.
ENDLOOP.
IF I_PR[] IS NOT INITIAL.
SELECT AOBJNR APSPHI B~ASTNR
FROM PRPS AS A INNER JOIN PROJ AS B
ON APSPHI = BPSPNR
INTO TABLE I_PRPS
FOR ALL ENTRIES IN I_PR
WHERE A~OBJNR = I_PR-OBJNR.
ENDIF.
IF I_NV[] IS NOT INITIAL.
SELECT OBJNR PROJN FROM AFVC INTO TABLE I_AFVC
FOR ALL ENTRIES IN I_NV
WHERE OBJNR = I_NV-OBJNR AND
PROJN <> '' .
LOOP AT I_AFVC.
CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
EXPORTING
INPUT = I_AFVC-PROJN
IMPORTING
OUTPUT = I_AFVC-PROJ
I_AFVC-PROJ = I_AFVC-PROJ+0(9).
CALL FUNCTION 'CONVERSION_EXIT_KONPD_INPUT'
EXPORTING
INPUT = I_AFVC-PROJ
IMPORTING
OUTPUT = I_AFVC-PSPNR.
MODIFY I_AFVC.
CLEAR : I_AFVC.
ENDLOOP.
SELECT PSPNR ASTNR FROM PROJ INTO TABLE I_PROJ
FOR ALL ENTRIES IN I_AFVC
WHERE PSPNR = I_AFVC-PSPNR.
LOOP AT I_NV.
I_PRPS-OBJNR = I_NV-OBJNR.
READ TABLE I_AFVC WITH KEY OBJNR = I_NV-OBJNR.
IF SY-SUBRC = 0.
READ TABLE I_PROJ WITH KEY PSPNR = I_AFVC-PSPNR.
IF SY-SUBRC = 0.
I_PRPS-ASTNR = I_PROJ-ASTNR.
ENDIF.
ENDIF.
APPEND I_PRPS.
I_PR-OBJNR = I_NV-OBJNR.
APPEND I_PR.
CLEAR : I_NV, I_AFVC, I_PROJ, I_PR.
ENDLOOP.
ENDIF.
SORT I_PRPS BY OBJNR.
LOOP AT I_PR.
READ TABLE I_PRPS WITH KEY OBJNR = I_PR-OBJNR.
IF SY-SUBRC = 0.
READ TABLE I_SECTOR WITH KEY KVGR5 = I_PRPS-ASTNR+5(3).
IF SY-SUBRC <> 0.
DELETE I_COEP WHERE OBJNR = I_PR-OBJNR.
loop at i_coep where objnr = i_pr-objnr.
i_coep-kvgr5 = 'OTH'.
modify i_coep.
clear : i_coep.
endloop.
ELSE.
READ TABLE I_COEP WITH KEY OBJNR = I_PR-OBJNR.
IF SY-SUBRC = 0.
CONCATENATE 'S' I_SECTOR-KVGR5+1(2) INTO I_COEP-KVGR5.
MODIFY I_COEP INDEX SY-TABIX.
LOOP AT I_COEP WHERE OBJNR = I_PR-OBJNR.
CONCATENATE 'S' I_SECTOR-KVGR5+1(2) INTO I_COEP-KVGR5.
MODIFY I_COEP.
CLEAR : I_COEP.
ENDLOOP.
ENDIF.
ENDIF.
ELSE.
DELETE I_COEP WHERE OBJNR = I_PR-OBJNR.
loop at i_coep where objnr = i_pr-objnr.
i_coep-kvgr5 = 'OTH'.
modify i_coep.
clear : i_coep.
endloop.
ENDIF.
CLEAR : I_PR, I_PRPS, I_SECTOR, I_COEP.
ENDLOOP.
ENDFORM. " VALIDATE_SECTOR
*& Form GROUP_OUTPUT
text
--> p1 text
<-- p2 text
FORM GROUP_OUTPUT .
LOOP AT I_COEP.
I_OUTPUT-KSTAR = I_COEP-KSTAR.
IF I_COEP-KVGR5 = 'S01'.
I_OUTPUT-S01 = I_COEP-WOGBTR.
ENDIF.
IF I_COEP-KVGR5 = 'S02'.
I_OUTPUT-S02 = I_COEP-WOGBTR.
ENDIF.
IF I_COEP-KVGR5 = 'S03'.
I_OUTPUT-S03 = I_COEP-WOGBTR.
ENDIF.
IF I_COEP-KVGR5 = 'S04'.
I_OUTPUT-S04 = I_COEP-WOGBTR.
ENDIF.
IF I_COEP-KVGR5 = 'S05'.
I_OUTPUT-S05 = I_COEP-WOGBTR.
ENDIF.
IF I_COEP-KVGR5 = 'S06'.
I_OUTPUT-S06 = I_COEP-WOGBTR.
ENDIF.
IF I_COEP-KVGR5 = 'S07'.
I_OUTPUT-S07 = I_COEP-WOGBTR.
ENDIF.
IF I_COEP-KVGR5 = 'S08'.
I_OUTPUT-S08 = I_COEP-WOGBTR.
ENDIF.
IF I_COEP-KVGR5 = 'S09'.
I_OUTPUT-S09 = I_COEP-WOGBTR.
ENDIF.
IF I_COEP-KVGR5 = 'OTH' OR I_COEP-KVGR5 = ''.
I_OUTPUT-OTH = I_COEP-WOGBTR.
ENDIF.
COLLECT I_OUTPUT.
CLEAR : I_COEP, I_OUTPUT.
ENDLOOP.
LOOP AT I_OUTPUT.
SELECT SINGLE MCTXT FROM CSKU
INTO I_OUTPUT-MCTXT
WHERE KTOPL = 'KBL' AND
SPRAS = SY-LANGU AND
KSTAR = I_OUTPUT-KSTAR.
I_OUTPUT-TOTAL = I_OUTPUT-S01 + I_OUTPUT-S02 + I_OUTPUT-S03
+ I_OUTPUT-S04 + I_OUTPUT-S05 + I_OUTPUT-S06
+ I_OUTPUT-S07 + I_OUTPUT-S08 + I_OUTPUT-S09
+ I_OUTPUT-OTH.
MODIFY I_OUTPUT.
CLEAR : I_OUTPUT.
ENDLOOP.
ENDFORM. " GROUP_OUTPUT
*& Form BUILD_CATLOG
text
--> p1 text
<-- p2 text
FORM BUILD_CATLOG .
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'KSTAR'.
k_fieldcat-seltext_l = text-002.
k_fieldcat-hotspot = 'X'.
APPEND k_fieldcat TO t_fieldcat_sum_rep.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'MCTXT'.
k_fieldcat-seltext_l = text-003.
k_fieldcat-hotspot = 'X'.
APPEND k_fieldcat TO t_fieldcat_sum_rep.
READ TABLE I_SECTOR WITH KEY KVGR5 = 'S01'.
IF SY-SUBRC = 0.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'S01'.
k_fieldcat-seltext_l = text-004.
k_fieldcat-hotspot = 'X'.
k_fieldcat-do_sum = 'X'. "Statement inserted by Sunil Maurya
APPEND k_fieldcat TO t_fieldcat_sum_rep.
ENDIF.
READ TABLE I_SECTOR WITH KEY KVGR5 = 'S02'.
IF SY-SUBRC = 0.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'S02'.
k_fieldcat-seltext_l = text-005.
k_fieldcat-hotspot = 'X'.
k_fieldcat-do_sum = 'X'. "Statement inserted by Sunil Maurya
APPEND k_fieldcat TO t_fieldcat_sum_rep.
ENDIF.
READ TABLE I_SECTOR WITH KEY KVGR5 = 'S03'.
IF SY-SUBRC = 0.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'S03'.
k_fieldcat-seltext_l = text-006.
k_fieldcat-hotspot = 'X'.
k_fieldcat-do_sum = 'X'. "Statement inserted by Sunil Maurya
APPEND k_fieldcat TO t_fieldcat_sum_rep.
ENDIF.
READ TABLE I_SECTOR WITH KEY KVGR5 = 'S04'.
IF SY-SUBRC = 0.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'S04'.
k_fieldcat-seltext_l = text-007.
k_fieldcat-hotspot = 'X'.
k_fieldcat-do_sum = 'X'. "Statement inserted by Sunil Maurya
APPEND k_fieldcat TO t_fieldcat_sum_rep.
ENDIF.
READ TABLE I_SECTOR WITH KEY KVGR5 = 'S05'.
IF SY-SUBRC = 0.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'S05'.
k_fieldcat-seltext_l = text-008.
k_fieldcat-hotspot = 'X'.
k_fieldcat-do_sum = 'X'. "Statement inserted by Sunil Maurya
APPEND k_fieldcat TO t_fieldcat_sum_rep.
ENDIF.
READ TABLE I_SECTOR WITH KEY KVGR5 = 'S06'.
IF SY-SUBRC = 0.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'S06'.
k_fieldcat-seltext_l = text-009.
k_fieldcat-hotspot = 'X'.
k_fieldcat-do_sum = 'X'. "Statement inserted by Sunil Maurya
APPEND k_fieldcat TO t_fieldcat_sum_rep.
ENDIF.
READ TABLE I_SECTOR WITH KEY KVGR5 = 'S07'.
IF SY-SUBRC = 0.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'S07'.
k_fieldcat-seltext_l = text-010.
k_fieldcat-hotspot = 'X'.
k_fieldcat-do_sum = 'X'. "Statement inserted by Sunil Maurya
APPEND k_fieldcat TO t_fieldcat_sum_rep.
ENDIF.
READ TABLE I_SECTOR WITH KEY KVGR5 = 'S08'.
IF SY-SUBRC = 0.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'S08'.
k_fieldcat-seltext_l = text-011.
k_fieldcat-hotspot = 'X'.
k_fieldcat-do_sum = 'X'. "Statement inserted by Sunil Maurya
APPEND k_fieldcat TO t_fieldcat_sum_rep.
ENDIF.
READ TABLE I_SECTOR WITH KEY KVGR5 = 'S09'.
IF SY-SUBRC = 0.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'S09'.
k_fieldcat-seltext_l = text-012.
k_fieldcat-hotspot = 'X'.
k_fieldcat-do_sum = 'X'. "Statement inserted by Sunil Maurya
APPEND k_fieldcat TO t_fieldcat_sum_rep.
ENDIF.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'OTH'.
k_fieldcat-seltext_l = text-019.
k_fieldcat-hotspot = 'X'.
k_fieldcat-do_sum = 'X'. "Statement inserted by Sunil Maurya
APPEND k_fieldcat TO t_fieldcat_sum_rep.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'TOTAL'.
k_fieldcat-seltext_l = text-020.
k_fieldcat-do_sum = 'X'. "Statement inserted by Sunil Maurya
APPEND k_fieldcat TO t_fieldcat_sum_rep.
*=======================================================================
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'BELNR'.
k_fieldcat-seltext_l = text-013.
APPEND k_fieldcat TO t_fieldcat_det_rep.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'BUZEI'.
k_fieldcat-seltext_l = text-014.
APPEND k_fieldcat TO t_fieldcat_det_rep.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'PERIO'.
k_fieldcat-seltext_l = text-015.
APPEND k_fieldcat TO t_fieldcat_det_rep.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'WOGBTR'.
k_fieldcat-seltext_l = text-016.
APPEND k_fieldcat TO t_fieldcat_det_rep.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'OBJNR'.
k_fieldcat-seltext_l = text-018.
APPEND k_fieldcat TO t_fieldcat_det_rep.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'KSTAR'.
k_fieldcat-seltext_l = text-002.
APPEND k_fieldcat TO t_fieldcat_det_rep.
CLEAR k_fieldcat.
k_fieldcat-fieldname = 'KVGR5'.
k_fieldcat-seltext_l = text-017.
APPEND k_fieldcat TO t_fieldcat_det_rep.
*==============================================================
Statements inserted by Sunil Maurya for sorting
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'KSTAR'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT1.
GS_SORT1-FIELDNAME = 'KSTAR'.
GS_SORT1-SPOS = 1.
GS_SORT1-UP = 'X'.
GS_SORT1-SUBTOT = 'X'.
APPEND GS_SORT1 TO GT_SORT1.
*CLEAR GS_SORT1.
*GS_SORT1-FIELDNAME = 'WOGBTR'.
*GS_SORT1-SPOS = 2.
*GS_SORT1-UP = 'X'.
*GS_SORT1-SUBTOT = 'X'.
*APPEND GS_SORT1 TO GT_SORT1.
FORM build_sortcat.
k_sortcat-spos = 1.
k_sortcat-fieldname = 'KSTAR'.
k_sortcat-up = 'X'.
k_sortcat-down = 'X'.
APPEND k_sortcat TO it_sortcat.
clear k_sortcat.
ENDFORM.
Statements inserted by Sunil Maurya for sorting
ENDFORM. " BUILD_CATLOG
*& Form DISPLAY_OUTPUT
text
--> p1 text
<-- p2 text
FORM DISPLAY_OUTPUT .
DATA l_repid TYPE syrepid.
l_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
it_fieldcat = t_fieldcat_sum_rep
i_callback_user_command = c_user_command
i_save = 'A'
it_sort = GT_SORT[] "Statements inserted by Sunil
TABLES
t_outtab = I_OUTPUT
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_OUTPUT
*& Form user_command
text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: l_repid TYPE syrepid.
l_repid = sy-repid.
CASE r_ucomm.
WHEN '&IC1'.
clear : i_detail. refresh : i_detail.
LOOP AT I_COEP WHERE KVGR5 = rs_selfield-fieldname.
MOVE i_coep to i_detail.
append i_detail.
clear : i_detail, i_coep.
endloop.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
it_fieldcat = t_fieldcat_det_rep
i_callback_user_command = c_user_command
i_save = 'A'
it_sort = GT_SORT1[] "Inserted by Sunil
TABLES
t_outtab = i_detail
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.
ENDCASE.
ENDFORM.Run the SE30 with internal tables, then examine the top lines.
see
SE30
The ABAP Runtime Trace (SE30) - Quick and Easy
Define you tables as sorted tables or use at least binary search, otherwise this sorts are useless
and the nested loop is slow.
SORT I_VBAKP BY OBJNR.
SORT I_COEP BY OBJNR.
LOOP AT I_WB.
READ TABLE I_VBAKP WITH KEY OBJNR = I_WB-OBJNR.
IF SY-SUBRC = 0.
READ TABLE I_SECTOR WITH KEY KVGR5 = I_VBAKP-KVGR5.
IF SY-SUBRC 0.
DELETE I_COEP WHERE OBJNR = I_WB-OBJNR.
loop at i_coep where objnr = i_wb-objnr.
i_coep-kvgr5 = 'OTH'.
modify i_coep.
clear : i_coep.
endloop.
ELSE.
READ TABLE I_COEP WITH KEY BELNR = I_WB-BELNR BUZEI = I_WB-BUZEI.
READ TABLE I_COEP WITH KEY OBJNR = I_WB-OBJNR.
IF SY-SUBRC = 0.
I_COEP-KVGR5 = I_SECTOR-KVGR5.
MODIFY I_COEP INDEX SY-TABIX.
LOOP AT I_COEP WHERE OBJNR = I_WB-OBJNR.
I_COEP-KVGR5 = I_SECTOR-KVGR5.
MODIFY I_COEP.
CLEAR : I_COEP.
ENDLOOP.
This is all very slow.
Read my blog on internal tables:
Measurements on internal tables: Reads and Loops:
Runtimes of Reads and Loops on Internal Tables
If you really wnat to identify all bugs, then try this
Z_SE30_COMPARE
A Tool to Compare Runtime Measurements: Z_SE30_COMPARE
Nonlinearity Check
Nonlinearity Check Using the Z_SE30_COMPARE
It needs at bit of experience but then it is very powerful!!!
That is also a waste of time, but not a nested loop. You sort and resort the same table,
but the sort is useless the deletes are still sequential on standard tables.
Put all the stuff into ONE loop on I_COEP.
SORT I_COEP BY OBJNR.
DELETE I_COEP WHERE OBJNR+0(2) <> 'VB' AND
OBJNR+0(2) <> 'PR' AND
OBJNR+0(2) <> 'NV' AND
OBJNR+0(2) <> 'NP' AND
OBJNR+0(2) <> 'AO'.
SORT I_COEP BY KSTAR.
DELETE I_COEP WHERE KSTAR+0(5) <> '00003' AND
KSTAR+0(5) <> '00004'.
LOOP AT I_COEP WHERE OBJNR+0(2) = 'NP'.
MOVE I_COEP TO I_NP.
APPEND I_NP.
CLEAR : I_NP, I_COEP.
ENDLOOP.
LOOP AT I_COEP WHERE OBJNR+0(2) = 'NV'.
MOVE I_COEP TO I_NV.
APPEND I_NV.
CLEAR : I_NV, I_COEP.
ENDLOOP.
LOOP AT I_COEP WHERE OBJNR+0(2) = 'VB' .
MOVE I_COEP TO I_WB.
APPEND I_WB.
CLEAR : I_WB, I_COEP.
ENDLOOP.
LOOP AT I_COEP WHERE OBJNR+0(2) = 'PR' .
MOVE I_COEP TO I_PR.
APPEND I_PR.
CLEAR : I_PR, I_COEP.
ENDLOOP.
There is probably more. BBut with the compare tool you can find everything.
Siegfried -
Need to be displayed in ALV grid
Dear All,
Below is my Program's code which is working accordingly. But in this code I am generating output as Basic list display. But I want my output to be displayed in ALV only. So from where I will start. Where to add code for Alv in my existing code. Can anybody help me out on the same.
Regards,
Abhay.
REPORT zfi_temp_rfkopr00
MESSAGE-ID FR
LINE-SIZE 132
NO STANDARD PAGE HEADING.
Report Name : Vendor Open Items Ageing Report
Purpose : This report displays the Vendor Open Items based on
different Ageing days (Calculated by taking the Base
Line date and the days mentioned in Payment Terms)
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: lfa1, " Vendor 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 Vendor Open Items Data
DATA: BEGIN OF int_bsik OCCURS 0,
lifnr LIKE bsik-lifnr, " Vendor Number
name1 LIKE lfa1-name1, " Vendor Name
shkzg LIKE bsik-shkzg, " Dr/Cr Indicator
belnr LIKE bsik-belnr, " Document Number
xblnr LIKE bsik-xblnr, " Ref Doc No
blart LIKE bsik-blart, " Document Type
zfbdt LIKE bsik-zfbdt, " Base Line Date
zbd1t LIKE bsik-zbd1t, " Due date1
zbd2t LIKE bsik-zbd2t, " Due Date2
zbd3t LIKE bsik-zbd3t, " Due Date3
waers LIKE bsik-waers, " Currency
dmbtr LIKE bsik-dmbtr, " Amount in Local Curr
END OF int_bsik.
Internal Table for Amounts Sum Up Data
DATA: BEGIN OF int_final OCCURS 0,
lifnr LIKE bsik-lifnr, " Vendor Number
name1 LIKE lfa1-name1, " Vendor Name
total1 LIKE bsik-dmbtr, " Amount in Local Curr
total2 LIKE bsik-dmbtr, " Amount in Local Curr
total3 LIKE bsik-dmbtr, " Amount in Local Curr
total4 LIKE bsik-dmbtr, " Amount in Local Curr
total5 LIKE bsik-dmbtr, " Amount in Local Curr
total6 LIKE bsik-dmbtr, " Amount in Local Curr
total LIKE bsik-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 bsik-dmbtr, " Amount Totals
v_gtotal2 LIKE bsik-dmbtr, " Amount Totals
v_gtotal3 LIKE bsik-dmbtr, " Amount Totals
v_gtotal4 LIKE bsik-dmbtr, " Amount Totals
v_gtotal5 LIKE bsik-dmbtr, " Amount Totals
v_gtotal6 LIKE bsik-dmbtr, " Amount Totals
v_gtotal LIKE bsik-dmbtr, " Amount Totals
v_subtotal1 LIKE bsik-dmbtr, " Amount Totals
v_subtotal2 LIKE bsik-dmbtr, " Amount Totals
v_subtotal3 LIKE bsik-dmbtr, " Amount Totals
v_subtotal4 LIKE bsik-dmbtr, " Amount Totals
v_subtotal5 LIKE bsik-dmbtr, " Amount Totals
v_subtotal6 LIKE bsik-dmbtr, " Amount Totals
v_subtotal LIKE bsik-dmbtr, " Amount Totals
v_date LIKE bsik-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 bsik-zfbdt, " Date Range 1
r_date2 FOR bsik-zfbdt, " Date Range 2
r_date3 FOR bsik-zfbdt, " Date Range 3
r_date4 FOR bsik-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_lifnr FOR lfa1-lifnr. "Vendor 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 Vendor Code
CLEAR lfa1-lifnr.
SELECT lifnr UP TO 1 ROWS
INTO lfa1-lifnr
FROM lfa1
WHERE lifnr IN s_lifnr AND
spras = sy-langu.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Invalid Vendor 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 Vendor Open Items data from BSIK
SELECT l~lifnr
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_bsik
FROM lfb1 AS l INNER JOIN lfa1 AS l1
ON llifnr = l1lifnr
INNER JOIN bsik AS b
ON llifnr = blifnr AND
lbukrs = bbukrs
WHERE l~lifnr IN s_lifnr 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_bsik WHERE
( blart NE 'RE' AND blart NE 'KR' ) OR
shkzg NE 'H'.
SORT int_bsik BY lifnr.
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 Vendor 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) 'Vendor#'(015) CENTERED,
13 sy-vline ,14(35) 'Vendor 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_bsik.
CLEAR v_date.
IF int_bsik-zbd3t <> ' '.
v_date = int_bsik-zfbdt + int_bsik-zbd3t.
ELSE.
IF int_bsik-zbd2t <> ' '.
v_date = int_bsik-zfbdt + int_bsik-zbd2t.
ELSE.
v_date = int_bsik-zfbdt + int_bsik-zbd1t.
ENDIF.
ENDIF.
IF int_bsik-zbd1t = ' '.
v_date = int_bsik-zfbdt.
ENDIF.
IF v_date IN r_date1.
int_final-total1 = int_final-total1 + int_bsik-dmbtr.
ELSEIF v_date IN r_date2.
int_final-total2 = int_final-total2 + int_bsik-dmbtr.
ELSEIF v_date IN r_date3.
int_final-total3 = int_final-total3 + int_bsik-dmbtr.
ELSEIF v_date IN r_date4.
int_final-total4 = int_final-total4 + int_bsik-dmbtr.
ELSEIF v_date > r_date4-high.
int_final-total5 = int_final-total5 + int_bsik-dmbtr.
ELSEIF v_date < p_allgst.
int_final-total6 = int_final-total6 + int_bsik-dmbtr.
ENDIF.
AT END OF lifnr.
v_flag = 1.
ENDAT.
IF v_flag = 1.
int_final-lifnr = int_bsik-lifnr.
int_final-name1 = int_bsik-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-lifnr 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_bsik-waers,
66 sy-vline,
67 int_final-total2 CURRENCY int_bsik-waers,
83 sy-vline,
84 int_final-total3 CURRENCY int_bsik-waers,
100 sy-vline,
101 int_final-total4 CURRENCY int_bsik-waers,
117 sy-vline,
118 int_final-total5 CURRENCY int_bsik-waers,
134 sy-vline,
135 int_final-total6 CURRENCY int_bsik-waers,
151 sy-vline,
152 int_final-total CURRENCY int_bsik-waers,
168 sy-vline.
ELSE.
WRITE : 50 int_final-total1 CURRENCY int_bsik-waers,
66 sy-vline,
67 int_final-total2 CURRENCY int_bsik-waers,
83 sy-vline,
84 int_final-total3 CURRENCY int_bsik-waers,
100 sy-vline,
101 int_final-total4 CURRENCY int_bsik-waers,
117 sy-vline,
118 int_final-total5 CURRENCY int_bsik-waers,
134 sy-vline,
135 int_final-total6 CURRENCY int_bsik-waers,
151 sy-vline,
152 int_final-total CURRENCY int_bsik-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_bsik-waers,
66 sy-vline, 67 v_gtotal2 CURRENCY int_bsik-waers,
83 sy-vline, 84 v_gtotal3 CURRENCY int_bsik-waers,
100 sy-vline,101 v_gtotal4 CURRENCY int_bsik-waers,
117 sy-vline,118 v_gtotal5 CURRENCY int_bsik-waers,
134 sy-vline,135 v_gtotal6 CURRENCY int_bsik-waers,
151 sy-vline,152 v_gtotal CURRENCY int_bsik-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_bsik BY belnr zfbdt.
LOOP AT int_bsik WHERE lifnr EQ int_final-lifnr.
v_rem = v_cnt MOD 2.
CLEAR v_date.
IF int_bsik-zbd3t <> ' '.
v_date = int_bsik-zfbdt + int_bsik-zbd3t.
ELSE.
IF int_bsik-zbd2t <> ' '.
v_date = int_bsik-zfbdt + int_bsik-zbd2t.
ELSE.
v_date = int_bsik-zfbdt + int_bsik-zbd1t.
ENDIF.
ENDIF.
IF int_bsik-zbd1t = ' '.
v_date = int_bsik-zfbdt.
ENDIF.
IF v_rem NE 0.
FORMAT COLOR 2 INTENSIFIED.
WRITE :/1 sy-vline, 2 int_bsik-belnr,
12 sy-vline,13 int_bsik-lifnr,
23 sy-vline,24 int_bsik-name1,
59 sy-vline,60 int_bsik-xblnr,
76 sy-vline,77 int_bsik-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_bsik-dmbtr CURRENCY int_bsik-waers,
206 sy-vline.
IF v_date IN r_date1.
v_subtotal1 = v_subtotal1 + int_bsik-dmbtr.
WRITE : 88 int_bsik-dmbtr CURRENCY int_bsik-waers.
ELSEIF v_date IN r_date2.
v_subtotal2 = v_subtotal2 + int_bsik-dmbtr.
WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
ELSEIF v_date IN r_date3.
v_subtotal3 = v_subtotal3 + int_bsik-dmbtr.
WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
ELSEIF v_date IN r_date4.
v_subtotal4 = v_subtotal4 + int_bsik-dmbtr.
WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
ELSEIF v_date > r_date4-high.
v_subtotal5 = v_subtotal5 + int_bsik-dmbtr.
WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
ELSEIF v_date < p_allgst.
v_subtotal6 = v_subtotal6 + int_bsik-dmbtr.
WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-waers.
ENDIF.
FORMAT COLOR OFF.
ELSE.
WRITE :/1 sy-vline, 2 int_bsik-belnr,
12 sy-vline,13 int_bsik-lifnr,
23 sy-vline,24 int_bsik-name1,
59 sy-vline,60 int_bsik-xblnr,
76 sy-vline,77 int_bsik-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_bsik-dmbtr CURRENCY int_bsik-waers,
206 sy-vline.
IF v_date IN r_date1.
v_subtotal1 = v_subtotal1 + int_bsik-dmbtr.
WRITE : 88 int_bsik-dmbtr CURRENCY int_bsik-waers.
ELSEIF v_date IN r_date2.
v_subtotal2 = v_subtotal2 + int_bsik-dmbtr.
WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
ELSEIF v_date IN r_date3.
v_subtotal3 = v_subtotal3 + int_bsik-dmbtr.
WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
ELSEIF v_date IN r_date4.
v_subtotal4 = v_subtotal4 + int_bsik-dmbtr.
WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
ELSEIF v_date > r_date4-high.
v_subtotal5 = v_subtotal5 + int_bsik-dmbtr.
WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
ELSEIF v_date < p_allgst.
v_subtotal6 = v_subtotal6 + int_bsik-dmbtr.
WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-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_bsik-waers ,
87 sy-vline,
88 v_subtotal1 CURRENCY int_bsik-waers,
104 sy-vline,
105 v_subtotal2 CURRENCY int_bsik-waers,
121 sy-vline,
122 v_subtotal3 CURRENCY int_bsik-waers,
138 sy-vline,
139 v_subtotal4 CURRENCY int_bsik-waers,
155 sy-vline,
156 v_subtotal5 CURRENCY int_bsik-waers,
172 sy-vline,
173 v_subtotal6 CURRENCY int_bsik-waers,
189 sy-vline,
190 v_subtotal CURRENCY int_bsik-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 Vendor 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) 'Vendor#'(015) CENTERED,
23 sy-vline, 24(35) 'Vendor 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. " header1Hi Abhay,
After moving the whole data into final internal table, pass that internal table to function module REUSE_ALV_GRID_DISPLAY.
before that you need to build field catalog and have to build layout with all the required columns.
Go through the below links for your reference.
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV? http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV? http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV? http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
Check this for basic concepts of OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
Tabstrip
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
Editable ALV
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
Tree
http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
General Tutorial for OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
http://www.sap-img.com/abap/what-is-alv-programming.htm
http://www.sap-img.com/abap-function.htm
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm
http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf
http://www.sap-img.com/abap-function.htm
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
This helps us to implement all the features mentioned very effectively.
Using ALV, We can have three types of reports:
1. Simple Report
2. Block Report
3. Hierarchical Sequential Report
There are some function modules which will enable to produce the above reports without much effort.
All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
1. SIMPLE REPORT.
The important function modules are
a. Reuse_alv_list_display
b. Reuse_alv_fieldcatalog_merge
c. Reuse_alv_events_get
d. Reuse_alv_commentary_write
e. Reuse_alv_grid_display
A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
The important parameters are :
I. Export :
i. I_callback_program : report id
ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
iii. I_callback_user_command : routine where the function codes are handled
iv. I_structure name : name of the dictionary table
v. Is_layout : structure to set the layout of the report
vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
II. Tables :
i. t_outtab : internal table with the data to be output
B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
The Important Parameters are :
I. Export :
i. I_program_name : report id
ii. I_internal_tabname : the internal output table
iii. I_inclname : include or the report name where all the dynamic forms are handled.
II Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
declared in the type pool SLIS.
C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
Parameters :
I. Import :
Et_Events : The event table is returned with all possible CALLBACK events
for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
II. Export :
I_List_type :
0 = simple list REUSE_ALV_LIST_DISPLAY
1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
3 = hierarchical-sequential block list
REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
Parameters :
I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
This internal table has three fields :
Typ : H header, S selection , A - action
Key : only when typ is S.
Info : the text to be printed
E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
Parameters : same as reuse_alv_list_display
This is an example for simple list.
2. BLOCK REPORT
This is used to have multiple lists continuously.
The important functions used in this report are:
A. REUSE_ALV_BLOCK_LIST_INIT
B. REUSE_ALV_BLOCK_LIST_APPEND
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_BLOCK_LIST_DISPLAY
A. REUSE_ALV_BLOCK_LIST_INIT
Parameters:
I. I_CALLBACK_PROGRAM
II. I_CALLBACK_PF_STATUS_SET
III. I_CALLBACK_USER_COMMAND
This function module is used to set the default gui status etc.
B. REUSE_ALV_BLOCK_LIST_APPEND
Parameters :
Export :
I. is_layout : layout settings for block
II. it_fieldcat : field catalog
III. i_tabname : internal table name with output data
IV. it_events : internal table with all possible events
Tables :
i. t_outtab : internal table with output data.
This function module adds the data to the block.
Repeat this function for all the different blocks to be displayed one after the other.
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
This function module is used for hierarchical sequential blocks.
D. REUSE_ALV_BLOCK_LIST_DISPLAY
Parameters : All the parameters are optional.
This function module display the list with data appended by the above function.
Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
3. Hierarchical reports :
Hierarchical sequential list output.
The function module is
A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
Parameters:
I. Export:
i. I_CALLBACK_PROGRAM
ii. I_CALLBACK_PF_STATUS_SET
iii. I_CALLBACK_USER_COMMAND
iv. IS_LAYOUT
v. IT_FIELDCAT
vi. IT_EVENTS
vii. i_tabname_header : Name of the internal table in the program containing the
output data of the highest hierarchy level.
viii. i_tabname_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
ix. is_keyinfo : This structure contains the header and item table field
names which link the two tables (shared key).
II. Tables
i. t_outtab_header : Header table with data to be output
ii. t_outtab_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using REUSE_ALV_FIELDCATALOG_MERGE.
Important Attributes :
A. col_pos : position of the column
B. fieldname : internal fieldname
C. tabname : internal table name
D. ref_fieldname : fieldname (dictionary)
E. ref_tabname : table (dictionary)
F. key(1) : column with key-color
G. icon(1) : icon
H. symbol(1) : symbol
I. checkbox(1) : checkbox
J. just(1) : (R)ight (L)eft (C)ent.
K. do_sum(1) : sum up
L. no_out(1) : (O)blig.(X)no out
M. outputlen : output length
N. seltext_l : long key word
O. seltext_m : middle key word
P. seltext_s : short key word
Q. reptext_ddic : heading (ddic)
R. ddictxt(1) : (S)hort (M)iddle (L)ong
S. datatype : datatype
T. hotspot(1) : hotspot
<b>Reward points for helpful answers,</b>
Satish
Maybe you are looking for
-
10.5.6 update has apparently caused all MS Office apps to fail to launch
Installed 10.5.6 update last week. First time I attempted to use Word afterwards it failed to launch. None of the MS Office 2003 apps will launch now. Other apps seem OK. I've shut down and re-started but still same problem. Using PowerBook G4 with 2
-
I need a script that can save images in whatever directory they reside in
I am working on a project where I have over 1500 directories that have multiple .TIF images in each one. I am looking for a solution where I can run a script (which may or may not call on actions) that allows me to save each .TIF as a .PSD and again
-
Getting the dashboard prompt value
Hello, I there a way on how can i get the dashboard prompt value when using other operators beside equal/is in. It seems that you can only set a presentation variable using the equal/is in operator. Also how can i get prompt value when using multi-se
-
SWE_EVENT_CREATE
Hi all i want details of using the function module SWE_EVENT_CREATE to trigger event . Points will be rewarded if info is useful -David Boon
-
Update lässt sich nicht installieren
Das Update der Firmawre für Flash-Storage 1.0 lässt sich nicht installieren. Ich sag Update JA > Neustart > Jetzt neu starten JA Nach dem Reboot sagt mir der AppStore das ein Update verfügbar ist. Und das ganze hab ich jetzt schon 10 mal gemacht. Wa