cancel
Showing results for 
Search instead for 
Did you mean: 

keyFieldValue for incrementing key value in a range of (01001 - 09998)

Former Member
0 Kudos

Hi Guys,

I have to use keyFieldValues for the below file structure.

please suggest what will be the keyFieldValues for the below marked record.

00001,3550 ,201104170001,201104172400

00010,3550 ,201104170001,201104172400,01,W

01001,2.6, ,2.725, ,2.93, ,2.69, ,2.865, ,3.06, ,2.77, ,3.05, ,3.235, ,2.915, ,3.115, ,2.795, ,2.8, ,2.81, ,2.705, ,3.03, ,3.92, ,4.105, ,3.33, ,3.245, ,3.535, ,3.615, ,3.47, ,3.19,

01002,3.325, ,2.9, ,3.27, ,3.035, ,2.99, ,3.43, ,4.19, ,3.255, ,3.62, ,3.29, ,3.69, ,3.23, ,3.315, ,3.24, ,3.36, ,3.075, ,3.025, ,3.22, ,2.99, ,3.295, ,3.285, ,2.9, ,2.79, ,2.81,

00001,6567 ,201104170001,201104182400

00010,6567 ,201104170001,201104182400,01,W

01001,0.6, ,0.946, ,0.669, ,1.4, ,0.504, ,0.945, ,0.39, ,0.691, ,1.05, ,0.853, ,0.404, ,0.427, ,0.594, ,0.417, ,0.42, ,0.417, ,0.721, ,0.459, ,1.164, ,0.763, ,1.638, ,1.045, ,0.729, ,0.754,

01002,1.518, ,0.726, ,0.744, ,0.398, ,0.732, ,1.156, ,0.429, ,0.649, ,0.388, ,0.383, ,0.711, ,0.376, ,1.304, ,0.365, ,0.707, ,0.696, ,0.688, ,1.421, ,1.121, ,0.621, ,0.743, ,0.659, ,0.41, ,0.77,

01003,0.454, ,0.409, ,0.769, ,0.427, ,0.46, ,0.875, ,0.48, ,0.61, ,0.366, ,0.881, ,0.427, ,0.888, ,1.122, ,1.307, ,0.393, ,0.739, ,0.384, ,0.705, ,0.366, ,0.398, ,1.319, ,0.369, ,0.506, ,0.554,

01004,0.374, ,0.364, ,0.373, ,0.365, ,0.37, ,0.374, ,1.264, ,0.365, ,0.365, ,0.378, ,0.723, ,0.391, ,1.064, ,0.815, ,0.694, ,0.713, ,1.046, ,0.731, ,0.776, ,0.532, ,0.596, ,0.634, ,0.526, ,0.568,

00001,12691 ,201104140001,201104182400

00010,12691 ,201104140001,201104182400,01,W

01001,1.518, ,1.531, ,1.514, ,1.52, ,1.529, ,1.529, ,1.51, ,1.522, ,1.525, ,1.524, ,1.514, ,1.519, ,1.529, ,1.535, ,1.533, ,1.558, ,1.579, ,1.571, ,1.564, ,1.575, ,1.571, ,1.575, ,1.574, ,1.561,

01002,1.56, ,1.566, ,1.565, ,1.579, ,1.568, ,1.578, ,1.59, ,1.579, ,1.57, ,1.557, ,1.553, ,1.554, ,1.55, ,1.544, ,1.552, ,1.536, ,1.542, ,1.554, ,1.528, ,1.542, ,1.534, ,1.526, ,1.532, ,1.539,

01003,1.528, ,1.524, ,1.524, ,1.523, ,1.52, ,1.519, ,1.52, ,1.525, ,1.507, ,1.522, ,1.523, ,1.526, ,1.53, ,1.531, ,1.538, ,1.56, ,1.538, ,1.562, ,1.576, ,1.584, ,1.589, ,1.591, ,1.574, ,1.6,

01004,1.593, ,1.578, ,1.581, ,1.594, ,1.602, ,1.596, ,1.593, ,1.604, ,1.584, ,1.566, ,1.566, ,1.571, ,1.561, ,1.558, ,1.558, ,1.55, ,1.544, ,1.552, ,1.546, ,1.544, ,1.534, ,1.524, ,1.53, ,1.507,

01005,1.532, ,1.514, ,1.524, ,1.509, ,1.525, ,1.522, ,1.508, ,1.518, ,1.522, ,1.507, ,1.515, ,1.507, ,1.518, ,1.525, ,1.508, ,1.527, ,1.548, ,1.555, ,1.544, ,1.541, ,1.557, ,1.556, ,1.564, ,1.564,

01006,1.556, ,1.563, ,1.541, ,1.557, ,1.548, ,1.55, ,1.553, ,1.551, ,1.556, ,1.564, ,1.557, ,1.548, ,1.55, ,1.539, ,1.544, ,1.519, ,1.544, ,1.539, ,1.528, ,1.526, ,1.528, ,1.527, ,1.53, ,1.513,

01007,1.527, ,1.512, ,1.528, ,1.501, ,1.519, ,1.504, ,1.518, ,1.521, ,1.512, ,1.518, ,1.524, ,1.505, ,1.531, ,1.514, ,1.518, ,1.533, ,1.536, ,1.539, ,1.55, ,1.555, ,1.558, ,1.582, ,1.572, ,1.575,

01008,1.58, ,1.582, ,1.58, ,1.588, ,1.579, ,1.575, ,1.586, ,1.567, ,1.561, ,1.561, ,1.568, ,1.557, ,1.554, ,1.562, ,1.547, ,1.556, ,1.542, ,1.544, ,1.513, ,1.532, ,1.519, ,1.527, ,1.535, ,1.52,

01009,1.521, ,1.513, ,1.522, ,1.508, ,1.52, ,1.504, ,1.521, ,1.504, ,1.524, ,1.51, ,1.515, ,1.52, ,1.513, ,1.541, ,1.521, ,1.556, ,1.567, ,1.564, ,1.566, ,1.576, ,1.575, ,1.578, ,1.579, ,1.595,

01010,1.594, ,1.597, ,1.591, ,1.61, ,1.634, ,1.634, ,1.618, ,1.601, ,1.603, ,1.606, ,1.595, ,1.56, ,1.575, ,1.577, ,1.561, ,1.536, ,1.582, ,1.565, ,1.538, ,1.546, ,1.544, ,1.553, ,1.53, ,1.534,

For the 1st record the key = 00001, for second record key = 00010.

Please suggest what should be the keyFieldValue for the next structure.

Here, the range is from 01001 - 09998

Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Ashish,

you can follow these steps

1. No need to use key field structure.

2. Use FCC to read all the lines

Say for the file structure as shown

00001,3550 ,201104170001,201104172400

00010,3550 ,201104170001,201104172400,01,W

01001,2.6, ,2.725, ,2.93, ,2.69, ,2.865, ,3.06, ,2.77, ,3.05, ,3.235, ,2.915, ,3.115, ,2.795, ,2.8, ,2.81, ,2.705, ,3.03, ,3.92, ,4.105, ,3.33, ,3.245, ,3.535, ,3.615, ,3.47, ,3.19,

01002,3.325, ,2.9, ,3.27, ,3.035, ,2.99, ,3.43, ,4.19, ,3.255, ,3.62, ,3.29, ,3.69, ,3.23, ,3.315, ,3.24, ,3.36, ,3.075, ,3.025, ,3.22, ,2.99, ,3.295, ,3.285, ,2.9, ,2.79, ,2.81,

09999,0000000005

After FCC you should be getting something like this structure

<MT_mesg_source>

<ROW>00001,3550,201104170001,201104172400</ROW>

<ROW>00010,3550,201104170001,201104172400,01,W</ROW>

<ROW>01001,2.6, ,2.725, ,2.93, ,2.69, ,2.865, ,3.06, ,2.77, ,3.05, ,3.235, ,2.915, ,3.115, ,2.795, ,2.8, ,2.81, ,2.705, ,3.03, ,3.92, ,4.105, ,3.33, ,3.245, ,3.535, ,3.615, ,3.47, ,3.19, </ROW>

<ROW>01002,3.325, ,2.9, ,3.27, ,3.035, ,2.99, ,3.43, ,4.19, ,3.255, ,3.62, ,3.29, ,3.69, ,3.23, ,3.315, ,3.24, ,3.36, ,3.075, ,3.025, ,3.22, ,2.99, ,3.295, ,3.285, ,2.9, ,2.79, ,2.81, </ROW>

<ROW>09999,0000000005</ROW>

</MT_mesg_source>

Let us call this as MT1.

3. Validate this message if required. In PI 7.0 we use java mapping to validate this structure.

4. Now you need to get individual fields from comma separeted values. For this use java mapping. Within Mapping use the "split" function to obtain each of the field values.

5. Create a message structure called MT2. Say a structure such as shown below


<mt2>
   <f1>
          <f11/>
          <f12/>
   </f1>
</mt2>

populate this message structure using java mapping to each of its individual fields.

If your file size is not large use DOM parser.

6. Now after you have achieved this.Assuming you are working on a file to idoc scenario. Import the idoc into 3rd message type say MT3. just perform a simple graphical mapping between MT2 and MT3.

7. In ID part perform neccessary configuration changes.

In case you need help with java mapping refer to following link

http://wiki.sdn.sap.com/wiki/display/XI/BeginnersguidetoJavamappingusingDOMparserinSAPXI

Hope this helps

Regards

Anupam

Answers (1)

Answers (1)

sunilchandra007
Active Contributor
0 Kudos

Hi Ashish,

Key field identification seems difficult in your case. The clean solution will be to use a custom adaptor module before using FCC. The custom adapter module should create key field for the records having first field between 01001 and 09998. Also you can incorporate the validation to check continouity in the range 01001 - 09998 in the module.

Regards,

Sunil Chandra

Former Member
0 Kudos

Hi,

Is there any way i can do the same without using adapter module?

Shabarish_Nair
Active Contributor
0 Kudos

Using an adapter module also seems tricky here.

End of the day even if the module generates the key fields, how will you still do your XML conversion?

1. Either go for a Java mapping to parse the file

2. Write a FCC for around 8999 keyfields - this seems a massive thing to do