You are on page 1of 18

User Guide CUSTOMER

FBS Solution Sales Configurator


Document Version: 2.0 – 2014-05-14

Enhancement of ERP IDOC Inbound Interface for


Sales Order Creation
Typographic Conventions

Type Style Description

Example Words or characters quoted from the screen. These include field names, screen titles,
pushbuttons labels, menu names, menu paths, and menu options.
Textual cross-references to other documents.

Example Emphasized words or expressions.

EXAMPLE Technical names of system objects. These include report names, program names,
transaction codes, table names, and key concepts of a programming language when they
are surrounded by body text, for example, SELECT and INCLUDE.

Example Output on the screen. This includes file and directory names and their paths, messages,
names of variables and parameters, source text, and names of installation, upgrade and
database tools.

Example Exact user entry. These are words or characters that you enter in the system exactly as they
appear in the documentation.

<Example> Variable user entry. Angle brackets indicate that you replace these words and characters
with appropriate entries to make entries in the system.

EXAMPLE Keys on the keyboard, for example, F 2 or E N T E R .

CUSTOMER Enhancement of ERP IDOC Inbound Interface for Sales Order Creation
2 © 2014 SAP AG or an SAP affiliate company. All rights reserved. Typographic Conventions
Document History

Version Date Change

0.1 2014-03-25 Creation

1.0 2014-03-27 Released to Customer - Note 1996874

2.0 2014-05-14 Released to Customer - Note 2003665

Enhancement of ERP IDOC Inbound Interface for Sales Order Creation CUSTOMER
Document History © 2014 SAP AG or an SAP affiliate company. All rights reserved. 3
Table of Contents

1 Overview ................................................................................................................................................... 5
1.1 Prerequisites ............................................................................................................................................................5
1.2 Business Scenario ...................................................................................................................................................5
1.3 Assumptions ............................................................................................................................................................8
1.4 Glossary ....................................................................................................................................................................8

2 Transfer Rich-config XML by own IDOC Segment ............................................................................... 10


2.1 Introduction ............................................................................................................................................................ 10
2.2 Details and Execution ............................................................................................................................................ 10
2.2.1 IDOC Extension Type ............................................................................................................................ 10
2.2.2 IDOC Outbound ......................................................................................................................................11
2.2.3 IDOC Inbound .........................................................................................................................................11
2.2.4 Order Creation ........................................................................................................................................11

3 Retrieve Rich-config XML from External Source ................................................................................. 13


3.1 Introduction ............................................................................................................................................................ 13
3.2 Details and Execution ............................................................................................................................................ 13

4 Dark Configuration by SSC ................................................................................................................... 16


4.1 Introduction ............................................................................................................................................................ 16
4.2 Details and Execution ............................................................................................................................................ 16
4.3 Restricted Usage.................................................................................................................................................... 16

CUSTOMER Enhancement of ERP IDOC Inbound Interface for Sales Order Creation
4 © 2014 SAP AG or an SAP affiliate company. All rights reserved. Table of Contents
1 Overview

1.1 Prerequisites

Make sure that the following prerequisites are met:


FBS Solution Sales Configurator (SSC) add-on for SAP ERP has been installed with latest support package level.
In case of release 1.0, support package < 04 ensure that note 2003665 has been implemented (incl. pre- and
post-installation steps). Note 2003665 requires the implementation of further notes: 1991156, 1996874,
2006212, 1923474, 1880466.

1.2 Business Scenario

You send IDOCs from a source- to a target system: Source system might be an SAP- or third-party system with
SSC add-on installed. Target system is SAP ERP system with SSC add-on installed.
You use ORDERS IDOC inbound interface in the target ERP system to create sales documents with configured
items.
You use basic IDOC type ORDERS05 and standard inbound function module IDOC_INPUT_ORDERS for IDOC
processing:

ECC 6.0
IDOC Outbound

IDOC Inbound IDOC_INPUT_ORDERS


SAP/3rd Party

IDOC Solution Sales


VA01
Solution Sales ORDERS05 Configurator
Configurator

Sales Order

Enhancement of ERP IDOC Inbound Interface for Sales Order Creation CUSTOMER
Overview © 2014 SAP AG or an SAP affiliate company. All rights reserved. 5
An ERP solution configuration created by SSC has two flavors at the same time:
1. The so called Advanced Mode model that contains the complete solution configuration (e.g. incl. ADT cstics).
The results of the advanced mode configuration are returned and stored by SSC in the so called rich-config XML
format.
2. The so called Classic Mode model, also called Passive Receiving Structure (PRS), that contains only those parts
of the configuration that are relevant for low-level configuration and production processes in SAP ERP.
The PRS is returned and stored by SSC in the so called CBase format.

Basic IDOC type ORDERS05 provides a set of segments to transfer configuration results: E1CUCFG, E1CUINS, etc.
Those segments must be used to transfer the PRS.
As of today, the rich-config XML cannot be transferred by a standard IDOC type or BAPI.

Problem: If you only can create sales orders by IDOCs that contain the PRS configuration results, but not the rich-
config XML, then users cannot see the full advanced mode configuration when they try to open the configuration
manually in that sales order.

To solve this problem, notes 1996874 and 2003665 enhance IDOC inbound processing in the following way:
Enhancement of inbound function module IDOC_INPUT_ORDERS:
o New user-exit that allows customers to read rich-config XML from own IDOC segment(s) or fetch the XML
from an external source (e.g. by an own web service).
o Functionality to export the retrieved XML(s) to ABAP memory.
Enhancement of sales document creation process:
o If an XML is found in ABAP memory, it will be imported from memory.
o The XML will be assigned to the corresponding sales item.

CUSTOMER Enhancement of ERP IDOC Inbound Interface for Sales Order Creation
6 © 2014 SAP AG or an SAP affiliate company. All rights reserved. Overview
Before:

ECC 6.0
IDOC Outbound
IDOC
IDOC Inbound IDOC_INPUT_ORDERS
ORDERS05

Parse
IDOC

Check export Config in


Config Memory

VA01

import

Sales Order

After (note 1996874):

ECC 6.0
IDOC Outbound
IDOC
ORDERS05
IDOC Inbound IDOC_INPUT_ORDERS

Parse
IDOC Rich-Config
User-Exit
export

Check export Config + XML


Config in Memory

VA01

import

Sales Order

In that way you can create a sales document with configured items by IDOC; and when you open the configuration
afterwards in SSC UI, you will see the full advanced mode model.

Enhancement of ERP IDOC Inbound Interface for Sales Order Creation CUSTOMER
Overview © 2014 SAP AG or an SAP affiliate company. All rights reserved. 7
1.3 Assumptions

This user guide is based on the assumption that you have some level of familiarity with the terminology and
functions associated with SAP Solution Sales Configurator and ERP ORDERS IDOC interface.
The aim of this user guide is to provide you with the information you need to make use of the enhancements
provided by notes 1996874 and 2003665.
It is assumed that you have already customized ORDERS IDOC inbound interface in target ERP system and that
you are already able to create sales documents by basic IDOC type ORDERS05. It is assumed that those sales
documents are already created with the correct PRS configuration and that only the rich-config XML is missing.
Items out of scope are especially, but not limited to the following processes and functions:
Transfer and storage of custom relations in table /SLCE/IRT
IDOC outbound interface
IDOC interface for order change
Other IDOC interfaces or BAPIs

1.4 Glossary

Term Abbreviation Definition

Focused Business Solution FBS SAP product category delivered to


customers by SAP Custom
Development

Solution Sales Configurator SSC SAP's configurator tailored for


solution- and high volume
businesses

Solution Modeling Environment SME Eclipse plugin delivered with the


SSC FBS to create advanced mode
models

Variant Configurator VC SAP's product configurator


integrated into SAP ERP processes

Internet Pricing Configurator IPC SAP's sales configurator integrated


into SAP CRM processes

Classic Mode Model Product model created for VC or


IPC (comprised of material master,
classification, dependencies, etc.)

Advanced Mode Model Product model created in SME for


SSC

CBase Database tables where the


configuration results are stored

Rich-Configuration XML Rich-Config XML XML representation of the


configuration results of an

CUSTOMER Enhancement of ERP IDOC Inbound Interface for Sales Order Creation
8 © 2014 SAP AG or an SAP affiliate company. All rights reserved. Overview
Term Abbreviation Definition
advanced mode model

Passive Receiving Structure PSR Classic mode model used in SAP


ERP in combination with an
advanced mode model to take
configuration results needed for
low-level configuration and
production processes.

Bill of Material BOM

Characteristic cstic

Abstract Data Type Characteristic ADT cstic New cstic type introduced with
advanced mode modeling. Cstic
values are references to
instantiated classes.

Configurable Material KMAT

Enhancement of ERP IDOC Inbound Interface for Sales Order Creation CUSTOMER
Overview © 2014 SAP AG or an SAP affiliate company. All rights reserved. 9
2 Transfer Rich-config XML by own IDOC
Segment

2.1 Introduction

You want to transfer the rich-config XML additionally to the PRS as part of the IDOC.

2.2 Details and Execution

It is not possible to deliver a new IDOC type by OSS note. We will deliver a new IDOC type /SLCE/ORDERS05 with
next support package SSC 1.0 SP04.
You will be able to process this new IDOC type with standard inbound function module IDOC_INPUT_ORDERS like
IDOC type ORDERS05 today.
IDOC type /SLCE/ORDERS05 will be a copy of IDOC type ORDERS05 with an additional segment
/SCLE/E1CUXML that can take the rich-config XMLs for configurable main items. /SCLE/E1CUXML will have the
same structure as described for ZCUXML in the following sub-chapter.
Until support package 04 will be released or as a general alternative, you could use own IDOC extension type as
described in the following sub-chapters.

2.2.1 IDOC Extension Type

Create new IDOC extensions type for basic type ORDERS05.


Add an optional new segment ZCUXML on hierarchy level 2 (like E1CUCFG). Maximum occurrence: 99999.
Segment ZCUXML will have three fields:
- Field name POSEX, data element CHAR6, export length 6: field for corresponding item number
- Field name LINE_NO, data element /SLCE/LINE_NO: sequence of XML parts
- Field name CONTENT, data element /SLCE/CUXML: XML data
Please refer also to DDIC structure /SLCE/S_CUXML with the same fields.
Update IDOC inbound customizing in the way that extension type is used instead of basic IDOC type ORDERS05.

CUSTOMER Enhancement of ERP IDOC Inbound Interface for Sales Order Creation
10 © 2014 SAP AG or an SAP affiliate company. All rights reserved. Transfer Rich-config XML by own IDOC Segment
2.2.2 IDOC Outbound

We will focus in this document on IDOC inbound in the target system, not on IDOC creation in source system; but
for an example how to read the rich-config XML and convert it into the required IDOC segment format, please
refer to method READ_XML_FROM_DB of class /SLCE/CL_XML_UTIL.
You will have to transfer a rich-config XML additionally to the PRS for each main item with an advance mode
model.
As the XML will be bigger than what can be transferred by a single ZCUXML segment, you will have to split the
XML into several lines/IDOC segments as shown in method READ_XML_FROM_DB.
So for a single configurable main item you will have several ZCUXML segments with same POSEX, but different
LINE_NOs.

2.2.3 IDOC Inbound

IDOC segments are parsed by inbound function module IDOC_INPUT_ORDERS in sub-routine


INTERPRET_IDOC_ORDERS.
The sub-routine loops over all IDOC segments. At the beginning of the loop exists an explicit enhancement point
LVEDAF2U_01 (of enhancement spot ES_SAPLVEDA). We have implemented that enhancement point with
enhancement implementation /SLCE/EHI_IDOC_ORD_01_SAPLVEDA. In that way new sub-routine
GET_RICH_CONFIG_XML of new module pool /SLCE/IDOC_ORDERS is invoked for each segment before
standard code is processed.
Sub-routine GET_RICH_CONFIG_XML contains an example implementation how to read the new IDOC segment
with XML data and how to export it to ABAP memory.
It furthermore provides an explicit enhancement point GET_RICH_CONFIG_XML_01 (new enhancement spot
/SLCE/ES_IDOC_ORDERS). Please implement this enhancement point analogously:
Press Enhance (Shift+F4) button,
right-click on the enhancement point name,
in context menu choose Enhancement Operations -> Create Implementation

Remark: With note 1996874 not only enhancement-point LVEDAF2U_01 in sub-routine


INTERPRET_IDOC_ORDERS has been implemented, but also enhancement point LVEDAF2P_01 in sub-routine
INITIALIZE_ORGANIZATIONAL_DATA. Please refer to enhancement implementation
/SLCE/EHI_IDOC_ORD_00_SAPLVEDA. It invokes new sub-routine INIT_GLOBAL_DATA to reset global variables
(used in sub-routine GET_RICH_CONFIG_XML) each time when a new IDOC is being processed.

2.2.4 Order Creation

Function module V45CU_CONFIGURATION has been enhanced in the way that new sub-routine
PROCESS_RICH_CONFIG_XML is invoked:

Enhancement of ERP IDOC Inbound Interface for Sales Order Creation CUSTOMER
Transfer Rich-config XML by own IDOC Segment © 2014 SAP AG or an SAP affiliate company. All rights reserved. 11
PERFORM process_rich_config_xml(/slce/idoc_orders)
USING it_application_input[].

* call configurator
case lv_ctype.
when gc_r3_config.

Function module V45CU_CONFIGURATION is executed always when a configurable item is being processed;
independently of whether this is done by opening the configurator manually in a sales document, by creating the
sales document by SAP CRM middleware, or by creating the sales document by IDOC or BAPI.
In any case PROCESS_RICH_CONFIG_XML will check if rich-config XML has been exported before to ABAP
memory [by method /SLCE/CL_XML_UTIL =>EXPORT_XML_TO_MEMORY()]. If not, it will not do anything. If
XML is available, it will check if XML belongs to the current item. If yes, it will be assigned to the current item. The
XML will be stored on database when the document will be stored.

CUSTOMER Enhancement of ERP IDOC Inbound Interface for Sales Order Creation
12 © 2014 SAP AG or an SAP affiliate company. All rights reserved. Transfer Rich-config XML by own IDOC Segment
3 Retrieve Rich-config XML from External
Source

3.1 Introduction

You don't want to change IDOC type ORDERS05 as described in chapter 2, but you want to fetch the rich-config
XML from an external source while IDOC is being processed.

3.2 Details and Execution

Incoming ORDERS IDOCs are processed by function module IDOC_INPUT_ORDERS. IDOC segments are parsed
there by sub-routine INTERPRET_IDOC_ORDERS.
The sub-routine loops over all IDOC segments. At the beginning of the loop exists an explicit enhancement point
LVEDAF2U_01 (of enhancement spot ES_SAPLVEDA). We have implemented that enhancement point with
enhancement implementation /SLCE/EHI_IDOC_ORD_01_SAPLVEDA. In that way new sub-routine
GET_RICH_CONFIG_XML of new module pool /SLCE/IDOC_ORDERS is invoked for each segment before
standard code is processed.
Sub-routine GET_RICH_CONFIG_XML contains an example implementation how to read IDOC segments with XML
data and how to export it to ABAP memory.
It furthermore provides an explicit enhancement point GET_RICH_CONFIG_XML_01 (new enhancement spot
/SLCE/ES_IDOC_ORDERS). You have to implement this enhancement point:
Press Enhance (Shift+F4) button,
right-click on the enhancement point name,
in context menu choose Enhancement Operations -> Create Implementation

Import parameters of sub-routine GET_RICH_CONFIG_XML provide access to


full IDOC data of all IDOCs that might be processed in a bulk (parameters PIT_IDOC_CONTROL and
PIT_IDOC_DATA).
number of IDOC that is currently being processed (parameter PIV_DOCNUM). Can for example be used to
access corresponding control data in PIT_IDOC_CONTROL.
parsed IDOC data (parameters PIS_XVBAK, PCT_XVBAP, PCT_XVBEP, etc.). Those parameters are empty at
the beginning and filled more and more after corresponding IDOC segments have been processed.
error messages occurred (parameter PCT_ERRTAB). You can add own error messages to stop sales
document creation.

In your implementation you have to take care that it will be executed several times: for each segment in the IDOC
once.

Enhancement of ERP IDOC Inbound Interface for Sales Order Creation CUSTOMER
Retrieve Rich-config XML from External Source © 2014 SAP AG or an SAP affiliate company. All rights reserved. 13
Let's assume that we are processing an IDOC with two configurable main items, each with several sub-items. In
that case sub-routine GET_RICH_CONFIG_XML will be executed several times; for example once for the order
header (segment E1EDK01) and for each main- and sub-item (segment E1EDP01).
Let's assume that you have implemented a web service in your source system that can be called to retrieve the
rich-config XML for a certain item corresponding to a certain IDOC. Let's assume that you have to provide the
IDOC number and the item number to get the rich-config XML.
In that case your implementation could look like this:

[1]
If segment name in PIS_IDOC_DATA equals 'E1EDP01', then get item number (POSEX) and
parent item number (UEPOS) from segment data. IDOC number is already available by
import parameter PIV_DOCNUM.
If parent item number is initial, then call web service and provide IDOC number and
item number.
If an error occurs, then fill changing parameter PCT_ERRTAB accordingly.
If web service returns an XML string, split the string into chunks that fit into data
element /SLCE/CUXML. Take care that you do not remove leading- or trailing blanks
unintentionally. Iterate through those chunks, fill work area LS_XML_EXT, and insert
it into global internal table GT_XML_EXT.
Fill LS_XML_EXT as follows: LS_XML_EXT-POSEX must be the item number with leading
zeros. LS_XML_EXT-LINE_NO must be the sequential number of the XML chunk (also with
leading zeros). LS_XML_EXT-CONTENT must be the XML chunk.

This code should then get two XMLs, one for each main item, and insert them into internal table GT_XML_EXT.
GT_XML_EXT will be exported to memory by sub-routine GET_RICH_CONFIG_XML if flag
GV_EXPORT_TO_MEMORY has been set to 'X'.

But when should GV_EXPORT_TO_MEMORY be set to 'X'? Answer: When you are done with filling GT_XML_EXT
and ready for export to memory. In our example this would be the case after processing the last main item.
You could for example count number of main items once and store it in global attribute GV_EXPECTED_LINES:

[2]
If segment name equals ' E1EDK01', then loop over all IDOC segments in PIT_IDOC_DATA
where IDOC number (DOCNUM) equals PIV_DOCNUM and segment name (SEGNAM) equals
'E1EDP01' and parent item number (UEPOS) is initial: Increase GV_EXPECTED_LINES by 1.

Each time you have found a main item in [1] above, you could decrease GV_EXPECTED_LINES by 1. Then you
can calculate:

[3]
gv_export_to_memory = boolc( gv_expected_lines EQ 0 AND gt_xml_ext IS NOT INITIAL ).

The correct order of the above pseudo code snippets in your enhancement point implementation would be [2],
[1], and [3]. Then, sub-routine GET_RICH_CONFIG_XML would export the XML(s) to ABAP memory by method
/SLCE/CL_XML_UTIL =>EXPORT_XML_TO_MEMORY().

CUSTOMER Enhancement of ERP IDOC Inbound Interface for Sales Order Creation
14 © 2014 SAP AG or an SAP affiliate company. All rights reserved. Retrieve Rich-config XML from External Source
After parsing the IDOC, function module IDOC_INPUT_ORDERS will invoke transaction VA01 in batch input mode
to create the order. Please refer to chapter 2.2.4 to learn how the XML that has just been exported to ABAP
memory will then be assigned to the corresponding item during sales documents creation.

Remark: With note 1996874 not only enhancement-point LVEDAF2U_01 in sub-routine


INTERPRET_IDOC_ORDERS has been implemented, but also enhancement point LVEDAF2P_01 in sub-routine
INITIALIZE_ORGANIZATIONAL_DATA. Please refer to enhancement implementation
/SLCE/EHI_IDOC_ORD_00_SAPLVEDA. It invokes new sub-routine INIT_GLOBAL_DATA to reset global variables
(used in sub-routine GET_RICH_CONFIG_XML) each time when a new IDOC is being processed.

Enhancement of ERP IDOC Inbound Interface for Sales Order Creation CUSTOMER
Retrieve Rich-config XML from External Source © 2014 SAP AG or an SAP affiliate company. All rights reserved. 15
4 Dark Configuration by SSC

4.1 Introduction

Executing the configurator in background mode without any user interaction is called dark configuration.
You will have to set SCE (external sales configuration) flag to 1 in segment E1CUCFG for IDOCs that contain SSC
configurations. During IDOC inbound SCE configurations will be stored in data base without invoking the
configurator in background mode. This is different to VC configurations where VC is executed during IDOC
inbound.
Note 2003665 introduces a switch that can be used to force the system to trigger SSC in background mode
during IDOC inbound.

4.2 Details and Execution

If you want to enable the switch, you will have to invoke new function module /SLCE/DARK_CONFIG_SET with
input parameter IV_SWITCH = 'X'. This must be done in one of the enhancement-points in function module
IDOC_INPUT_ORDERS before IDOC_INPUT_ORDERS calls transaction VA01.
We have enhanced function module V45CU_CONFIGURATION in the way that it checks if the switch has been set.
If yes, it will trigger the dark configuration. If not, it will simply store the configuration.

4.3 Restricted Usage

The functionality of dark configuration by SSC provided by note 2003665 may only be used and will only be
supported for the following use case:
- Orders IDOC inbound (IDOC types ORDERS05 or /SLCE/ORDERS05)
- IDOC only contains item details of the configurable main item
- IDOC does not contain any item details of the main item’s sub-items
- SCE flag set to 1
- IDOC may contain the PRS configuration (only config details of root instance or full configuration results)
- IDOC must contain the full rich-config XML or must fetch it during IDOC inbound
In that case SSC may be used in background mode during IDOC inbound to take the rich-config XML, re-iterate
the configuration, and explode the BOM to generate the sub-items that are not part of the IDOC.
It is not possible to change sub-item details by IDOC or BAPI when SSC is invoked in background.

CUSTOMER Enhancement of ERP IDOC Inbound Interface for Sales Order Creation
16 © 2014 SAP AG or an SAP affiliate company. All rights reserved. Dark Configuration by SSC
www.sap.com/contactsap

Enhancement of ERP IDOC Inbound Interface for Sales Order Creation CUSTOMER
Dark Configuration by SSC © 2014 SAP AG or an SAP affiliate company. All rights reserved. 17
© 2014 SAP AG or an SAP affiliate company. All rights reserved.
.

CUSTOMER Enhancement of ERP IDOC Inbound Interface for Sales Order Creation
18 © 2014 SAP AG or an SAP affiliate company. All rights reserved. Dark Configuration by SSC