Skip to main content

ERPL Function Reference

Complete reference for all ERPL functions organized by protocol. This reference covers RFC, BICS, and ODP functions with parameters, return types, and examples.

RFC Functions

Core RFC Functions

sap_rfc_read_table()

Read data from SAP tables.

Signature:

sap_rfc_read_table(table_name VARCHAR, [LIMIT INTEGER], [FIELDS VARCHAR], [WHERE VARCHAR], [ORDER_BY VARCHAR])

Parameters:

ParameterTypeDescriptionExample
table_nameVARCHARSAP table name'KNA1'
LIMITINTEGERMaximum rows to returnLIMIT => 1000
FIELDSVARCHARComma-separated field listFIELDS => 'KUNNR,NAME1'
WHEREVARCHARWHERE clause conditionsWHERE => 'LAND1 = "DE"'
ORDER_BYVARCHARSort orderORDER_BY => 'KUNNR'

Example:

SELECT * FROM sap_rfc_read_table('KNA1', LIMIT => 100);

sap_rfc_invoke()

Call SAP function modules and BAPIs.

Signature:

sap_rfc_invoke(function_name VARCHAR, [path VARCHAR], [parameters JSON])

Parameters:

ParameterTypeDescriptionExample
function_nameVARCHARSAP function module name'BAPI_FLIGHT_GETLIST'
pathVARCHARJSON path to specific return structurepath => '/FLIGHT_LIST'
parametersJSONFunction input parameters{'AIRLINEID': 'LH'}

Example:

SELECT * FROM sap_rfc_invoke('BAPI_FLIGHT_GETLIST', path => '/FLIGHT_LIST');

RFC Metadata Functions

sap_rfc_describe_function()

Get detailed information about RFC function parameters.

Signature:

sap_rfc_describe_function(function_name VARCHAR)

Example:

SELECT * FROM sap_rfc_describe_function('BAPI_FLIGHT_GETLIST');

sap_rfc_describe_fields()

Get table structure and field information.

Signature:

sap_rfc_describe_fields(table_name VARCHAR)

Example:

SELECT * FROM sap_rfc_describe_fields('KNA1');

sap_rfc_describe_references()

List all referenced tables in the SAP system.

Signature:

sap_rfc_describe_references()

Example:

SELECT * FROM sap_rfc_describe_references();

sap_rfc_show_function()

List all available RFC functions.

Signature:

sap_rfc_show_function()

Example:

SELECT * FROM sap_rfc_show_function();

sap_rfc_show_groups()

List all RFC function groups.

Signature:

sap_rfc_show_groups()

Example:

SELECT * FROM sap_rfc_show_groups();

sap_rfc_show_tables()

List all available SAP tables.

Signature:

sap_rfc_show_tables()

Example:

SELECT * FROM sap_rfc_show_tables();

BICS Functions

Basic Query Functions

sap_bics_show()

List available cubes, queries, or InfoProviders.

Signature:

sap_bics_show(object_type VARCHAR)

Parameters:

ParameterTypeDescriptionExample
object_typeVARCHARType of objects to list'CUBE', 'QUERY', 'INFOPROVIDER'

Example:

SELECT * FROM sap_bics_show('CUBE');

sap_bics_describe()

Describe cube structure or query.

Signature:

sap_bics_describe([cube_name VARCHAR], [query_name VARCHAR])

Example:

SELECT * FROM sap_bics_describe('0BWTESTCUBE');

sap_bics_begin()

Start a BICS query session.

Signature:

sap_bics_begin(cube_name VARCHAR)

Example:

SELECT * FROM sap_bics_begin('0BWTESTCUBE');

sap_bics_columns()

Select specific columns for the query.

Signature:

sap_bics_columns(query_state, column1 VARCHAR, column2 VARCHAR, ...)

Example:

SELECT * FROM sap_bics_columns(
sap_bics_begin('0BWTESTCUBE'),
'0CALMONTH',
'0SALES_AMOUNT'
);

sap_bics_filter()

Apply filters to the query.

Signature:

sap_bics_filter(query_state, filter_field VARCHAR, filter_value VARCHAR, ...)

Example:

SELECT * FROM sap_bics_filter(
sap_bics_begin('0BWTESTCUBE'),
'0CALMONTH', '202401'
);

sap_bics_result()

Execute the query and get results.

Signature:

sap_bics_result(query_state)

Example:

SELECT * FROM sap_bics_result(
sap_bics_filter(
sap_bics_begin('0BWTESTCUBE'),
'0CALMONTH', '202401'
)
);

Intermediate Query Functions

sap_bics_show_hierarchies()

List available hierarchies.

Signature:

sap_bics_show_hierarchies()

Example:

SELECT * FROM sap_bics_show_hierarchies();

sap_bics_hierarchy()

Query hierarchy data.

Signature:

sap_bics_hierarchy(hierarchy_name VARCHAR, root_node VARCHAR)

Example:

SELECT * FROM sap_bics_hierarchy('0MATERIAL_HIER', 'MAT001');

sap_bics_describe_infoobject()

Get InfoObject details.

Signature:

sap_bics_describe_infoobject(infoobject_name VARCHAR)

Example:

SELECT * FROM sap_bics_describe_infoobject('0MATERIAL');

Advanced Metadata Functions

sap_bics_query_lineage()

Get complete end-to-end lineage from source tables to BEx queries.

Signature:

sap_bics_query_lineage(query_name VARCHAR, [secret VARCHAR])

Example:

SELECT * FROM sap_bics_query_lineage('0D_FC_NW_C01_Q0008');

sap_bics_meta_providers()

Get InfoProvider metadata.

Signature:

sap_bics_meta_providers()

Example:

SELECT * FROM sap_bics_meta_providers();

sap_bics_meta_datasources()

Get DataSource metadata.

Signature:

sap_bics_meta_datasources()

Example:

SELECT * FROM sap_bics_meta_datasources();

sap_bics_meta_transformations()

Get transformation metadata.

Signature:

sap_bics_meta_transformations()

Example:

SELECT * FROM sap_bics_meta_transformations();

sap_bics_meta_queries()

Get query metadata.

Signature:

sap_bics_meta_queries()

Example:

SELECT * FROM sap_bics_meta_queries();

sap_bics_meta_query_elements()

Get query element metadata.

Signature:

sap_bics_meta_query_elements()

Example:

SELECT * FROM sap_bics_meta_query_elements();

sap_bics_meta_query_stats()

Get query statistics.

Signature:

sap_bics_meta_query_stats()

Example:

SELECT * FROM sap_bics_meta_query_stats();

sap_bics_meta_query_usage()

Get query usage metadata.

Signature:

sap_bics_meta_query_usage()

Example:

SELECT * FROM sap_bics_meta_query_usage();

sap_bics_meta_provider_fields()

Get InfoProvider field metadata.

Signature:

sap_bics_meta_provider_fields()

Example:

SELECT * FROM sap_bics_meta_provider_fields();

sap_bics_meta_datasource_fields()

Get DataSource field metadata.

Signature:

sap_bics_meta_datasource_fields()

Example:

SELECT * FROM sap_bics_meta_datasource_fields();

sap_bics_meta_transform_fields()

Get transformation field metadata.

Signature:

sap_bics_meta_transform_fields()

Example:

SELECT * FROM sap_bics_meta_transform_fields();

sap_bics_meta_hcpr()

Get HCPR (Hierarchy Change Pointer) metadata.

Signature:

sap_bics_meta_hcpr()

Example:

SELECT * FROM sap_bics_meta_hcpr();

sap_bics_meta_hcpr_mapping()

Get HCPR mapping metadata.

Signature:

sap_bics_meta_hcpr_mapping()

Example:

SELECT * FROM sap_bics_meta_hcpr_mapping();

sap_bics_meta_infoobjects()

Get InfoObject metadata.

Signature:

sap_bics_meta_infoobjects()

Example:

SELECT * FROM sap_bics_meta_infoobjects();

sap_bics_meta_objxref()

Get object cross-reference metadata.

Signature:

sap_bics_meta_objxref()

Example:

SELECT * FROM sap_bics_meta_objxref();

Lineage Functions

sap_bics_lineage_edges()

Get lineage graph edges.

Signature:

sap_bics_lineage_edges(query_name VARCHAR)

Example:

SELECT * FROM sap_bics_lineage_edges('0D_FC_NW_C01_Q0008');

sap_bics_lineage_graph_json()

Get lineage as JSON graph structure.

Signature:

sap_bics_lineage_graph_json(query_name VARCHAR)

Example:

SELECT * FROM sap_bics_lineage_graph_json('0D_FC_NW_C01_Q0008');

sap_bics_lineage_trace()

Trace specific lineage path.

Signature:

sap_bics_lineage_trace(query_name VARCHAR)

Example:

SELECT * FROM sap_bics_lineage_trace('0D_FC_NW_C01_Q0008');

ODP Functions

Basic ODP Functions

sap_odp_show_contexts()

List all available ODP contexts.

Signature:

sap_odp_show_contexts()

Example:

SELECT * FROM sap_odp_show_contexts();

sap_odp_show()

List data sources in a specific context.

Signature:

sap_odp_show(context_name VARCHAR)

Example:

SELECT * FROM sap_odp_show('BW');

sap_odp_describe()

Describe data source structure.

Signature:

sap_odp_describe(context_name VARCHAR, data_source VARCHAR)

Example:

SELECT * FROM sap_odp_describe('BW', 'VBAK$F');

sap_odp_preview()

Preview data without creating subscription.

Signature:

sap_odp_preview(context_name VARCHAR, data_source VARCHAR, [LIMIT INTEGER])

Example:

SELECT * FROM sap_odp_preview('BW', 'VBAK$F', LIMIT => 100);

sap_odp_read_full()

Extract data with full/delta/recover modes.

Signature:

sap_odp_read_full(context_name VARCHAR, data_source VARCHAR, [replication_mode VARCHAR], [subscriber_name VARCHAR], [subscriber_type VARCHAR], [selection VARCHAR])

Parameters:

ParameterTypeDescriptionExample
context_nameVARCHARODP context name'BW'
data_sourceVARCHARData source name'VBAK$F'
replication_modeVARCHARReplication mode'FULL', 'DELTA', 'RECOVER'
subscriber_nameVARCHARSubscriber name'ERPL'
subscriber_typeVARCHARSubscriber type'SAP_BW'
selectionVARCHARSelection criteria'ERDAT >= "20240101"'

Example:

SELECT * FROM sap_odp_read_full('BW', 'VBAK$F', replication_mode => 'DELTA');

Advanced ODP Functions

sap_odp_show_subscriptions()

View active subscriptions.

Signature:

sap_odp_show_subscriptions()

Example:

SELECT * FROM sap_odp_show_subscriptions();

sap_odp_show_cursors()

Check extraction cursors.

Signature:

sap_odp_show_cursors([replication_mode VARCHAR])

Example:

SELECT * FROM sap_odp_show_cursors(replication_mode => 'DELTA');

ODP Pragma Functions

PRAGMA sap_odp_drop()

Drop specific subscription.

Signature:

PRAGMA sap_odp_drop(context_name VARCHAR, data_source VARCHAR, subscriber_name VARCHAR)

Example:

PRAGMA sap_odp_drop('BW', 'VBAK$F', 'ERPL');

PRAGMA sap_odp_drop_all()

Drop all subscriptions.

Signature:

PRAGMA sap_odp_drop_all()

Example:

PRAGMA sap_odp_drop_all();

Custom Types

BICS Types

BICS_RETURN

Enum type for BICS return codes.

Values:

  • SUCCESS
  • ERROR
  • WARNING

BICS_OPERATION

Enum type for BICS operations.

Values:

  • BEGIN
  • FILTER
  • COLUMNS
  • RESULT

ODP Types

ODP_REPLICATION_MODE

Enum type for ODP replication modes.

Values:

  • FULL - Complete data load
  • DELTA - Only changed records
  • RECOVER - Recovery mode

ODP_SELECT_SIGN

Enum type for ODP selection signs.

Values:

  • I - Include
  • E - Exclude

ODP_SELECT_OP

Enum type for ODP selection operations.

Values:

  • EQ - Equal
  • NE - Not equal
  • GT - Greater than
  • LT - Less than
  • GE - Greater than or equal
  • LE - Less than or equal

Function Categories

By Complexity Level

Beginner Functions:

  • sap_rfc_read_table()
  • sap_rfc_invoke()
  • sap_bics_show()
  • sap_bics_begin()
  • sap_bics_result()
  • sap_odp_show_contexts()
  • sap_odp_read_full()

Intermediate Functions:

  • sap_rfc_describe_function()
  • sap_rfc_describe_fields()
  • sap_bics_describe()
  • sap_bics_filter()
  • sap_bics_hierarchy()
  • sap_odp_describe()
  • sap_odp_preview()

Advanced Functions:

  • sap_rfc_describe_references()
  • sap_bics_query_lineage()
  • sap_bics_meta_*() (all metadata functions)
  • sap_odp_show_subscriptions()
  • sap_odp_show_cursors()
  • PRAGMA sap_odp_drop*()

By Protocol

RFC Functions (8):

  • sap_rfc_read_table()
  • sap_rfc_invoke()
  • sap_rfc_describe_function()
  • sap_rfc_describe_fields()
  • sap_rfc_describe_references()
  • sap_rfc_show_function()
  • sap_rfc_show_groups()
  • sap_rfc_show_tables()

BICS Functions (25+):

  • Basic query functions (7)
  • Metadata functions (15)
  • Lineage functions (3)

ODP Functions (8):

  • sap_odp_show_contexts()
  • sap_odp_show()
  • sap_odp_describe()
  • sap_odp_preview()
  • sap_odp_read_full()
  • sap_odp_show_subscriptions()
  • sap_odp_show_cursors()
  • PRAGMA sap_odp_drop*()

Common Patterns

Basic Query Pattern (BICS)

-- Standard BICS query pattern
SELECT * FROM sap_bics_result(
sap_bics_filter(
sap_bics_begin('CUBE_NAME'),
'FILTER_FIELD', 'FILTER_VALUE'
)
);

Delta Replication Pattern (ODP)

-- Standard ODP delta pattern
-- 1. Initial full load
SELECT * FROM sap_odp_read_full(
'BW', 'VBAK$F',
replication_mode => 'FULL'
);

-- 2. Subsequent delta loads
SELECT * FROM sap_odp_read_full(
'BW', 'VBAK$F',
replication_mode => 'DELTA'
);

Function Discovery Pattern (RFC)

-- Discover and analyze functions
SELECT * FROM sap_rfc_show_function()
WHERE function_name LIKE '%BAPI%';

SELECT * FROM sap_rfc_describe_function('FUNCTION_NAME');

Error Handling

Common Error Patterns

Function Not Found:

-- Check if function exists
SELECT * FROM sap_rfc_show_function()
WHERE function_name = 'FUNCTION_NAME';

Table Not Found:

-- Check if table exists
SELECT * FROM sap_rfc_show_tables()
WHERE table_name = 'TABLE_NAME';

Subscription Errors:

-- Check subscription status
SELECT * FROM sap_odp_show_subscriptions()
WHERE status = 'ERROR';

Performance Tips

Optimization Strategies

Use LIMIT for large datasets:

SELECT * FROM sap_rfc_read_table('KNA1', LIMIT => 1000);

Filter early in BICS queries:

SELECT * FROM sap_bics_result(
sap_bics_filter(
sap_bics_begin('CUBE'),
'FILTER_FIELD', 'VALUE'
)
);

Use DELTA mode for ODP:

SELECT * FROM sap_odp_read_full(
'BW', 'VBAK$F',
replication_mode => 'DELTA'
);

Next Steps

🚀 Ready for More?

🔧 Advanced Topics

💡 Examples


Need help? Check our troubleshooting guide or browse more examples.