Vous êtes sur la page 1sur 23

 Community

 Topics
 Answers
 Blogs
 Events
 Programs
 Resources
 What's New


 Home
 Community
 Questions
 Ask a Question
 Write a Blog Post
 Login / Sign-up

Not what you're looking for? Search community questions.

1
Rodney Sweat

Mass load of documents into EASY DMS


Posted onSep 01, 2015 at 07:19 PM | 390 Views
Follow
 RSS Feed
Gentlemen
How would you recommend mass loading documents into SAP EASY DMS .
I have two sets of documents.
One set is already in SAP DMS but as I understand it, we need to move these documents to the
EASY DMS directory and the only way to do that is to create them by the execution of the
EasyDMS software.
Second set is documents NOT in SAP DMS that needs to be loaded into EasyDMS.
I can't find any documentation that suggest a process or is there a BAPI available in SAP. I don't
want a BAPI for creating a SAP DMS document but I need to BAPI to create an EasyDMS
document ( I think)
Please help
RS
PLM Document Management System (DMS)

Related questions
Editing a Document Info Record in SAP PLM
By John Mher Flotildes, Jul 15, 2019
Mass Loading of documents on Easy DMS
By Former Member, Apr 05, 2011
5 Answers
Sort by: 
 Votes

 Newest

 Oldest

  Best Answer

Chandu Rdy

Posted onSep 03, 2015 at 04:01 AM

Hi Rodney,
EasyDMS is MS explorer integration with SAP. DMS is part of SAP
components.
Based on the hardware setup we can decide the storage location for your
documents.
Below link contains the ABAP program for bulk documents into sap. Please do
the changes in the program as your configured the data.
http://wiki.scn.sap.com/wiki/display/Snippets/Abap+code+for+mass+upload+in+
DMS
Regards,
Chandu.

o Share

Tilak Raj

Posted onSep 02, 2015 at 12:11 PM

Hi Rodney,
One set is already in SAP DMS but as I understand it, we need to move
these documents to the EASY DMS directory and the only way to do
that is to create them by the execution of the EasyDMS software.
1) To meet these requirements, firstly you have to create a folders in EasyDMS,
where you want to see all SAP DMS document info records.
2) Go to t-code CV12 (change document structure), select the folder, add all
the Document info records as Item category "D". For huge data structure, you
can create LSMW program and use the same for updating different folders.
3) Check the document info records in EasyDMS.

Second set is documents NOT in SAP DMS that needs to be loaded


into EasyDMS.

I can't find any documentation that suggest a process or is there a BAPI


available in SAP. I don't want a BAPI for creating a SAP DMS
document but I need to BAPI to create an EasyDMS document ( I think)
1) Either create a LSMW program to upload documents in SAP or use
BAPI_DOCUMENT_CREATE
2) Then same DIR can be entered in document structure (CV12) as mentioned
above for listing them into EasyDMS.
3) In case you are using single doc type, you can also use copypaste
functionality to directly create multiple documents in EasyDMS without user
interaction.
/Tilak

o Share

Former Member

Posted onSep 03, 2015 at 04:37 AM

Hi Rodney,
Easy DMS is a tool to explore document in easy way like (Windows explorer)
Back end every thing happen in SAP ECC through RFC.
One set is already in SAP DMS but as I understand it, we need to move these
documents to the EASY DMS directory and the only way to do that is to create
them by the execution of the EasyDMS software.

You need to create document folder (Mandatory Public folder). This can be
created through T code CV11 and change CV12.
Also you can view the same in DMS through browser option and same can be
viewed in easy DMS.
Second set is documents NOT in SAP DMS that needs to be loaded into
EasyDMS.
I can't find any documentation that suggest a process or is there a BAPI
available in SAP. I don't want a BAPI for creating a SAP DMS document but I
need to BAPI to create an EasyDMS document ( I think)
If you require document to be available in E DMS then DIR to be created in
DMS and the same needs to to assigned in document structure. There is no
way to create through FM for E DMS. Since RFC calls the BAPI
BAPI_DOCUMENT_CREATE2 which used to create DIR.

Rgds,
Nayeem.

FOlder.png (35.5 kB)

struc.png (28.6 kB)

o Share

 Caetano Almeida

Posted onSep 02, 2015 at 11:18 AM

Hello
This thread was moved to the space SAP Document Management. Please use
this space for DMS related issues.

BR
Caetano

o Share


Former Member
Posted onSep 02, 2015 at 12:32 PM
1
Please try to use win shuttle, if you have license, its easy way of uploading all
the data.

o Share

Find us on







 Privacy
 Terms of Use
 Legal Disclosure
 Copyright
 Trademark
 Cookie Preferences
 Newsletter
 Support
 Community
 Topics
 Answers
 Blogs
 Events
 Programs
 Resources
 What's New

 Home
 Community
 Questions
 Ask a Question
 Write a Blog Post
 Login / Sign-up
Not what you're looking for? Search community questions.

Rodney Sweat

Mass load of documents into EASY DMS


Posted onSep 01, 2015 at 07:19 PM | 390 Views

Follow

 RSS Feed
Gentlemen
How would you recommend mass loading documents into SAP EASY DMS .
I have two sets of documents.
One set is already in SAP DMS but as I understand it, we need to move these documents to the
EASY DMS directory and the only way to do that is to create them by the execution of the
EasyDMS software.
Second set is documents NOT in SAP DMS that needs to be loaded into EasyDMS.
I can't find any documentation that suggest a process or is there a BAPI available in SAP. I don't
want a BAPI for creating a SAP DMS document but I need to BAPI to create an EasyDMS
document ( I think)
Please help
RS
PLM Document Management System (DMS)

Related questions
Editing a Document Info Record in SAP PLM
By John Mher Flotildes, Jul 15, 2019

Mass Loading of documents on Easy DMS

By Former Member, Apr 05, 2011

5 Answers
Sort by: 

 Votes

 Newest

 Oldest
  Best Answer

Chandu Rdy
Posted onSep 03, 2015 at 04:01 AM
3
Hi Rodney,
EasyDMS is MS explorer integration with SAP. DMS is part of SAP components.
Based on the hardware setup we can decide the storage location for your documents.
Below link contains the ABAP program for bulk documents into sap. Please do the
changes in the program as your configured the data.
http://wiki.scn.sap.com/wiki/display/Snippets/Abap+code+for+mass+upload+in+DMS
Regards,
Chandu.
o Share


Tilak Raj
Posted onSep 02, 2015 at 12:11 PM
2
Hi Rodney,
One set is already in SAP DMS but as I understand it, we need to move these
documents to the EASY DMS directory and the only way to do that is to create them by
the execution of the EasyDMS software.
1) To meet these requirements, firstly you have to create a folders in EasyDMS, where
you want to see all SAP DMS document info records.
2) Go to t-code CV12 (change document structure), select the folder, add all the
Document info records as Item category "D". For huge data structure, you can create
LSMW program and use the same for updating different folders.
3) Check the document info records in EasyDMS.

Second set is documents NOT in SAP DMS that needs to be loaded into EasyDMS.
I can't find any documentation that suggest a process or is there a BAPI available in
SAP. I don't want a BAPI for creating a SAP DMS document but I need to BAPI to create
an EasyDMS document ( I think)
1) Either create a LSMW program to upload documents in SAP or use
BAPI_DOCUMENT_CREATE
2) Then same DIR can be entered in document structure (CV12) as mentioned above for
listing them into EasyDMS.
3) In case you are using single doc type, you can also use copypaste functionality to
directly create multiple documents in EasyDMS without user interaction.
/Tilak
o Share

Former Member

Posted onSep 03, 2015 at 04:37 AM


2
Hi Rodney,
Easy DMS is a tool to explore document in easy way like (Windows explorer) Back end
every thing happen in SAP ECC through RFC.
One set is already in SAP DMS but as I understand it, we need to move these
documents to the EASY DMS directory and the only way to do that is to create them by
the execution of the EasyDMS software.

You need to create document folder (Mandatory Public folder). This can be created
through T code CV11 and change CV12.
Also you can view the same in DMS through browser option and same can be viewed in
easy DMS.

Second set is documents NOT in SAP DMS that needs to be loaded into EasyDMS.
I can't find any documentation that suggest a process or is there a BAPI available in
SAP. I don't want a BAPI for creating a SAP DMS document but I need to BAPI to create
an EasyDMS document ( I think)
If you require document to be available in E DMS then DIR to be created in DMS and the
same needs to to assigned in document structure. There is no way to create through FM
for E DMS. Since RFC calls the BAPI BAPI_DOCUMENT_CREATE2 which used to
create DIR.
Rgds,
Nayeem.

FOlder.png (35.5 kB)
struc.png (28.6 kB)
o Share


 

 Caetano Almeida
Posted onSep 02, 2015 at 11:18 AM
1
Hello
This thread was moved to the space SAP Document Management. Please use this
space for DMS related issues.

BR
Caetano
o Share


Former Member
Posted onSep 02, 2015 at 12:32 PM
1
Please try to use win shuttle, if you have license, its easy way of uploading all the data.
o Share

Find us on






 Privacy
 Terms of Use
 Legal Disclosure
 Copyright
 Trademark
 Cookie Preferences
 Newsletter
 Support

 Skip to content
 Skip to breadcrumbs
 Skip to header menu
 Skip to action menu
 Skip to quick search

Welcome to the new version of SAP Community Wiki: Learn What's New? and what has
changed.

Community Wiki
 Spaces
 


Quick Search

 Help



 Log in
Code Gallery

 Pages

ConfigureSpace tools

1. Dashboard

2. …
3.  Document Management (DMS for ERP)

Skip to end of banner

Go to start of banner

Abap code for mass upload in DMS


Skip to end of metadata

 Created by Former Member, last modified by Former Member on Jun 20, 2013


Go to start of metadata

Error rendering macro 'code': Invalid value specified for parameter


'com.atlassian.confluence.ext.code.render.InvalidValueException'
REPORT zdms_mass_upload.
TYPE-POOLS:truxs, slis.
DATA:
lt_documentdescriptions TYPE TABLE OF bapi_doc_drat,
lt_characteristicvalues TYPE TABLE OF bapi_characteristic_values,
lt_documentfiles TYPE TABLE OF bapi_doc_files2,
lt_drad TYPE TABLE OF bapi_doc_drad,
lt_return TYPE TABLE OF bapiret2,
bt_return TYPE TABLE OF bapiret2,
ls_documentdata TYPE bapi_doc_draw2,
ls_drad TYPE bapi_doc_drad,
ls_documentdescriptions TYPE bapi_doc_drat,
ls_characteristicvalues TYPE bapi_characteristic_values,
ls_documentfiles TYPE bapi_doc_files2,
ls_return TYPE bapiret2,
ss_return TYPE bapiret2.

*Local Variable Declaration


DATA: lv_documenttype TYPE bapi_doc_aux-doctype,
lv_documentnumber TYPE bapi_doc_aux-docnumber,
lv_documentpart TYPE bapi_doc_aux-docpart,
lv_documentversion TYPE bapi_doc_aux-docversion,
lv_msg TYPE char255,
tv_msg TYPE char255.
TYPES: BEGIN OF i_out,
index TYPE sy-tabix,
docnumber TYPE bapi_doc_aux-docnumber,
message(255) TYPE c,
END OF i_out.

TYPES: BEGIN OF ty_dokar,


dokar TYPE dokar,
END OF ty_dokar.

*ALV data declarations


DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.

DATA: it_out TYPE STANDARD TABLE OF i_out,


wa_out TYPE i_out,
it_success TYPE STANDARD TABLE OF i_out,
ls_out TYPE i_out,
w_index TYPE sy-tabix.

DATA: lt_dokar TYPE STANDARD TABLE OF ty_dokar.

DATA: gt_file TYPE STANDARD TABLE OF alsmex_tabline INITIAL SIZE 0.

* Access file and create XSTRING


TYPES: BEGIN OF ty_xline,
ind(4) TYPE c,
doc_type(3) TYPE c,
desc(50) TYPE c,
filename(225) TYPE c,
filetype(3) TYPE c,
filepath(225) TYPE c,
labor(3) TYPE c,
storage(10) TYPE c,
value1(30) TYPE c,
value2(30) TYPE c,
value3(30) TYPE c,
value4(30) TYPE c,
value5(30) TYPE c,
value6(30) TYPE c,
value7(30) TYPE c,
value8(30) TYPE c,
value9(30) TYPE c,
value10(30) TYPE c,
value11(30) TYPE c,
value12(30) TYPE c,
END OF ty_xline.

TYPES: BEGIN OF ty_errorlog,


ind(4) TYPE c,
doc_type(3) TYPE c,
desc(50) TYPE c,
filename(225) TYPE c,
filetype(3) TYPE c,
filepath(225) TYPE c,
storage(10) TYPE c,
value1(30) TYPE c,
value2(30) TYPE c,
value3(30) TYPE c,
value4(30) TYPE c,
value5(30) TYPE c,
value6(30) TYPE c,
value7(30) TYPE c,
value8(30) TYPE c,
value9(30) TYPE c,
value10(30) TYPE c,
value11(30) TYPE c,
value12(30) TYPE c,
msg TYPE char255,
END OF ty_errorlog.
DATA:
lf_file TYPE rlgrap-filename,
" lf_file type string,
" LF_FILELENGTH TYPE I,
lt_datatab TYPE STANDARD TABLE OF ty_xline,
lt_datatab1 TYPE STANDARD TABLE OF ty_xline,
it_errorlog TYPE STANDARD TABLE OF ty_errorlog,
ls_errorlog TYPE ty_errorlog,
ls_datatab TYPE ty_xline,
ls_datatab1 TYPE ty_xline,
req_datatab TYPE ty_xline.

DATA: l_lines TYPE i,


l_lines1 TYPE i,
w_lines TYPE i,
l_dokar TYPE dokar,
w_header_txt(70) TYPE c.

DATA: ls_tdwa TYPE tdwa,


ls_tdwo TYPE tdwo,
ls_klah TYPE klah,
lt_ksml TYPE STANDARD TABLE OF ksml,
lt_tdwo TYPE STANDARD TABLE OF tdwo,
"LS_KSML TYPE KSML,
lt_cabn TYPE STANDARD TABLE OF cabn.

DATA: it_raw TYPE truxs_t_text_data.


DATA: tt_return TYPE ddshretval OCCURS 0 WITH HEADER LINE.
DATA: gt_upld TYPE STANDARD TABLE OF ty_xline INITIAL SIZE 0 ,
gt_error TYPE STANDARD TABLE OF ty_xline INITIAL SIZE 0 .

DATA : w_mara TYPE matnr,


w_equi TYPE equnr.

DATA: gwa_upld TYPE ty_xline,


gwa_data TYPE ty_xline,
gwa_file TYPE alsmex_tabline.

DATA: value(15) TYPE c,


num(2) TYPE c,
w_tplnr TYPE tplnr.

DATA : w_vendorno TYPE bapivendor_01-vendor_no,


w_cust TYPE bapicustomer_id-customer.

INITIALIZATION.
REFRESH: lt_dokar.
SELECT dokar FROM tdwa INTO TABLE lt_dokar.
SORT lt_dokar BY dokar.
************************************************************************
* Selection screen
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-005.
PARAMETERS: doctyp TYPE dokar OBLIGATORY,
file TYPE localfile OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.

************************************************************************
* Events
************************************************************************
AT SELECTION-SCREEN.
PERFORM main.
* READ TABLE lt_dokar INTO l_dokar WITH KEY dokar = doctyp BINARY SEARCH.
*
* SELECT SINGLE dokar FROM tdwa INTO l_dokar WHERE dokar = doctyp.
* IF sy-subrc NE 0.
* MESSAGE e001(zdms) WITH doctyp .
* ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.


PERFORM file_f4.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR doctyp.


PERFORM get_doctyp.

START-OF-SELECTION.

PERFORM get_characteristics.
PERFORM get_objects.
PERFORM readdata.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.

*&---------------------------------------------------------------------*
*& Form FILE_F4
*&---------------------------------------------------------------------*
FORM file_f4 .
DATA:
lt_filetable TYPE filetable,
lf_rc TYPE i.
REFRESH: lt_filetable.
CLEAR: lf_rc.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
multiselection = abap_false
CHANGING
file_table = lt_filetable
rc = lf_rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.

IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
DISPLAY LIKE 'E'
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
* Number of selected filed must be equal to one.
CHECK lf_rc = 1.

* Access selected file


DATA:
ls_file TYPE file_table.

READ TABLE lt_filetable INTO ls_file INDEX 1.


CHECK sy-subrc = 0.

file = ls_file-filename.

ENDFORM. " FILE_F4


*&---------------------------------------------------------------------*
*& Form MAIN
*&---------------------------------------------------------------------*
FORM main .
IF file IS INITIAL.
MESSAGE s058(vscan) DISPLAY LIKE 'E'.
EXIT.
ENDIF.
lf_file = file.
DATA: lv_date(10) TYPE c,
w_truxs TYPE truxs_t_text_data.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'


EXPORTING
* I_FIELD_SEPERATOR =
* I_LINE_HEADER =
i_tab_raw_data = w_truxs
i_filename = lf_file
TABLES
i_tab_converted_data = lt_datatab
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
.

MOVE lt_datatab TO lt_datatab1.

ENDFORM. " MAIN


*&---------------------------------------------------------------------*
*& Form GET_CHARACTERISTICS
*&---------------------------------------------------------------------*
FORM get_characteristics .
CLEAR: ls_tdwa, ls_klah, l_lines.

REFRESH:lt_ksml.
SELECT SINGLE * FROM tdwa INTO ls_tdwa WHERE dokar = doctyp.

SELECT SINGLE * FROM klah INTO ls_klah WHERE class = ls_tdwa-klasse


AND klart = '017'.

SELECT * FROM ksml INTO TABLE lt_ksml WHERE clint = ls_klah-clint.

IF NOT lt_ksml IS INITIAL.


DESCRIBE TABLE lt_ksml LINES l_lines.

SELECT * FROM cabn INTO TABLE lt_cabn FOR ALL ENTRIES IN


lt_ksml WHERE atinn = lt_ksml-imerk .
ENDIF.

ENDFORM. " GET_CHARACTERISTICS


*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
FORM build_fieldcatalog .

fieldcatalog-fieldname = 'INDEX'.
fieldcatalog-seltext_m = 'Index Number'(008).
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 25.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.

fieldcatalog-fieldname = 'DOCNUMBER'.
fieldcatalog-seltext_m = 'Document Number'(002).
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 25.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.

fieldcatalog-fieldname = 'MESSAGE'.
fieldcatalog-seltext_m = 'Message'(003).
fieldcatalog-outputlen = 100.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.

ENDFORM. " BUILD_FIELDCATALOG


*&---------------------------------------------------------------------*
*& Form BUILD_LAYOUT
*&---------------------------------------------------------------------*
FORM build_layout .
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-zebra = 'X'.
w_header_txt = 'Records Processed From File'(004).
CONDENSE w_header_txt.
gd_layout-window_titlebar = w_header_txt.

ENDFORM. " BUILD_LAYOUT


*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
FORM display_alv_report .
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_callback_user_command = 'USER_COMMAND'
i_save = 'X'
TABLES
t_outtab = it_out
EXCEPTIONS
program_error = 1
OTHERS = 2.

ENDFORM. " DISPLAY_ALV_REPORT


*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

* Check function code


CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'DOCNUMBER'.

CLEAR wa_out.
READ TABLE it_out INTO wa_out INDEX rs_selfield-tabindex.
SET PARAMETER ID 'CV1' FIELD wa_out-docnumber.
SET PARAMETER ID 'CV2' FIELD ls_datatab-doc_type.
SET PARAMETER ID 'CV4' FIELD '000'.
SET PARAMETER ID 'CV3' FIELD '00'.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'CV03N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM. "user_command
*&---------------------------------------------------------------------*
*& Form GET_DOCTYP
*&---------------------------------------------------------------------*
FORM get_doctyp .
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'DOKAR'
dynpprog = sy-repid
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = lt_dokar
return_tab = tt_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
READ TABLE tt_return INDEX 1.
MOVE tt_return-fieldval TO doctyp.
ENDIF.
ENDFORM. " GET_DOCTYP
*&---------------------------------------------------------------------*
*& Form GET_OBJECTS
*&---------------------------------------------------------------------*
FORM get_objects.
CLEAR: ls_tdwo, ls_klah, l_lines1.
REFRESH:lt_tdwo.

SELECT *
FROM tdwo INTO TABLE lt_tdwo WHERE dokar = doctyp.

IF NOT lt_tdwo IS INITIAL.


DESCRIBE TABLE lt_tdwo LINES l_lines1.
ENDIF.

ENDFORM. " GET_OBJECTS


*&---------------------------------------------------------------------*
*& Form READDATA
*&---------------------------------------------------------------------*
FORM readdata .
****Populate Bapi Tables
CLEAR: ls_documentdata,
ls_drad,
ls_return,
lv_documenttype,
lv_documentnumber,
lv_documentpart,
lv_documentversion.

REFRESH: lt_documentdescriptions,
lt_drad,
lt_characteristicvalues,
lt_documentfiles,
bt_return,
it_out.

CLEAR: req_datatab.
READ TABLE lt_datatab INTO req_datatab INDEX 1.
IF sy-subrc = 0.
DELETE lt_datatab INDEX 1.
ENDIF.
CLEAR: req_datatab.
READ TABLE lt_datatab1 INTO req_datatab INDEX 1.
IF sy-subrc = 0.
DELETE lt_datatab1 INDEX 1.
ENDIF.
DESCRIBE TABLE lt_datatab LINES w_lines.
DESCRIBE TABLE lt_datatab1 LINES w_lines.

LOOP AT lt_datatab INTO ls_datatab.


ON CHANGE OF ls_datatab-ind.
REFRESH: lt_characteristicvalues.
REFRESH lt_drad.
REFRESH: lt_documentdescriptions.
REFRESH lt_documentfiles.

LOOP AT lt_datatab1 INTO ls_datatab1


WHERE ind = ls_datatab-ind.
w_index = ls_datatab1-ind ."sy-tabix.
* HEADER STRUCTURE
ls_documentdata-documenttype = ls_datatab1-doc_type.
ls_documentdata-documentnumber = '*'.
ls_documentdata-documentversion = '00'.
ls_documentdata-documentpart = '000'.
ls_documentdata-description = ls_datatab1-desc.
" LS_DOCUMENTDATA-STATUSEXTERN = 'IA'.
ls_documentdata-laboratory = ls_datatab1-labor.
* Characteristics Table
" REFRESH: lt_characteristicvalues.
CLEAR: ls_characteristicvalues, value.
" REFRESH lt_drad.
CLEAR ls_drad.
FIELD-SYMBOLS: <fs> TYPE any,
<req_fs> TYPE any.
CLEAR: num.
DO l_lines TIMES.
num = num + 1.
CONDENSE num.
CONCATENATE 'VALUE' num INTO value.
ASSIGN COMPONENT value OF STRUCTURE ls_datatab1 TO <fs>.
ASSIGN COMPONENT value OF STRUCTURE req_datatab TO <req_fs>.
ls_characteristicvalues-classtype = '017'.
ls_characteristicvalues-classname = ls_tdwa-klasse.
ls_characteristicvalues-charname = <req_fs>.
ls_characteristicvalues-charvalue = <fs>.
UNASSIGN <fs>.
UNASSIGN <req_fs>.
APPEND ls_characteristicvalues TO lt_characteristicvalues.
CLEAR ls_characteristicvalues.
ENDDO.

DO l_lines1 TIMES.
num = num + 1.
CONDENSE num.
CONCATENATE 'VALUE' num INTO value.
ASSIGN COMPONENT value OF STRUCTURE ls_datatab1 TO <fs>.
ASSIGN COMPONENT value OF STRUCTURE req_datatab TO <req_fs>.
ls_drad-objecttype = <req_fs>.
IF <req_fs> = 'IFLOT' .
SELECT tplnr FROM iflos INTO w_tplnr WHERE strno = <fs>.
ENDSELECT.
ls_drad-objectkey = w_tplnr.

ELSEIF <req_fs> = 'EQUI'.


ls_drad-objectkey = <fs>.
" ls_drad-OBJECTDESCRIPTION = 'abc'.
w_equi = <fs>.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_equi
IMPORTING
output = w_equi.
<fs> = w_equi.

ls_drad-objectkey = <fs>.
ELSEIF <req_fs> = 'MARA'.
ls_drad-objectkey = <fs>.
" ls_drad-OBJECTDESCRIPTION = 'abc'.
w_mara = <fs>.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_mara
IMPORTING
output = w_mara.
<fs> = w_mara.
ls_drad-objectkey = <fs>.

ELSEIF <req_fs> = 'KNA1'.


ls_drad-objectkey = <fs>.
" ls_drad-OBJECTDESCRIPTION = 'abc'.
w_cust = <fs>.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_cust
IMPORTING
output = w_cust.
<fs> = w_cust.
ls_drad-objectkey = <fs>.

ELSEIF <req_fs> = 'LFA1'.


ls_drad-objectkey = <fs>.
w_vendorno = <fs>.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_vendorno
IMPORTING
output = w_vendorno.
<fs> = w_vendorno.

ls_drad-objectkey = <fs>.
ELSE .
ls_drad-objectkey = <fs>.
ENDIF.
UNASSIGN <fs>.
UNASSIGN <req_fs>.
IF ls_drad <> ''.
APPEND ls_drad TO lt_drad.
ENDIF.
CLEAR ls_drad.
CLEAR w_tplnr.
ENDDO.
* Description Table

CLEAR: ls_documentdescriptions.
" REFRESH: lt_documentdescriptions.
ls_documentdescriptions-language = 'EN'.
ls_documentdescriptions-description = ls_datatab1-desc.
APPEND ls_documentdescriptions TO lt_documentdescriptions.
CLEAR ls_documentdescriptions.

" REFRESH lt_documentfiles.


CLEAR ls_documentfiles.
ls_documentfiles-documenttype = ls_datatab1-doc_type..
ls_documentfiles-documentnumber = '*'.
ls_documentfiles-documentpart = '000'.
ls_documentfiles-documentversion = '00'.
ls_documentfiles-sourcedatacarrier = 'PC'.
ls_documentfiles-storagecategory = ls_datatab1-storage.
TRANSLATE ls_datatab1-filetype TO UPPER CASE.
ls_documentfiles-wsapplication = ls_datatab1-filetype.

" if ls_datatab1-filename <> ''.


ls_documentfiles-description = ls_datatab1-filename.
ls_documentfiles-docfile = ls_datatab1-filepath.
ls_documentfiles-checkedin = 'X'.
APPEND ls_documentfiles TO lt_documentfiles.
" ENDIF.
REFRESH lt_return.
CLEAR: lv_documentnumber.
" CLEAR : ls_datatab1.

ENDLOOP.
DELETE lt_documentfiles WHERE docfile = ''.
* CALL BAPI TO UPDATE DATA

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'


EXPORTING
documentdata = ls_documentdata
IMPORTING
documenttype = lv_documenttype
documentnumber = lv_documentnumber
documentpart = lv_documentpart
documentversion = lv_documentversion
return = ls_return
TABLES
characteristicvalues = lt_characteristicvalues
documentdescriptions = lt_documentdescriptions
objectlinks = lt_drad
documentfiles = lt_documentfiles.

APPEND ls_return TO lt_return.


CLEAR ls_return.
* APPEND ls_return TO bt_return.
CLEAR lv_msg.
READ TABLE lt_return INTO ls_return WITH KEY type = 'E'.
IF sy-subrc = 0.

CALL FUNCTION 'FORMAT_MESSAGE'


EXPORTING
id = sy-msgid
lang = 'EN'
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
IMPORTING
msg = lv_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
CLEAR: ls_errorlog, lv_documentnumber.
MOVE-CORRESPONDING ls_datatab TO ls_errorlog.
tv_msg = lv_msg.
ls_errorlog-msg = tv_msg.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'


IMPORTING
return = ss_return.
ELSE.
IF NOT lv_documentnumber IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = lv_documentnumber
IMPORTING
output = lv_documentnumber.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'


EXPORTING
wait = 'X'.
lv_msg = 'Successfully Generated'(001).
CLEAR: ls_out.
ENDIF.
ENDIF.
CLEAR: ls_out.
ls_out-index = w_index.
ls_out-docnumber = lv_documentnumber.
ls_out-message = lv_msg.
APPEND ls_out TO it_out.
ENDON.
ENDLOOP.
ENDFORM. "readdata

 No labels

1 Comment

1.
Former Member
Hello guru,

Looks like an good documentation . I have a requirement is like need to upload bulk


drawings with respect to material master number as well as by creating new DIRs in DMS. Can
you suggest me for any changes need to do in above program.

Thanks very much.

Regards,

Nithal.
o Aug 05, 2014

 Privacy

 Terms of Use

 Legal Disclosure

 Copyright

 Trademark

 Cookie Preferences

Vous aimerez peut-être aussi