Skip to Content
Technical Articles

SAP PI/PO – B2B ADD ON – ZIDOC TO EDI 940

Hello Folks,

One more blog to make this community bigger and bigger – it’s a long blog I really hope you will not get bored easily.

Thanks, RAPHAEL DE SOUZA XAVIER my partner developer in this project.

Thanks, Roberto Cantero for the hints about B2B add on but in the end, I didn’t use the TPM functionality.

Before I start I would like to mention the other fantastic blogs (I did a compilation of all) examining the functionalities of – B2B ADD ON Toolkit the list below – There are many others but for me, this was enough to find a solution and understand the product:

  1. SAP PI B2B Add-on 3.0
  2. Simplify and accelerate B2B integration – SAP’s B2B add-on unveiled
  3. EDI to IDOC development using B2B Add-on in SAP PI/PO
  4. The new B2B Add-On for SAP NetWeaver Process Integration
  5. B2B Add-on implementation scenarios PO. Part I Inbound EDI
  6. B2B Add-on implementation scenarios PO. Part II Outbound EDI

Integration Details:

The SAP ECC ERP systems will send the custom DELVRY05, MATMAS05, CLFMAS02 IDOC’S type, and document file transfer PDF – all interfaces outbound asynchronous.

  • Delivery Order:
    • ZDESADV_XX.DELVRY05.Z1DEXXX – Delivery Order
    • DESADV.DELVRY05.ZDEL01XXX – Delivery Order
  • Sales Order:
    • EDI940 B2B ADD ON Schema – Sales Order – PROXY
  • Material Master:
    • ZMATMAS_XXX.MATMAS05.ZMATMAS5
  • Material Classification:
    • ZCLFMAS_XXX.CLFMAS02
  • Proxy with Attachment:
    • Stream PDF to attachment – PayloadSwapBean Module – Content-Type:application/pdf
  • External Definition EDI 940 – 004010

I will focus only on the EDI interfaces (Delivery Order) and DocumentSharing, Material Master and Material Classification it’s simple ZIDOC to Custom XML Schema.

Integration Diagram:

5 outbound interfaces will be sent from two different ERP systems and the receiver will be an intermediate validator system using AS2 Adapter under HTTPS + SLL + Signature + Encryption and the validation of the EDI940 based on the standard rules, after that forward to logistic system and clients will be happy to receive the goods in time.

Is it clear for you the integration aspects of this project? 

I think so let’s keep going

B2B ADD ON – Steps:

In the very well explained blog of NARSAIAH THOTTEMPUDI that I already mentioned on the list above let me recap the steps:

  • First Step: Enter to B2B Integration Cockpit

  • Second Step: EDI Content Manager

  • Third Step: EDI940 it is Ansi X.12 – Generate the XSD

The logistic company provides me the version: 004010

After clicking in the Start, the tool kit will generate the XML schema of the EDI for SAP product, you can’t use this with other platforms.

What are the next steps?

Now it’s time to have fun, So let’s ROCK!

Integration Development Steps:

  1. Repository:

    • External definition: ASC_940004010.xsd
    • Import the IDOCs XML structures
    • Message Mapping (I will not explain all logics this changes from business to business, there are many for each field)
      •  DocumentSharing Interface
      •  Delivery Order
      •  ISA Header EDI
      •  Set Control Number
      •  UDF – NTE Segment
    • Message Mapping – DocumentSharing
  2. Directory:

    • AS2 Adapter configuration

Process steps – Repository:

  • External definition: ASC_940004010.xsd

  • Import the IDOCs XML structures

  • Message Mapping – DocumentSharing

Basically this interface it’s outbound ABAP proxy with attachment, for this I created one generic XML just to setup the filename dynamic and extension of the file and the module localejbs/AF_Modules/PayloadSwapBean is responsible to ignore the MainPayload and Swap only the attachment with Content-Type: application/pdf

<?xml version="1.0" encoding="UTF-8"?>
<FileInfoGeneric>
   <Name>SCN TEST</Name>
</FileInfoGeneric>

Process steps – Dir

UDF – for all types of Adapters:

MappingTrace trace;
trace = container.getTrace();
trace.addInfo("FileName: " + FName);

try
{
	DynamicConfiguration conf=(DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

	// SAP standard
	DynamicConfigurationKey key=DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
	if (conf != null)	{ 
			 conf.put(key,FName); 
	 }

	// SAP SFTP Standard
	DynamicConfigurationKey sapSFTPkey=DynamicConfigurationKey.create("http://sap.com/xi/XI/System","FileName");
	conf.put(sapSFTPkey,FName); 

	// SFTP Seeburger
	DynamicConfigurationKey sftpkey=DynamicConfigurationKey.create("http://seeburger.com/xi/common","dtSubject");
	conf.put(sftpkey,FName);

	DynamicConfigurationKey sftpAN=DynamicConfigurationKey.create("http://seeburger.com/xi/common","dtAttachmentName");
	conf.put(sftpAN,FName);

	// AS2 Seeburger
	
	DynamicConfigurationKey as2Key=DynamicConfigurationKey.create("http://seeburger.com/xi/AS2","dtAS2FileName");
	conf.put(as2Key,FName);

}
catch (Exception e)
{
	return ("ERROR");
}

return (FName);

Test of UDF:

  • Message Mapping – Delivery Order

Delivery Order to ASC_940004010

  • ZDESADV_XX.DELVRY05.Z1DEXXX – Delivery Order – to – ASC_940004010
  • DESADV.DELVRY05.ZDEL01XXX – Delivery Order – to – ASC_940004010

I will present to you only one mapping to you understand how to proceed with it.

As you can see the external definition (ASC_940004010) there are they are own TAGS and properties generated by B2B ADD ON Toolkit, so it means that I just need a map one by one and it’s done?

NO chances…

The trick point, the business users are not able to understand what means XML TAGS as D_479, D_473, D_285, and others, you must be the middleware layer with them and using the descriptions – W0501 / W0503 because with this codes it’s they are expertise area.

In my case, I created the spreadsheet only with the descriptions codes and they were able to provide me the correspondent ZIDOC fields to XSD ASC_940004010.

  • Message Mapping – ISA Header EDI

Basically, all those fields are hardcode values that business and the external logistic system will provide you to hardcode with constant in the message mapping – samples below:

Sample of S_ISA/D_DATAELEMENTSEPARATOR (*)- The separator between the data:

Sample of S_ISA/D_SEGMENTTERMINATOR (~)- The separator between the data:

  • Message Mapping – Set Control Number

You need to create the range numbers dynamically for those fields, for that you can take look in the help SAP link below about

Configuring the Number Range Objects (NRO) Module

Configuring the Communication Channels with NRO Module

Configuration details:

How I will generate dynamically this control numbers for the fields :

The number range should be mapped to the target field as below. Use a Constant to assign with the value in the format ‘$B2B_UEBNR<Number Range Name>$B2B_END_UEBNR’.

  • /ns0:ASC940_004010/S_ISA/S_GS/S_ST/D_329

$B2B_UEBNRD_329_Number$B2B_END_UEBNR

  • /ns0:ASC940_004010/S_ISA/S_GS/S_ST/S_SE/D_96

$B2B_SEG_COUNTER – This one will be set up in the module, I will explain later.

  • /ns0:ASC940_004010/S_ISA/S_GS/S_ST/S_SE/D_329

  $B2B_UEBNRD_329_Number$B2B_END_UEBNR

  • /ns0:ASC940_004010/S_ISA/S_GS/S_GE/D_28 –

  $B2B_UEBNRXPO$B2B_END_UEBNR

  • /ns0:ASC940_004010/S_ISA/S_IEA/D_I12

$B2B_UEBNRXPO$B2B_END_UEBNR

  • Message Mapping – UDF – NTE Segment

Generate N NTE segments based on the context change of E1TXTH8 Segments and childrens.

I was really no able using the node context functions (remove context, slipt, etc..) standard provide correct logic for /ns0:ASC940_004010/S_ISA/S_GS/S_ST/S_NTE, I decide to apply custom UDF via Xpath developed by my work partner  RAPHAEL DE SOUZA XAVIER

UDF:

//UDF used to create a correspontent queue values for NTE validating if the TDID has the value which is passed by constant

for(int i = 0; i < E1TXTH8.length; i ++) {
	
	XPath xPath = XPathFactory.newInstance().newXPath();

	try {
	
	  String TDIDValue = xPath.evaluate("//TDID", new InputSource(new ByteArrayInputStream(E1TXTH8[i].getBytes())));
		NodeList E1TXTP8 = (NodeList) xPath.evaluate("//E1TXTH8/E1TXTP8",  new InputSource(new ByteArrayInputStream(E1TXTH8[i].getBytes())), XPathConstants.NODESET);
		
		for (int y = 0; y < E1TXTP8.getLength(); y++) {
			
			boolean createNode = false;
			NodeList list = E1TXTP8.item(y).getChildNodes();
		    
			for (int z = 0; z < list.getLength(); z++) {
		    	Node n = list.item(z);
					 if(n.getNodeName().equals("TDLINE") && TDIDValue.equals(TDID[0])) {
		    		createNode = true;
		    	}
		    }
		    
		    if(createNode)
		    	result.addValue("");
		    else
		    	result.addSuppress();
		    
		    createNode = false;
		}

	} catch (XPathExpressionException ex) {
		 trace.addWarning(ex.getMessage());
	}

}

Result Mapping:

Nice nice,  End? Not yet…

Process steps – Directory – AS2 Adapter:

I will just show the communication receiver AS2, there is nothing special in the ICO’s as the default of any type of integration.

The hot point where it’s about the module configuration to generate TEXT/PLAIN from XML based on the schema ASC_940004010 

Configuring the ANSI ASC X12-XML Converter Module

  • AS2 Adapter configuration

General tab:

Signature and encryption:

MDN:

Configuring the AS2 Receiver Channel

Module tab:

What means this configuration?

  • localejbs/TransmissionNumberModule it’s link with the value $B2B_SEG_COUNTER
    • /ns0:ASC940_004010/S_ISA/S_GS/S_ST/S_SE/D_96

This module will be responsible to count how many segments the XML contains.

  • localejbs/X12ConverterModule
    • will convert the XML ASC_940004010 to TEXT/PLAIN

Sample text using B2B ADD ON – Converter

Viana, I still see the values of $B2B_UEBNRD_329_Number$B2B_END_UEBNR and others, why if I set up the configuration and NRO Table?

Because it’s just simple text to see the XML conversion to TEXT/PLAIN so in this case the module configuration was not used just the result from Message Mapping.

XML to Ansi:

Process steps – Directory – SFTP Adapter:

Once again thanks and I hope with these blogs, information, compilations, and others will help you to design and develop integrations using the B2B ADD ON Tool kit from SAP.

If you have questions or additional information let me know.

Thanks,
Kind regards,
Viana.

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.