‎2006 May 23 2:09 PM
Hi,
in a loop (select) i call function 'SO_NEW_DOCUMENT_SEND_API1' as often as there is a entry in the loop-table.
only the FIRST call of SO_NEW_DOCUMENT_SEND_API1 goes OKAY. But then i receive return-code 15 (Doucment_not_sent) in function SO_OBJECT_SEND (called in SO_NEW_DCOUMENT_SEND_API1).
I can't find any reason for this ??? Please help.
regards, Martin
‎2006 May 23 2:12 PM
Are you setting the parameter COMMIT_WORK = 'X' in the function call SO_NEW_DOCUMENT_SEND_API1?
Regards,
Suresh Datti
‎2006 May 23 2:21 PM
Suresh,
there is NO parameter COMMIT_WORK in the function !!!!
i wish there is one, but i can't find it
reg, martin
‎2006 May 23 2:23 PM
What version are you on? you can also put an explicit COMMIT WORK after each function call.. at least it doesn't hurt..
Regards,
Suresh Datti
‎2006 May 23 2:26 PM
Suresh,
we are on 46c.
I have tried a commit work after every call, BUT: then i get a database-error, as the fc is in an select....endselect-loop !!! ;-(
‎2006 May 23 2:30 PM
the COMMIT WORK has been introduced only from 47 onward.. Since, you are on 46c it is not required to COMMIT.. the issue could be something else.. Did you try TCode SOST for any additional info that could be of help?
Regards,
Suresh Datti
‎2006 May 23 2:44 PM
‎2006 May 23 2:52 PM
LOOP AT gt_editpos.
SELECT * FROM zknvt WHERE kunnr = gt_editpos-objectid AND
( ende = 0 OR ende >= sy-datum ).
IF sy-subrc = 0 AND sy-dbcnt = 1.
SELECT SINGLE * FROM kna1 WHERE kunnr = zknvt-kunnr.
SELECT SINGLE * FROM adrc WHERE addrnumber = kna1-adrnr.
IF sy-subrc <> 0.
CLEAR adrc.
ENDIF.
SELECT SINGLE * FROM adr6 WHERE addrnumber = kna1-adrnr AND
flgdefault = 'X'.
IF sy-subrc <> 0.
CLEAR adr6.
ENDIF.
ENDIF.
CLEAR so_doc_contenttab[].
CLEAR so_receivertab[].
WRITE: 'Vertragsart:' TO so_doc_contenttab-line.
WRITE: gf_text TO so_doc_contenttab-line+14.
APPEND so_doc_contenttab.
WRITE: 'Vertragsbeginn:' TO so_doc_contenttab-line.
WRITE: zknvt-beginn TO so_doc_contenttab-line+14.
APPEND so_doc_contenttab.
IF NOT zknvt-ende IS INITIAL.
WRITE: 'Vertragsende:' TO so_doc_contenttab-line.
WRITE: zknvt-ende TO so_doc_contenttab-line+14.
APPEND so_doc_contenttab.
gf_name = 'ZENDGRUND'.
gf_spras = 'DE'.
gf_value = zknvt-endgrund.
PERFORM texte_festwerte_holen.
WRITE: 'Endgrund:' TO so_doc_contenttab-line.
WRITE: gf_text TO so_doc_contenttab-line+14.
APPEND so_doc_contenttab.
ENDIF.
so_doc_header-obj_name = 'cdp'.
so_doc_header-obj_descr = 'Zentrale Partnerdatenbank SAP: Kunde '.
so_doc_header-obj_descr+38 = zknvt-kunnr.
so_receivertab-rec_type = 'C'.
CONCATENATE 'ZKNVT_' zknvt-marke INTO so_receivertab-receiver.
APPEND so_receivertab.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = so_doc_header
TABLES
OBJECT_HEADER =
object_content = so_doc_contenttab
receivers = so_receivertab.
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
ENDSELECT.
ENDLOOP.
‎2006 May 23 4:36 PM
You still need to clear the header as your internal tables have the header lines apparently. So change your CLEAR statements as follows.
CLEAR: so_doc_contenttab, so_doc_contenttab[].
CLEAR: so_receivertab, so_receivertab[].
CLEAR: so_doc_header.Srinivas
‎2006 May 23 2:16 PM
Hi,
FYI,
Why dont you just try looking at the FM Documentation.
The complete code is given in it.
Regards,
Sampath.
‎2006 May 23 2:17 PM
HI Martin,
As youare calling the FM in a loop, are you refreshing and clearing the export/import/tables parameters after the function call each time in a loop pass?
Regards,
Ravi
‎2006 May 23 2:22 PM
Ravi,
yes, i am clearing all the tables and parameters at every new loop-step.
reg., martin