2007 Oct 12 12:11 PM
Hi,
My idoc segment contains total 16 fields but in those 16 fields I want to pick seventh field value. In the table edid4 the SDATA field contains mixing of all 16 fields data so how to pick seventh field data in that.
Please help me. I will give points.
Thanks a lot in advance.
Hi,
My idoc segment contains total 16 fields but in those 16 fields I want to pick seventh field value. In the table edid4 the SDATA field contains mixing of all 16 fields data so how to pick seventh field data in that.
Please help me. I will give points.
Thanks a lot in advance.
2007 Oct 12 12:27 PM
Hi,
yes u can get like this..say for example i have a segment which has 5 fields..
1>matnr (18 character)
2>maktx (40 characters)
3>matkl (9 characters)
4>field1 (5 characters)
5>field2 (2 characters)..
if i want third field value i can do this..
v_matkl = i_edidd-sdata+58(9).
58 because,ur matnr has 18 chars and maktx has 40 chars....
try this..
Reward if helpful.
Regards,
Nagaraj
2007 Oct 12 9:49 PM
hi,
read SDATA (segment data) into the structure of the same type as the idoc segement and use the field.
If the field number and the idoc type are to be determined dynamically then you have to use field-symbols and use assign component statement.
Regards,
Aj
Message was edited by:
Abhishek Jolly
2007 Oct 13 12:08 AM
Hi,
Try IDOC_READ_COMPLETELY to read segment and values based on IDoc number.
Sri
2007 Oct 13 12:26 AM
Babji,
Best way would be declare a variable of type segment and then move data from SDATA to segement variable. So var-field7 ( where as field7--> Sevent field name)
Using this technic you can always read correct field value.
Hope this will help. Let me know if you need more details.
Nilesh
2007 Oct 13 3:22 AM
Hi Babji, YOu can use the function modules:
1) EDI_DOCUMENT_OPEN_FOR_READ
2) EDI_SEGMENTS_GET_ALL and
3) EDI_DOCUMENT_CLOSE_READ
in the same order:
sample code:
CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_READ'
EXPORTING
DOCUMENT_NUMBER = P_DOCNUM
IMPORTING
IDOC_CONTROL = F_IDOC_CONTROL
EXCEPTIONS
OTHERS = 01.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
RAISING ERROR_OPENING_IDOC.
ENDIF.
Read IDOC data segments
CALL FUNCTION 'EDI_SEGMENTS_GET_ALL'
EXPORTING
DOCUMENT_NUMBER = P_DOCNUM
TABLES
IDOC_CONTAINERS = T_IDOC_DATA
EXCEPTIONS
OTHERS = 01.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
RAISING ERROR_READING_IDOC.
ENDIF.
Close IDOC
CALL FUNCTION 'EDI_DOCUMENT_CLOSE_READ'
EXPORTING
DOCUMENT_NUMBER = P_DOCNUM
IMPORTING
IDOC_CONTROL = F_IDOC_CONTROL
EXCEPTIONS
OTHERS = 01.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
RAISING ERROR_CLOSING_IDOC.
ENDIF.
Then you can use teh T_idoc_data intermal table to read the element in the segment.
Regards,
Ravi Kanth Talagana
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |