Skip to Content
avatar image
Former Member

PDF Generation for LAbels in EHS SAP ABAP

Hi Team,

Request to suggest an idea on the below issue and I want to send the label to the third party system .

1. We have maintain the labels in particular EHS transaction .

2. We have written the code to convert that label to PDF format, but it fails in the Funtion module of "WWI_GENERATE_AND_IMPORT2" .

Listed the code used,

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

SELECT recn dmskey langu FROM estdh INTO TABLE t_dms_key
FOR ALL ENTRIES IN t_spec_header

WHERE delflg NE c_x
AND subid = t_spec_header-subid
AND sbgvid = w_var_name
AND repstatus = c_rep_stat .
IF sy-subrc = 0 AND t_dms_key[] IS NOT INITIAL.
SORT t_dms_key BY recn .

CLEAR wa_dms_key.
READ TABLE t_dms_key INTO wa_dms_key INDEX 1.
IF sy-subrc = 0.

CALL FUNCTION 'C148_TRANSLATE_SUBID_TO_RECN_1'
EXPORTING
i_subid = w_spec_id
IMPORTING
e_recn = w_recntrh.

wa_sbgv-dokar = wa_dms_key-dmskey+00(03) .
wa_sbgv-doknr = wa_dms_key-dmskey+03(25) .
wa_sbgv-dokvr = wa_dms_key-dmskey+28(02) .
wa_sbgv-doktl = wa_dms_key-dmskey+30(03) .

w_flg_write_protocol = c_x.
*start add kar
wa_sbgv-recn = wa_estlp-recn .
wa_sbgv-recnroot = wa_estlp-recnroot .
wa_sbgv-dokar = wa_estlp-dokar .
wa_sbgv-doknr = wa_estlp-doknr .
wa_sbgv-ldepid = wa_estlp-ldepid .
wa_sbgv-rvlid = wa_estlp-rvlid .
wa_sbgv-reptype = wa_estlp-reptype .
wa_sbgv-initrelst = wa_estlp-initrelst .
wa_sbgv-valfr = wa_estlp-valfr .
wa_sbgv-valto = wa_estlp-valto .

*end add kar
CALL FUNCTION 'C125_VALUE_TABLE_GENERATE'
EXPORTING
i_rcglpiot = wa_sbgv
i_recntrh = w_recntrh
* i_rtime_from = '11'
* i_rtime_to = '99'
i_val_date = sy-datum
i_langu = wa_dms_key-langu
i_no_dialog = c_x
i_flg_write_protocol = w_flg_write_protocol
IMPORTING
e_generation_ok = w_generation_ok
TABLES
e_value_tab = w_src_val
e_msg_tab = w_msg_tab
i_param_values_tab = t_param_val[]
EXCEPTIONS
generation_error = 1
status_error = 2
OTHERS = 3.

wa_src_dockey-dokar = wa_dms_key-dmskey+00(03) .
wa_src_dockey-doknr = wa_dms_key-dmskey+03(25) .
wa_src_dockey-dokvr = wa_dms_key-dmskey+28(02) .
wa_src_dockey-doktl = wa_dms_key-dmskey+30(03) .

CALL FUNCTION 'C14S_DOCUMENT_ORIGINAL_COPY'
EXPORTING
i_dockey = wa_src_dockey
IMPORTING
e_filesize = w_src_doc_size
TABLES
e_repfile = t_src_doc
e_exterror_tab = w_exterror_tab
EXCEPTIONS
checkout_orig_failed = 1
OTHERS = 2.


UNPACK w_src_doc_size TO w_docsize_n .

CALL FUNCTION 'WWI_GENERATE_AND_IMPORT2' DESTINATION w_rfcdest
EXPORTING
estoh_recn = wa_estlp-recn
target_doc1_appl = 'PDF'
target_doc2_appl = ' '
mode = 'G'
printer = c_printer
source_doc_size = w_docsize_n
wwi_anchor = w_anchor
IMPORTING
target_doc1_name = w_trg_doc1_name
target_doc2_name = w_trg_doc2_name
target_doc1_size = w_trg_doc1_size_numc
target_doc2_size = w_trg_doc2_size_numc
target_doc1_pages = w_trg_doc1_pages
target_doc2_pages = w_trg_doc2_pages
result = w_wwi_result
TABLES
source_doc = t_src_doc
source_val = w_src_val
target_doc1 = t_binary_data
target_doc2 = t_trg_doc2
target_str = t_trg_str
doc_file_tab = t_doc_file
doc_file_key_tab = t_doc_filekey
errorfile = t_errorfile
EXCEPTIONS
communication_failure = 1
system_failure = 2
estoh_recn_invalid = 3
write_source_doc_failed = 4
write_source_val_failed = 5
wwiserv_start_failed = 6
wwiserv_failed = 7
result_not_found = 8
files_not_found = 9
OTHERS = 10.

Regards,

Karthik S

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 02, 2017 at 06:58 PM

    Hello

    as long as you have a "released" wwi report you can always use "ALE" to distribute the report (as well to a third party system)

    You should not use own coding for this purpose but use any function "out of the box"

    Normal process is as:

    SAP => ALE => XI/PI => whetever technique required => third party systen

    C.B.

    PS: check e.g. https://archive.sap.com/discussions/thread/3890517 or similar thread

    Add comment
    10|10000 characters needed characters exceeded