cancel
Showing results for 
Search instead for 
Did you mean: 

how to handle empty value coming to PI

former_member723031
Participant
0 Kudos

Hi Experts,

My scenario is ABAP proxy to File. ABAP program is sending data to PI with blank value. But in PI payload that field is not showing at all.

Suppose customer number value is blank in ABAP internal table, in PI payload customer number xml tag is not showing at all in source structure.

Have used one to one mapping and in content conversion we have used.

.addHeaderLine 0

.fieldSeparator ;

endSeparator 'nl'

and also I need - if any value in the source structure is coming empty we need to replace it with semi colon.it is not for a specific field, it might be any field of source structure.

please help on this.

Thanks,

Swapnashree

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Make the source field mandatory then regenerate the proxy. Field will definitely come even with null as well.

Regards

Raj

former_member723031
Participant
0 Kudos

I have made it occurance 1..1.. still no result. do i make in both source and target.. i v made in source data type..

Former Member
0 Kudos

make it also in target.

If you try test mapping the target field is generated? I mean without filling the source fields of course

Fabio

Former Member
0 Kudos

Please regenerate the proxy as well. Target side is not necessary but you can make.

Regards

Raj

former_member723031
Participant
0 Kudos

Made on both side.. still not coming.. is it something related to data type in ABAP side, the data type is char20

anupam_ghosh2
Active Contributor
0 Kudos

Hi,

Before you call the message mapping in interface mapping, u need a java mapping code. This code will check if the required tag is absent. In case the required XML tag is missing, the java mapping code will insert the tag under proper parent node. This is best accomplished using DOM parser. If you need any further guidance from forum members on how to achieve this, then you need to publish following information

1. Version of PI you are working on.

2. Source XML structure.

3. Target XML structure.

You may refer to various java mapping blogs in SDN for further information on the topic.

Else try this mapping of the source field




Source field--------Exists ------> if  ----------------- target field

if the condition evaluates true    then  map  source field -------> target else  constant (";") ------->target.

regards

Anupam

Edited by: anupamsap on Sep 20, 2011 2:42 PM

S0025526023
Explorer
0 Kudos

Hi

Thank you for the suggestion of regenerating the proxy.  I had made the source fields mandatory, but then a new set of problems arose - The application failed because it was expecting some value for the mandatory fields (blank was not accepted).  I forgot to regenerate the proxy, or left it for later once I established that the solution was working fine.  I regenerated the proxy, after which it started working as desired - XML tags were generated even for empty fields

Former Member
0 Kudos

use MapWithDefault in message mapping and insert the default value in "MapWithDefault properties" (double click on function).

Fabio

former_member723031
Participant
0 Kudos

Do I use MapwithDefault for every field of souce structure. And how to handle the empty value coming from ABAP. No xml tag showing in payload for blank value.

I made the field occurance 1..1 still no result

Former Member
0 Kudos

Yes,

u have to use map with default for each field, map with default allow you to create target field even is source is missing.

If you want blank spaces try to digit spaces in mapwithdefault properties.

Fabio

PriyankaAnagani
Active Contributor
0 Kudos

Hi,

>>>>>Do I use MapwithDefault for every field of souce structure.

Use mapWithDefault when mapping every field of target structure and specify space as the default value in the function property so that you'll get space in your target text file.

Regards

Priyanka

former_member723031
Participant
0 Kudos

While empty value data coming from ABAP program, for that blank value , xml tag is not getting generated for that in source structure of datatype.

How to get blank xml tag in PI payload like <Customer/>. Do any change will be done at ABAP side or PI side .

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>and also I need - if any value in the source structure is coming empty we need to replace it with semi colon.it is not for a specific field, it might be any field of source structure.

Another possible way is ...Check whether source structure gets value or not using if function and together using a constant function (storing semi colon in it) handle this issue. You might also try mapwithdefault standard function.

Shabarish_Nair
Active Contributor
0 Kudos

you will have to use the standard function mapwithdefault to handle your case.

Refer: http://help.sap.com/saphelp_nwpi711/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/frameset.htm