Skip to Content
author's profile photo Former Member
Former Member

Performance issue.

Hi,

when we are checking this report for performance checking, the system is giving message for these "#EC NEEDED, "#EC CALLED, "#EC * etc. with message (The message can be hidden with "#EC CALLED).

we are using the code as below after making change, is it right method to do it?

TYPE-POOLS : slis.

DATA : it_fieldcat TYPE slis_t_fieldcat_alv,

is_fieldcat TYPE slis_fieldcat_alv,

is_events TYPE slis_t_event,

is_grid TYPE REF TO cl_gui_alv_grid,

it_header TYPE slis_t_listheader,

is_header TYPE slis_listheader.

****************TABLE Decleration***************

TABLES : ekko.

****************STRUCTURE Decleration***********

TYPES : BEGIN OF ty_ekko,

ebeln TYPE ekko-ebeln,

lifnr TYPE ekko-lifnr,

bstyp TYPE ekko-bstyp,

END OF ty_ekko.

TYPES : BEGIN OF ty_eket,

ebeln TYPE ekko-ebeln,

ebelp TYPE eket-ebelp,

etenr TYPE eket-etenr,

menge TYPE eket-menge,

wemng TYPE eket-wemng,

yopen_qty TYPE eket-menge,

END OF ty_eket.

TYPES : BEGIN OF ty_final,

sno(5),

menge TYPE eket-menge,

wemng TYPE eket-wemng,

yopen_qty TYPE eket-menge,

ebeln TYPE ekko-ebeln,

lifnr TYPE ekko-lifnr,

name1 TYPE lfa1-name1,

END OF ty_final.

TYPES : BEGIN OF ty_lfa1,

lifnr TYPE lfa1-lifnr,

name1 TYPE lfa1-name1,

END OF ty_lfa1.

****************INTERNAL TABLE Decleration********

DATA : it_ekko TYPE TABLE OF ty_ekko,

it_eket TYPE TABLE OF ty_eket,

it_final TYPE TABLE OF ty_final,

it_lfa1 TYPE TABLE OF ty_lfa1.

****************WORK AREA Decleration*************

DATA : is_ekko TYPE ty_ekko,

is_eket TYPE ty_eket,

is_final TYPE ty_final,

is_lfa1 TYPE ty_lfa1,

it_sort TYPE slis_t_sortinfo_alv,

is_sort TYPE slis_sortinfo_alv.

****************VARIABLES Decleration*************

DATA : w_idate TYPE sy-datum,

w_ltext TYPE t247-ltx,

w_day(2),

w_month(2),

w_year(4),

w_oday(2),

w_omonth(2), "#EC NEEDED

w_oyear(4),

w_o_date(20),

w_total_rec(5),

w_fill(14).

  • CONSTANTS ************************

CONSTANTS : c_tabname TYPE slis_tabname VALUE 'EKKO',

c_tabname1 TYPE slis_tabname VALUE 'LFA1',

c_tabname2 TYPE slis_tabname VALUE 'IT_FINAL',

c_fieldname TYPE slis_fieldname VALUE 'LIFNR',

c_fieldname1 TYPE slis_fieldname VALUE 'NAME1',

c_fieldname2 TYPE slis_fieldname VALUE 'SNO',

c_fieldname3 TYPE slis_fieldname VALUE 'EBELN',

c_up TYPE alvdynp-sortup VALUE 'X',

c_spos TYPE alvdynp-sortpos VALUE '1',

c_spos1 TYPE alvdynp-sortpos VALUE '2',

c_one TYPE sy-cucol VALUE '1',

c_three TYPE sy-cucol VALUE '3',

c_eight TYPE sy-cucol VALUE '8',

c_outputlen TYPE dd03p-outputlen VALUE '12',

c_outputlen1 TYPE dd03p-outputlen VALUE '25',

c_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',

c_end_of_list TYPE slis_formname VALUE 'END_OF_LIST_HTML',

c_typ(1) TYPE c VALUE 'H',

c_fill(14) TYPE c VALUE 'SET_ROW_HEIGHT'.

  • SELECTION SCREEN ****************

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

SELECT-OPTIONS : so_v_no FOR ekko-lifnr,

so_c_cod FOR ekko-bukrs,

so_p_typ FOR ekko-bsart.

SELECTION-SCREEN END OF BLOCK purchase.

  • DATA RETREIVAL *******************

**Select Purchase Orders and Vendor Numbers

SELECT ebeln lifnr bstyp

FROM ekko

INTO TABLE it_ekko

WHERE bukrs IN so_c_cod

AND lifnr IN so_v_no

AND bsart IN so_p_typ.

**Select Quantities for Purchase Orders

IF it_ekko[] IS NOT INITIAL.

SELECT ebeln ebelp etenr menge wemng

FROM eket

INTO TABLE it_eket

FOR ALL ENTRIES IN it_ekko

WHERE ebeln EQ it_ekko-ebeln.

ENDIF.

**Select Name of Vendor for Vendor Number

IF it_ekko[] IS NOT INITIAL.

SELECT lifnr name1

FROM lfa1

INTO TABLE it_lfa1

FOR ALL ENTRIES IN it_ekko

WHERE lifnr EQ it_ekko-lifnr.

ENDIF.

IF it_ekko[] IS INITIAL.

MESSAGE s000(ysrm) WITH text-008.

LEAVE LIST-PROCESSING.

ENDIF.

**Sort tables

SORT it_ekko BY lifnr.

SORT it_eket BY ebeln.

SORT it_lfa1 BY lifnr.

**Fill the data into Final Internal Table

CLEAR : w_total_rec,

is_final,

is_ekko,

is_eket,

is_lfa1.

LOOP AT it_ekko INTO is_ekko.

READ TABLE it_eket INTO is_eket WITH KEY ebeln = is_ekko-ebeln BINARY SEARCH.

IF sy-subrc EQ 0.

READ TABLE it_lfa1 INTO is_lfa1 WITH KEY lifnr = is_ekko-lifnr BINARY SEARCH.

IF sy-subrc EQ 0.

is_final-yopen_qty = is_eket-menge - is_eket-wemng.

is_final-ebeln = is_ekko-ebeln.

is_final-lifnr = is_ekko-lifnr.

is_final-name1 = is_lfa1-name1.

IF is_final-yopen_qty NE 0.

is_final-sno = is_final-sno + c_one.

APPEND is_final TO it_final.

w_total_rec = w_total_rec + c_one.

ENDIF.

ENDIF.

ENDIF.

CLEAR : is_ekko,

is_eket,

is_lfa1.

ENDLOOP.

IF it_final[] IS INITIAL.

MESSAGE s000(ysrm) WITH text-009.

LEAVE LIST-PROCESSING.

ENDIF.

**Sort Final Internal Table with Key Vendor Number Asscending

is_sort-up = c_up.

is_sort-spos = c_spos.

is_sort-fieldname = c_fieldname.

is_sort-tabname = c_tabname.

APPEND is_sort TO it_sort.

is_sort-spos = c_spos1.

is_sort-fieldname = c_fieldname1.

is_sort-tabname = c_tabname1.

APPEND is_sort TO it_sort.

  • PRINT DATA *******************

is_fieldcat-tabname = c_tabname2.

is_fieldcat-fieldname = c_fieldname2.

is_fieldcat-col_pos = c_one.

is_fieldcat-outputlen = c_outputlen.

is_fieldcat-seltext_l = text-002.

APPEND is_fieldcat TO it_fieldcat.

CLEAR is_fieldcat.

is_fieldcat-tabname = c_tabname2.

is_fieldcat-fieldname = c_fieldname3.

is_fieldcat-col_pos = c_one.

is_fieldcat-outputlen = c_outputlen.

is_fieldcat-seltext_l = text-003.

APPEND is_fieldcat TO it_fieldcat.

CLEAR is_fieldcat.

is_fieldcat-tabname = c_tabname2.

is_fieldcat-fieldname = c_fieldname.

is_fieldcat-col_pos = c_one.

is_fieldcat-outputlen = c_outputlen.

is_fieldcat-seltext_l = text-004.

APPEND is_fieldcat TO it_fieldcat.

CLEAR is_fieldcat.

is_fieldcat-tabname = c_tabname2.

is_fieldcat-fieldname = c_fieldname1.

is_fieldcat-col_pos = c_one.

is_fieldcat-outputlen = c_outputlen1.

is_fieldcat-seltext_l = text-005.

APPEND is_fieldcat TO it_fieldcat.

CLEAR is_fieldcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = it_fieldcat[]

i_callback_pf_status_set = 'STATUS'

i_callback_user_command = 'USER_COMMAND'

i_callback_top_of_page = c_top_of_page

i_callback_html_end_of_list = c_end_of_list

i_save = c_up

it_sort = it_sort[]

it_events = is_events[]

TABLES

t_outtab = it_final.

**************Display Top of Page Header******************

FORM top_of_page. "#EC CALLED

*ALV Header declarations

CLEAR is_header.

REFRESH it_header.

w_day = sy-datum+6(2).

w_month = sy-datum+4(2).

w_year = sy-datum+0(4).

CONCATENATE w_year w_month w_day INTO w_idate.

CALL FUNCTION 'HR_IN_GET_DATE_COMPONENTS'

EXPORTING

idate = w_idate

IMPORTING

day = w_oday

month = w_omonth "Value assignment

year = w_oyear

ltext = w_ltext.

CONCATENATE w_oday '-' w_ltext '-' w_oyear INTO w_o_date.

is_header-typ = c_typ.

CONCATENATE text-006 w_o_date

INTO is_header-info SEPARATED BY space.

APPEND is_header TO it_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_header.

ENDFORM. "top-of-page

************End of List****

FORM end_of_list_html USING end TYPE REF TO cl_dd_document. "#EC CALLED

DATA: is_text TYPE sdydo_text_element.

w_fill = c_fill.

CONCATENATE text-007 w_total_rec

INTO is_text SEPARATED BY space.

  • adds text (via variable)

CALL METHOD end->add_text

EXPORTING

text = is_text.

*set height of this section

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = is_grid.

CALL METHOD is_grid->parent->parent->(w_fill)

EXPORTING

id = c_three

height = c_eight.

ENDFORM. "end_of_list_html. "Value assignment

&----


*& Form STATUS

&----


  • text

----


  • -->P_EXTAB text

----


FORM status USING p_extab TYPE slis_t_extab. "#EC *

*- Pf status

SET PF-STATUS 'STATUS'.

ENDFORM. " STATUS

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->R_UCOMM text

  • -->RS_SELFIELD text

----


FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield."#EC CALLED

CASE r_ucomm.

WHEN 'BACK' OR 'CANC' OR 'EXIT'.

LEAVE TO SCREEN 0.

WHEN '&IC1'.

SORT it_ekko BY ebeln.

READ TABLE it_ekko INTO is_ekko WITH KEY ebeln = rs_selfield-value BINARY SEARCH."#EC *

IF is_ekko-bstyp EQ 'F'.

SET PARAMETER ID 'BES' FIELD rs_selfield-value.

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

ENDIF.

IF is_ekko-bstyp EQ 'L'.

SET PARAMETER ID 'VRT' FIELD rs_selfield-value.

CALL TRANSACTION 'ME33' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

CLEAR is_ekko.

ENDFORM. "USER_COMMAND

points will be rewarded,

P.A.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 08, 2007 at 11:46 AM

    The "#EC CALLED / "#EC * etc are just ways of telling the extended syntax checker that you are happy with the code, and want to override warnings - e.g. in an ALV such as yours, there will be several dynamic subroutine calls such as the user command, and the extended syntax check would warn that the form does not appear to be called ... putting the "#EC * or "#EC CALLED on the end of the line will suppress the message.

    Jonathan

    p.s. should you be reading all the EKETs for each PO, not just the first? And you may get faster performance if you select from lfa1 with a list on unique LIFNR values that are in sorted order.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.