cancel
Showing results for 
Search instead for 
Did you mean: 

Add company code to filename

gurudatta
Participant
0 Kudos

Hi,

i want to display the company code in the output file name and company code is dynamic.

output file----.CSV

following is my MT and can anyone tell how to display the company-code for each output triggered.

i tried giving payload:MT_ECC_CORE_MASTERDATA,1,CUSTOMERDATA,1,BUKRS,1 where BUKRS is company code which i was trying to use as  variable substitution but it is failing is RWB "Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: var1."

i have done the following configuration in communication channel

required output:LFBSCSER_Companycode(ex:002,001 etc).CSV

Accepted Solutions (1)

Accepted Solutions (1)

azharshaikh
Active Contributor
0 Kudos

Hi Guru,

I believe you have defined the File name as :

LFBSCSER_%var1%.CSV


Also can you confirm if there exists a value in payload for the field that you are trying to pass to the variable. Please check in Moni if value exists.


Regards,

Azhar

gurudatta
Participant
0 Kudos

Hi Azar,

yes it is defined as LFBSCSER_%var1%.CSV


BUKRS-Company code


azharshaikh
Active Contributor
0 Kudos

Hi Guru,

And I believe this is the Receiver / Output payload?

Can you try to use ASMA instead. Please check the following link:

Dynamic file name and directory in Receiver File Adapter - summary of possibilities - Process Integr...

Adapter-Specific Message Attributes and Dynamic Configuration

Regards,

Azhar

praveen_sutra
Active Contributor
0 Kudos

hi Guru,

I hope you  are using Receiver Message-Type.

It will not work with Sender Message-type structure. So in that case u need to map the target structure with the source field and then you can use it.

Alternatively you can  use UDF with Dynamic configuration to do the same.

thanks,

Praveen T

naveen_chichili
Active Contributor
gurudatta
Participant
0 Kudos

Hi Praveen,

Thanks a lot for the information.i was using source message type structure so it was not working.

i did it with target type and it is working fine.

@all -Thank you

Answers (2)

Answers (2)

gurudatta
Participant
0 Kudos

Hi Praveen,

Thanks a lot for the information.i was using source message type structure so it was not working.

i did it with target type and it is working fine.

@all -Thank you

praveen_sutra
Active Contributor
0 Kudos

Hi Guru,

Great it resolved your issue .

Close the thread as the issue is resolved.

thanks and regards,

Praveen T

former_member189440
Participant
0 Kudos

Hi Guru,

Please use Below Correct syntax in place of what you have used it will work.

Correct One :xmlpayload:MT_ECC_CORE_MASTERDATA,1,CUSTOMERDATA,1,BUKRS,1

Wrong One :payload:MT_ECC_CORE_MASTERDATA,1,CUSTOMERDATA,1,BUKRS,1

If it works please award some points

Thanks & Regards

Uday Suvvada.

gurudatta
Participant
0 Kudos

Hi Uday,

Its not working

Adapter Framework caught exception: The following variables cannot be resolved by any variable data source: "var1". Please check the spelling of each value's prefix.

former_member189440
Participant
0 Kudos

one More Option:

Use the below code and map the udf with two inputs first with Param Name and second input will be the Company code value what you want to populate.

public String SetParamValue(String paramName, String paramValue, Container container) throws StreamTransformationException{

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key =DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","paramName");

conf.put(key, paramValue);

return paramValue;

}

In Comm Channel Under advanced Tab under variable substitution.

VarName  == message:http:/"+"/sap.com/xi/XI/System/File,FileName

Map paramName with Constant"FileName"

This will also work,Please award some points if it works.Same worked for my development also.