cancel
Showing results for 
Search instead for 
Did you mean: 

Automate duplicate values in impex

0 Kudos

Hello, I have an impex of this form:

INSERT_UPDATE CS;code[unique=true];deliveryMode(code);startDate[dateformat=dd-MM-yyyy];endDate[dateformat=dd-MM-yyyy];priority;exclusion(code)
;A1;standard-net;01-01-2017;01-01-2017;4;SN;
;A2;standard-net;01-01-2017;01-01-2017;4;SN;
;A3;standard-net;01-01-2017;01-01-2017;4;SN;
;A4;standard-net;01-01-2017;01-01-2017;4;SN;
;A5;standard-net;01-01-2017;01-01-2017;4;SN;
;A6;standard-net;01-01-2017;01-01-2017;4;SN;
;A7;standard-net;01-01-2017;01-01-2017;4;SN;
;A8;standard-net;01-01-2017;01-01-2017;4;SN;
;A9;standard-net;01-01-2017;01-01-2017;4;SN;
;A10;standard-net;01-01-2017;01-01-2017;4;SN;
;A11;standard-net;01-01-2017;01-01-2017;4;SN;

....
;A50;standard-net;01-01-2017;01-01-2017;4;SN;

Except for the code all the rest of the attributes are duplicated. Is there a way to somehow avoid this duplication of values (maybe writing code in beanshell?). Dynamically generating the impex in java code is not a solution.

Accepted Solutions (0)

Answers (2)

Answers (2)

StefanKruk
Active Participant

You can make use of default values:

INSERT_UPDATE CS;code[unique=true];deliveryMode(code)[default=standard-net];startDate[dateformat=dd-MM-yyyy, default=;01-01-2017];endDate[dateformat=dd-MM-yyyy,default=01-01-2017];priority[default=4];exclusion(code)[default=SN]
;A1;
;A2;
;A3;
;A4;
;A5;
;A6;
;A7;
;A8;
;A9;
;A10;
;A11;

....
;A50;

In this case you just need to specify the code.

christoph_probst
Active Participant

According to documentation you can use the default attribute in the header to achieve this see https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/2005/en-US/1c8f5bebdc6e434782ff0cfdb0ca...

INSERT_UPDATE CS;code[unique=true];deliveryMode(code)[default=standard-net];startDate[dateformat=dd-MM-yyyy,default=01-01-2017];endDate[dateformat=dd-MM-yyyy,default=01-01-2017];priority[default=4];exclusion(code)[default=SN]
;A1;
;A2;
....
;A50;

Have not found anything to dynamically add a value line via beanShell. But you can investigate yourself maybe you can find a method. The following objects are available in beanshell

  • impex -> ImpExReader.class
  • line -> Map<Integer, String>
  • currentLineNumber -> int
  • currentLocation -> String