Hope it's will be helpfull.
*** Data Definition
DATA : v_cout TYPE dms_checkout_def,
v_dttrg TYPE dttrg, "Name of data carrier
v_docfile TYPE dms_doc_file,
v_dappl TYPE dappl, "Application
v_tabix TYPE i ,
v_tdwa TYPE tdwa ,
v_phio TYPE dms_phio,
v_frontend TYPE dms_frontend_data,
v_exception TYPE REF TO cx_root.
*
**
*** Internal Table Definition
DATA : t_drao TYPE STANDARD TABLE OF drao,
t_kpro TYPE dms_tbl_file ,
t_hexa TYPE solix_tab.
**
*** Constants
CONSTANTS : c_hostname TYPE ntadr VALUE 'DEFAULT', "Hostname
c_type TYPE typdt VALUE 'PC', "Type
c_system TYPE char4 VALUE 'WN32'. "System
**
*** field-symblos
FIELD-SYMBOLS : TYPE LINE OF dms_tbl_file,
TYPE LINE OF dms_tbl_phio .
CLEAR : v_tdwa .
v_frontend-frontend_type = c_type. "'PC'.
v_frontend-hostname = c_hostname. "'DEFAULT'.
v_frontend-winsys = c_system. "'WN32'.
v_frontend-platform = 0.
v_cout-comp_get = abap_true.
v_cout-batchmode = abap_true.
v_cout-content_provide = 'TBL'.
* Check if for FID Type KPRO is used
CALL FUNCTION 'CV200_DB_TDWA_SELECT'
EXPORTING
pf_dokar = fid-dokar
IMPORTING
psx_tdwa = v_tdwa
EXCEPTIONS
not_found = 1.
check sy-subrc eq 0.
v_cout-kpro_use = v_tdwa-kpro_use.
CASE v_tdwa-kpro_use.
WHEN abap_true.
* Kpro is used
* retrieve FID Master Data
FREE t_kpro.
CALL FUNCTION 'CV120_KPRO_MASTER_DATA_GET'
EXPORTING
pf_dokar = fid-dokar
pf_doknr = fid-doknr
pf_dokvr = fid-dokvr
pf_doktl = fid-doktl
TABLES
ptx_data = t_kpro
EXCEPTIONS
not_found = 1
error = 2.
check sy-subrc eq 0.
v_frontend-frontend_type = 'KP'.
LOOP AT t_kpro ASSIGNING.
FREE t_drao.
LOOP AT-tbl_phios ASSIGNING .
MOVE-CORRESPONDING TO v_phio.
CALL FUNCTION 'CV120_DOC_CHECKOUT_VIEW'
EXPORTING
ps_cout_def = v_cout
ps_doc_file = v_docfile
ps_draw = fid
ps_phio = v_phio
ps_frontend = v_frontend
TABLES
ptx_content = t_drao
EXCEPTIONS
error = 1.
check sy-subrc eq 0.
perform transform_fid_to_binary table T_DRAO
T_HEXA.
ENDLOOP.
ENDLOOP.
WHEN abap_false.
DO 2 TIMES.
CLEAR : v_docfile .
FREE : t_drao.
v_tabix = sy-index.
v_docfile-fileno = v_tabix.
CASE v_tabix.
WHEN 1.
v_dappl = fid-dappl.
v_dttrg = fid-dttrg.
WHEN 2.
v_dappl = fid-dappl1.
v_dttrg = fid-dttrg1.
ENDCASE.
v_docfile-dappl = v_dappl.
v_docfile-dttrg = v_dttrg.
CALL FUNCTION 'CV120_DOC_CHECKOUT'
EXPORTING
ps_cout_def = v_cout
ps_draw = fid
ps_doc_file = v_docfile
TABLES
ptx_drao = t_drao
EXCEPTIONS
error = 1
OTHERS = 2.
check sy-subrc eq 0.
check sy-subrc eq 0.
perform transform_fid_to_binary tables T_DRAO
T_HEXA.
ENDDO.
ENDCASE.
Form transform_fid_to_binary tables DRAO type DRAO
binary_table type SOLIX.
*** Field-Symbols definition
FIELD-SYMBOLS : TYPE drao ,
DATA : v_cout TYPE dms_checkout_def,
v_dttrg TYPE dttrg, "Name of data carrier
v_docfile TYPE dms_doc_file,
v_dappl TYPE dappl, "Application
v_tabix TYPE i ,
v_tdwa TYPE tdwa ,
v_phio TYPE dms_phio,
v_frontend TYPE dms_frontend_data,
v_exception TYPE REF TO cx_root.
*
**
*** Internal Table Definition
DATA : t_drao TYPE STANDARD TABLE OF drao,
t_kpro TYPE dms_tbl_file ,
t_hexa TYPE solix_tab.
**
*** Constants
CONSTANTS : c_hostname TYPE ntadr VALUE 'DEFAULT', "Hostname
c_type TYPE typdt VALUE 'PC', "Type
c_system TYPE char4 VALUE 'WN32'. "System
**
*** field-symblos
FIELD-SYMBOLS :
CLEAR : v_tdwa .
v_frontend-frontend_type = c_type. "'PC'.
v_frontend-hostname = c_hostname. "'DEFAULT'.
v_frontend-winsys = c_system. "'WN32'.
v_frontend-platform = 0.
v_cout-comp_get = abap_true.
v_cout-batchmode = abap_true.
v_cout-content_provide = 'TBL'.
* Check if for FID Type KPRO is used
CALL FUNCTION 'CV200_DB_TDWA_SELECT'
EXPORTING
pf_dokar = fid-dokar
IMPORTING
psx_tdwa = v_tdwa
EXCEPTIONS
not_found = 1.
check sy-subrc eq 0.
v_cout-kpro_use = v_tdwa-kpro_use.
CASE v_tdwa-kpro_use.
WHEN abap_true.
* Kpro is used
* retrieve FID Master Data
FREE t_kpro.
CALL FUNCTION 'CV120_KPRO_MASTER_DATA_GET'
EXPORTING
pf_dokar = fid-dokar
pf_doknr = fid-doknr
pf_dokvr = fid-dokvr
pf_doktl = fid-doktl
TABLES
ptx_data = t_kpro
EXCEPTIONS
not_found = 1
error = 2.
check sy-subrc eq 0.
v_frontend-frontend_type = 'KP'.
LOOP AT t_kpro ASSIGNING
FREE t_drao.
LOOP AT
MOVE-CORRESPONDING
CALL FUNCTION 'CV120_DOC_CHECKOUT_VIEW'
EXPORTING
ps_cout_def = v_cout
ps_doc_file = v_docfile
ps_draw = fid
ps_phio = v_phio
ps_frontend = v_frontend
TABLES
ptx_content = t_drao
EXCEPTIONS
error = 1.
check sy-subrc eq 0.
perform transform_fid_to_binary table T_DRAO
T_HEXA.
ENDLOOP.
ENDLOOP.
WHEN abap_false.
DO 2 TIMES.
CLEAR : v_docfile .
FREE : t_drao.
v_tabix = sy-index.
v_docfile-fileno = v_tabix.
CASE v_tabix.
WHEN 1.
v_dappl = fid-dappl.
v_dttrg = fid-dttrg.
WHEN 2.
v_dappl = fid-dappl1.
v_dttrg = fid-dttrg1.
ENDCASE.
v_docfile-dappl = v_dappl.
v_docfile-dttrg = v_dttrg.
CALL FUNCTION 'CV120_DOC_CHECKOUT'
EXPORTING
ps_cout_def = v_cout
ps_draw = fid
ps_doc_file = v_docfile
TABLES
ptx_drao = t_drao
EXCEPTIONS
error = 1
OTHERS = 2.
check sy-subrc eq 0.
check sy-subrc eq 0.
perform transform_fid_to_binary tables T_DRAO
T_HEXA.
ENDDO.
ENDCASE.
Form transform_fid_to_binary tables DRAO type DRAO
binary_table type SOLIX.
*** Field-Symbols definition
FIELD-SYMBOLS :
ALSO READ:
- Creating A Directory On Presentation Server Using FM GUI_CREATE_DIRECTORY.
- Removing A Directory From Presentation Server Using FM GUI_REMOVE_DIRECTORY.
- Removing A File From Presentation Server Using FM GUI_DELETE_FILE.
- ZIP Files In Application Server Using FM SCMS_XSTRING_TO_BINARY.
- Saving Files To Presentation Server Using Methods.
RETURN TO MAIN INDEX:
- Sample Programs On Uploading & Downloading Files.
- Sample Programs On HR ABAP.
- Sample Report Programs On ALV List/ Grid Display.
- Sample Programs On Selection Screen.
- Sample Programs On BDC.
.....Back To MAIN INDEX.
No comments:
Post a Comment