Use of mapwithDefault

Hi,
I have an IDOC to CSV File Scenario for Matmas04.
Some of the fields in certain segments are blank.
Blank field values donot get reflected in the output file.
After some research, i found that mapwithDefault can solve the problem. However, i would have to transform each individual field in the message mapping editor.
The number of fields involved being large, is there a way
to recursively apply the function to each mapped field.
Or perhaps there is some other solution to this issue using a java program or using XSLT.
Any pointers on the above ?
Regards,
Jeron

HI,
No, you need to do for each individual fields.
But using Java Mapping you can reduce the manual work.
If you use XSLT mapping, then you can design this mapping as Fieldwise, if so then you can get this blank field automatically.. But for this you need to write XSLT for each field level ( you need to avoid copy-of with segment level),
SO option is to do this with Message mapping as you planned. It is not prefer to use Java/XSLT mapping only for this purpose.(performance constraints)
Regards,
Moorthy

Similar Messages

  • Using File Content Conversion

    Hi
    My source is like -,-,-,-,a,b,c  like this.
    and here -,-,-,- means white spaces.
    If i do one to one mapping..should i get the same target as same with spaces
    Regards,
    YRaj.

    Yes that is correct if you do one to one mapping then as long as the elements come in the source structure you will have the nodes in the target structure.
    To ensure this you could also use a mapwithdefault funstion and simply put a space in there
    let me know if this helps

  • Mapping issue with mapWithDefault

    Well i am a liitle confused: i have following mapping for target field:
    /MT_NC_ART_edit/ARTRecordSet/ARTDetailsStruct/sAfoBez=replaceString(oneToMany(concat([delimeter=]/ZBC14_ARTIKEL/IDOC/ZBC14_ARTIKEL/ZBC14_ARTIKEL_VORNR/SAFOBEZ=, const([value=:]))), const([value=null]), const([value=]))
    Actually i need the case now that when getting no value for sAfoBez there should be a ":" in target field. Therefore i tried with mapWithDefault giving a default-value. But funny thing is XI does not take it!
    i tired this:
    /MT_NC_ART_edit/ARTRecordSet/ARTDetailsStruct/sAfoBez=replaceString(oneToMany(concat([delimeter=]mapWithDefault([default_value=:]/ZBC14_ARTIKEL/IDOC/ZBC14_ARTIKEL/ZBC14_ARTIKEL_VORNR/SAFOBEZ=), const([value=:]))), const([value=null]), const([value=]))
    The UDF inside the mapping is:
    String[] store = new String[1];
    for(int i=0;i<SAFONR.length;i++)
    store[0] = store[0]+SAFONR<i>;
    result.addValue(store[0]);
    Can somebody give a hand?!
    br

    Hi Fritz,
           I couldn't understand your mapping. At what point are you using the 'mapwithdefault' function and whr does the UDF come into picture?
    Idealy it should take whatever constant you specify when the desired field is not present. Its a simple mapping.
    Can you elaborate it a little it?
    Regards,
    Akshay

  • Sender file adapter with FCC not creating last field

    Hi,
    I've got the following file:
    field1;field2;field3
    FCC is the following:
    Recordset streucture: ITEM,*
    ITEM.fieldSeparator     ;
    ITEM.endSeparator     'nl'
    ITEM.fieldNames FIELD1,FIELD2,FIELD3
    ignoreRecordsetName     true
    I expect to generate the following XML:
    <FIELD1>field1</FIELD1>
    <FIELD2>field2</FIELD2>
    <FIELD3>field3</FIELD3>
    That's working OK. The problem is when I receive a file with the FIELD3 empty. Example:
    field1;;
    I expect:
    <FIELD1>field1</FIELD1>
    </FIELD2>
    </FIELD3>
    But I get:
    <FIELD1>field1</FIELD1>
    </FIELD2>
    And this raises an error during the mapping because the FIELD3 is mandatory in the Data Type definition, even it's empty

    I expect:
    <FIELD1>field1</FIELD1>
    </FIELD2>
    </FIELD3>
    But I get:
    <FIELD1>field1</FIELD1>
    </FIELD2>
    use a mapwithdefault in your mapping so that it will always create an empty node if there was no value to be mapped to the target field.

  • Mapping of same structure

    Dear Experts,
    I have querry regarding the mapping of source and target structure.The source and target structure are same.
    The structure looks like this.
    <Source>
    +<Header>
      <LineItem>  0:Unbounded
        <Value>    1:1
        <Text>      1:1
      <LineItem>
    Even if there is no entries in Value and Text field of tag <LineItem> , I have to show in the target.
    -<Header>
       -<LineItem>
         -<Value/>
         -<Text/>
    -<LineItem>
    -<Header>
    Please help for the mapping of the Source Line Item and Target Line Item,
    Regards
    Alice Rebecca

    Hi Alice,
    For Line Item, use straight mapping without any additional functions. For both: Value and Text, use source -> mapWithDefault -> target, and set the default value in mapWithDefault to empty (just erase the value). Thus you will achieve the required functionality.
    Hope you'll find this useful,
    Greg

  • Sender file adapter dropping last column during content conversion

    I am trying to process a flat file with pipe delimited data, but when the last column of the file is empty the file adapter ignores the column, causing issues with the subsequent mapping program.  For example, if the file contains the following data..
    1||three|
    ... the converted content produced is...
       <column1>1<column1>
       <column2/>
       <column3>three</column3>
    My mapping is expecting that <column4/> also be delivered in order to function properly.  The fields are all defined in record.fieldNames, and if there is any data present following the third pipe it is assigned correctly to the column4 element.  I have also experimented with setting missingLastFields to "add", and tried explicitly specifying endFieldSeparator to 'nl' with no success.
    Is there anyway to control this behavior in the communication channel, or is my only option to to account for it within the mapping by using mapWithDefault function for every field that appears at the end of a record?

    Nataliya,
    Ensuring that the element is populated during the mapping appears to be the only way to account for this.  Therefore, whenever mapping the last column of a record set, I just made sure to use the MapWithDefault function in case the last field of the record is empty.  It's a little extra manual effort, but it appears to be working fine so far.  I was hoping for a better answer myself.

  • Context handling during message mapping

    Hi,
    I'm working on a mapping and it almost works. There is just 1 thing to solve. I use the fixvalues funtion with as input a field A in a segment of my Idoc. This function is used to map a field B in another segment. However as this segment has multiple occurences, I have problems with the context handling: the first timle works ok but then it fails (as the filed A is in another segment/context). How could I fix this?  I would like to avoid UDF as I don't know much java.
    Kind regards,
    Ulrich

    Hi Ulrich,
    <b>Mapping A_source-Fixvalue-B_target</b>
    In the above case What are the elements exist in A_Source same thing will be transfered to B_target . If it is not find any value in Fixvalue table then it will pass the default value. So provde the default value.
    If there is not element in context then it won't create b_target not at all for that context. So use the Mapwithdefault() nodefunction before passing the value B_target. so in that case it will generate the empty value instead of none.
    Warm Regards,
    Vijay

  • Udf for exists

    I have to concat 14 Idoc text fields into a string at a varying position. Mostly some of the fields are not assigned, a normal concat does not work(no output if one field is missing). I created a workaround with the exists function (graphical) which is about 25 meter long (my colleague imediately started to cry). It works but it is ugly.
    Does anybody know how the exists function works. If one of the IDoc fields is missing I do not get <b>any</b> output of my udf whatever I do inside. How can I change this.
    Regards, Thomas

    Hi Thomas,
    You can handle the absence of values in two ways.
    1. Using <b>MapWithDefault</b> Standard function.
    Field1- MapWithDefault(Default value single space)->
                                           ->Concat/UDF -> TargetField
        Field2- MapWithDefault(Default value single space)->
    2. In UDF check for SUPPRESS value like this:
    public String UDF_Name(String StrVal1,String StrVal2,Container container){
              if((!StrVal1.equals(ResultList.SUPPRESS)) && (!StrVal1.equals(ResultList.SUPPRESS))  ){
                  //concat...
    Hope this helps.
    Regards,
    Ananth

  • FCC issue--Receiver side

    Hi Exeprts,
    Below is my data type structure
    DT_Master
         <MasterData>1..unbounded
               <MaterailNo>0.1
                <Organization>0.1
                  <Salesofice>0.1
                 u2026u2026u2026u2026u2026u2026u2026u202660 fields  I have in receiver data type,I want to convert this file in to text file with separator &&,but sometimes 60 elements will not have data from source , even in this case I want separator.
    But what is happening in my case is if I receive data for only 20 fields IN TARGET ,in text file it is giving only 20 fields, empty tags with separator not coming for other fields.
    Record structure : MasterData
    MasterData.fieldSeparator &&
    MasterData.endSeparator nl
    any pointers apprecited.
    Regards,
    JAM

    Hai!
    yes i agree with "mapWithDefault".
    For all the sixty fields you want to use this mapWithDefault Node funtion in your mapping. Since your are not know that which field will come with empty value.
    For Example:
    If a source node Field1 is mapped with a Field1 in Target MT,you should follow the below mapping
    Field1-->mapWithDefault--
    >Field1.
    If the source field conatins any value it will consider in FCC or it considered a empty value in FCC.
    Hope,this will help u.
    regard's
    Preethi.

  • Mapping issues while using MapwithDefault Node function for Idoc

    Hi Experts,
    We are facing issues while trying to generate nodes at reciver side even though it does not exist at sender side.
    we are using the matmas05 and we want the nodes E1marcm and e1mardm to generated at target structure.
    the structure is like this
    Matmas05
    idoc
    E1maram
    segment
          E1marcm
            segment
              msgfn
              .....other fields
              E1mardm (can be many segments)
                segment 
                  lgort
                  ..other fields
              E1mpgdm
                 segment
                 ...e1mpgdm fields
    the mapping has been done like:
    e1marcm -mapwithdefault-e1marcm
    constant -segment
    werks-mapwithdefault-werks
    other fields(one to one mapping)
    e1mardm-mapwith default-e1mardm
    lgort-mapwithdefault(value 1000)-lgort
    other fields -one to one mapping
    now the problem we are facing is when e1mardm is not existing in source structure the values from the other node of e1mardm(which exists) are getting overwritten into it.
    we want only the lgort to be 1000 and the segment should populate at target side.
    like
    e1mardm
    segment
    lgort value 1000
    Could you please assist in solving this issue and give your valuable suggestions as how could we handle it.
    Thanks and regards,
    jyoti

    U will achieve this using UDF function. Map the below Like.
    e1mardm-mapwith default(Value Constant)-e1mardm
                                                            lgort (A) ---
    e1mardm-mapwith default(Value Exit)u2014(EqualsS) (B)- (UDF1)- lgort
                                Constant(Value Exit)---   
                                              Constant(Value 1000)(C)---   
    Other one to one mapping fields also you should use one more UDF.
                        Other one to one fields (A) ---
    e1mardm-mapwith default(Value Exit)u2014(EqualsS)    (B) - (UDF2)- Target
                                 Constant(Value Exit)---   
    UDF1:
    Argument A,B,C and select queue.
       //write your code here
    int j = 0;
    for(int i=0;i<a.length;i++)
    if (b[j].equals("true"))
    result.addValue(c[0]);
    i--;
    result.addValue(ResultList.CC);
    else
    result.addValue(a<i>);
    j++;
    UDF2:
       Argument A,B and select queue.
        //write your code here
    int j = 0;
    for(int i=0;i<a.length;i++)
    if (b[j].equals("true"))
    i--;
    result.addValue(ResultList.CC);
    else
    result.addValue(a<i>);
    j++;

  • Using CopyValue function with error

    Hi All,
    I have a requirement to send the three values coming in the one source field to three different target fields.
    E.g: Source field is "src1" and having the values 1,2 ,3 These values should be sent to the target fields such as
    first target field "Trg1" should get the value as "1" and the second target field "Trg2" should get the value as "2".
    third target field should getv value as "3"
    I have used copyvalue function. it is working fine but if any value from "src 1" is blank.
    I will have the runtime error as follow
    Runtime exception occurred during application mapping com/sap/xi/tf/_MM_MT_WORKORDER_TO_ORDCHG_ORDERSO5_; com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception when processing target-fieldmapping /ns0:MT_WORKORDER/StatementName2/TEST/acc
    Will appreciate your advise on how to resolve this.
    Regards,
    FNG

    I have mapped as follows
    sourc1 ->  mapWithDefault [NIL}  ->  copyvalue [0]  -> targt 1
    sourc1 ->  mapWithDefault [NIL}  ->  copyvalue [1]  -> targt 2
    sourc1 ->  mapWithDefault [NIL}  ->  copyvalue [2]  -> targt 2
    No substring function used.
    But still having error
    Runtime exception occurred during application mapping com/sap/xi/tf/_MM_MT_WORKORDER_TO_ORDCHG_ORDERSO5_; com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception when processing target-fieldmapping /ns0:MT_WORKORDER/StatementName2/TEST/acc
    I noticed from the source xml structure in the inbound payload, when sourc1 is blank, the tag is not created.
    so question is how to create sourc1 tag if the sourc1 is come as blank ?

  • Using concat Function in Mapping

    Hello,
    I have a mapping where I'm using the standart concat function to concatenate the content of two queues. Every queue has normally only one entry. When both queues have one entry, it is working without any issues.
    But now my problem: First queue has one entry and second queue has only a supresser. When I want to concatenate both queues, the result is also a supresser. But I'd like to have that the result will be the entry of the first queue when second queue exists of supresser...
    How can I get this realized that the concat function is also working in this case? 
    Is there maybe a workaround?
    Thank you for your help.

    Hi Lukas
    You can add the node function MapwithDefault with default value space after the field which is having suppress value.
    Then add the output of MapwithDefault to the second input of concat function.
    This will generate the output as the value of first field.
    let me know if you have any doubts.

  • Standard function MapwithDefault in NWDS?

    Hi Folks,
    Do we have any standard function available in NWDS for achieving the MapwithDefault mapping. FYI, I am trying to propagate the tag of the field for no input value in the source.

    Hi Pavan,
    I saw that the "Use Expression Editor for Mapping" was already unchecked. But to make sure I checked it and applied the settings and again went back and removed the check. I observed that in the workspace log I see java null pointer error when I did anything on the check box. Did you encounter anything of this sort?
    java.lang.NullPointerException
      at com.sap.ide.esr.foundation.login.preferences.BrowserPreferences.performOk(BrowserPreferences.java:247)
      at org.eclipse.jface.preference.PreferenceDialog$13.run(PreferenceDialog.java:964)
      at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      at org.eclipse.core.runtime.Platform.run(Platform.java:888)
      at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
      at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
      at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:944)
      at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:453)
      at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.okPressed(WorkbenchPreferenceDialog.java:169)
      at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:233)
      at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
      at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
      at org.eclipse.jface.window.Window.open(Window.java:801)
      at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.open(WorkbenchPreferenceDialog.java:211)
      at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:65)
      at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
      at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
      at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
      at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
      at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
      at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
      at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
      at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
      at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)

  • How do I use Edge Web Fonts with Muse?

    How do I use Edge Web Fonts with Muse - is it an update to load, a stand alone, how does it interface with Muse? I've updated to CC but have no info on this.

    Hello,
    Is there a reason why you want to use Edge Web Fonts with Adobe Muse?
    Assuming you wish to improve typography of your web pages, you should know that Muse is fully integrated with Typekit. This allows you to access and apply over 500 web fonts from within Muse. Here's how you do it:
    Select a text component within Muse, and click the Text drop-down.
    Select Add Web Fonts option, to pop-open the Add Web Fonts dialog.
    Browse and apply fonts per your design needs.
    Muse also allows you to create paragraph styles that you can save and apply to chunks of text, a la InDesign. Watch this video for more information: http://tv.adobe.com/watch/muse-feature-tour/using-typekit-with-adobe-muse/
    Also take a look at these help files to see if they help you:
    http://helpx.adobe.com/muse/tutorials/typography-muse-part-1.html
    http://helpx.adobe.com/muse/tutorials/typography-muse-part-2.html
    http://helpx.adobe.com/muse/tutorials/typography-muse-part-3.html
    Hope this helps!
    Regards,
    Suhas Yogin

  • How can multiple family members use one account?

    My children have iphones, ipads, ipods and mac books, my problem is how do you use home sharing with the devices and not get each others data.  My Husband just added his iphone to the account and got all of my daughters contacts.  I understand they could have there own accounts but if i buy music on itunes and both children want the same song, I don't feel i should have to pay for it twice.  Is there away we can have home sharing on the devices and they can pick and choose what they want? and is this icloud going to make it harder to keep their devices seperate?

    My children have iphones, ipads, ipods and mac books, my problem is how do you use home sharing with the devices and not get each others data.  My Husband just added his iphone to the account and got all of my daughters contacts.  I understand they could have there own accounts but if i buy music on itunes and both children want the same song, I don't feel i should have to pay for it twice.  Is there away we can have home sharing on the devices and they can pick and choose what they want? and is this icloud going to make it harder to keep their devices seperate?

Maybe you are looking for

  • Terms of Payment Issue

    Hi SD Experts, How do i configure my terms of payment to work based on the scenario given as below: ZPR1 to ZPR4 are condition types. ZPR1 - $10 ZPR2 - $5 ZPR3 - $5 ZPR4 - $5 Customer must pay ZPR1 first, the remaining ZPR2 to ZPR4 are 30 days term.

  • Looking to dump 4 or 5 cards

    Hi All I have much more available credit than i will ever need - and thinking of reducing some of my cc accounts, which may make better cards with higher limits available to me, further down the road?? This is what I have - and suggestions would be g

  • Can we call ALV Grid in another ALV Grid

    Hi,   I have a requirement where I have an ALV List Displayed and for this we have an User Command and the User Defined Button Placed on the ALV List displaya another ALV Grid. Now the user want an User Command to be activated on the Second ALV Repor

  • Translation of text module

    Hi Experts, I  have created  a text module for a smartforms. and wrote some text in english. Now I have to transalate this text module data into chinese. Please tell me how to do this translation for TEXT MODULE. Thnks Krishan

  • Message ADF

    Hi. I am wanting to use the RequestDispatcher invalid after one session. The page you want to shoot soon after the invalidation is login.jspx .. And in the faces config already exists navigating pages. See my code: public String logout () ( FacesCont