2006 Jan 03 11:33 PM
My requirement is to update the Idoc segment through the report program. Any SAP provided standard function module is available to update the Idoc segment values. Please help needed.
DATA: LT_EDIDD TYPE STANDARD TABLE OF EDIDD."Local Table to Hold EDIDD
LT_EDIDD = I_EDIDD. "table should have the data
*-- Opening the IDoc for Edit
CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT'
EXPORTING
DOCUMENT_NUMBER = X_EDIDC-DOCNUM
TABLES
IDOC_DATA = IT_EDIDD
EXCEPTIONS
DOCUMENT_FOREIGN_LOCK = 1
DOCUMENT_NOT_EXIST = 2
DOCUMENT_NOT_OPEN = 3
STATUS_IS_UNABLE_FOR_CHANGING = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*-- Editing the IDoc
CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENTS'
TABLES
IDOC_CHANGED_DATA_RANGE = LT_EDIDD
EXCEPTIONS
IDOC_NOT_OPEN = 1
DATA_RECORD_NOT_EXIST = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*-- Closing the IDoc after Edit
CALL FUNCTION 'EDI_DOCUMENT_CLOSE_EDIT'
EXPORTING
DOCUMENT_NUMBER = X_EDIDC-DOCNUM
DO_COMMIT = 'X'
DO_UPDATE = 'X'
WRITE_ALL_STATUS = 'X'
EXCEPTIONS
IDOC_NOT_OPEN = 1
DB_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.thanks
vijay
2006 Jan 04 5:24 AM
Hi,
You can use the following steps in succession to change segment data.
1) EDI_DOCUMENT_OPEN_FOR_EDIT. Use this to read the IDoc
data into an internal table(declared of type EDIDD)
2) EDI_CHANGE_DATA_SEGMENTS. Looping at this table make
necessary changes to the segments and pass them to
another internal table (eg: IT_EDIDD) and pass this
table to this fm. This changes only those segements
that you have changed.
3) EDI_DOCUMENT_CLOSE_EDIT. This closes the IDoc.
4) IDOC_STATUS_WRITE_TO_DATABASE. This writes the status
to the IDoc. Use this if you need.
Hope this helps,
Vamsi
2006 Jan 11 3:54 PM
I need the function module name to release the IDOC lock,
after the Idoc close.
Actually i am using the below function module for update the segment value through report program.
1) EDI_DOCUMENT_OPEN_FOR_EDIT.
2) EDI_CHANGE_DATA_SEGMENTS.
3) EDI_DOCUMENT_CLOSE_EDIT.
4) IDOC_STATUS_WRITE_TO_DATABASE. To update Idoc status.
After using this fn. mod., i can't able to release the IDOC lock.
I was used the fn. mod. EDI_DOCUMENT_DEQUEUE_LATER to release the lock but it is getting released.
I need help to solve this problem.
2006 Jan 04 7:06 AM
Use the FM L_IDOC_SEGMENT_CREATE in the program and do update.
Thanks
Eswar
2006 Jan 04 7:09 AM
DATA: LT_EDIDD TYPE STANDARD TABLE OF EDIDD."Local Table to Hold EDIDD
LT_EDIDD = I_EDIDD. "table should have the data
*-- Opening the IDoc for Edit
CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT'
EXPORTING
DOCUMENT_NUMBER = X_EDIDC-DOCNUM
TABLES
IDOC_DATA = IT_EDIDD
EXCEPTIONS
DOCUMENT_FOREIGN_LOCK = 1
DOCUMENT_NOT_EXIST = 2
DOCUMENT_NOT_OPEN = 3
STATUS_IS_UNABLE_FOR_CHANGING = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*-- Editing the IDoc
CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENTS'
TABLES
IDOC_CHANGED_DATA_RANGE = LT_EDIDD
EXCEPTIONS
IDOC_NOT_OPEN = 1
DATA_RECORD_NOT_EXIST = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*-- Closing the IDoc after Edit
CALL FUNCTION 'EDI_DOCUMENT_CLOSE_EDIT'
EXPORTING
DOCUMENT_NUMBER = X_EDIDC-DOCNUM
DO_COMMIT = 'X'
DO_UPDATE = 'X'
WRITE_ALL_STATUS = 'X'
EXCEPTIONS
IDOC_NOT_OPEN = 1
DB_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.thanks
vijay
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |