on 04-04-2012 2:50 PM
Hi Experts,
IDoc has a limitation of 999 line items so I am trying to write a UDF to create multiple IDoc.
My Source structure looks like:
MT_Source 1..1
Recordset 1..1
Source_Data 0..unbounded
S1 0..1
S2 0..1
S3 0..1
S4 0..1
The UDF I wrote for testing is of form "Context" and the code is as mentioned below:
int idocCounter = 1;
for (int i=1;i<Source_Data.length;i++)
{
idocCounter++;
if ( idocCounter==5)
{
idocCounter = 1;
result.addContextChange();
}
}
I have put 6 occurences of "Source_Data" node in the "testing" tab and put the check at 5 in UDF. So, Now, 2 IDoc nodes should be created but I am getting the below error as:
Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD
I request you to please help me in this regard and let me know what am I doing wrong here ?
Regards,
Arkesh
Hi,
The problem doesn't seem to be connected with the UDF itself. Most probably you did not put any value to MT_Source or Recordset nodes, which are obligatory in your structure (1..1 occurrence). Map some value to them (even a constant would be fine) to get rid of this error.
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Greg,
The nodes (MT_Source and Recordset) are at the source side so I dont think this should be a problem even if I dont map anything at the source structure to the target IDoc.
I have already mapped MT_Source to the target IDoc node ACC_EMPLOYEE_EXP. I havent done anything for the recordset as it only occurs once. Let me try that as well and I will get back to you.
Thanks,
Arkesh
Dear Arkesh,
Ok, now I get it. I didn't notice initially that what you provided was the source, not the target structure. Anyway, this is what your error description says: the problem is caused by some mandatory element not being created, because it is either not mapped, or the source field for it has no values in your test case.
Hope this helps,
Greg
Hi Greg,
The problem was that I did not import IDoc as an XSD and didnt change the occurence to "0..unbounded" in the target XSD so the issue was occurring. But now, I am stuck with a new problem.. The line in the UDF "result.addContextChange();" is Not working fine for me.. I am unable to identify the cause of the issue for this one now..
Hope you have given execution type as "All Values of Queue".
You will find ResultList result as an argument in the method.
So, you are using the result object which is an instance of ResultList Class.
result.addContextChange();
refer this thread
Hi,
See the following links:-
http://www.saptotal.com/AddContextChangeUDF.html
http://help.sap.com/saphelp_nw04/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/content.htm
http://scn.sap.com/thread/851887
Hope it helps.
Regards,
Atul
The issue was resolved by modifying the code to suit the requirement and also by adding the statement
result.addValue(ResultList.CC);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.