‎2006 Jul 06 6:16 AM
hello everybody,
please tell me how can i create a similar functionality bihind the create attachment button like in trac./so00. tell me something other than Debugging.
thanks in advance
chetan vishnoi
‎2006 Jul 18 2:23 PM
Hi,
check this code,
DATA method1 LIKE sy-ucomm.
DATA g_user LIKE soudnamei1.
DATA g_user_data LIKE soudatai1.
DATA g_owner LIKE soud-usrnam.
DATA g_receipients LIKE soos1 OCCURS 0 WITH HEADER LINE.
DATA g_document LIKE sood4 .
DATA g_header LIKE sood2.
DATA g_folmam LIKE sofm2.
DATA g_objcnt LIKE soli OCCURS 0 WITH HEADER LINE.
DATA g_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
DATA g_objpara LIKE selc OCCURS 0 WITH HEADER LINE.
DATA g_objparb LIKE soop1 OCCURS 0 WITH HEADER LINE.
DATA g_attachments LIKE sood5 OCCURS 0 WITH HEADER LINE.
DATA g_references LIKE soxrl OCCURS 0 WITH HEADER LINE.
DATA g_authority LIKE sofa-usracc.
DATA g_ref_document LIKE sood4.
DATA g_new_parent LIKE soodk.
DATA: BEGIN OF g_files OCCURS 10 ,
text(4096) TYPE c,
END OF g_files.
DATA: fold_number(12) TYPE c,
fold_yr(2) TYPE c,
fold_type(3) TYPE c.
PARAMETERS ws_file(4096) TYPE c DEFAULT 'c:\ Vikalp Solutions'.
Can be any file from your pc....either xls or word or ppt etc...
g_user-sapname = sy-uname.
CALL FUNCTION 'SO_USER_READ_API1'
EXPORTING
user = g_user
PREPARE_FOR_FOLDER_ACCESS = ' '
IMPORTING
user_data = g_user_data
EXCEPTIONS
USER_NOT_EXIST = 1
PARAMETER_ERROR = 2
X_ERROR = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
fold_type = g_user_data-outboxfol+0(3).
fold_yr = g_user_data-outboxfol+3(2).
fold_number = g_user_data-outboxfol+5(12).
CLEAR g_files.
REFRESH : g_objcnt,
g_objhead,
g_objpara,
g_objparb,
g_receipients,
g_attachments,
g_references,
g_files.
method1 = 'SAVE'.
g_document-foltp = fold_type.
g_document-folyr = fold_yr.
g_document-folno = fold_number.
g_document-objtp = g_user_data-object_typ.
.
g_document-objdes = 'testing by program'.
g_document-folrg = 'O'.
g_document-objlen = '0'.
g_document-file_ext = 'TXT'.
g_header-objdes = 'testing by program'.
g_header-file_ext = 'TXT'.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = method1
office_user = sy-uname
ref_document = g_ref_document
new_parent = g_new_parent
IMPORTING
authority = g_authority
TABLES
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
CHANGING
document = g_document
header_data = g_header
FOLMEM_DATA =
RECEIVE_DATA =
.
File from the pc to send...
method1 = 'ATTCREATEFROMPC'.
g_files-text = ws_file.
APPEND g_files.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
IMPORTING
authority = g_authority
TABLES
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
CHANGING
document = g_document
header_data = g_header.
method1 = 'SEND'.
g_receipients-recnam = 'MK085'.
g_receipients-recesc = 'B'.
g_receipients-sndex = 'X'.
APPEND g_receipients.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
IMPORTING
authority = g_authority
TABLES
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
CHANGING
document = g_document
header_data = g_header.
Hope this helps u.
Regards,
Seema.
‎2006 Jul 06 6:19 AM
Hi chetan,
1. If you are talking about Document Management System (DMS),
then the tcode is OAOR,
where u can STORE your word/excel/bitmaps,
and other documents/files, in the r/3 system.
regards,
amit m.
‎2006 Jul 18 2:23 PM
Hi,
check this code,
DATA method1 LIKE sy-ucomm.
DATA g_user LIKE soudnamei1.
DATA g_user_data LIKE soudatai1.
DATA g_owner LIKE soud-usrnam.
DATA g_receipients LIKE soos1 OCCURS 0 WITH HEADER LINE.
DATA g_document LIKE sood4 .
DATA g_header LIKE sood2.
DATA g_folmam LIKE sofm2.
DATA g_objcnt LIKE soli OCCURS 0 WITH HEADER LINE.
DATA g_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
DATA g_objpara LIKE selc OCCURS 0 WITH HEADER LINE.
DATA g_objparb LIKE soop1 OCCURS 0 WITH HEADER LINE.
DATA g_attachments LIKE sood5 OCCURS 0 WITH HEADER LINE.
DATA g_references LIKE soxrl OCCURS 0 WITH HEADER LINE.
DATA g_authority LIKE sofa-usracc.
DATA g_ref_document LIKE sood4.
DATA g_new_parent LIKE soodk.
DATA: BEGIN OF g_files OCCURS 10 ,
text(4096) TYPE c,
END OF g_files.
DATA: fold_number(12) TYPE c,
fold_yr(2) TYPE c,
fold_type(3) TYPE c.
PARAMETERS ws_file(4096) TYPE c DEFAULT 'c:\ Vikalp Solutions'.
Can be any file from your pc....either xls or word or ppt etc...
g_user-sapname = sy-uname.
CALL FUNCTION 'SO_USER_READ_API1'
EXPORTING
user = g_user
PREPARE_FOR_FOLDER_ACCESS = ' '
IMPORTING
user_data = g_user_data
EXCEPTIONS
USER_NOT_EXIST = 1
PARAMETER_ERROR = 2
X_ERROR = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
fold_type = g_user_data-outboxfol+0(3).
fold_yr = g_user_data-outboxfol+3(2).
fold_number = g_user_data-outboxfol+5(12).
CLEAR g_files.
REFRESH : g_objcnt,
g_objhead,
g_objpara,
g_objparb,
g_receipients,
g_attachments,
g_references,
g_files.
method1 = 'SAVE'.
g_document-foltp = fold_type.
g_document-folyr = fold_yr.
g_document-folno = fold_number.
g_document-objtp = g_user_data-object_typ.
.
g_document-objdes = 'testing by program'.
g_document-folrg = 'O'.
g_document-objlen = '0'.
g_document-file_ext = 'TXT'.
g_header-objdes = 'testing by program'.
g_header-file_ext = 'TXT'.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = method1
office_user = sy-uname
ref_document = g_ref_document
new_parent = g_new_parent
IMPORTING
authority = g_authority
TABLES
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
CHANGING
document = g_document
header_data = g_header
FOLMEM_DATA =
RECEIVE_DATA =
.
File from the pc to send...
method1 = 'ATTCREATEFROMPC'.
g_files-text = ws_file.
APPEND g_files.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
IMPORTING
authority = g_authority
TABLES
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
CHANGING
document = g_document
header_data = g_header.
method1 = 'SEND'.
g_receipients-recnam = 'MK085'.
g_receipients-recesc = 'B'.
g_receipients-sndex = 'X'.
APPEND g_receipients.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
IMPORTING
authority = g_authority
TABLES
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
CHANGING
document = g_document
header_data = g_header.
Hope this helps u.
Regards,
Seema.