Application Development and Automation 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: 
Read only

function SO_NEW_DOCUMENT_SEND_API1

Former Member
0 Likes
1,228

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

11 REPLIES 11
Read only

suresh_datti
Active Contributor
0 Likes
1,178

Are you setting the parameter COMMIT_WORK = 'X' in the function call SO_NEW_DOCUMENT_SEND_API1?

Regards,

Suresh Datti

Read only

0 Likes
1,178

Suresh,

there is NO parameter COMMIT_WORK in the function !!!!

i wish there is one, but i can't find it

reg, martin

Read only

0 Likes
1,178

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

Read only

0 Likes
1,178

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 !!! ;-(

Read only

0 Likes
1,178

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

Read only

0 Likes
1,178

Can you post your code?

Read only

0 Likes
1,178

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.

Read only

0 Likes
1,178

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

Read only

Former Member
0 Likes
1,178

Hi,

FYI,

Why dont you just try looking at the FM Documentation.

The complete code is given in it.

Regards,

Sampath.

Read only

Former Member
0 Likes
1,178

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

Read only

0 Likes
1,178

Ravi,

yes, i am clearing all the tables and parameters at every new loop-step.

reg., martin