Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Report

Former Member
0 Kudos
166

Hi,

I'm new to SAP ABAP and I need one report. Can any one provide the coding for it and please help me out.

Below is the description of the report. This report is related with MM tables.

Objective: Measure of supplier on-time delivery performance review deliverys for a vendor for a given period, and determine the % on time performance.

Stat. Del Date: From the PO item detail tab; Delivery Schedule.

This is the vendor's promised date.

If it becomes known that the vendor can only deliver ordered goods some days later than originally stipulated,for instance,you can change the delivery date accordingly for materials planning and control purposes.However,the statistics-relevant delivery date remains unchanged.

Del Date: Date the goods are to be delivered.

GR date: the goods posting date. To be used if the del. date is not being maintained by buyers.

Selection:

Vendor # : Query by Vendor

Creatuon Date: PO Creation Date Range

Deliv. Date: Delivery Date Range

Deletion Indicator: Exclude deleted line items.

Below is the display which should come.

Vendor# Name PO# Line Item Creation Date Start Del Date Delivery Date Gr date

Please provide me the coding for this.

Thanks

Regards

Srikar

1 ACCEPTED SOLUTION

Former Member
0 Kudos
115

See the similar report and based on ur requirement modify it

type-pools : slis.

  • Tables

tables : ekko, " Purchase order Header

ekpo, " Purchase order Item

marc. " Material with Plant data

  • Internal table for output.

data : begin of i_output occurs 0,

ebeln like ekko-ebeln,

matnr like ekpo-matnr,

end of i_output.

  • ALV Data declaration.

data : v_repid like sy-repid.

  • ALV Function Module Variables

DATA: gs_layout type slis_layout_alv,

g_exit_caused_by_caller,

gs_exit_caused_by_user type slis_exit_by_user.

DATA: gt_fieldcat type slis_t_fieldcat_alv,

gs_print type slis_print_alv,

gt_events type slis_t_event,

gt_list_top_of_page type slis_t_listheader,

g_status_set type slis_formname value 'PF_STATUS_SET',

g_user_command type slis_formname value 'USER_COMMAND',

g_top_of_page type slis_formname value 'TOP_OF_PAGE',

g_top_of_list type slis_formname value 'TOP_OF_LIST',

g_end_of_list type slis_formname value 'END_OF_LIST',

g_variant LIKE disvariant,

g_save(1) TYPE c,

g_tabname_header TYPE slis_tabname,

g_tabname_item TYPE slis_tabname,

g_exit(1) TYPE c,

gx_variant LIKE disvariant.

data : gr_layout_bck type slis_layout_alv.

  • Ranges

ranges r_eindt for eket-eindt.

initialization.

v_repid = sy-repid.

start-of-selection.

  • Get the data from EKKO ,EKPO and MARC Table

perform get_data_tables.

end-of-selection.

  • display the data in the form of ALV

perform display_data.

&----


*& Form get_data_tables

&----


  • Get the data from EKKO,EKPO and MARC Table

----


FORM get_data_tables.

clear : i_output.

refresh : i_output.

  • fill the dates in ranges

r_eindt-low = sy-datum - 7.

r_eindt-high = sy-datum + 14.

r_eindt-option = 'BT'.

r_eindt-sign = 'I'.

append r_eindt.

  • Get the data from EKKO,EKPO and EKET Tables

select aebeln bmatnr into table i_output

from ekko as a inner join

ekpo as b on aebeln = bebeln

inner join marc as c on cmatnr = bmatnr

inner join mara as d on dmatnr = bmatnr

inner join eket as e on eebeln = aebeln

and eebelp = bebelp

where c~beskz = 'E'

and c~werks = '1000'

and d~mtart = 'FERT'

and b~loekz = space

and b~elikz = space

and e~eindt in r_eindt.

if sy-subrc ne 0.

message e000(zwave) with 'No open purchase order found'.

endif.

ENDFORM. " get_data_tables

&----


*& Form display_data

&----


  • text

----


FORM display_data.

  • Fill the Fiedlcat

PERFORM fieldcat_init using gt_fieldcat[].

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = v_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = g_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 = gr_layout_bck

IT_FIELDCAT = gt_fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = g_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

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IT_EXCEPT_QINFO =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

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_data

&----


*& Form fieldcat_init

&----


  • text

----


  • -->P_GT_FIELDCAT[] text

----


FORM fieldcat_init USING e01_lt_fieldcat type slis_t_fieldcat_alv.

DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

  • Purchase order number

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'EBELN'.

LS_FIELDCAT-ref_fieldname = 'EBELN'.

LS_FIELDCAT-ref_tabname = 'EKKO'.

LS_FIELDCAT-TABNAME = 'I_OUTPUT'.

ls_fieldcat-seltext_L = 'Purchase Order'.

ls_fieldcat-seltext_M = 'Purchase Order'.

ls_fieldcat-seltext_S = 'Purchase Order'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

  • Material #

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'MATNR'.

LS_FIELDCAT-ref_fieldname = 'MATNR'.

LS_FIELDCAT-ref_tabname = 'EKPO'.

LS_FIELDCAT-TABNAME = 'I_OUTPUT'.

ls_fieldcat-seltext_L = 'Material'.

ls_fieldcat-seltext_M = 'Material'.

ls_fieldcat-seltext_S = 'Material'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

ENDFORM. " fieldcat_init

7 REPLIES 7

Former Member
0 Kudos
115

Hello Rajesh,

It would be more helpful if you can create the program and then ask question how to do certain things not to write the whole program.

Regards,

Abdullah

0 Kudos
115

Hi

I have done the program i'm having probelm with the getting data and display it.

Here i'm pasting the program which i have done.

type-pools : slis.

  • Tables

tables : ekko, " Purchase order Header

ekpo, " Purchase order Item

marc. " Material with Plant data

  • Internal table for output.

data : begin of i_output occurs 0,

ebeln like ekko-ebeln,

matnr like ekpo-matnr,

end of i_output.

  • ALV Data declaration.

data : v_repid like sy-repid.

  • ALV Function Module Variables

DATA: gs_layout type slis_layout_alv,

g_exit_caused_by_caller,

gs_exit_caused_by_user type slis_exit_by_user.

DATA: gt_fieldcat type slis_t_fieldcat_alv,

gs_print type slis_print_alv,

gt_events type slis_t_event,

gt_list_top_of_page type slis_t_listheader,

g_status_set type slis_formname value 'PF_STATUS_SET',

g_user_command type slis_formname value 'USER_COMMAND',

g_top_of_page type slis_formname value 'TOP_OF_PAGE',

g_top_of_list type slis_formname value 'TOP_OF_LIST',

g_end_of_list type slis_formname value 'END_OF_LIST',

g_variant LIKE disvariant,

g_save(1) TYPE c,

g_tabname_header TYPE slis_tabname,

g_tabname_item TYPE slis_tabname,

g_exit(1) TYPE c,

gx_variant LIKE disvariant.

data : gr_layout_bck type slis_layout_alv.

  • Ranges

ranges r_eindt for eket-eindt.

initialization.

v_repid = sy-repid.

start-of-selection.

  • Get the data from EKKO ,EKPO and MARC Table

perform get_data_tables.

end-of-selection.

  • display the data in the form of ALV

perform display_data.

&----


*& Form get_data_tables

&----


  • Get the data from EKKO,EKPO and MARC Table

----


FORM get_data_tables.

clear : i_output.

refresh : i_output.

  • fill the dates in ranges

r_eindt-low = sy-datum - 7.

r_eindt-high = sy-datum + 14.

r_eindt-option = 'BT'.

r_eindt-sign = 'I'.

append r_eindt.

  • Get the data from EKKO,EKPO and EKET Tables

select aebeln bmatnr into table i_output

from ekko as a inner join

ekpo as b on aebeln = bebeln

inner join marc as c on cmatnr = bmatnr

inner join mara as d on dmatnr = bmatnr

inner join eket as e on eebeln = aebeln

and eebelp = bebelp

where c~beskz = 'E'

and c~werks = '1000'

and d~mtart = 'FERT'

and b~loekz = space

and b~elikz = space

and e~eindt in r_eindt.

if sy-subrc ne 0.

message e000(zwave) with 'No open purchase order found'.

endif.

ENDFORM. " get_data_tables

&----


*& Form display_data

&----


  • text

----


FORM display_data.

  • Fill the Fiedlcat

PERFORM fieldcat_init using gt_fieldcat[].

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = v_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = g_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 = gr_layout_bck

IT_FIELDCAT = gt_fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = g_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

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IT_EXCEPT_QINFO =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

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_data

&----


*& Form fieldcat_init

&----


  • text

----


  • -->P_GT_FIELDCAT[] text

----


FORM fieldcat_init USING e01_lt_fieldcat type slis_t_fieldcat_alv.

DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

  • Purchase order number

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'EBELN'.

LS_FIELDCAT-ref_fieldname = 'EBELN'.

LS_FIELDCAT-ref_tabname = 'EKKO'.

LS_FIELDCAT-TABNAME = 'I_OUTPUT'.

ls_fieldcat-seltext_L = 'Purchase Order'.

ls_fieldcat-seltext_M = 'Purchase Order'.

ls_fieldcat-seltext_S = 'Purchase Order'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

  • Material #

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'MATNR'.

LS_FIELDCAT-ref_fieldname = 'MATNR'.

LS_FIELDCAT-ref_tabname = 'EKPO'.

LS_FIELDCAT-TABNAME = 'I_OUTPUT'.

ls_fieldcat-seltext_L = 'Material'.

ls_fieldcat-seltext_M = 'Material'.

ls_fieldcat-seltext_S = 'Material'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

ENDFORM. " fieldcat_init

So, please help me out to get the data and display it.

0 Kudos
115

type-pools : slis.

  • Tables

tables : ekko, " Purchase order Header

ekpo, " Purchase order Item

marc. " Material with Plant data

  • Internal table for output.

data : begin of i_output occurs 0,

ebeln like ekko-ebeln,

matnr like ekpo-matnr,

end of i_output.

  • ALV Data declaration.

data : v_repid like sy-repid.

  • ALV Function Module Variables

DATA: gs_layout type slis_layout_alv,

g_exit_caused_by_caller,

gs_exit_caused_by_user type slis_exit_by_user.

DATA: gt_fieldcat type slis_t_fieldcat_alv,

gs_print type slis_print_alv,

gt_events type slis_t_event,

gt_list_top_of_page type slis_t_listheader,

g_status_set type slis_formname value 'PF_STATUS_SET',

g_user_command type slis_formname value 'USER_COMMAND',

g_top_of_page type slis_formname value 'TOP_OF_PAGE',

g_top_of_list type slis_formname value 'TOP_OF_LIST',

g_end_of_list type slis_formname value 'END_OF_LIST',

g_variant LIKE disvariant,

g_save(1) TYPE c,

g_tabname_header TYPE slis_tabname,

g_tabname_item TYPE slis_tabname,

g_exit(1) TYPE c,

gx_variant LIKE disvariant.

data : gr_layout_bck type slis_layout_alv.

  • Ranges

ranges r_eindt for eket-eindt.

initialization.

v_repid = sy-repid.

start-of-selection.

  • Get the data from EKKO ,EKPO and MARC Table

perform get_data_tables.

end-of-selection.

  • display the data in the form of ALV

perform display_data.

&----


*& Form get_data_tables

&----


  • Get the data from EKKO,EKPO and MARC Table

----


FORM get_data_tables.

clear : i_output.

refresh : i_output.

  • fill the dates in ranges

r_eindt-low = sy-datum - 7.

r_eindt-high = sy-datum + 14.

r_eindt-option = 'BT'.

r_eindt-sign = 'I'.

append r_eindt.

  • Get the data from EKKO,EKPO and EKET Tables

select aebeln bmatnr into table i_output

from ekko as a inner join

ekpo as b on aebeln = bebeln

inner join marc as c on cmatnr = bmatnr

inner join mara as d on dmatnr = bmatnr

inner join eket as e on eebeln = aebeln

and eebelp = bebelp

where c~beskz = 'E'

and c~werks = '1000'

and d~mtart = 'FERT'

and b~loekz = space

and b~elikz = space

and e~eindt in r_eindt.

if sy-subrc ne 0.

message e000(zwave) with 'No open purchase order found'.

endif.

ENDFORM. " get_data_tables

&----


*& Form display_data

&----


  • text

----


FORM display_data.

  • Fill the Fiedlcat

PERFORM fieldcat_init using gt_fieldcat[].

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = v_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = g_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 = gr_layout_bck

IT_FIELDCAT = gt_fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = g_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

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IT_EXCEPT_QINFO =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

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_data

&----


*& Form fieldcat_init

&----


  • text

----


  • -->P_GT_FIELDCAT[] text

----


FORM fieldcat_init USING e01_lt_fieldcat type slis_t_fieldcat_alv.

DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

  • Purchase order number

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'EBELN'.

LS_FIELDCAT-ref_fieldname = 'EBELN'.

LS_FIELDCAT-ref_tabname = 'EKKO'.

LS_FIELDCAT-TABNAME = 'I_OUTPUT'.

ls_fieldcat-seltext_L = 'Purchase Order'.

ls_fieldcat-seltext_M = 'Purchase Order'.

ls_fieldcat-seltext_S = 'Purchase Order'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

  • Material #

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'MATNR'.

LS_FIELDCAT-ref_fieldname = 'MATNR'.

LS_FIELDCAT-ref_tabname = 'EKPO'.

LS_FIELDCAT-TABNAME = 'I_OUTPUT'.

ls_fieldcat-seltext_L = 'Material'.

ls_fieldcat-seltext_M = 'Material'.

ls_fieldcat-seltext_S = 'Material'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

ENDFORM. " fieldcat_init

0 Kudos
115

Hello Rajesh,

In form F_GET_TABLES, do you get any data in internal table I_OUTPUT? If not, you might want to fix the SELECT statement. Usually, you should be able to use function modules that extract all desired data instead of a direct SELECT.

Another trick that should perform better is to create a view in SE11 and then do a simple SELECT rather than the JOIN.

Regards,

Abdullah

0 Kudos
115

Hi

This is my program

&----


*& Report /BAY2/UPLIC_VNOT_REPORT

*&

&----


  • Identification

  • Module Name : /BAY2/UPLIC_VNOT_REPORT

  • Title : Measure of Supplier on-time Delivery Performance

  • Author : Chakravarthy Mandavilli

  • Creation Date : 05/16/2007

  • Owner (Support): BCBS SAP Development

  • SAP-Release : ERP 2005 (MySAP)

  • ITSDD :

  • CMT : (Interactive Rep to Measure of Supplier on-time Delivery Performance)

----


  • Description :

  • This Program generates a report measure of Supplier on-time Delivery

  • Performance Review deliverys for a vendor for a given period, and determine the % on the time performance

  • selection criteria that needs to be Query by Vendor Number, Creation Date, Delivery Date

  • and Deletion Indicator exclude deleted line items.

*----


----


  • MODIFICATION HISTORY

  • Corr. No. Name Date Version

*

*

----


REPORT /BAY2/UPLIC_VNOT_REPORT NO STANDARD PAGE HEADING

LINE-SIZE 100

LINE-COUNT 45(2)

MESSAGE-ID 00.

  • DATABASE TABLES *

TABLES EKKO. " Purchasing document header

TABLES LFA1. " Vendor master (general section)

TABLES EKPO. " Purchasing document item

TABLES EKBE. " History per Purchasing Document

TABLES EKET. " Delivery Schedules

*Data type for the creation of the ALV grid in the resulting screen

TYPE-POOLS: slis.

*Declaration of internal table i_vt_data

DATA : BEGIN OF i_vt_data occurs 0,

EBELN like EKKO-EBELN, "Purchasing Document Number

LIFNR like EKKO-LIFNR, "Account Number of Vendor

LOEKZ like EKKO-LOEKZ, "Deletion Indicator

AEDAT like EKKO-AEDAT, "Creation Date

NAME1 like LFA1-NAME1, "Name

EBELP like EKPO-EBELP, "Item Number of Purchasing Document

W_PCT(6) Type c, "Percentage

EINDT like EKET-EINDT, "Item Delivery Date

BUDAT like EKBE-BUDAT. "Gr Date

DATA: END OF i_vt_data.

DATA: BEGIN OF I_ALV_DATA OCCURS 100,

EKKO LIKE EKKO-LIFNR, " VENDOR NUMBER

NAME1 LIKE LFA1-NAME1, " NAME

EBELN LIKE EKKO-EBELN, " PURCHASE ORDER NUMBER

EKPO LIKE EKPO-EBELP, " LINE ITEM

AEDAT LIKE EKKO-AEDAT, " CREATION DATE

EINDT LIKE EKET-EINDT, " START DELIVERY DATE

BELNR LIKE EKBE-BELNR. " GR DATE

DATA: END OF I_ALV_DATA.

*Declaration of percentage palce holder

DATA: w_pct(5) TYPE n.

DATA: w_td_name LIKE THEAD-TDNAME.

CONSTANTS: c_text_object LIKE THEAD-TDOBJECT VALUE 'YVERSCONTR'.

CONSTANTS: c_text_id LIKE THEAD-TDID VALUE 'YLTX'.

DATA: I_GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, "ALV Catalog Table

I_GS_FIELDCAT TYPE SLIS_FIELDCAT_ALV, "ALV Catalog Structure

I_GD_LAYOUT TYPE SLIS_LAYOUT_ALV,

I_ls_SORT TYPE SLIS_SORTINFO_ALV,

I_lt_SORT TYPE SLIS_T_SORTINFO_ALV.

DATA: W_REPORT_ID LIKE SY-REPID,

W_ATIN_STR TYPE STRING.

W_REPORT_ID = SY-REPID.

*Creating the selection screen with a title

SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.

*Select Options

SELECT-OPTIONS:

s_lifnr FOR lfa1-lifnr, "Vendor Number

s_aedat FOR ekko-aedat, "Creation Date

s_eindt FOR eket-eindt, "Delivery Date

s_loekz FOR ekko-loekz. "Deletion Indicator

*End of Selection Screen.

SELECTION-SCREEN END OF BLOCK A1.

*Starting the logic of the program

REFRESH i_alv_data.

*Select Purchase Document Number, Vendor Account Number from Purchasing Document Header

SELECT EBELN LIFNR FROM EKKO INTO

CORRESPONDING FIELDS OF i_vt_data from LIFNR eq s_lifnr.

*Select Name,Vendor Account Number from Vendor Master

SELECT NAME1 LIFNR FROM LFA1 INTO

CORRESPONDING FIELDS OF it_lfa1 FOR ALL ENTRIES IN it_ekko

WHERE LIFNR eq it_ekko-lifnr.

*Select Purchase Document Number, Item Number of Purchasing Document from Purchasing Document Item

SELECT EBELN EBELP FROM EKPO INTO

CORRESPONDING FIELDS OF it_ekpo FOR ALL ENTRIES IN it_ekko

WHERE EBELN eq it_ekko-ebeln.

*Select Item Delivery Date, Purchase Ducument Number from Scheduling Agreement Schedule Lines

SELECT EINDT EBELN EBELP FROM EKET INTO

CORRESPONDING FIELDS OF it_eket FOR ALL ENTRIES IN it_ekpo

WHERE EBELN eq it_ekpo-ebeln AND EBELP eq it_ekpo-ebelp.

*Select Posting Date in the Document, Purchase Document Number, Item Number of Purchasing Document from History per Purchasing Document

SELECT BUDAT EBELN EBELP FROM EKBE INTO

CORRESPONDING FIELDS OF it_ekbe FOR ALL ENTRIES IN it_ekpo

WHERE EBELN eq it_ekpo-ebeln AND EBELP eq it_ekpo-ebelp.

ENDSELECT.

ENDSELECT.

ENDSELECT.

ENDSELECT.

PERFORM BUILT_FIELD_CATALOG.

PERFORM BUILD_LAYOUT.

************Calling fucntion module forALV***************************

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_REPORT_ID

i_grid_title = 'Measure of Supplier Performance Report'

it_fieldcat = I_GT_FIELDCAT[]

I_SAVE = 'X'

is_layout = I_GD_LAYOUT

TABLES

t_outtab = I_ALV_DATA.

&----


*& Form BUILD_LAYOUT

&----


  • Build layout for ALV grid report

----


form build_layout.

I_GD_LAYOUT-no_input = 'X'.

I_GD_LAYOUT-colwidth_optimize = 'X'.

I_GD_LAYOUT-zebra = 'X'.

endform. " BUILD_LAYOUT

&----


*& Form built_field_catalog

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM built_field_catalog.

I_GS_FIELDCAT-col_pos = '1'.

I_GS_FIELDCAT-fieldname = 'LIFNR'.

I_GS_FIELDCAT-outputlen = 10.

I_GS_FIELDCAT-seltext_l = 'Vendor Number'.

APPEND I_GS_FIELDCAT TO I_GT_FIELDCAT.

I_GS_FIELDCAT-col_pos = '2'.

I_GS_FIELDCAT-fieldname = 'LFA1'.

I_GS_FIELDCAT-outputlen = 35.

I_GS_FIELDCAT-seltext_l = 'Name'.

I_GS_FIELDCAT-do_sum = ''.

APPEND I_GS_FIELDCAT TO I_GT_FIELDCAT.

I_GS_FIELDCAT-col_pos = '3'.

I_GS_FIELDCAT-fieldname = 'EBELN'.

I_GS_FIELDCAT-outputlen = 10.

I_GS_FIELDCAT-seltext_l = 'PO Number'.

I_GS_FIELDCAT-do_sum = ''.

APPEND I_GS_FIELDCAT TO I_GT_FIELDCAT.

I_GS_FIELDCAT-col_pos = '4'.

I_GS_FIELDCAT-fieldname = 'EBELP'.

I_GS_FIELDCAT-outputlen = 5.

I_GS_FIELDCAT-seltext_l = 'Line Item Number'.

APPEND I_GS_FIELDCAT TO I_GT_FIELDCAT.

I_GS_FIELDCAT-col_pos = '5'.

I_GS_FIELDCAT-fieldname = 'AEDAT'.

I_GS_FIELDCAT-outputlen = 8.

I_GS_FIELDCAT-seltext_l = 'Creation Date'.

APPEND I_GS_FIELDCAT TO I_GT_FIELDCAT.

I_GS_FIELDCAT-col_pos = '6'.

I_GS_FIELDCAT-fieldname = 'EINDT'.

I_GS_FIELDCAT-outputlen = 8.

I_GS_FIELDCAT-seltext_l = 'Stated Delivery Date'.

APPEND I_GS_FIELDCAT TO I_GT_FIELDCAT.

I_GS_FIELDCAT-col_pos = '7'.

I_GS_FIELDCAT-fieldname = 'EINDT'.

I_GS_FIELDCAT-outputlen = 8.

I_GS_FIELDCAT-seltext_l = 'Delivery Date'.

APPEND I_GS_FIELDCAT TO I_GT_FIELDCAT.

I_GS_FIELDCAT-col_pos = '8'.

I_GS_FIELDCAT-fieldname = 'BELNR'.

I_GS_FIELDCAT-outputlen = 10.

I_GS_FIELDCAT-seltext_l = 'Gr Date'.

APPEND I_GS_FIELDCAT TO I_GT_FIELDCAT.

ENDFORM. "built_field_catalog

0 Kudos
115

Rajesh,

You need to add START-OF-SELECTION just before the comment:

*Starting the logic of the program

Also, do you get any entries in internal table I_ALV_DATA just before the call:

PERFORM BUILT_FIELD_CATALOG.?

Regards,

Abdullah

Former Member
0 Kudos
116

See the similar report and based on ur requirement modify it

type-pools : slis.

  • Tables

tables : ekko, " Purchase order Header

ekpo, " Purchase order Item

marc. " Material with Plant data

  • Internal table for output.

data : begin of i_output occurs 0,

ebeln like ekko-ebeln,

matnr like ekpo-matnr,

end of i_output.

  • ALV Data declaration.

data : v_repid like sy-repid.

  • ALV Function Module Variables

DATA: gs_layout type slis_layout_alv,

g_exit_caused_by_caller,

gs_exit_caused_by_user type slis_exit_by_user.

DATA: gt_fieldcat type slis_t_fieldcat_alv,

gs_print type slis_print_alv,

gt_events type slis_t_event,

gt_list_top_of_page type slis_t_listheader,

g_status_set type slis_formname value 'PF_STATUS_SET',

g_user_command type slis_formname value 'USER_COMMAND',

g_top_of_page type slis_formname value 'TOP_OF_PAGE',

g_top_of_list type slis_formname value 'TOP_OF_LIST',

g_end_of_list type slis_formname value 'END_OF_LIST',

g_variant LIKE disvariant,

g_save(1) TYPE c,

g_tabname_header TYPE slis_tabname,

g_tabname_item TYPE slis_tabname,

g_exit(1) TYPE c,

gx_variant LIKE disvariant.

data : gr_layout_bck type slis_layout_alv.

  • Ranges

ranges r_eindt for eket-eindt.

initialization.

v_repid = sy-repid.

start-of-selection.

  • Get the data from EKKO ,EKPO and MARC Table

perform get_data_tables.

end-of-selection.

  • display the data in the form of ALV

perform display_data.

&----


*& Form get_data_tables

&----


  • Get the data from EKKO,EKPO and MARC Table

----


FORM get_data_tables.

clear : i_output.

refresh : i_output.

  • fill the dates in ranges

r_eindt-low = sy-datum - 7.

r_eindt-high = sy-datum + 14.

r_eindt-option = 'BT'.

r_eindt-sign = 'I'.

append r_eindt.

  • Get the data from EKKO,EKPO and EKET Tables

select aebeln bmatnr into table i_output

from ekko as a inner join

ekpo as b on aebeln = bebeln

inner join marc as c on cmatnr = bmatnr

inner join mara as d on dmatnr = bmatnr

inner join eket as e on eebeln = aebeln

and eebelp = bebelp

where c~beskz = 'E'

and c~werks = '1000'

and d~mtart = 'FERT'

and b~loekz = space

and b~elikz = space

and e~eindt in r_eindt.

if sy-subrc ne 0.

message e000(zwave) with 'No open purchase order found'.

endif.

ENDFORM. " get_data_tables

&----


*& Form display_data

&----


  • text

----


FORM display_data.

  • Fill the Fiedlcat

PERFORM fieldcat_init using gt_fieldcat[].

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = v_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = g_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 = gr_layout_bck

IT_FIELDCAT = gt_fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = g_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

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IT_EXCEPT_QINFO =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

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_data

&----


*& Form fieldcat_init

&----


  • text

----


  • -->P_GT_FIELDCAT[] text

----


FORM fieldcat_init USING e01_lt_fieldcat type slis_t_fieldcat_alv.

DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

  • Purchase order number

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'EBELN'.

LS_FIELDCAT-ref_fieldname = 'EBELN'.

LS_FIELDCAT-ref_tabname = 'EKKO'.

LS_FIELDCAT-TABNAME = 'I_OUTPUT'.

ls_fieldcat-seltext_L = 'Purchase Order'.

ls_fieldcat-seltext_M = 'Purchase Order'.

ls_fieldcat-seltext_S = 'Purchase Order'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

  • Material #

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'MATNR'.

LS_FIELDCAT-ref_fieldname = 'MATNR'.

LS_FIELDCAT-ref_tabname = 'EKPO'.

LS_FIELDCAT-TABNAME = 'I_OUTPUT'.

ls_fieldcat-seltext_L = 'Material'.

ls_fieldcat-seltext_M = 'Material'.

ls_fieldcat-seltext_S = 'Material'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

ENDFORM. " fieldcat_init