SAP Expert
Core Concepts
SAP Ecosystem
- SAP ERP - Enterprise Resource Planning suite (ECC, S/4HANA)
- SAP HANA - In-memory database platform
- SAP Fiori - Modern UX layer with responsive apps
- SAP Business Suite - Finance, HR, Supply Chain, Manufacturing modules
- SAP BTP - Business Technology Platform (cloud services)
ABAP Development
- ABAP Objects - Object-oriented programming in ABAP
- CDS Views - Core Data Services for data modeling
- AMDP - ABAP Managed Database Procedures
- ALV - ABAP List Viewer for reports
- BAPIs - Business Application Programming Interfaces
- RFCs - Remote Function Calls for integration
Integration Technologies
- OData Services - RESTful APIs for SAP data
- IDoc - Intermediate Documents for data exchange
- SOAP/RFC - Web services and remote function calls
- SAP PI/PO - Process Integration/Orchestration
- SAP Gateway - OData and REST API framework
Implementation Examples
ABAP Report with ALV Grid
*&---------------------------------------------------------------------*
*& Report Z_EMPLOYEE_REPORT
*&---------------------------------------------------------------------*
REPORT z_employee_report.
TABLES: pa0001. " Organizational Assignment
TYPES: BEGIN OF ty_employee,
pernr TYPE pa0001-pernr,
ename TYPE pa0001-ename,
orgeh TYPE pa0001-orgeh,
plans TYPE pa0001-plans,
stell TYPE pa0001-stell,
END OF ty_employee.
DATA: gt_employee TYPE TABLE OF ty_employee,
gs_employee TYPE ty_employee,
go_alv TYPE REF TO cl_salv_table.
SELECT-OPTIONS: s_pernr FOR pa0001-pernr.
START-OF-SELECTION.
" Fetch employee data
SELECT pernr ename orgeh plans stell
FROM pa0001
INTO TABLE gt_employee
WHERE pernr IN s_pernr
AND endda = '99991231'
AND begda <= sy-datum.
IF sy-subrc = 0.
" Display ALV
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = go_alv
CHANGING
t_table = gt_employee ).
" Enable all standard functions
go_alv->get_functions( )->set_all( abap_true ).
" Optimize column width
go_alv->get_columns( )->set_optimize( abap_true ).
" Display
go_alv->display( ).
CATCH cx_salv_msg INTO DATA(lx_msg).
MESSAGE lx_msg TYPE 'E'.
ENDTRY.
ELSE.
MESSAGE 'No data found' TYPE 'I'.
ENDIF.
CDS View with Associations
@AbapCatalog.sqlViewName: 'ZSALESORDERV'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Sales Order with Customer'
define view Z_SalesOrder
as select from vbak as SalesOrder
association [1..1] to kna1 as _Customer
on $projection.CustomerId = _Customer.kunnr
{
key SalesOrder.vbeln as SalesOrderId,
SalesOrder.erdat as CreatedDate,
SalesOrder.erzet as CreatedTime,
SalesOrder.ernam as CreatedBy,
SalesOrder.kunnr as CustomerId,
SalesOrder.netwr as NetValue,
SalesOrder.waerk as Currency,
// Associations
_Customer
}
where SalesOrder.vbtyp = 'C' // Sales order
OData Service Implementation
CLASS zcl_odata_employee_dpc_ext DEFINITION
PUBLIC
INHERITING FROM zcl_odata_employee_dpc
CREATE PUBLIC.
PUBLIC SECTION.
METHODS /iwbep/if_mgw_appl_srv_runtime~get_entityset
REDEFINITION.
METHODS /iwbep/if_mgw_appl_srv_runtime~get_entity
REDEFINITION.
METHODS /iwbep/if_mgw_appl_srv_runtime~create_entity
REDEFINITION.
ENDCLASS.
CLASS zcl_odata_employee_dpc_ext IMPLEMENTATION.
METHOD /iwbep/if_mgw_appl_srv_runtime~get_entityset.
DATA: lt_employees TYPE TABLE OF zcl_odata_employee_mpc=>ts_employee,
ls_employee TYPE zcl_odata_employee_mpc=>ts_employee.
CASE iv_entity_name.
WHEN 'EmployeeSet'.
" Apply filters from URI
DATA(lt_filter) = io_tech_request_context->get_filter( )->get_filter_select_options( ).
" Fetch data
SELECT pernr, ename, orgeh, plans
FROM pa0001
INTO CORRESPONDING FIELDS OF TABLE lt_employees
WHERE endda = '99991231'
AND begda <= sy-datum.
" Return data
copy_data_to_ref(
EXPORTING
is_data = lt_employees
CHANGING
cr_data = er_entityset ).
ENDCASE.
ENDMETHOD.
METHOD /iwbep/if_mgw_appl_srv_runtime~create_entity.
DATA: ls_employee TYPE zcl_odata_employee_mpc=>ts_employee,
ls_pa0001 TYPE pa0001.
" Get payload
io_data_provider->read_entry_data(
IMPORTING
es_data = ls_employee ).
" Create employee record
ls_pa0001-pernr = ls_employee-pernr.
ls_pa0001-ename = ls_employee-ename.
ls_pa0001-begda = sy-datum.
ls_pa0001-endda = '99991231'.
" Call BAPI to create employee
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = ls_pa0001-pernr
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
INSERT pa0001 FROM ls_pa0001.
COMMIT WORK.
ENDIF.
" Return created entity
er_entity = ls_employee.
ENDMETHOD.
ENDCLASS.
SAP Fiori App (SAPUI5)
sap.ui.define(
[
'sap/ui/core/mvc/Controller',
'sap/ui/model/json/JSONModel',
'sap/m/MessageToast',
],
function (Controller, JSONModel, MessageToast) {
'use strict';
return Controller.extend('com.example.employee.controller.Main', {
onInit: function () {
// Initialize model
var oModel = new JSONModel();
this.getView().setModel(oModel);
// Load employee data
this._loadEmployees();
},
_loadEmployees: function () {
var that = this;
var oDataModel = this.getView().getModel('odata');
oDataModel.read('/EmployeeSet', {
success: function (oData) {
that.getView().getModel().setProperty('/employees', oData.results);
},
error: function (oError) {
MessageToast.show('Failed to load employees');
},
});
},
onEmployeeSelect: function (oEvent) {
var oItem = oEvent.getParameter('listItem');
var oContext = oItem.getBindingContext();
var sEmployeeId = oContext.getProperty('Pernr');
// Navigate to detail view
this.getOwnerComponent().getRouter().navTo('detail', {
employeeId: sEmployeeId,
});
},
onCreateEmployee: function () {
var oDialog = this.byId('createDialog');
oDialog.open();
},
onSaveEmployee: function () {
var oView = this.getView();
var oModel = oView.getModel('odata');
var oEntry = {
Pernr: oView.byId('pernrInput').getValue(),
Ename: oView.byId('enameInput').getValue(),
Orgeh: oView.byId('orgehInput').getValue(),
};
oModel.create('/EmployeeSet', oEntry, {
success: function () {
MessageToast.show('Employee created successfully');
this._loadEmployees();
this.byId('createDialog').close();
}.bind(this),
error: function () {
MessageToast.show('Failed to create employee');
},
});
},
});
}
);
RFC Function Module
FUNCTION z_get_employee_details.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_PERNR) TYPE PERNR_D
*" EXPORTING
*" VALUE(ES_EMPLOYEE) TYPE ZS_EMPLOYEE
*" EXCEPTIONS
*" EMPLOYEE_NOT_FOUND
*"----------------------------------------------------------------------
SELECT SINGLE pernr ename orgeh plans stell
FROM pa0001
INTO CORRESPONDING FIELDS OF es_employee
WHERE pernr = iv_pernr
AND endda = '99991231'
AND begda <= sy-datum.
IF sy-subrc <> 0.
RAISE employee_not_found.
ENDIF.
" Enrich with additional data
SELECT SINGLE persg persk
FROM pa0001
INTO (es_employee-persg, es_employee-persk)
WHERE pernr = iv_pernr
AND endda = '99991231'.
ENDFUNCTION.
Best Practices
Development Standards
- Use naming conventions (Z*/Y* for custom objects)
- Implement proper error handling with exceptions
- Follow ABAP coding guidelines (clean code)
- Use CDS views for data modeling in S/4HANA
- Leverage ABAP unit tests for quality assurance
- Document code with proper comments
Performance Optimization
- Use database views instead of nested SELECTs
- Implement buffering for frequently accessed tables
- Use SAP HANA-specific features (AMDP, CDS)
- Optimize ALV displays with field catalogs
- Implement lazy loading for large datasets
- Use parallel processing for batch jobs
Integration Patterns
- Prefer OData services for modern integrations
- Use IDoc for asynchronous batch processing
- Implement RFC for synchronous real-time calls
- Apply proper authorization checks
- Implement retry logic and error handling
- Use SAP Gateway for REST APIs
Security Best Practices
- Implement authorization objects properly
- Use secure network communication (SNC)
- Encrypt sensitive data at rest and in transit
- Apply principle of least privilege
- Regular security patches and updates
- Implement audit logging
Anti-Patterns
Code Smells
- Hard-coded values instead of customizing
- Missing error handling and exceptions
- SELECT * statements without field list
- Nested loops with database access
- Missing authorization checks
- Modifications to standard SAP objects
Design Issues
- Tight coupling between modules
- God objects with too many responsibilities
- Direct table access instead of BAPIs
- Synchronous processing for long-running tasks
- Missing transaction management
- No separation of concerns
Integration Mistakes
- Point-to-point integrations without middleware
- Missing idempotency in service calls
- No versioning for APIs
- Inadequate error handling in RFC calls
- Synchronous calls where async would be better
- Missing retry mechanisms
Resources
Official Documentation
Learning Platforms
Tools & Extensions
Community Resources
1---
2name: sap-expert
3version: 1.1.0
4description: >-
5 Expert in SAP ERP systems, ABAP programming, SAP HANA, S/4HANA, Fiori applications, and
6 SAP integration patterns including OData, RFC, and IDoc. Use when the user mentions ERP,
7 enterprise, business apps, ABAP, HANA, or S/4HANA, or when the task involves SAP
8 Ecosystem, ABAP Development, Integration Technologies, or ABAP Report with ALV Grid.
9category: domains
10tags:
11 [
12 sap,
13 erp,
14 enterprise,
15 business-apps,
16 abap,
17 hana,
18 s4hana,
19 fiori,
20 odata,
21 rfc,
22 idoc,
23 sap-integration,
24 enterprise-software,
25 ]
26allowed-tools:
27 - Read
28 - Write
29 - Bash
30 - WebSearch
31metadata:
32 source: https://skillmd.com/skills/personamanagmentlayer/sap-expert
33 author: PCL Standard Library
34 complexity: expert
35---
36
37# SAP Expert
38
39## Core Concepts
40
41### SAP Ecosystem
42
43- **SAP ERP** - Enterprise Resource Planning suite (ECC, S/4HANA)
44- **SAP HANA** - In-memory database platform
45- **SAP Fiori** - Modern UX layer with responsive apps
46- **SAP Business Suite** - Finance, HR, Supply Chain, Manufacturing modules
47- **SAP BTP** - Business Technology Platform (cloud services)
48
49### ABAP Development
50
51- **ABAP Objects** - Object-oriented programming in ABAP
52- **CDS Views** - Core Data Services for data modeling
53- **AMDP** - ABAP Managed Database Procedures
54- **ALV** - ABAP List Viewer for reports
55- **BAPIs** - Business Application Programming Interfaces
56- **RFCs** - Remote Function Calls for integration
57
58### Integration Technologies
59
60- **OData Services** - RESTful APIs for SAP data
61- **IDoc** - Intermediate Documents for data exchange
62- **SOAP/RFC** - Web services and remote function calls
63- **SAP PI/PO** - Process Integration/Orchestration
64- **SAP Gateway** - OData and REST API framework
65
66## Implementation Examples
67
68### ABAP Report with ALV Grid
69
70```abap
71*&---------------------------------------------------------------------*
72*& Report Z_EMPLOYEE_REPORT
73*&---------------------------------------------------------------------*
74REPORT z_employee_report.
75
76TABLES: pa0001. " Organizational Assignment
77
78TYPES: BEGIN OF ty_employee,
79 pernr TYPE pa0001-pernr,
80 ename TYPE pa0001-ename,
81 orgeh TYPE pa0001-orgeh,
82 plans TYPE pa0001-plans,
83 stell TYPE pa0001-stell,
84 END OF ty_employee.
85
86DATA: gt_employee TYPE TABLE OF ty_employee,
87 gs_employee TYPE ty_employee,
88 go_alv TYPE REF TO cl_salv_table.
89
90SELECT-OPTIONS: s_pernr FOR pa0001-pernr.
91
92START-OF-SELECTION.
93
94 " Fetch employee data
95 SELECT pernr ename orgeh plans stell
96 FROM pa0001
97 INTO TABLE gt_employee
98 WHERE pernr IN s_pernr
99 AND endda = '99991231'
100 AND begda <= sy-datum.
101
102 IF sy-subrc = 0.
103 " Display ALV
104 TRY.
105 cl_salv_table=>factory(
106 IMPORTING
107 r_salv_table = go_alv
108 CHANGING
109 t_table = gt_employee ).
110
111 " Enable all standard functions
112 go_alv->get_functions( )->set_all( abap_true ).
113
114 " Optimize column width
115 go_alv->get_columns( )->set_optimize( abap_true ).
116
117 " Display
118 go_alv->display( ).
119
120 CATCH cx_salv_msg INTO DATA(lx_msg).
121 MESSAGE lx_msg TYPE 'E'.
122 ENDTRY.
123 ELSE.
124 MESSAGE 'No data found' TYPE 'I'.
125 ENDIF.
126```
127
128### CDS View with Associations
129
130```abap
131@AbapCatalog.sqlViewName: 'ZSALESORDERV'
132@AbapCatalog.compiler.compareFilter: true
133@AccessControl.authorizationCheck: #CHECK
134@EndUserText.label: 'Sales Order with Customer'
135
136define view Z_SalesOrder
137 as select from vbak as SalesOrder
138 association [1..1] to kna1 as _Customer
139 on $projection.CustomerId = _Customer.kunnr
140{
141 key SalesOrder.vbeln as SalesOrderId,
142 SalesOrder.erdat as CreatedDate,
143 SalesOrder.erzet as CreatedTime,
144 SalesOrder.ernam as CreatedBy,
145 SalesOrder.kunnr as CustomerId,
146 SalesOrder.netwr as NetValue,
147 SalesOrder.waerk as Currency,
148
149 // Associations
150 _Customer
151}
152where SalesOrder.vbtyp = 'C' // Sales order
153```
154
155### OData Service Implementation
156
157```abap
158CLASS zcl_odata_employee_dpc_ext DEFINITION
159 PUBLIC
160 INHERITING FROM zcl_odata_employee_dpc
161 CREATE PUBLIC.
162
163 PUBLIC SECTION.
164 METHODS /iwbep/if_mgw_appl_srv_runtime~get_entityset
165 REDEFINITION.
166 METHODS /iwbep/if_mgw_appl_srv_runtime~get_entity
167 REDEFINITION.
168 METHODS /iwbep/if_mgw_appl_srv_runtime~create_entity
169 REDEFINITION.
170
171ENDCLASS.
172
173CLASS zcl_odata_employee_dpc_ext IMPLEMENTATION.
174
175 METHOD /iwbep/if_mgw_appl_srv_runtime~get_entityset.
176
177 DATA: lt_employees TYPE TABLE OF zcl_odata_employee_mpc=>ts_employee,
178 ls_employee TYPE zcl_odata_employee_mpc=>ts_employee.
179
180 CASE iv_entity_name.
181 WHEN 'EmployeeSet'.
182
183 " Apply filters from URI
184 DATA(lt_filter) = io_tech_request_context->get_filter( )->get_filter_select_options( ).
185
186 " Fetch data
187 SELECT pernr, ename, orgeh, plans
188 FROM pa0001
189 INTO CORRESPONDING FIELDS OF TABLE lt_employees
190 WHERE endda = '99991231'
191 AND begda <= sy-datum.
192
193 " Return data
194 copy_data_to_ref(
195 EXPORTING
196 is_data = lt_employees
197 CHANGING
198 cr_data = er_entityset ).
199
200 ENDCASE.
201
202 ENDMETHOD.
203
204 METHOD /iwbep/if_mgw_appl_srv_runtime~create_entity.
205
206 DATA: ls_employee TYPE zcl_odata_employee_mpc=>ts_employee,
207 ls_pa0001 TYPE pa0001.
208
209 " Get payload
210 io_data_provider->read_entry_data(
211 IMPORTING
212 es_data = ls_employee ).
213
214 " Create employee record
215 ls_pa0001-pernr = ls_employee-pernr.
216 ls_pa0001-ename = ls_employee-ename.
217 ls_pa0001-begda = sy-datum.
218 ls_pa0001-endda = '99991231'.
219
220 " Call BAPI to create employee
221 CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
222 EXPORTING
223 number = ls_pa0001-pernr
224 EXCEPTIONS
225 OTHERS = 1.
226
227 IF sy-subrc = 0.
228 INSERT pa0001 FROM ls_pa0001.
229 COMMIT WORK.
230 ENDIF.
231
232 " Return created entity
233 er_entity = ls_employee.
234
235 ENDMETHOD.
236
237ENDCLASS.
238```
239
240### SAP Fiori App (SAPUI5)
241
242```javascript
243sap.ui.define(
244 [
245 'sap/ui/core/mvc/Controller',
246 'sap/ui/model/json/JSONModel',
247 'sap/m/MessageToast',
248 ],
249 function (Controller, JSONModel, MessageToast) {
250 'use strict';
251
252 return Controller.extend('com.example.employee.controller.Main', {
253 onInit: function () {
254 // Initialize model
255 var oModel = new JSONModel();
256 this.getView().setModel(oModel);
257
258 // Load employee data
259 this._loadEmployees();
260 },
261
262 _loadEmployees: function () {
263 var that = this;
264 var oDataModel = this.getView().getModel('odata');
265
266 oDataModel.read('/EmployeeSet', {
267 success: function (oData) {
268 that.getView().getModel().setProperty('/employees', oData.results);
269 },
270 error: function (oError) {
271 MessageToast.show('Failed to load employees');
272 },
273 });
274 },
275
276 onEmployeeSelect: function (oEvent) {
277 var oItem = oEvent.getParameter('listItem');
278 var oContext = oItem.getBindingContext();
279 var sEmployeeId = oContext.getProperty('Pernr');
280
281 // Navigate to detail view
282 this.getOwnerComponent().getRouter().navTo('detail', {
283 employeeId: sEmployeeId,
284 });
285 },
286
287 onCreateEmployee: function () {
288 var oDialog = this.byId('createDialog');
289 oDialog.open();
290 },
291
292 onSaveEmployee: function () {
293 var oView = this.getView();
294 var oModel = oView.getModel('odata');
295
296 var oEntry = {
297 Pernr: oView.byId('pernrInput').getValue(),
298 Ename: oView.byId('enameInput').getValue(),
299 Orgeh: oView.byId('orgehInput').getValue(),
300 };
301
302 oModel.create('/EmployeeSet', oEntry, {
303 success: function () {
304 MessageToast.show('Employee created successfully');
305 this._loadEmployees();
306 this.byId('createDialog').close();
307 }.bind(this),
308 error: function () {
309 MessageToast.show('Failed to create employee');
310 },
311 });
312 },
313 });
314 }
315);
316```
317
318### RFC Function Module
319
320```abap
321FUNCTION z_get_employee_details.
322*"----------------------------------------------------------------------
323*"*"Local Interface:
324*" IMPORTING
325*" VALUE(IV_PERNR) TYPE PERNR_D
326*" EXPORTING
327*" VALUE(ES_EMPLOYEE) TYPE ZS_EMPLOYEE
328*" EXCEPTIONS
329*" EMPLOYEE_NOT_FOUND
330*"----------------------------------------------------------------------
331
332 SELECT SINGLE pernr ename orgeh plans stell
333 FROM pa0001
334 INTO CORRESPONDING FIELDS OF es_employee
335 WHERE pernr = iv_pernr
336 AND endda = '99991231'
337 AND begda <= sy-datum.
338
339 IF sy-subrc <> 0.
340 RAISE employee_not_found.
341 ENDIF.
342
343 " Enrich with additional data
344 SELECT SINGLE persg persk
345 FROM pa0001
346 INTO (es_employee-persg, es_employee-persk)
347 WHERE pernr = iv_pernr
348 AND endda = '99991231'.
349
350ENDFUNCTION.
351```
352
353## Best Practices
354
355### Development Standards
356
357- Use naming conventions (Z*/Y* for custom objects)
358- Implement proper error handling with exceptions
359- Follow ABAP coding guidelines (clean code)
360- Use CDS views for data modeling in S/4HANA
361- Leverage ABAP unit tests for quality assurance
362- Document code with proper comments
363
364### Performance Optimization
365
366- Use database views instead of nested SELECTs
367- Implement buffering for frequently accessed tables
368- Use SAP HANA-specific features (AMDP, CDS)
369- Optimize ALV displays with field catalogs
370- Implement lazy loading for large datasets
371- Use parallel processing for batch jobs
372
373### Integration Patterns
374
375- Prefer OData services for modern integrations
376- Use IDoc for asynchronous batch processing
377- Implement RFC for synchronous real-time calls
378- Apply proper authorization checks
379- Implement retry logic and error handling
380- Use SAP Gateway for REST APIs
381
382### Security Best Practices
383
384- Implement authorization objects properly
385- Use secure network communication (SNC)
386- Encrypt sensitive data at rest and in transit
387- Apply principle of least privilege
388- Regular security patches and updates
389- Implement audit logging
390
391## Anti-Patterns
392
393### Code Smells
394
395- Hard-coded values instead of customizing
396- Missing error handling and exceptions
397- SELECT \* statements without field list
398- Nested loops with database access
399- Missing authorization checks
400- Modifications to standard SAP objects
401
402### Design Issues
403
404- Tight coupling between modules
405- God objects with too many responsibilities
406- Direct table access instead of BAPIs
407- Synchronous processing for long-running tasks
408- Missing transaction management
409- No separation of concerns
410
411### Integration Mistakes
412
413- Point-to-point integrations without middleware
414- Missing idempotency in service calls
415- No versioning for APIs
416- Inadequate error handling in RFC calls
417- Synchronous calls where async would be better
418- Missing retry mechanisms
419
420## Resources
421
422### Official Documentation
423
424- [SAP Help Portal](https://help.sap.com/) - Comprehensive documentation
425- [SAP API Business Hub](https://api.sap.com/) - API references
426- [ABAP Keyword Documentation](https://help.sap.com/doc/abapdocu_latest/) - Language reference
427- [SAP Fiori Design Guidelines](https://experience.sap.com/fiori-design/) - UX patterns
428
429### Learning Platforms
430
431- [SAP Learning Hub](https://learning.sap.com/) - Official training
432- [openSAP](https://open.sap.com/) - Free online courses
433- [SAP Community](https://community.sap.com/) - Forums and blogs
434- [SAP Press](https://www.sap-press.com/) - Technical books
435
436### Tools & Extensions
437
438- [ABAP Development Tools (ADT)](https://tools.hana.ondemand.com/) - Eclipse-based IDE
439- [SAP GUI](https://support.sap.com/en/product/connectors/sapgui.html) - Classic interface
440- [SAP Business Application Studio](https://www.sap.com/products/business-application-studio.html) - Cloud IDE
441- [SAP Cloud Connector](https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681) - On-premise connectivity
442
443### Community Resources
444
445- [ABAP Forums](https://answers.sap.com/tags/833755570260738661924709785639) - Q&A
446- [SAP Blogs](https://blogs.sap.com/) - Technical articles
447- [GitHub SAP Samples](https://github.com/SAP-samples) - Code examples
448- [SAP CodeJam](https://community.sap.com/topics/codejam) - Hands-on events