2007 Jun 28 10:52 AM
hi can any body tell me shy my program is not working.urgent plz...
&----
*& Report Z_PM_MAINTANANCE_ORDERS
*&
&----
*&
*&
&----
REPORT Z_PM_MAINTANANCE_ORDERS
no standard page heading
line-count 20
line-size 130.
type-pools: slis.
*message-id 00
----
*Author: kiran kumar
*Creation Date: 28/06/2007
*Description:
*This is an alv Report program to show material planning for maintanance orders.
&----
*& definition of tables
&----
tables:caufv,
resb,
rsdb.
&----
*& definition of select-options,ranges
&----
selection-screen begin of block s_blk1 with frame title text-001.
select-options:s_aufnr for caufv-aufnr ,
s_sowrk for caufv-sowrk,
s_auart for caufv-auart,
s_gstrp for caufv-gstrp.
selection-screen end of block s_blk1 .
&----
*& data definition of types/structures
&----
types:begin of ty_caufv,
aufnr like caufv-aufnr,
sowrk like caufv-sowrk,
auart like caufv-auart,
gstrp like caufv-gstrp,
rsnum like caufv-rsnum,
end of ty_caufv.
types:begin of ty_resb,
matnr like resb-matnr,
bdmng like resb-bdmng,
meins like resb-meins,
end of ty_resb.
types:begin of ty_rsdb,
banfn like rsdb-banfn,
bnfpo like rsdb-bnfpo,
end of ty_rsdb.
&----
*& data definition of internal tables
&----
data:i_itab_caufv type table of ty_caufv with header line,
i_itab_resb type table of ty_resb with header line,
i_itab_rsdb type table of ty_rsdb with header line.
&----
*& internal tables declaration for grid display
&----
data:it_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv,
it_list type slis_t_listheader,
wa_list type slis_listheader.
&----
*& initialisaiton
&----
initialization.
&----
*& at selection-screen
&----
at selection-screen.
&----
*& start-of-selection
&----
select aufnr
sowrk
auart
gstrp
rsnum from caufv into table i_itab_caufv
where aufnr in s_aufnr
and sowrk in s_sowrk
and auart in s_auart
and gstrp in s_gstrp.
select matnr
bdmng
meins from resb into table i_itab_resb
for all entries in i_itab_caufv
where rsnum = i_itab_caufv-rsnum.
select banfn
bnfpo from rsdb into table i_itab_rsdb
for all entries in i_itab_caufv
where rsnum = i_itab_caufv-rsnum.
&----
*& display of data
&----
wa_fieldcat-fieldname = 'aufnr'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'order number'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'sowrk'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'plant'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'auart'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'order type'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'gstrp'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'basic start date'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'rsnum'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'reservation number'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'matnr'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'material number'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'bdmng'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'requirement quantity'.
wa_fieldcat-outputlen = 10.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'meins'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'unit of measure'.
wa_fieldcat-outputlen = 10.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'banfn'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'purcahse requisition number'.
wa_fieldcat-outputlen = 15.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'bnfpo'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'requisition.item number'.
wa_fieldcat-outputlen = 15.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'sy-repid'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_itab_resb
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.
urgent plz andpoints will be rewarded.
2007 Jun 28 10:59 AM
HI.
You have tree internal table.two have values.transfer all record to one internal table if both have any comman filed .Give export and import parament to Functional module.
refer this code.
*data definition
tables:
marav. "Table MARA and table MAKT
----
Data to be displayed in ALV
Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
matically determine the fieldstructure from this source program
Data:
begin of imat occurs 100,
matnr like marav-matnr, "Material number
maktx like marav-maktx, "Material short text
matkl like marav-matkl, "Material group (so you can test to make
" intermediate sums)
ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
"make sums)
gewei like marav-gewei, "weight unit (just to be complete)
end of imat.
----
Other data needed
field to store report name
data i_repid like sy-repid.
field to check table length
data i_lines like sy-tabix.
----
Data for ALV display
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
----
select-options:
s_matnr for marav-matnr matchcode object MAT1.
----
start-of-selection.
read data into table imat
select * from marav
into corresponding fields of table imat
where
matnr in s_matnr.
Check if material was found
clear i_lines.
describe table imat lines i_lines.
if i_lines lt 1.
Using hardcoded write here for easy upload
write: /
'No materials found.'.
exit.
endif.
end-of-selection.
----
*
Now, we start with ALV
*
----
*
*
To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
The fieldcatalouge can be generated by FUNCTION
'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
report source, including this report.
The only problem one might have is that the report and table names
need to be in capital letters. (I had it )
*
*
----
Store report name
i_repid = sy-repid.
Create Fieldcatalogue from internal table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'IMAT' "capital letters!
I_INCLNAME = i_repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
*explanations:
I_PROGRAM_NAME is the program which calls this function
*
I_INTERNAL_TABNAME is the name of the internal table which you want
to display in ALV
*
I_INCLNAME is the ABAP-source where the internal table is defined
(DATA....)
CT_FIELDCAT contains the Fieldcatalouge that we need later for
ALV display
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
*This was the fieldcatlogue
----
*
And now, we are ready to display our list
Call for ALV list display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
I_CALLBACK_PROGRAM = i_repid
IT_FIELDCAT = int_fcat
I_SAVE = 'A'
TABLES
T_OUTTAB = imat
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*
*explanations:
I_CALLBACK_PROGRAM is the program which calls this function
*
IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains
now the data definition needed for display
*
I_SAVE allows the user to save his own layouts
*
T_OUTTAB contains the data to be displayed in ALV
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.
*
----
*
yes, it is that simple. Go ahead and try yourself!
*
----
Reward all helpfull answers.
Regards.
Jay
hi can any body tell me shy my program is not working.urgent plz...
&----
*& Report Z_PM_MAINTANANCE_ORDERS
*&
&----
*&
*&
&----
REPORT Z_PM_MAINTANANCE_ORDERS
no standard page heading
line-count 20
line-size 130.
type-pools: slis.
*message-id 00
----
*Author: kiran kumar
*Creation Date: 28/06/2007
*Description:
*This is an alv Report program to show material planning for maintanance orders.
&----
*& definition of tables
&----
tables:caufv,
resb,
rsdb.
&----
*& definition of select-options,ranges
&----
selection-screen begin of block s_blk1 with frame title text-001.
select-options:s_aufnr for caufv-aufnr ,
s_sowrk for caufv-sowrk,
s_auart for caufv-auart,
s_gstrp for caufv-gstrp.
selection-screen end of block s_blk1 .
&----
*& data definition of types/structures
&----
types:begin of ty_caufv,
aufnr like caufv-aufnr,
sowrk like caufv-sowrk,
auart like caufv-auart,
gstrp like caufv-gstrp,
rsnum like caufv-rsnum,
end of ty_caufv.
types:begin of ty_resb,
matnr like resb-matnr,
bdmng like resb-bdmng,
meins like resb-meins,
end of ty_resb.
types:begin of ty_rsdb,
banfn like rsdb-banfn,
bnfpo like rsdb-bnfpo,
end of ty_rsdb.
&----
*& data definition of internal tables
&----
data:i_itab_caufv type table of ty_caufv with header line,
i_itab_resb type table of ty_resb with header line,
i_itab_rsdb type table of ty_rsdb with header line.
&----
*& internal tables declaration for grid display
&----
data:it_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv,
it_list type slis_t_listheader,
wa_list type slis_listheader.
&----
*& initialisaiton
&----
initialization.
&----
*& at selection-screen
&----
at selection-screen.
&----
*& start-of-selection
&----
select aufnr
sowrk
auart
gstrp
rsnum from caufv into table i_itab_caufv
where aufnr in s_aufnr
and sowrk in s_sowrk
and auart in s_auart
and gstrp in s_gstrp.
select matnr
bdmng
meins from resb into table i_itab_resb
for all entries in i_itab_caufv
where rsnum = i_itab_caufv-rsnum.
select banfn
bnfpo from rsdb into table i_itab_rsdb
for all entries in i_itab_caufv
where rsnum = i_itab_caufv-rsnum.
&----
*& display of data
&----
wa_fieldcat-fieldname = 'aufnr'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'order number'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'sowrk'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'plant'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'auart'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'order type'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'gstrp'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'basic start date'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'rsnum'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'reservation number'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'matnr'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'material number'.
wa_fieldcat-outputlen = 8.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'bdmng'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'requirement quantity'.
wa_fieldcat-outputlen = 10.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'meins'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'unit of measure'.
wa_fieldcat-outputlen = 10.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'banfn'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'purcahse requisition number'.
wa_fieldcat-outputlen = 15.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'bnfpo'.
wa_fieldcat-tabname = ''.
wa_fieldcat-seltext_l = 'requisition.item number'.
wa_fieldcat-outputlen = 15.
APPEND wa_fieldcat TO it_fieldcat.
clear wa_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'sy-repid'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_itab_resb
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.
urgent plz andpoints will be rewarded.
2007 Jun 28 10:59 AM
HI.
You have tree internal table.two have values.transfer all record to one internal table if both have any comman filed .Give export and import parament to Functional module.
refer this code.
*data definition
tables:
marav. "Table MARA and table MAKT
----
Data to be displayed in ALV
Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
matically determine the fieldstructure from this source program
Data:
begin of imat occurs 100,
matnr like marav-matnr, "Material number
maktx like marav-maktx, "Material short text
matkl like marav-matkl, "Material group (so you can test to make
" intermediate sums)
ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
"make sums)
gewei like marav-gewei, "weight unit (just to be complete)
end of imat.
----
Other data needed
field to store report name
data i_repid like sy-repid.
field to check table length
data i_lines like sy-tabix.
----
Data for ALV display
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
----
select-options:
s_matnr for marav-matnr matchcode object MAT1.
----
start-of-selection.
read data into table imat
select * from marav
into corresponding fields of table imat
where
matnr in s_matnr.
Check if material was found
clear i_lines.
describe table imat lines i_lines.
if i_lines lt 1.
Using hardcoded write here for easy upload
write: /
'No materials found.'.
exit.
endif.
end-of-selection.
----
*
Now, we start with ALV
*
----
*
*
To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
The fieldcatalouge can be generated by FUNCTION
'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
report source, including this report.
The only problem one might have is that the report and table names
need to be in capital letters. (I had it )
*
*
----
Store report name
i_repid = sy-repid.
Create Fieldcatalogue from internal table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'IMAT' "capital letters!
I_INCLNAME = i_repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
*explanations:
I_PROGRAM_NAME is the program which calls this function
*
I_INTERNAL_TABNAME is the name of the internal table which you want
to display in ALV
*
I_INCLNAME is the ABAP-source where the internal table is defined
(DATA....)
CT_FIELDCAT contains the Fieldcatalouge that we need later for
ALV display
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
*This was the fieldcatlogue
----
*
And now, we are ready to display our list
Call for ALV list display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
I_CALLBACK_PROGRAM = i_repid
IT_FIELDCAT = int_fcat
I_SAVE = 'A'
TABLES
T_OUTTAB = imat
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*
*explanations:
I_CALLBACK_PROGRAM is the program which calls this function
*
IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains
now the data definition needed for display
*
I_SAVE allows the user to save his own layouts
*
T_OUTTAB contains the data to be displayed in ALV
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.
*
----
*
yes, it is that simple. Go ahead and try yourself!
*
----
Reward all helpfull answers.
Regards.
Jay
2007 Jun 28 10:59 AM
HI.
You have tree internal table.two have values.transfer all record to one internal table if both have any comman filed .Give export and import parament to Functional module.
refer this code.
*data definition
tables:
marav. "Table MARA and table MAKT
----
Data to be displayed in ALV
Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
matically determine the fieldstructure from this source program
Data:
begin of imat occurs 100,
matnr like marav-matnr, "Material number
maktx like marav-maktx, "Material short text
matkl like marav-matkl, "Material group (so you can test to make
" intermediate sums)
ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
"make sums)
gewei like marav-gewei, "weight unit (just to be complete)
end of imat.
----
Other data needed
field to store report name
data i_repid like sy-repid.
field to check table length
data i_lines like sy-tabix.
----
Data for ALV display
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
----
select-options:
s_matnr for marav-matnr matchcode object MAT1.
----
start-of-selection.
read data into table imat
select * from marav
into corresponding fields of table imat
where
matnr in s_matnr.
Check if material was found
clear i_lines.
describe table imat lines i_lines.
if i_lines lt 1.
Using hardcoded write here for easy upload
write: /
'No materials found.'.
exit.
endif.
end-of-selection.
----
*
Now, we start with ALV
*
----
*
*
To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
The fieldcatalouge can be generated by FUNCTION
'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
report source, including this report.
The only problem one might have is that the report and table names
need to be in capital letters. (I had it )
*
*
----
Store report name
i_repid = sy-repid.
Create Fieldcatalogue from internal table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'IMAT' "capital letters!
I_INCLNAME = i_repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
*explanations:
I_PROGRAM_NAME is the program which calls this function
*
I_INTERNAL_TABNAME is the name of the internal table which you want
to display in ALV
*
I_INCLNAME is the ABAP-source where the internal table is defined
(DATA....)
CT_FIELDCAT contains the Fieldcatalouge that we need later for
ALV display
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
*This was the fieldcatlogue
----
*
And now, we are ready to display our list
Call for ALV list display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
I_CALLBACK_PROGRAM = i_repid
IT_FIELDCAT = int_fcat
I_SAVE = 'A'
TABLES
T_OUTTAB = imat
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*
*explanations:
I_CALLBACK_PROGRAM is the program which calls this function
*
IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains
now the data definition needed for display
*
I_SAVE allows the user to save his own layouts
*
T_OUTTAB contains the data to be displayed in ALV
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.
*
----
*
yes, it is that simple. Go ahead and try yourself!
*
----
Reward all helpfull answers.
Regards.
Jay
2007 Jun 28 11:02 AM
hi kiran,
try this
while calling the FM REUSE_ALV_GRID_DISPLAY
pass the parameter I_CALLBACK_PROGRAM = g_repid where g_repid type sy-repid without quotes.
if helpful reward points .
2007 Jun 28 11:17 AM
1) you have three int table but you are passing only i_itab_resb which has only three fields but you are buiding the fieldcat for more fields . So you have to take all the data in a final itab and have to pass that one to reuse alv grid display .
2) in the fn module you are passing I_CALLBACK_PROGRAM = 'sy-repid' but it should be I_CALLBACK_PROGRAM = sy-repid i.e. without qoute..
3)in field cat you are passing the field name like wa_fieldcat-fieldname = 'banfn'. but it should be wa_fieldcat-fieldname = 'BANFN'. i.e. in CAPS.
after trying those pls let us know whether you are getting the output or not?
regards
shiba dutta
2007 Jun 28 11:27 AM
HI ,
THIS MIGHT HEALP YOU OUT
&----
*& Report YMP_ALV_BLOCK *
*& *
&----
*& *
*& *
&----
REPORT YMP_ALV_BLOCK .
--
TABLES : VBAK.
TYPE-POOLS : SLIS,ICON.
SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN.
--
TYPES : BEGIN OF TY_VBAK,
VBELN TYPE VBELN_VA,
ERDAT TYPE ERDAT,
ERZET TYPE ERZET,
ERNAM TYPE ERNAM,
ANY(4) TYPE C,
END OF TY_VBAK.
TYPES : BEGIN OF TY_VBAP,
VBELN TYPE VBELN_VA,
POSNR TYPE POSNR_VA,
MATNR TYPE MATNR,
MATWA TYPE MATWA,
END OF TY_VBAP.
TYPES : TT_VBAK TYPE STANDARD TABLE OF TY_VBAK,
TT_VBAP TYPE STANDARD TABLE OF TY_VBAP.
DATA : IT_VBAK TYPE TT_VBAK WITH HEADER LINE,
IT_VBAP TYPE TT_VBAP WITH HEADER LINE.
DATA : FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
FCAT1 TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
LAYOUT TYPE SLIS_LAYOUT_ALV,
LAYOUT1 TYPE SLIS_LAYOUT_ALV,
EVENTS TYPE SLIS_T_EVENT.
--
SELECT VBELN
ERDAT
ERZET
ERNAM
FROM VBAK
INTO TABLE IT_VBAK
WHERE VBELN IN S_VBELN.
IF IT_VBAK IS NOT INITIAL.
SELECT VBELN
POSNR
MATNR
MATWA
FROM VBAP
INTO TABLE IT_VBAP
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN EQ IT_VBAK-VBELN.
ENDIF.
--
FCAT-COL_POS = '1'.
FCAT-FIELDNAME = 'VBELN'.
FCAT-TABNAME = 'IT_VBAK'.
FCAT-OUTPUTLEN = '20'.
FCAT-SELTEXT_L = 'SALES DOCUMENT'.
FCAT-EMPHASIZE = 'C310'.
APPEND FCAT.
CLEAR FCAT.
FCAT-COL_POS = '2'.
FCAT-FIELDNAME = 'ERDAT'.
FCAT-TABNAME = 'IT_VBAK'.
FCAT-OUTPUTLEN = '20'.
FCAT-SELTEXT_L = 'DATE OF ENTRY'.
FCAT-EMPHASIZE = 'C410'.
APPEND FCAT.
CLEAR FCAT.
FCAT-COL_POS = '3'.
FCAT-FIELDNAME = 'EZETR'.
FCAT-TABNAME = 'IT_VBAK'.
FCAT-OUTPUTLEN = '20'.
FCAT-SELTEXT_L = 'TIME OF ENTRY'.
FCAT-EMPHASIZE = 'C510'.
APPEND FCAT.
CLEAR FCAT.
FCAT-COL_POS = '4'.
FCAT-FIELDNAME = 'ERNAM'.
FCAT-TABNAME = 'IT_VBAK'.
FCAT-OUTPUTLEN = '20'.
FCAT-SELTEXT_L = 'NAME OF ENTRY'.
FCAT-EMPHASIZE = 'C610'.
APPEND FCAT.
CLEAR FCAT.
FCAT1-COL_POS = '1'.
FCAT1-FIELDNAME = 'VBELN'.
FCAT1-TABNAME = 'IT_VBAP'.
FCAT1-OUTPUTLEN = '20'.
FCAT1-SELTEXT_L = 'SALES DOCUMENT'.
APPEND FCAT1.
CLEAR FCAT1.
FCAT1-COL_POS = '2'.
FCAT1-FIELDNAME = 'POSNR'.
FCAT1-TABNAME = 'IT_VBAP'.
FCAT1-OUTPUTLEN = '20'.
FCAT1-SELTEXT_L = 'ITEM DOCUMENT'.
APPEND FCAT1.
CLEAR FCAT1.
FCAT1-COL_POS = '3'.
FCAT1-FIELDNAME = 'MATNR'.
FCAT1-TABNAME = 'IT_VBAP'.
FCAT1-OUTPUTLEN = '20'.
FCAT1-SELTEXT_L = 'MATERIAL NUMBER'.
APPEND FCAT1.
CLEAR FCAT1.
FCAT1-COL_POS = '4'.
FCAT1-FIELDNAME = 'MATWA'.
FCAT1-TABNAME = 'IT_VBAP'.
FCAT1-OUTPUTLEN = '20'.
FCAT1-SELTEXT_L = 'MATERIAL NAME'.
APPEND FCAT1.
CLEAR FCAT1.
--
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = SY-CPROG.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = LAYOUT
it_fieldcat = FCAT[]
i_tabname = 'IT_VBAK'
it_events = EVENTS
tables
t_outtab = IT_VBAK
.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = LAYOUT1
it_fieldcat = FCAT1[]
i_tabname = 'IT_VBAP'
it_events = EVENTS
tables
t_outtab = IT_VBAP
.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |