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

BAPI_DOCUMENT_CREATE2 do not checkin original

Former Member
0 Likes
456

hi,

i use the BAPI_DOCUMENT_CREATE2 within a FM for creating "DocumentInfoRecords" including original-document.

creating the "DocumentInfoRecords" works fine, but i have a problem with the DOCUMENTFILES for linking the origin document.

I got the hint to do it via UNIX-file, but it doesnot work.

please have a look at this and give me any idea.

thx in advance, Silvio ; -)

==========

  • create UNIX-File and tranfer Original into UNIX

OPEN DATASET file_name FOR OUTPUT

IN BINARY MODE

MESSAGE msg.

IF sy-subrc <> 0.

MESSAGE a899(zz) WITH file_name.....

ENDIF.

TRANSFER doc_content TO file_name.

CLOSE DATASET file_name.

move: art to lt_files-documenttype,

number to lt_files-documentnumber,

'000' to lt_files-documentpart,

'00' to lt_files-documentversion,

'1' to lt_files-originaltype,

'DMS_C1_ST' to lt_files-storagecategory,

file_name to lt_files-docfile,

' ' to lt_files-checkedin.

translate lt_files-wsapplication to upper case.

append lt_files.

move: art to documentdata-documenttype,

number to documentdata-documentnumber,

'000' to documentdata-documentpart,

'00' to documentdata-documentversion,

STATE TO documentdata-STATUSINTERN,

TITLE_SHORT TO documentdata-DESCRIPTION.

...

CLEAR ls_return.

  • Call BAPI for Create

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

EXPORTING

documentdata = documentdata

pf_http_dest = 'SAPHTTPA'

IMPORTING

documentnumber = lt_files-documentnumber

documenttype = lt_files-documenttype

documentversion = lt_files-documentversion

documentpart = lt_files-documentpart

return = return

TABLES

documentfiles = lt_files

EXCEPTIONS

OTHERS = 1.

commit work.

========

1 REPLY 1
Read only

Former Member
0 Likes
398

Hi,

I am not sure what is the problem you are facing. You need to pass the details of the file to the parameter DOCUMENTFILES STRUCTURE BAPI_DOC_FILES2.

Remember this is TABLES parameter, so you need to declare a internal table of type BAPI_DOC_FILES2, and pass that to the function.

Can you explain the problem, if it something else?

Regards,

Ravi

Note - Please mark the helpful answers