cancel
Showing results for 
Search instead for 
Did you mean: 

Graphical or UDF

raviteja_satuluri
Contributor
0 Kudos

Hi friends,

I have One source filed Serial and One Target field SERIAL.

We will get production order details as an xml file from the sender system. PRDOrd is One segment in the xml file and the Serial filed in the PRDOrd Segment. If two PRDOrd segments are in the xml file and both have Serial fields that are not blank then each one would create a new segment ITEM_Create. we have another segment SerialNumber in that filed i have One filed say ITM this would be 0001 for the first segment ITEM_Create segment created and would be 0002 for the second segment ITEM_Create segment created.


The filed ITM references the # of ITEM_Create so that the Idoc knows which segment the Serial is relevant for **.

How can i achieve this, is it possible using Graphical Mapping or UDF.

Please help on this friends.  In case of UDF please provide the UDF.

Regards,

Teja

Accepted Solutions (1)

Accepted Solutions (1)

sahithi_moparthi
Contributor
0 Kudos


Hi,

You can acheive this using Graphical Mapping.Please Go through Node Functions.

raviteja_satuluri
Contributor
0 Kudos

Hi Sahithi,

Thanks for your reply.

Please tell me which node functions i need to use.

please share a view by taking the fields as input and output which i have mentioned above.

Thanks in advance,

Regards,

Teja.

sahithi_moparthi
Contributor
0 Kudos

Hi,

Please share your Source and Target Structure.

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Teja,

Can you please share proper screen shots of the fields which needs the mapping for better understanding of the requirement.

Regards

Vishnu

raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

Thanks for your reply.

Source structure :

Target Structures :

Regards,

Teja

raviteja_satuluri
Contributor
0 Kudos

I am using standard idoc MBGMCR.MBGMCR03

Regards,

Teja

sahithi_moparthi
Contributor
0 Kudos

Hi Teja,

Please try below logic:

-If Serial is not equals to empty then creat if Target ITEM_CREATE .

-Serial Number map with Counter value.

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Teja,

Can you try the below mapping.

Let me know if you face any issues.

Regards

Vishnu

raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

Thanks for your reply.

I have One segment Component under PRDOrd segment.

Component segment is repeating under PRDOrd segment.


ITM to increment by one for every new segment passing the rule.


For this is can i go for UDF or Graphical


If graphical please help me.


Thanks in advance,


Regards,

Teja.

raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

Thanks for your reply.

I need to create new idoc and new ITEM_CREATE segment in the idoc for each component segment of XML only when MIGO,SCRAP or AddMigo are not blank and if blank then no additional Item_create segment required and OrderId Target field in the segment created will be from ORD under PRDOrd segment.

Please help on this

Thanks in Advance.

Regards,

Teja.

sahithi_moparthi
Contributor
0 Kudos

Hi,

USe the same logic as above like:

If MIGO exists and not equals to empty AND SCRAP exists and not equals to empty AND AddMIGO exists and not equals to empty then create target i.e ITEM_Node.

If still issue persits please provide complete structure and the result you are expecting

raviteja_satuluri
Contributor
0 Kudos

Thanks for your reply Sahithi.

Can you help on below

Component segment is repeating under PRDOrd segment.


ITM to increment by one for every new segment passing the rule.


Regards,

Teja.

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Teja,

Try the below mapping.

Regards

Vishnu

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Teja,

If you don't have any queries left, then can you please close this thread..

Regards

raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

There may be some changes in requirement.
Once i have tested that the mapping is Ok, then definitely i will close the thread.

I will approach you and Sahithi if any thing required

Thanks a lot for your help 

Regards,

Teja.

raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

I am facing some problem while doing testing in Message Mapping.

In the Source structure I have CONTROL Records Under Control records I have Production Order Segment under Production Order I have Component Segment.

I need to

Create new IDOC and new ITEM_CREATE segment in the IDOC for each Component segment of XML only when MIGO, Scrap, or Add Migo are not blank


I have created one duplicate sub tree of component segment. but the idoc is not generated. is it possible in PI level testing to create the Idoc for every component segment or while we go for End to End testing will it succeed.


Please let me know if any mapping logic that the idoc should generate for every component segment of xml file.


Thanks in Advance.


Regards,

Kamal.



raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

from sender system I am getting one xml file. In that xml file may be we have two component segments. for every new component segment in xml file i need to create one new idoc.

I am doing testing in Test Tab of Message Mapping. When i am going to create two component the idoc is not created.

I am getting the above error.

Please help on this.

Regards,

Kamal.

sahithi_moparthi
Contributor
0 Kudos


Hi,

Have you used below logic for the IDOC.

If  MIGO or Scrap or AddMigo not equlas to null then create if  IDOC(ITEM_CREATE).

raviteja_satuluri
Contributor
0 Kudos

Yes I have used above logic

Regards,

Kamal

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Kamal,

From the error log, I think some issue is there while populating control record population for the second occurrence of the IDOC.

Can you check the mapping logic.

Regards

raviteja_satuluri
Contributor
0 Kudos

H

</MIGO>

If "X" then MOVE_TYPE defaulted to 261

<SCRAP/>

If "X" then MOVE_TYPE defaulted to 551

<AddMIGO/>

If "Y" then MOVE_TYPE defaulted to 261 and If "N" then MOVE_TYPE defaulted to 262

raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

Thanks for your reply.

I have 3 source fields and I need to map to single Target field.

Please check the table and provide me the logic

Thanks in advance,

Regards,

Kamal

sahithi_moparthi
Contributor
0 Kudos

Hi

you can try below logic:

MIGO -> Fixvalues X ->261 (Default ->262) or

SCRAP -> Fixvalues X ->551 (Default ->262) or

ADDMIGO -> Fixvalues Y->261 (Default ->262)

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Kamal,

You can achieve this using equals text function and Ifelse boolean functions.

Regards

raviteja_satuluri
Contributor
0 Kudos

Hi Sahithi,

Thanks for your reply.

Please tell me what are the values I need to maintain in the fix value  table for Key and Value

Regards,

Kamal.

raviteja_satuluri
Contributor
0 Kudos

Hi Sahithi,

I am getting the error unable to cast * to Boolean.

Please provide the logic with screenshot if possible.

Thanks in advance,

Regards,

Kamal

sahithi_moparthi
Contributor
0 Kudos


In Key Maintain X and in Value 261

Also in Default mention 262.

raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

Thanks for your reply. I am really very happy. but the Item_create segment is not created.

These are the conditions to create ITEM_Create segment.

1. I have One source filed Serial and One Target field SERIAL.

We will get production order details as an xml file from the sender system. PRDOrd is One segment in the xml file and the Serial filed in the PRDOrd Segment. If two PRDOrd segments are in the xml file and both have Serial fields that are not blank then each one would create a new segment ITEM_Create. we have another segment SerialNumber in that filed i have One filed say ITM this would be 0001 for the first segment ITEM_Create segment created and would be 0002 for the second segment ITEM_Create segment created.


2.Create new IDOC and new ITEM_CREATE segment in the IDOC for each Component segment of XML only when MIGO, Scrap, or Add Migo are not blank and if blank then no additional ITEM_CREATE segment required and ORDERID in the segment created will be from <ORD> above and GM_CODE = 03

3. example if two PRDOrd segments are in the xml file and both have Serial fields that are not blank then each one would create a new ITEM_CREATE segment and the MATDOC_ITM would be 0001 for the first segment created and would be 0002 for the second ITEM_CREATE segment created.  This field MATDOC_ITM references the # of the ITEM_CREATE so that the IDOC knows which segment the serial is relevant for**

Based on these 3 conditions i need to map to target segment ITEM_Create.

I have tried the logics which you have provided before but the Target segment is not crating So please check Once and provide the Mapping Logic

Please provide the Mapping logic.

Thanks in Advance,

Regards,

Kamal

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Kamal,

Use the below udf to create Item_Create & IDOC node. Refer the below sample mapping.

UDF code:

for(int i=0;i<Migo.length;i++)

{

if((Migo[i]!="") && (Scrap[i]!="") && (AddMigo[i]!=""))

result.addValue("");

}

Regards

raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

Thanks for your reply.

This UDF can satisfy the second condition but not the remaining.

Please provide the logic for remaining two conditions.

Thanks and Regards,

Kamal

raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

Can you please send the logic for satisfying remaining two conditions

Thanks in advance,

Regards,

Kamal

raviteja_satuluri
Contributor
0 Kudos

Hi Sahithi,

Thanks for your reply.

But the segment should create

1. For every component segment of xml and

2. if there are two PRDORD segments in XML file then for every Serial field One ITEM_Create segment should be create.

Please help on this.

it is urgent now.

Thanks in Advance,

Regards,

Kamal

raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

Thanks for your reply.

I have tried your UDF but in Test Tab Result tab i am unable to see ITEM_Create Segment.

Please help on this.

Thanks and Regards,

Kamal.

raviteja_satuluri
Contributor
0 Kudos

Hi Buddies,

Please any one help me

It is urgent to me.

Thanks in advance,

Regards,

kamal.

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Kamal,

Can you check the inputs, as the udf checks whether the inputs are not blank for the creation of Item_Create segment.

Let me know the screen shots.

Regarding the logic for the remaining two conditions, I will check and let you know on it.

Regards

sahithi_moparthi
Contributor
0 Kudos

Hi Kamal,

Add one more condition to the above UDF  as

if((Serial[i]!="") && remaining conditions as suggested by Vishnu.

Please share your screenshot.Please share your source XML structure .

raviteja_satuluri
Contributor
0 Kudos

Hi Vishnu,

Thanks for your reply.

The UDF is working fine and i didn't develop the logic for those two conditions. I am expecting from you and our buddies.

ITEM_Create segment should be create based on 3 conditons.

1. ITEM_Create segment should be created for each component segment in xml file Only when        MIGO, SCRAP or AddMigo values should be not null.

2. If two production Order segments in XML file in that there is one Serial field.

For every Serial field One ITEM_CREATE segment should be created.

Thanks in Advance,

Regards,

Kamal

raviteja_satuluri
Contributor
0 Kudos

When ever the Serial fields are not blank

Regards,

kamal

raviteja_satuluri
Contributor
0 Kudos

Hi Sahiti,

Thanks for your reply. that one i have already added

But I am expecting the whole logic which satisfy the 3 conditions.

I am not able to see ITEM_CREATE Segment in Target side result tab.

Regards,

kamal

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi kamal,

I echo with sahithi. Just add the below udf code to the existing udf and give Serial as one of the input besides the existing ones. Use remove context to the source Serial field and then give as input to the udf.

for(int i=0;i<Serial.length;i++)

  if((Serial[i]!=""))

     result.addValue("");

Regards

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Kamal,

What do you mean when you say you are not able to see Item_Create segment in the target.

Can you please provide screenshots for better understanding.

For ITM & MATDOC_ITM field population, pass the output of the udf to the below segment and map to the ITM & MATDOC_ITM target fields.

Regards

Answers (0)