Pages

Friday, September 3, 2010

View on SAP Certification

http://www.jonerp.com/pdf/sap_certification_from_cert5.pdf


http://www.zdnet.com/blog/btl/can-sap-certifications-join-the-big-leagues/33369

Wednesday, September 1, 2010

ALV design Header with Selection screen elements

*----------------------------------------------------------------------*
FORM event_top_of_page USING p_dyndoc_id TYPE REF TO cl_dd_document.

* Design the Layout
PERFORM f_design_top_new USING p_dyndoc_id.

* populating data to html control
PERFORM f_html_header USING p_dyndoc_id.


ENDFORM. " EVENT_TOP_OF_PAGE

************************************************************************

FORM f_design_top_new USING p_dyndoc_id TYPE REF TO cl_dd_document.

DATA obj_area1 TYPE REF TO cl_dd_area.
DATA obj_area2 TYPE REF TO cl_dd_area.
DATA obj_table TYPE REF TO cl_dd_table_element.
DATA obj_col_key TYPE REF TO cl_dd_area.
DATA obj_col_info TYPE REF TO cl_dd_area.
DATA l_text TYPE sdydo_text_element.
DATA:l_ext_date TYPE char10."Date

* populating header to top-of-page
PERFORM f_date_to_external USING sy-datum
CHANGING l_ext_date.

* add gap
CALL METHOD p_dyndoc_id->add_gap
EXPORTING
width = 150.

MOVE 'Tree House Foods'(001) TO l_text.
"Add Text to Header
CALL METHOD p_dyndoc_id->add_text
EXPORTING
text = l_text
sap_style = cl_dd_area=>heading.

CALL METHOD p_dyndoc_id->underline.

* add gap
CALL METHOD p_dyndoc_id->add_gap
EXPORTING
width = 150.

MOVE sy-title TO l_text.
"Add Text to Header
CALL METHOD p_dyndoc_id->add_text
EXPORTING
text = l_text
sap_emphasis = 'Strong'.

CLEAR l_text.

CALL METHOD p_dyndoc_id->new_line.
* Report Type***********************
IF rb_md06 EQ c_x.
MOVE 'Report based on MRP (MD06)'(s04) TO l_text.
ELSEIF rb_md04 EQ c_x.
MOVE 'Report based on Stock Requirements (MD04)'(032) TO l_text.
ENDIF.

"Add Text to Header
CALL METHOD p_dyndoc_id->add_text
EXPORTING
text = l_text
sap_emphasis = 'Strong'
sap_style = 'SUCCESS'.

CLEAR l_text.

* split of document into up/below
CALL METHOD p_dyndoc_id->horizontal_split
EXPORTING
split_area = p_dyndoc_id
IMPORTING
below_area = obj_area1.

l_text = 'Selection Screen Parameters'(040).
CALL METHOD obj_area1->add_text
EXPORTING
text = l_text
sap_emphasis = 'Strong'
sap_style = 'TABLE_HEADING'.

* split of below into below_left/below_right
CALL METHOD p_dyndoc_id->horizontal_split
EXPORTING
split_area = obj_area1
IMPORTING
below_area = obj_area2.

CALL METHOD obj_area2->add_table
EXPORTING
no_of_columns = 2
with_heading = ' '
border = '0'
IMPORTING
table = obj_table.

CALL METHOD obj_table->add_column
IMPORTING
column = obj_col_key.

CALL METHOD obj_table->add_column
IMPORTING
column = obj_col_info.


CALL METHOD obj_table->new_row.

l_text = 'Exception message number:'(041).
CALL METHOD obj_col_key->add_text
EXPORTING
text = l_text
sap_emphasis = 'Strong'.

LOOP AT s_auskt.
CALL METHOD obj_col_info->add_gap
EXPORTING
width = 5.
CONCATENATE s_auskt-option s_auskt-low s_auskt-high c_colon INTO l_text
SEPARATED BY space.
CALL METHOD obj_col_info->add_text
EXPORTING
text = l_text.
ENDLOOP.

CALL METHOD obj_table->new_row.

l_text = 'Plant:'(042).
CALL METHOD obj_col_key->add_text
EXPORTING
text = l_text
sap_emphasis = 'Strong'.

LOOP AT s_plwrk.
CALL METHOD obj_col_info->add_gap
EXPORTING
width = 5.
CONCATENATE s_plwrk-option s_plwrk-low s_plwrk-high c_colon INTO l_text
SEPARATED BY space.
CALL METHOD obj_col_info->add_text
EXPORTING
text = l_text.
ENDLOOP.

CALL METHOD obj_table->new_row.

l_text = 'Material Number:'(043).
CALL METHOD obj_col_key->add_text
EXPORTING
text = l_text
sap_emphasis = 'Strong'.

LOOP AT s_matnr.
CALL METHOD obj_col_info->add_gap
EXPORTING
width = 5.
CONCATENATE s_matnr-option s_matnr-low s_matnr-high c_colon INTO l_text
SEPARATED BY space.
CALL METHOD obj_col_info->add_text
EXPORTING
text = l_text.
ENDLOOP.

CALL METHOD obj_table->new_row.

l_text = 'Number of Excp. per Material:'(044).
CALL METHOD obj_col_key->add_text
EXPORTING
text = l_text
sap_emphasis = 'Strong'.

CALL METHOD obj_col_info->add_gap
EXPORTING
width = 5.

IF p_numex EQ 0.
l_text = 'Unlimited'(045).
ELSE.
l_text = p_numex.
ENDIF.
CALL METHOD obj_col_info->add_text
EXPORTING
text = l_text.

CALL METHOD obj_table->new_row.

l_text = 'Procurement Type:'(046).
CALL METHOD obj_col_key->add_text
EXPORTING
text = l_text
sap_emphasis = 'Strong'.

LOOP AT s_beskz.
CALL METHOD obj_col_info->add_gap
EXPORTING
width = 5.
CONCATENATE s_beskz-option s_beskz-low s_beskz-high c_colon INTO l_text
SEPARATED BY space.
CALL METHOD obj_col_info->add_text
EXPORTING
text = l_text.
ENDLOOP.

CALL METHOD obj_table->new_row.

l_text = 'MRP Type:'(047).
CALL METHOD obj_col_key->add_text
EXPORTING
text = l_text
sap_emphasis = 'Strong'.

LOOP AT s_dismm.
CALL METHOD obj_col_info->add_gap
EXPORTING
width = 5.
CONCATENATE s_dismm-option s_dismm-low s_dismm-high c_colon INTO l_text
SEPARATED BY space.
CALL METHOD obj_col_info->add_text
EXPORTING
text = l_text.
ENDLOOP.

CALL METHOD obj_table->new_row.

l_text = 'MRP Controller:'(048).
CALL METHOD obj_col_key->add_text
EXPORTING
text = l_text
sap_emphasis = 'Strong'.

LOOP AT s_dispo.
CALL METHOD obj_col_info->add_gap
EXPORTING
width = 5.
CONCATENATE s_dispo-option s_dispo-low s_dispo-high c_colon INTO l_text
SEPARATED BY space.
CALL METHOD obj_col_info->add_text
EXPORTING
text = l_text.
ENDLOOP.

CALL METHOD obj_table->new_row.

l_text = 'Material Type:'(049).
CALL METHOD obj_col_key->add_text
EXPORTING
text = l_text
sap_emphasis = 'Strong'.

LOOP AT s_mtart.
CALL METHOD obj_col_info->add_gap
EXPORTING
width = 5.
CONCATENATE s_mtart-option s_mtart-low s_mtart-high c_colon INTO l_text
SEPARATED BY space.
CALL METHOD obj_col_info->add_text
EXPORTING
text = l_text.
ENDLOOP.

ENDFORM. " F_DESIGN_TOP_NEW
****************************************************************************

*----------------------------------------------------------------------*
FORM f_html_header USING p_dyndoc_id TYPE REF TO cl_dd_document.

* creating html control
IF obj_html_cntrl IS INITIAL.
CREATE OBJECT obj_html_cntrl
EXPORTING
parent = obj_parent_html.
ENDIF.
* reuse_alv_grid_commentary_set
CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
EXPORTING
document = p_dyndoc_id
bottom = space.
* get top->htmobj_table ready
CALL METHOD p_dyndoc_id->merge_document.
* set wallpaper
CALL METHOD p_dyndoc_id->set_document_background
EXPORTING
picture_id = space.
* connect top document to html-control
p_dyndoc_id->html_control = obj_html_cntrl.
* display top document
CALL METHOD p_dyndoc_id->display_document
EXPORTING
reuse_control = c_x
parent = obj_parent_html
EXCEPTIONS
html_display_error = 1.
IF sy-subrc NE 0.
MESSAGE i000 WITH 'Error in displaying top-of-page'(035).
ENDIF.



ENDFORM. " F_HTML_HEADER
*****************************************************************

Tuesday, August 31, 2010

ALV background display as well as foreground

MODULE alv_display OUTPUT.

IF sy-batch NE c_x.

* First Main Container
CREATE OBJECT obj_container
EXPORTING
container_name = 'CC_CONTAINER'.
* Splitter Container
CREATE OBJECT obj_splitter
EXPORTING
parent = obj_container
rows = 2
columns = 1.

* Set the height of Top of page
CALL METHOD obj_splitter->set_row_height
EXPORTING
id = 1
height = 29.

* Place obj_parent_html in First row First column
* for Top_of_page
CALL METHOD obj_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = obj_parent_html.

* Place ALV grid display in Second row First column
CALL METHOD obj_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = obj_parent_grid.

* Create ALV grid Object
CREATE OBJECT obj_grid
EXPORTING
i_parent = obj_parent_grid.

ELSE. "For Background run
* Create ALV grid Object
CREATE OBJECT obj_grid
EXPORTING
i_parent = obj_dock.
ENDIF.

* Create Event handler Object
CREATE OBJECT obj_event.
*
** Set Event Handler for List TOP_OF_PAGE
SET HANDLER obj_event->on_top_of_page FOR obj_grid.
** Set Event Handler for Grid TOP_OF_PAGE
SET HANDLER obj_event->on_grid_top_of_page FOR obj_grid.
** Set Event Handler for Grid END_OF_PAGE
SET HANDLER obj_event->on_END_OF_PAGE FOR obj_grid.
** Set Event Handler for Double Click
SET HANDLER obj_event->handle_double_click FOR obj_grid.

* Call Grid method to display ALV Table
CALL METHOD obj_grid->set_table_for_first_display
EXPORTING
* i_buffer_active =
* i_bypassing_buffer =
* i_consistency_check =
* i_structure_name =
* is_variant =
* i_save =
* i_default = 'X'
is_layout = wa_layo
* is_print =
* it_special_groups =
* it_toolbar_excluding =
* it_hyperlink =
* it_alv_graphics =
* it_except_qinfo =
* ir_salv_adapter =
CHANGING
it_outtab = gt_mat
it_fieldcatalog = gt_fcat
it_sort = gt_sort
* it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE i000 WITH 'Error in Report Display'(003).
ENDIF.

* Create top-document
CREATE OBJECT obj_dyndoc_id
EXPORTING
style = 'ALV_GRID'.

* Initializing document
CALL METHOD obj_dyndoc_id->initialize_document.

* Processing events
CALL METHOD obj_grid->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = obj_dyndoc_id.

* Refresh ALV object before next display
CALL METHOD obj_grid->refresh_table_display
EXPORTING
is_stable = c_stable.

CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = obj_grid.


ENDMODULE. " ALV_DISPLAY OUTPUT

Normal ALV class Design-Events double click and top-end of page

********************************************************************
* ABAP Name: ZZSCPR044_INMRP_EXCP_CLASS
* Created by: Agnihotro Sinha
* Created on: 08/12/2010.
* Version: 1.0
*------------------------------------------------------------------*
* Modification Log:
* Date Programmer Correction Description
*
********************************************************************

************************************************************************
* Class declarations
************************************************************************
CLASS lcl_event_handler DEFINITION FINAL.
* event receiver definitions for ALV actions
PUBLIC SECTION.
*** Any Event with PREFIX as 'PRINT' is connected to ALV List Display
*** and also gthe event need not be registered with ALV Object
METHODS:
* Handle List output Top-Of-Page
on_top_of_page
FOR EVENT print_top_of_page OF cl_gui_alv_grid,
*Handle grid Top_Of_Page
on_grid_top_of_page
FOR EVENT TOP_OF_PAGE OF cl_gui_alv_grid
IMPORTING
e_dyndoc_id,
* Handle List End of Page
on_end_of_page
FOR EVENT print_END_OF_LIST OF cl_gui_alv_grid,
* Handle Double Click
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
ENDCLASS. "lcl_event_receiver DEFINITION
************************************************************************

CLASS lcl_event_handler IMPLEMENTATION.

* Create the Text to be dispalyed at top of page of ALV List Output
METHOD on_grid_top_of_page.
* top-of-page event for grid Display
PERFORM event_top_of_page USING e_dyndoc_id.
ENDMETHOD. "On_top_of_page

* Create Top_Of_Page display for ALV Grid Output
METHOD on_top_of_page.
* Will be hit only when ALV List Display is called
PERFORM display_list_top.
* e_dyndoc_id = obj_dyndoc_id.
ENDMETHOD. "create_top_of_page
* Create End of Page for List Display
METHOD on_end_of_page.
PERFORM display_list_end.
ENDMETHOD.
* Handle user command for Double Click
METHOD handle_double_click.

* read selected row from internal table gt_sflight
READ TABLE gt_mat INDEX e_row-index INTO wa_mat.
IF sy-subrc eq 0.
PERFORM f_drill_down USING wa_mat e_column.
ENDIF.


ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION