on 08-23-2016 9:11 PM
Hi All
We have a File to IDOC scenario.
It is a fixed length file.It contains 1 Header record with multiple line items.
if in Line item First 4 characters(field dealer) are blank then no IDOC should be created at ECC.
IDOC occurrence 0 to 1.
All the line items will be included in one IDOC.
Sample file
If file is as below IDOC should be created.This is working fine now.
Header: WXYZ2016-08-19 | 0000000001 |
Line Item: ABCDL03000000523.8000000000010000523.8000000000010000000001MZ350004
Requirement : if file is as below IDOC should not be created.
Header: WXYZ2016-08-19 | 0000000001 |
Line Item: L03000000523.8000000000010000523.8000000000010000000001MZ350004
Please help me on below questions:
1.When the occurrence is 0 to 1 can we suppress IDOC through mapping?
2.In receiver determination can we put a condition for not processing this file to ECC?
Thanks in advance!!
Hi Anitha,
Some comments:
1.When the occurrence is 0 to 1 can we suppress IDOC through mapping?
You mean there would be an idoc but no message type? Not sure what would happen.
2.In receiver determination can we put a condition for not processing this file to ECC?
This could work via the xpath function substring, but in your case since you are using multiline, there is a chance that some lines might have a value while others may not. If that happens, the message would still get created. Your best bet would be to use enhanced receiver determination.
Regards,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen
I am using Java mapping to convert fixed length file to XML.
So I am giving u input XML from mapping.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Indirect_Sales xmlns:ns0="urn:mmal.com.au:INT_689:Indirect_Sales">
<Sales>
<Header>
<DISTR_HEADER>XXXX</DISTR_HEADER>
<SALES_DATE>19.08.2016</SALES_DATE>
<FILLER/>
</Header>
<Detail>
<DEALER/>
<VEH_GROUP/>
<PRT_SLS_CODE/>
<FILLER1/>
</Detail>
</Sales>
</ns0:MT_Indirect_Sales>
Hi Mark
I used Java mapping because there is no constant value in input file(for FCC we must need some constant value to use as KEY field for Header and detail records). .
Finally we have decided to work with ABAP to have a batch job for collecting failed IDOCs with blank/invalid dealer and update them to have a status of No Further processing rather than suppressing at PI .
But I am interested to know for future use...why yours and Praveens XPATH conditions are not working for me .
Regards
Anitha
By the way, I'm not much experienced in FCC but It seems to me that in case of your file structure (one header line and multiple details) you don't need any keys. Try to set recordset structure as: Header,1,Details,* and set parameters for both recordsets. FCC should treat first line as Header and the rest lines as Details.
Regards, Evgeniy.
Hi Anitha,
You can do below approach.
Read the file line by line, use below FCC.
You will get the xml like below after FCC. You can see second line first 3 letters are blank.
<?xml version="1.0" encoding="utf-8"?>
<ns:FileSenderData xmlns:ns="http://mycompany.org">
<Record>
<Line>HH20160826</Line>
</Record>
<Record>
<Line> 1000XYZ</Line>
</Record>
<Record>
<Line>DEF2000PQR</Line>
</Record>
</ns:FileSenderData>
You can use below condition in Receiver Determination.
In message mapping using one UDF you can map header and detail.
Execution Type : All Values Of Queue
public void mapHeaderDetail(String[] line, ResultList headerField1Res, ResultList headerField2Res, ResultList detailRes,
ResultList detailField1Res, ResultList detailField2Res, ResultList detailField3Res, Container container)
throws StreamTransformationException {
boolean isFirst = true, isDetailFirst = true;
for (int i = 0; i < line.length; i++) {
if (!line[i].equals(ResultList.CC)) {
if (isFirst) {
isFirst = false;
headerField1Res.addValue(line[i].substring(0, 2));
headerField2Res.addValue(line[i].substring(2, 10));
} else {
if (isDetailFirst)
isDetailFirst = false;
else {
detailField1Res.addContextChange();
detailField2Res.addContextChange();
detailField3Res.addContextChange();
}
detailRes.addValue("");
detailField1Res.addValue(line[i].substring(0, 3));
detailField2Res.addValue(line[i].substring(3, 7));
detailField3Res.addValue(line[i].substring(7, 10));
}
}
}
}
Mapping Test:
Regards,
Praveen.
What is the buisness meanning of a line item in the file without the prefix charecters?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So its a case when the item's dealer is not provided by the sender system in the file?
If you have an external data source where the dealers are valid and maintained by the item then you can implement an enrichment pattern and add it to the IDoc during mapping using lookup..
You do understand that the customer wants you to handle bad business logic in the PI...
This is a good recipe for bad solution.
Hi Anitha!
If I understand your requirement right you need to create one IDOC containing all line items with non-empty dealer field. Or not to create IDOC if there are no line items with dealer field.
Is it correct?
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy
I tried placing creatif function.
It works fine when you test in mapping and shows like no IDOC created as output.
But if we test end to end message fails in PI.
SAP:Code area="IDOC_ADAPTER">ATTRIBUTE_IDOC_RUNTIME</SAP:Code>
<SAP:P1>MSGGUID A8FA96338F7F491C0C3BABFE7A6DE0A9: Tag found instead of tag IDOC BEGIN=</SAP:P1>
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText />
<SAP:Stack>Error: MSGGUID A8FA96338F7F491C0C3BABFE7A6DE0A9: Tag found instead of tag IDOC BEGIN=</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
Output payload:
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1 />
</ns0:Messages>
I seached SDN for this error and they requested to import meta data gain.check occurrence and all...
All I did but still same error.
Anitha,
One more way could be using Suppress in the UDF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anitha,
1.When the occurrence is 0 to 1 can we suppress IDOC through mapping?
->> you can modify the message mapping occurance ot 0..1 and put the condition on message node (above IDOC node). The older version of PI does not support multi mapping with IDOC adapter but it will work with version later 7.31. If you are running on older version then refer the below blog to change the ESR
2.In receiver determination can we put a condition for not processing this file to ECC?
-->> You can put the condition in receiver determination as xpath query.
refer the below wiki for xpath query
Xpath Condition in Receiver Determination - Process Integration - SCN Wiki
regards,
Harish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi harish
Thanks for your reply!!
I gone through the links and exported IDOC structure to XSD and modified occurrence(0 to 1) then imported as ED and created new MM and IM.
I am stuck at IM.if we use new MM with ED then target of IM should be service Interface with ED(Idoc structure).so I have to modify receiver service interface in ID from IDOC(original) to SI with ED.
Pls correct me if wrong.
Cming to Xpath I have put condition like this.but not working.
(/p1:MT_Indirect_Sales/Sales/Detail[substring(DEALER,1,2,3,4)!=' '] EX )
Regards
anitha
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.