2009 Dec 11 4:52 AM
Hi Experts,
I dont have much knowledge about Report Programming. So i need your helps on below.
Q- I want to fetch some data (like Address,City etc) from Master table by passing input field (like CustomerNo) and display it by using list ALV and grid ALV.
Any body can share the demo code for the same which will help me to understand.
Thanks in advance.
Hi Experts,
I dont have much knowledge about Report Programming. So i need your helps on below.
Q- I want to fetch some data (like Address,City etc) from Master table by passing input field (like CustomerNo) and display it by using list ALV and grid ALV.
Any body can share the demo code for the same which will help me to understand.
Thanks in advance.
2009 Dec 11 6:39 AM
Hi,
You can get this information from ABAPDOCU transaction. That can give you idea & example codes for fetching data from database & displaying that in ALV list.
Hope this solves your problem.
Rgds
Prateek
2009 Dec 11 6:43 AM
check this sample program SALV_TEST_TABLE
see other sampla programs too starting with SALV you'll get a lot of examples of using ALV with factory methods
кu03B1ятu03B9к
2009 Dec 11 7:02 AM
Hi,
I provide you a sample program I have written only for ALV Grid display. similarly you can write the ALV List display progarm
by changing rhe function module to REUSE_ALV_LIST_DISPLAY from REUSE_ALV_GRID_DISPLAY.
Please revert back , if any assistance is required
REPORT YINTALV_BIB1.
*&---------------------------------------------------------------------*
************TYPE POOLS************************
type-pools slis.
data:it_events type slis_t_event,
wa_events type slis_alv_event,
it_fieldcat TYPE slis_t_fieldcat_alv,
it_fieldcat1 TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
*************** Definition of structure*****************************
types: begin of itab_cust,
cust type kunnr,
name type name1,
city type ort01,
end of itab_cust.
********************Selection criteria field ***********************
Parameters: p_kunnr like kna1-kunnr.
********************************************************************
data: tab type standard table of itab_cust,
wa type itab_cust.
*********************************************************************
start-of-selection.
PERFORM read_data.
PERFORM build_catalog.
PERFORM fill_events.
END-OF-SELECTION.
PERFORM display_data.
FORM read_data.
select kunnr name1 ort01 from kna1 into table tab
where kunnr = p_kunnr.
*sort tab by cust.
endform.
************************************build_catalog***********************************************************************
FORM build_catalog.
wa_fieldcat-fieldname = 'CUST'.
wa_fieldcat-tabname = 'TAB'.
wa_fieldcat-col_pos = 1.
wa_fieldcat-seltext_m = 'CUSTOMER'.
APPEND wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'NAME'.
wa_fieldcat-tabname = 'TAB'.
wa_fieldcat-col_pos = 2.
wa_fieldcat-seltext_m = 'NAME'.
APPEND wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'CITY'.
wa_fieldcat-tabname = 'TAB'.
wa_fieldcat-col_pos = 3.
wa_fieldcat-seltext_m = 'CITY'.
APPEND wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
endform.
***********************************WRITE***************************************************************
************
FORM fill_events.
* TOP-OF-PAGE.
clear wa_events.
wa_events-name = 'TOP_OF_PAGE'.
wa_events-form = 'PRINT_HEADING'.
APPEND wa_events to it_events.
* USER-COMMAND
endform.
* ******Form print_heading**************************************************
FORM print_heading.
DATA: it_headings TYPE slis_t_listheader,
wa_headings LIKE LINE OF it_headings.
CLEAR wa_headings.
wa_headings-typ = 'H'.
wa_headings-info = 'Customer Information'.
APPEND wa_headings TO it_headings.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_headings
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.
endform.
***********************************************************************************
FORM attach_status USING ex_tab TYPE slis_t_extab.
SET PF-STATUS 'ASSIGN' EXCLUDING ex_tab.
ENDFORM. "atttach_status
*******************DISPLAY SCREEN FUNCTION******************************************
FORM display_data.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-cprog
* 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 = 'it_cust'
* 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_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 = tab
* 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.
************************************************END OF PROGRAM**********************************************************************************
Thanks,
Bibhu
Edited by: Bibhu Prasad on Dec 11, 2009 10:45 AM
2009 Dec 11 11:17 AM
2009 Dec 11 10:24 AM
Hi,
for your requirement you need to follow the steps.
step1) First you have to create one internal table( with your Fields ).
step2) fetch the data from database table to internal table.
step3) call the function module REUSE_ALV_GRID_DISPLAY (OR) REUSE_ALV_LIST_DISPLAY
step4) pass your internal table to the above function modules.
step5) execute.
2009 Dec 11 10:25 AM
2009 Dec 11 11:34 AM
just type ALV SAP or ALV grid SAP in google...you will get the executbale code
you just need to copy and paste those code in your report...and while debuging the same code ..you will get the idea...
Regards,
Yadesh
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |