Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

EDI quotes 845/843

paul_pendleton
Participant
0 Kudos

Has anyone ever written code or configured their system to send out only changed lines on a quote? For instance I have a quote and it has already been created and sent the full ouptut one time. Then after going back into the quote and changing a line it should send only the changed items along with header data. If anyone has done this can you give me some insight as to how and code sample or config settings if you can.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

There is not separate message type of quotation change.

What i would suggest you to do it to code user-exit EXIT_SAPLVEDE_003 ( Enhancement VEDE0001 ) . When the quotation idoc is created, this is the final user-exit. All idoc data is avaialble here. Here you can check that if document is being changed or created. If it is changed than delete the line items which are unchanged ( these is segment E1EDP01 and all the subsegment below that for that line item ). You write following loging in your code.

<b>[1].</b> Read table CDHDR with

OBJECTCLAS = VERKBELEG

OBJECTID = XVBAK-VBELN[

<b>[2].</b> If you find any records from CDHDR, that means that quotation has been changed. Now take the change document number from CDHDR (CHANGENR) and read table CDPOS with

OBJECTCLAS = VERKBELEG

OBJECTID = XVBAK-VBELN

CHANGENR = CHHDR-CHANGENR.

There might be multiple changes quotation. These causes multiple change document number in CDHDR. Also each changdocumnet has multiple line items in CDPOS.

So, you have to loop at the entries of CDHDR and for each Change document number in CDHDR, read CDPOS. Keep appending the line items of CDPOS into internal table.

SAP uses the standard function modules <b>CHANGEDOCUMENT_READ_HEADERS</b> ( to read header changes) and <b>CHANGEDOCUMENT_READ_POSITIONS</b> ( to read item level changes ) to read document changes.

See the code of the report <b>RVSCD100</b> to find out how SAP reads change document. When you go to quotation and choose menu "Environment --> Changes", SAP uses this program to read change document. You can execute this report directly from SE38. When you execute this report in SE38, enter your quotation number in document field and then debug to see what SAP does.

<b>[3].</b> So, once you determine which line items are being changed, now you loop through the idoc data table INT_EDIDD for segment "E1EDP01". if E1EDP01-POSEX ( line item number ) is not one of the line which is changed, then delete this segment and all subsegment of this segment.

<b>[4].</b> Once you do that, you might have to change the content of segment E1EDS01 too. This is IDOC summary segment which contents the details like number of items, total net amount. But it works fine without changing E1EDS01, then you can left it as it is.

I hope it will help you start your coding.

Let me know if you still have any question.

Regards,

RS

8 REPLIES 8

Former Member
0 Kudos

If there is no message type for changes, then I susect you will need to read the change pointer table CDHDR and CDPOS to see if any lines have changed. Unless there is a change date on the quote item.

0 Kudos

Can I verify that there is no message type for changes? How do I do this? Have you done this before if so where did you put this logic in the IDOC_OUTPUT_QUOTES? Thanks for response.

0 Kudos

I have not done this before.

But looking at the FM I would do it in the User Exit EXIT_SAPLVEDE_003. This is the last user exit called by the FM IDOC_OUTPUT_QUOTES.

What table are quotes stored on. Is it VBAP. If so there is a field called AEDAT. This is a change date.

Message was edited by:

Martin Shinks

Former Member
0 Kudos

Hi,

There is not separate message type of quotation change.

What i would suggest you to do it to code user-exit EXIT_SAPLVEDE_003 ( Enhancement VEDE0001 ) . When the quotation idoc is created, this is the final user-exit. All idoc data is avaialble here. Here you can check that if document is being changed or created. If it is changed than delete the line items which are unchanged ( these is segment E1EDP01 and all the subsegment below that for that line item ). You write following loging in your code.

<b>[1].</b> Read table CDHDR with

OBJECTCLAS = VERKBELEG

OBJECTID = XVBAK-VBELN[

<b>[2].</b> If you find any records from CDHDR, that means that quotation has been changed. Now take the change document number from CDHDR (CHANGENR) and read table CDPOS with

OBJECTCLAS = VERKBELEG

OBJECTID = XVBAK-VBELN

CHANGENR = CHHDR-CHANGENR.

There might be multiple changes quotation. These causes multiple change document number in CDHDR. Also each changdocumnet has multiple line items in CDPOS.

So, you have to loop at the entries of CDHDR and for each Change document number in CDHDR, read CDPOS. Keep appending the line items of CDPOS into internal table.

SAP uses the standard function modules <b>CHANGEDOCUMENT_READ_HEADERS</b> ( to read header changes) and <b>CHANGEDOCUMENT_READ_POSITIONS</b> ( to read item level changes ) to read document changes.

See the code of the report <b>RVSCD100</b> to find out how SAP reads change document. When you go to quotation and choose menu "Environment --> Changes", SAP uses this program to read change document. You can execute this report directly from SE38. When you execute this report in SE38, enter your quotation number in document field and then debug to see what SAP does.

<b>[3].</b> So, once you determine which line items are being changed, now you loop through the idoc data table INT_EDIDD for segment "E1EDP01". if E1EDP01-POSEX ( line item number ) is not one of the line which is changed, then delete this segment and all subsegment of this segment.

<b>[4].</b> Once you do that, you might have to change the content of segment E1EDS01 too. This is IDOC summary segment which contents the details like number of items, total net amount. But it works fine without changing E1EDS01, then you can left it as it is.

I hope it will help you start your coding.

Let me know if you still have any question.

Regards,

RS

0 Kudos

Thanks RS. I am going to look at everything. I may come back and give you points for solving my problem.

0 Kudos

RS,

Is there an easy way to tell if the quote coming through is a create or change?

0 Kudos

Hi,

There no flag exist which determites is quotation is being created or changed but you have to check couple of things and determine.

1. As i mentioned in my previous mail, the change document. If quotation is being created, you won't find any chagne document.

2. You can check the creation date agains current date. But this is not does give you the correct answer everytime since somebody can go and change the quotation same day it is created.

I think you requirement is to send only the line items which are being changed. In that case you need not worry about if quotation is being create or changed. Just read the change documents. If they exist, find out which line and delete lines which are not changed.

Let me know if you have any issue.

Regards,

RS

0 Kudos

your right my initial question was for only changes but I was just trying to narrow down what I needed then. Do you know if an output type can be setup to only be used in creation of a quote(VA21) but also allow it to be "proposed" manually in change mode(VA22)? If so I can just check the output type since when they propose it manually we want to send the full document. If we cannot then I will have to check the CDHDR etc as you suggest. Just trying to cut down on table reads for performance and coding reasons. Thanks for response.