Professional Documents
Culture Documents
CD120
CD120
Objective
Remind people of some of the older programming techniques that
will make your programming easier
Teach you just one thing Something new
Give you examples of things you can use NOW
Generate some open discussion
Personal objective get some feedback via the survey
Agenda
Model Get
the Data
Controller
Links the
View and
the model
View
User
Interface
Change Documents
Why
When
How
6
6
10
11
Enter a function
group, click generate
12
13
Custom Code
Include
FZMCTESTCHGCDC
Call form
cd_call_zmctestchg.
When there is a
change
14
SCU3
CALL FUNCTION 'CHANGEDOCUMENT_READ'
EXPORTING
* ARCHIVE_HANDLE
=0
* CHANGENUMBER
=''
* DATE_OF_CHANGE
= '00000000'
objectclass
= <Name of the class>
objectid
= objectid
TABLES
editpos
= editpos
EXCEPTIONS
no_position_found
=1
wrong_access_to_archive
=2
time_zone_conversion_error
=3
OTHERS
=4
.
15
Demo
16
Text Object
Why
When
How
17
18
19
SE75
Create the text object
20
21
23
24
Demo
25
Pattern
Why
When
How
26
Pattern - Why
Easily insert repeated text
27
Pattern - When
Used to keep our comments at the top of the program the same.
Quick reference for a simple ALV
28
Pattern - How
Create
the Code
Create the
Pattern
Use it
29
Patterns - How
Create a
program for
syntax
check
30
Patterns - How
Enter your code
for your pattern
and check it.
Switch your
parameters to
something
generic like
xx_table.
Copy to clipboard
31
Patterns - How
Create pattern
Utilities
More utilities
Edit Pattern
Create Pattern
32
33
Demo
34
34
Table Maintenance
Why
When
How
35
36
37
Table maintenance is
a nice quick way of
doing things
Set up foreign key
relationship.
39
SE80 Create
function group where
your table
maintenance for a
project will live. I
would recommend
creating a new one
based on the project
40
Create table
maintenance
41
42
SE93
Pick a name
Parameter transaction
Enter the update
value and viewname
43
44
Create a table
maintenance view
45
46
Click relationships
Let it generate the
joins
Move to the view
fields
Click table fields and
select the ones you
want
Look at the second
column.
47
Demo
49
ALV
Why
When
How
50
Why?
Quickly creates a very nice user interface where they have control of
the layout. That means no programming changes when they want
to rearrange data.
A side benefit if you give them more information than they need, set
up a default layout then when they request the extra fields, they
are already there. Again no programming.
51
ALV - How
= ls_layout
= lt_fcat
= gt_exc
= gt_outtab
=1
=2
52
= ls_layout
= lt_fcat
= gt_exc
= gt_outtab
=1
=2
DATA: go_alv
TYPE REF TO cl_sal
go_functions TYPE REF TO cl_salv_functions_list.
cl_salv_table=>factory(
IMPORTING
r_salv_table = go_alv
CHANGING
t_table
= gt_ZMC_TECHEDGRD_table
).
go_functions = go_alv->get_functions( ).
go_functions->set_all( ).
go_alv->display( ).
53
54
55
Debugging
Why
When
How
56
Debugging Why?
A million reasons basically to troubleshot programs while
developing and when there is a problem.
57
Debugging - When
Business Case
All the time!!!! Development and troubleshooting. Or figuring out
what SAP has done.
58
Debugging - How
Download internal tables I use this when I want to look at the data
in an excel format change to a summary view, total a column
subtotal etc.
Test FM with parameters saved from running your program This
one has saved a lot of time when Debugging SAP Programs. If you
just want to run the FM, and dont want to try to copy the data from
your screen into a FM.
Display multiple internal tables Ive used this to compare tables.
Modify multiple lines of internal tables.
Can be started from outside applications by setting break-point in
code.
Started with jobs in the background.
59
Debugging - How
Download Internal table
60
Debugging - How
Step 1 Save parameter FM test data
Name test
Test
FM
61
Tools Box
62
Debug - How
Tables Tab
Rows
open for
input
63
Debugging - how
External
Breakpoint
64
Debug - How
Set Breakpoint
Start
Debug
JDBG
65
Demo
66
Parameter IDs
SE38 or SE80 *Demo*
ABAPDOCU
SEARCH_SAP_MENU Search SAP Menus
DWDM Sap Demo Programs
Create variants at run time RS_CREATE_VARIANT
SHDB Create BDC recording
Enqueue / Dequeue table SE11, Lock Objects
67
Helpful Transactions
Transaction Variant require fields / hide etc
Create in SPRO
SPRO -> SAP Netweaver -> General Settings -> field display
characteristics -> Configure application transaction fields
ZMD_CONSTANT Set up a custom configuration table
Search Help SE11 saves code
SM37 set the breakpoints then JDBG to run the background job
RSMODPRF to maintain old text element changes
68
Web Dynpro
JAVA Dynpro
Visual Composer
Business Objects
BI reports
More
69
Questions? / Tips
you have?
70
Evaluations Please
Feedback
Please complete a session evaluation for this session!
71
73
Example of a Main
data table We can
even use a
maintenance view if
one person enters the
session and one
person adds the
speaker names
74
75
Create Transaction
76
77
78
Quickly have a
common heading
Now Ill add the ALV
Pattern
80
81
82
83
84
85
Demo
86
87
88
***********************************************************************
* Program Purpose: Provide a description of what this program does
* Date Written:
* Author:
* Initial request number
* Transaction code (if applies)
* SAIC Contact name
* SAIC functional area
* Unit test script name (if applicable)
* Where used: important if standard SAP "where-used" function won't
*
"see" this program
* Area Menu (if applicable)
************************************************************************
*
Maintenance
*
* Task #
Date
CC# Prgmr Description
* D46nnnnnn mm-dd-yyyy
ZMC_TECHEDGRDx
************************************************************************
*&---------------------------------------------------------------------*
*& Z_ALV: pattern for creating an ALV report
*&
*&---------------------------------------------------------------------*
*& Replace ZMC_TECHEDGRD_TABLE with the table you are selecting from or displaying
*& It must be defined in the data dictionary but may be a structure
*& instead of a transparent table
*&
*&---------------------------------------------------------------------*
REPORT zmc_fillform2.
PARAMETERS p_badge TYPE zsess_attkey OBLIGATORY.
PARAMETER: p_layout TYPE ltdx-variant.
DATA: gt_zmc_techedgrd_table TYPE TABLE OF zmc_techedgrd,
gs_zmc_techedgrd_table LIKE LINE OF gt_zmc_techedgrd_table.
DATA: go_alv
TYPE REF TO cl_salv_table,
go_functions TYPE REF TO cl_salv_functions_list,
go_layout TYPE REF TO cl_salv_layout,
v_key
TYPE salv_s_layout_key.
89
90
91
*=====================================================================*
CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS:
on_double_click FOR EVENT double_click OF cl_salv_events_table
IMPORTING row column.
ENDCLASS.
"lcl_handle_events DEFINITION
92
93
START-OF-SELECTION.
v_key-report = sy-repid.
DATA: lr_events TYPE REF TO cl_salv_events_table.
DATA: gr_events TYPE REF TO lcl_handle_events.
DATA: lr_layout TYPE REF TO cl_salv_layout.
*----------------------------------------------------------------------*
* either select from db table or use internal table that is already
* built but structure must be defined in DB
*----------------------------------------------------------------------*
SELECT * FROM zmc_techedgrd
INTO TABLE gt_zmc_techedgrd_table
WHERE badge = p_badge.
IF sy-subrc <> 0.
MESSAGE 'No records found' TYPE 'I'.
RETURN.
ENDIF.
94
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = go_alv
CHANGING
t_table
= gt_zmc_techedgrd_table
).
*IF ERROR...
CATCH cx_salv_msg.
*ELSE IF ERROR...
WRITE: /5 'ERROR OCCURRED'.
ENDTRY.
** Set up Double Click
lr_events = go_alv->get_event( ).
lr_layout = go_alv->get_layout( ).
95
go_layout = go_alv->get_layout( ).
* allow layout saves and sel.
* Set up the key for the layout
v_key-report = sy-repid.
* Step 2 set the key.
go_layout->set_key( v_key ).
* Set layout
go_layout->set_initial_layout( p_layout ).
* Allow save
DATA: v_res TYPE salv_de_layout_restriction.
v_res = if_salv_c_layout=>restrict_none.
go_layout->set_save_restriction( v_res ).
* Allow default layout
go_layout->set_default( 'X' ).
go_functions = go_alv->get_functions( ).
go_functions->set_all( ).
go_alv->display( ).
END-OF-SELECTION.
96
p_layout = ls_layout-layout.
97
Evaluations
Feedback
Please complete a session evaluation for this session!
98