cancel
Showing results for 
Search instead for 
Did you mean: 

how to get line item number for an IDOC

Former Member
0 Kudos

Hi Friends,

I am using ACC_DOCUMENT03 IDOC, in that i need to genarate line item number for a field ITEMNO_ACC in E1BPACGL09 segment.

If 2nd IDOC is genarating that line Item number shou start from 1 onwards.

Example: ACC_DOCUMENT03 - E1BPACGL09- ITEMNO_ACC 1

E1BPACGL09- ITEMNO_ACC 2

E1BPACGL09- ITEMNO_ACC 3

when 2nd IDOC starts,

ACC_DOCUMENT03 - E1BPACGL09- ITEMNO_ACC 1

E1BPACGL09- ITEMNO_ACC 2

E1BPACGL09- ITEMNO_ACC 3

Please help me on this

with regards,

Vivek

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member854360
Active Contributor
0 Kudos

Hi,

Please refer this blog

Sequence Number Generation : Mapping Pattern in PI

/people/sunil.ojha5/blog/2008/01/22/sequence-number-generation-mapping-pattern-in-pi

Former Member
0 Kudos

sorry guys, none of the solution is working for me.

when 2nd IDOC is genarated , that number is also starts from 1.

former_member854360
Active Contributor
0 Kudos

Hi Use this UDF

In messaage mapping editor Function tab add the follwing under

Attribut and method

int i;

Under init section

i=0;

And create a UDF using global variable i

public String sequence(Container container) throws StreamTransformationException{

i=i+1;
return Integer.toString(i);
}

ORRRRRRRR

If it is betweebn different mapping then

You can try to use the logic mentioned in the DOC for your requirement.

Generating Sequence Number Between Multiple Instances of Mapping Execution

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/503e9bea-ea09-2e10-ec8a-cdf369de99d3

baskar_gopalakrishnan2
Active Contributor
0 Kudos

The simplest way is to create a global variable using init method as Debashish refered. Use that variable in UDF to retrieve the current value and for further increment. Global variable maintains the update state of the counter value.

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

You can make use of the statistic function called index. Just make sure that the radio button is set to reset index to initial value with each new context.

To do this, group the contexts for idoc1 and idoc2 separated by a context change e.g


anyvalue
anyvalue
anyvalue
cc
anyvalue
anyvalue
anyvalue


Source -> index: 1,1 -> splitByValue -> Target

Will generate the following output


1
2
3
cc
1
2
3

Hope this helps,

Mark