cancel
Showing results for 
Search instead for 
Did you mean: 

Get xml file name within Abap Mapping

Former Member
0 Kudos

Hi,

I wish to get the file name (or full path name) of the source xml file that I need to parse. I can save the name of the file into container before launching the step of abap mapping.

I found in this forum this java source code.

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

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

Since I am using Abap O.O. is there a possibility to get the file name?

I receive this error message.

Statement "DYNAMICCONFIGURATION" is not defined. Check your spelling.

Any help will be well appreciated.

Thanks.

Giovanni

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Very good!

Many thanks for your reply.

Now, my last question. In my context I wish to receive only the file name from the dynamic configuration environment.

More exactly, if I try in this way:

DATA: ls_dynamic_conf TYPE MPP_DYNAMIC.

ls_dynamic_conf = dynamic_configuration->get_record(

namespace = 'http://sap.com/xi/XI/System/File'

name = 'FileName' )

I receive "no syntax errors found" after the check.

Without the "namespace" parameter I receive the following error message after the check.

The obligatory parameter "NAMESPACE" had no value assigned to it.

Any idea?

Is there a solution or I must keep the namespace value within my abap mapping?

Thanks in advance.

Regards,

Giovanni

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>Is there a solution or I must keep the namespace value within my abap mapping?

you need to use the namespace

Regards,

Michal Krawczyk

Answers (1)

Answers (1)

Shabarish_Nair
Active Contributor
0 Kudos

use the IF_MAPPING_DYNAMIC_CONFIGURATION interface

METHOD if_mapping~execute.
 
DATA l_record type mpp_dynamic.
 
* copy payload
result = source.
 
* add an adapter specific attribute
l_record-namespace = 'http://sap.com/xi/XI/System/File'.
l_record-name = 'FileName'.
l_record-value = 'youfilenamehere'.
dynamic_configuration->add_record( l_record ).
 
ENDMETHOD.