cancel
Showing results for 
Search instead for 
Did you mean: 

To Pass control records of IDOC dynamically in SAP PI

Former Member
0 Kudos

Hi Experts,

  

I have a scenario. File --> PI --> IDOC   . All control records of IDOC i.e. EDI_DC40 are passed as constant. For example, RCVPRN is passed as

DEVCLNT000. I want "RCVPRN " to pick up the value as QACLNT000 while changes are transported into QA.

Is there any way, either by UDF or by through some other mean, We can do this in PI DEV environment.

Please help.

Regards

Veeru

Accepted Solutions (0)

Answers (5)

Answers (5)

vicky20691
Active Contributor
0 Kudos

Hi Veer,

The only approaches will work are -

1. Parameterized mapping and trust me it is the most suitable to use.

2. Use the UDF as suggested by Priyanka ( but in this case you have to case you have to hardcode the first 3 letters of system name and if in worst cases it changes then everything will fall apart)

Regards,

Vikas

PriyankaAnagani
Active Contributor
0 Kudos

As mentioned by others in the previous posts, you can use UDF to get the system name and then send the respective value in RCVPRN field.
Here is the sample code.

String systemName = System.getProperty("SAPSYSTEMNAME");

String str = systemName.substring(0,3);

if(str.equals("DEV"))

     return devSystem;

else

     return qual;

If you are using IDoc_AAE adapter, then this requirement can be achieved without making any changes to mapping. You can just Override the Idoc control Headers with the value you want to pass.

---Priyanka

turmoll
Active Contributor
0 Kudos

Bhavesh has already answered how to achieve it.

I can only add that you have to fill in only two mandatory parameters: SNDPRT and SNDPRN.

Regards,

/k

manoj_khavatkopp
Active Contributor
0 Kudos

You can use UDF to get the system name(Dev/Q/P) and then maintain required values in Fixed values , so that the values are taken with respective of the environment.

Or you can use Header Mapping too.

Br,

Manoj

Former Member
0 Kudos

Hi Manoj,

   Could you please elaborate a bit.

Regards

Veeru

bhavesh_kantilal
Active Contributor
0 Kudos

I would not suggest using the approach of getting the System ID in your mapping and then mapping the target fields as this leads to hardcoding where if tomorrow the SID changes or an additional system is introduced in the landscape then there are unnecessary transports / mapping changes are required.

The cleanest approach is

- Use Header Mapping as Manoj has already pointed where the IDoc control record is then populated using the Business System details. I assume there is a reason why you want to hard code this in EDI_DC40 in your mapping and not use Header Mapping but would ask you to check if this is applicable.

- Use Parametric Mapping / Value Mapping

Regards,

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

You can do this 2 ways,

  • Use Value Mapping
  • Use Parameterized Mappings -

If this is required for a single Interface use Parametertized Mappings else use Value Mappings.

Regards

Bhavesh