cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Line Items in Output File

Former Member
0 Kudos

Hi everyone,

I am using a IDOC to Flat File scenario

IDOC is PO Idoc.

Flat file should contain n no of records For example if IDOC of a PO contains 3 Line Item Flat file should have 3 records...

Suppose , my flat file has 3 fields

PO #

Item #

Material #

Now How to achieve this ?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Use UseOneASMany standard function and map as given below


E1EDK01-BELNR (context E1EDK01) ------------------------\
E1EDP01 -------------------- ----------------------------- >useoneasmany ---> target PO field
E1EDP01-POSEX (context E1EDP01) ---------------------/

because you use function useOneAsMany() if a field that only occurs once needs to be replicated as often as another field occurs in the outbound message so that the fields can be written to the target structure in pairs as a record.

it takes three inputs

first input values to be replicated

second input for how often values to be repeated(Occurence)

third input How to structure the values(in your case you have to repeat values as often as E1EDP01 occurs and structure should be as Item or material field)

Edited by: Kubra fatima on Oct 7, 2009 8:44 AM

Answers (3)

Answers (3)

Former Member
0 Kudos

If your target structure is


MT_Target
   Details
     PO #
     Item #
     Material #

Map source segment, suppose Segment A, (which has the line item) to Details

Just do the direct assiagnment for the field inside Segment as

Segment A-PO field -> PO#

Segment A-item field ->item#

refer this link for how to use FCC at receiver file adapter

/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion

Former Member
0 Kudos

Thanks for your replies.

My Target structure is like this

MT_Target

Details

PO #

Item #

Material #

PO # is coming from the Header segment from the Source side ( For eg E1EDK01)

Item & Material are coming from Item Level ( for eg E1EDP01 )

Now , If I map 'Details' to E1EDP01 ,

For Example : If source IDOC has 2 Line Items , it will contain 1 E1EDK01 & 2 E1EDP01 ,

Now when I test this in Message Mapping Tool, It does give me 2 Details line but in the second 'Detail' it only contains Item & Material and Not the PO#.

Thanks ,

former_member187339
Active Contributor
0 Kudos

Hi

Map like this:


Header-field -- PO # -------- |
E1EDP01 (context  idoc)-----| useoneasmany ---> target PO field
E1EDP01 ----------------------|

Regards

Suraj

Former Member
0 Kudos

I have mapped it like this,

E1EDP01 - > Details

E1EDK01-BELNR (context E1EDK01) -> PO#

E1EDP01-POSEX (context E1EDP01) -> Item#

like this...

It does give 2 'Details' for a 2 line Item PO , but second line has only Item # (which is fine ) but PO# is not repeated.

Thanks

former_member187339
Active Contributor
0 Kudos

Hi,

since you have only one source field E1EDK01-BELNR for many line item fields. PO (in target) will be created only once.

Unless you use the node function useoneasmany. Check the documentation here

http://help.sap.com/saphelp_nw04/helpdata/en/ef/df564b6aa24fc9ab0d685460747de5/content.htm

and map the field like


E1EDK01-BELNR (context E1EDK01) ----
E1EDP01 (context IDOC)------------------- useoneasmany --------PO#
E1IDPO1--------------------------------------

Regards

suraj

Former Member
0 Kudos

Thanks Kubra & Suraj. I made the changes as suggested by you guys. It gives the desired result.

I learnt something today!!!! Thanks you so much.

Cheers

Edited by: V bhandari on Oct 7, 2009 2:57 AM

former_member187339
Active Contributor
0 Kudos

Hi Bhandari,

>>Flat file should contain n no of records For example if IDOC of a PO contains 3 Line Item Flat file should have 3 records...

What is your target structure look like?

Suppose it is :

--MT_XYZ

--Details

---PO #

---Item #

---Material #

Map source segment, suppose Segment A, (which has the line item) to Details

And the field inside

Segment A-PO field -> splitbyValue-> PO#

Segment A-item field -> splitbyValue-> item#

and so on..

Regards

Suraj

former_member732072
Active Participant
0 Kudos

Hello Mr Bhandari,

Please have a look at the following forum which might be of help to you

Best Regards