Attach a document to VA02 - Background
I really need your help. I have a scenario where I have to attach a PDF document to VA02.
I managed to make it work in dialog mode, but in my scenario I have to make it work in background.
The file will come to SAP via RFC in a lraw field. Then I have to get this file and attach it to VA02.
This is the guide I used to make it work in dialog mode. Attach File to Standard Trasaction VA02 Using Function Module SO_DOCUMENT_REPOSITORY_MANAGER
Thanks ! If you need any more information, please let me know.
Obs.: My problem is running in background. Any option is welcome. Save the file to a unix folder and upload, or read it straight from the table and attach, etc...
Roberto Vacca replied
You can try this:
Use SO_SOLIXTAB_TO_SOLITAB to convert your RAW data do SOLITAB.
Use FM SO_CONVERT_CONTENTS_BIN to convert your binary data
Use FM SO_FOLDER_ROOT_ID_GET to get your folder root data
Compile your objdata like this:
ls_obj_data-objsns = 'O'.
ls_obj_data-objla = sy-langu.
ls_obj_data-objdes = p_desc.
lv_offset = STRLEN( p_file ) - 3.
ls_obj_data-file_ext = p_file+lv_offset(3).
ls_obj_data-objlen = LINES( it_content ) * 255.
Call FM SO_OBJECT_INSERT to feed your object attachment.
With folder data from SD_FOLDER_ROOT_ID_GET, call BINARY_RELATION_CREATE_COMMIT to generate link between attachment and document
You should get your goal.
Hope to help