2006 Dec 01 1:26 PM
How to send data [ records ]to a perticular segment's field in an IDOC.
How to send data [ records ]to a perticular segment's field in an IDOC.
2006 Dec 01 1:29 PM
Hi,
Try with this simple example.
*If segment is E1KNVP fill the custom segment Z1KNVP.
WHEN gc_e1knvpm.
e1knvpm = idoc_data-sdata.
IF e1knvpm-kunn2 IS NOT INITIAL.
*Get Partner Function Customer name(KNVP-KUNN2).
SELECT SINGLE name1
FROM kna1
INTO gs_knvp-name1
WHERE kunnr = e1knvpm-kunn2.
IF sy-subrc EQ 0.
ENDIF.
ENDIF.
*Get Partner Function Description
IF e1knvpm-parvw IS NOT INITIAL.
SELECT SINGLE vtext
FROM tpart
INTO gs_knvp-partner_fun_des
WHERE spras EQ gc_en AND
parvw EQ e1knvpm-parvw.
IF sy-subrc EQ 0.
ENDIF.
ENDIF.
*Fill the custom segment Z1KNVP.
z1knvp = gs_knvp.
gs_idoc_data-segnam = gc_z1knvp.
gs_idoc_data-sdata = z1knvp.
APPEND gs_idoc_data TO idoc_data.
CLEAR: gs_idoc_data,
gs_knvp.
2006 Dec 01 2:19 PM
Hi,
IDOCs are transported as unstructured character records. IDOC records have a segment name segnam and a data part sdata.
If you want to access a particular segment field, the best way is to transfer the data stored in sdata to a structured field with the actual segment's structure. Then you can access it by name, store a value and tranport it back into sdata.
If you are familiar with field-symbols, you can speed up the process a lot, see this symbolic code:
field-symbols:
<segment> type any,
<field> type any.
assign [sdata](segment_length) to <segment> casting type (segment).
assign component (field) of structure <segment> to <field>.
<field> = [value].
This will maintain the value directly in the sdata part of the idoc segment data record. Especially in mass processing, you will gain 1000 % speed because nothging is copied back and forth.
Regards,
Clemens
2006 Dec 01 2:56 PM
hi
for standard SAP program you dont need to worry about filling the segments with data
but for your customized program you need to fill it.
Jus go thru the book "ALE/EDI and IDoc Technologies for SAP" By Arvind Nagpal.
You can gain tons of knowledge from it..
Cheers,
Abdul Hakim
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |