Skip to Content
author's profile photo Former Member
Former Member

SD Outbound Delivery extended fields userexit code for 1:N-N:N line items

Hi,

I have added extra zfields for each line item of the delivery in VL02N. Once this delivery saved, these details will be saved in one ztable with reference to that delivery no.

Ex-1:

VL02N

Delivery Line items:

ItemNo. -- MaterialNo. -- qty -- units -- ZField1

00010 -- mat1 -- 5 -- gms -- 3

00020 -- mat2 -- 7 -- gms -- 5

In the above example1, for the idoc DELVRY05, i've extended with zfield1. I have placed the segment under E1EDL24(Delivery Item)(for zsegment, E1EDL24 is the parent segment).

After entering the line item values, & saved VL02N, it is saved in ztable, which contains the fields: delivNo.,ItemNo.,materialno.,zfield1.

I have written the following code in userexit EXIT_SAPLV56K_002:

&----


*& Include ZXTRKU02

&----


TABLES: ZDELTAG.

BREAK-POINT.

*Segment Delivery Item

DATA: I_E1EDL24 LIKE E1EDL24,

*Segment added under E1EDL24

I_ZPBDELV LIKE ZPBDELV.

*EDIDD-Data record (IDoc)

DATA: BEGIN OF S_IDOC_DATA OCCURS 0.

INCLUDE STRUCTURE EDIDD.

DATA: END OF S_IDOC_DATA.

*Constants

CONSTANTS: lc_E1EDL24 LIKE edidd-segnam VALUE 'E1EDL24',

lc_ZPBDELV like edidd-segnam value 'ZPBDELV'.

check segment_name = 'E1EDL24'.

CASE SEGMENT_NAME.

WHEN 'E1EDL24'.

IF control_record_out-cimtyp = 'DELVEXT'. "'DESADV'. " Message type

I_E1EDL24 = IDOC_DATA-SDATA.

*Assign ZPBDELV Segment to IDOC_DATA-SEGMENT.

IDOC_DATA-SEGNAM = lc_ZPBDELV.

SELECT SINGLE * FROM ZDELTAG.

IF SY-SUBRC EQ 0.

I_ZPBDELV-VBELN = ZDELTAG-VBELN.

I_ZPBDELV-POSNR = ZDELTAG-POSNR.

I_ZPBDELV-TAGNO = ZDELTAG-TAGNO.

ENDIF.

*Finally assign all the data to S_IDOC_DATA-sdata and Append to idoc_data.

S_IDOC_DATA-sdata = I_ZPBDELV.

S_IDOC_DATA-segnam = lc_ZPBDELV.

Append S_IDOC_DATA to idoc_data.

Clear S_IDOC_DATA.

Endif.

ENDCASE.

Idoc is generated with proper hierarchy is fine. Now structure looks as shown below:

Data records

-


E1EDL20

-


E1EDL24........(for 1st line item)

-


ZPBDELV-----(is the zsegment)

-


E1EDL25

-


E1EDL26

-


E1EDL27...

-


E1EDL24........(for 2nd line item)

-


ZPBDELV-----(is the zsegment)

-


E1EDL25

-


E1EDL26

-


E1EDL27...

************************************************************************

Now, my actual requirement is as shown below:

Ex-2:

VL02N

Delivery Line items:

ItemNo. -- MaterialNo. -- qty -- units -- ZField1

00010 -- mat1 -- 5 -- gms -- 1

-


2

-


3

-


4

-


5

-


6

00020 -- mat2 -- 7 -- gms -- 1

-


2

-


3

-


4

-


5

Above line item1 contains 6 zfield values. So in this case hw shall i see the idoc segment hierarchy? what code lines are required for this? can anybody share their experience...

tanx & rgds,

balu

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 05:29 AM

    Hi,

    can anybody help in solving this issue?

    rgds,

    balu

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.