Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

IDoc to XML

0 Kudos

Hello Experts,

My requirement is related to IDoc.

I am using message type CLFMAS to generate class based idoc.

We wanted to generate its XML file which we ahieved using XML port creation(WE21).

Now what we want is to filter the XML file to remove some fields from it.

Please let me know the procedure to achieve this or if there is an alternate to meet this requirement.

Thanks in advance..:)

Regards,

Aabid Khan

9 REPLIES 9

Former Member
0 Kudos

Hi,

You may try using the Reduced IDOC types through BD53. You can also perform segment filtering using BD56 for a specific sender/receiver. Please go through the below link for more information on Reduced IDOC types.

http://help.sap.com/saphelp_40b/helpdata/en/66/1c4b6e5733d1118b3f0060b03ca329/content.htm

http://wiki.sdn.sap.com/wiki/display/ABAP/Reduced+Message+Types

Cheers

~Niranjan

0 Kudos

Thanks for your reply Niranjan,

We have got solution of generating the IDOC for required class and its working fine for us.

That we have achived using IDoc filteration, but how can we restrict it to transfer required fields in the XML.???

0 Kudos

Hi,

There is a BTE MASTERIDOC_CREATE_CLFMAS in the IDOC function module MASTERIDOC_CREATE_CLFMAS. You can implement the BTE and restrict/clear the segments for your IDOC type/message type.

Cheers

~Niranjan

0 Kudos

Thanks Niranjan,

I got a BTE where in I can see the IDOC data and I can even remove some of the fileds as per requirement.

But user wants to have some extra fields to be added to same XML, is it possible.???

I am using standard Idoc type i.e. CLFMAS02.

0 Kudos

Hi Aabid,

If you need to have extra fields in XML, you need to add the same in the IDOC. You can extend the IDOC CLFMAS02 into a Z custom IDOC and add your custom segment which will have the extra fields. Then the same will be pushed to XML also.

Please look at the below thread for more information on IDOC extension.

http://wiki.sdn.sap.com/wiki/display/ABAP/Outbound+Idocs+by+ALE

http://wiki.sdn.sap.com/wiki/display/HOME/Step+by+Step+procedure+for+creation+of+IDOC

Cheers

~Niranjan

0 Kudos

Thanks Niranjan,

Just would like to add one more thing, I am using CLFMAS02 as idoc type but user wants some of the fields which are not there in CLASSIFICATION view of the material.

Is it possible to pass those extra fields also ?

Reagards,

Aabid Khan

0 Kudos

Hi Aabid,

if you can accommodate the data in any of the segment within the IDOC CLFMAS02, then you can add the additional data using any of the exits available within the IDOC function module. If not, you need to add additional segments and add the data using the IDOC user exit.

In both the cases, you need to implement the IDOC exit and write the logic to populate the data,

Cheers

~Niranjan

0 Kudos

Thanks Niranjan,

As I mentioned in my trail comment, we are generating class based Idoc using CLFMAS02.

So can i populate the fields which are not there in CLASSIFICAITION view itself???

Since as far as I know CLFMAS-message type considers the fields in CLASSIFICATION view only.

Let me give you an example...

Suppose I change a Material(MM02) CLASSIFICATION data and save it, while generating Idoc using change pointer for CLFMAS, it generates Idoc considering fields in CLASSIFICATION view.

Now I want same Idoc to give me PLANT, MATERIAL TYPE, UNIT OF MEASURE and so on, is it possible and how???

I looked into BTE it does not give us any of the mentioned fields.!!!

Aabid Khan

0 Kudos

Hi Aabid,

You can populate the field which are not there in CLASSFICATION view.

You can create the custom segment through WE31. Save and release the Segment. Extend the IDOC CLFMAS02 into ZCLFMAS02. Add the new segment in the extended IDOC.

You need to check whether you are getting the material number inside the BTE. I hope the material number will be populated as obejct key in E1OCLFM-OBJEK  Then you can query MARA to get the needed value. Then append the table IDOC_DATA inside the BTE OPEN_FI_PERFORM_CLF00100_E.

Cheers

~Niranjan