2008 Jan 09 3:13 AM
Hi guys I have created the following small classical report, can you please help me how can I change this report of mine into ALV format.
Thanks,
Rajeev
2008 Jan 09 3:19 AM
Hi guys I have created the following small classical report, can you please help me how can I change this report of mine into ALV format.
Thanks,
Rajeev
2008 Jan 09 3:19 AM
2008 Jan 09 3:23 AM
I am sorry Chandu I forget to paste the code:
&----
*& Report ZTEST_REPORT *
*& *
&----
*& *
*& *
&----
REPORT ZTEST_REPORT .
Data: begin of it_mara occurs 0,
matnr like mara-matnr,
mtart like mara-matkl ,
end of it_mara.
Data: begin of it_marc occurs 0,
matnr like marc-matnr,
mmsta like marc-mmsta,
werks like marc-werks,
end of it_marc.
select matnr matkl into table it_mara
from mara
where matkl eq '001'.
loop at it_mara.
select werks mmsta into table it_marc
from marc
where matnr eq it_mara-matnr.
clear it_marc.
endloop.
loop at it_marc.
write:/1 it_marc-matnr,
/20 it_marc-werks,
/25 it_marc-mmsta.
endloop.
Can you also help me to create one classical report relating to FI using table BKPF, BSEG, BSIK, BSAD and BSAS. Then I will try to convert that one into ALV format.
Thanks,
Rajeev !!!!!
2008 Jan 09 3:37 AM
Hi,
This is ur code which u want.
TYPE-POOLS SLIS.
Data: begin of it_mara occurs 0,
matnr like mara-matnr,
mtart like mara-matkl ,
end of it_mara.
Data: begin of it_marc occurs 0,
matnr like marc-matnr,
mmsta like marc-mmsta,
werks like marc-werks,
end of it_marc.
select matnr matkl into table it_mara
from mara
where matkl eq '001'.
loop at it_mara.
select werks mmsta into table it_marc
from marc
where matnr eq it_mara-matnr.
clear it_mara.
endloop.
DATA: LAYOUT TYPE SLIS_LAYOUT_ALV,
FLDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
LAYOUT-ZEBRA = 'X'.
LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_MARC'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = SY-REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = FLDCAT1
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FLDCAT1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
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
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_MARC
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.
Reward points,if it is helpful.
Thank you,
chandu
2008 Jan 09 3:42 AM
Hi Chandu and Gopi,
I tried to use ALV in my classical report but I am getting this error when I run the program:
"Field catalog not found"
&----
*& Report ZTEST_REPORT *
*& *
&----
*& *
*& *
&----
REPORT ZTEST_REPORT
.
TYPE-POOLS: slis.
Data: begin of it_mara occurs 0,
matnr like mara-matnr,
mtart like mara-matkl ,
end of it_mara.
Data: begin of it_marc occurs 0,
matnr like marc-matnr,
mmsta like marc-mmsta,
werks like marc-werks,
end of it_marc.
DATA: fieldcat TYPE slis_t_fieldcat_alv.
DATA: repid TYPE syrepid.
repid = sy-repid.
select matnr matkl into table it_mara
from mara
where matkl eq '001'.
loop at it_mara.
select werks mmsta into table it_marc
from marc
where matnr eq it_mara-matnr.
clear it_marc.
endloop.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = repid
i_internal_tabname = 'it_marc'
i_inclname = repid
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = fieldcat
TABLES
t_outtab = it_marc.
THANKS
Rajeev
2008 Jan 09 4:15 AM
HI Gupta,
My code is working r not.
Try ur code by creating the fieldcatalog manually like,
FLDCAT-FIELDNAME = 'VBELN'.
FLDCAT-SELTEXT_M = 'Sales Document'.
FLDCAT-COL_POS = 0.
*FLDCAT-EMPHASIZE = 'C411'.
FLDCAT-OUTPUTLEN = 20.
FLDCAT-KEY = 'X'.
*FLDCAT-NO_OUT = 'X'. "It hides the field from display
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERDAT'.
FLDCAT-SELTEXT_L = 'Record Date created'.
FLDCAT-COL_POS = 1.
FLDCAT-KEY = 'X'.
FLDCAT-JUST = 'R'. "Right(R)/Left(L)/Center(C) Justification
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERNAM'.
FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.
FLDCAT-COL_POS = 2.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
and pass this to GRID FM.
reward points,if it is useful,
thank you
chandu.
2008 Jan 09 5:34 AM
Hi Rajeev,
Make thsi correction.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = repid
i_internal_tabname = 'IT_MARC' " give IT_MARC in capitals
i_inclname = repid
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = fieldcat.Regards
Gopi
2008 Jan 09 3:20 AM
Check this sample code for an ALV.
TYPE-POOLS: slis.
DATA : BEGIN OF xmara,
matnr LIKE makt-matnr,
spras LIKE makt-spras,
maktx LIKE makt-maktx,
END OF xmara.
DATA: imara LIKE STANDARD TABLE OF xmara WITH HEADER LINE.
DATA: fieldcat TYPE slis_t_fieldcat_alv.
DATA: repid TYPE syrepid.
repid = sy-repid.
SELECT matnr spras maktx
FROM makt
INTO TABLE imara
UP TO 100 ROWS
WHERE spras = sy-langu.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = repid
i_internal_tabname = 'XMARA'
i_inclname = repid
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = fieldcat
TABLES
t_outtab = imara.Regards
Gopi
2008 Jan 09 3:24 AM
Thanks for the help Gopi,
Can also help me to create a sample classical FI report using FI tables and then I will try to convert that in ALV report format.
Thanks,
Rajeev
2008 Jan 09 3:29 AM
Hi Rajeev
May be you can try on your own for the FI tables similar to what i had posted above and if you find any difficulty you can post in here.
We can surely help you out.
If not do a basic search in SDN, you can find some existing programs or examples.
Regards
Gopi
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |