2006 Aug 23 11:11 AM
Hi All,
I'm trying to extend my order print program in order to enable the sending by mail of a SapScript.
So :
I'm using :
READ_OTF_FROM_MEMORYThen
CONVERT_OTF_2_PDFAnd
SO_NEW_DOCUMENT_ATT_SEND_API1( With a little more code ! ).
In debug mode, I can see that the return code of
READ_OTF_FROM_MEMORYis <b>1</b> :
*-- Read OTF from memory
CALL FUNCTION 'READ_OTF_FROM_MEMORY'
EXPORTING
memory_key = nast-objky
TABLES
otf = lt_otf
EXCEPTIONS
memory_empty = 1
OTHERS = 2.Which means "memory empty" so I can't retrieve my form.
I don't understand why ?
Thx in advance,
Regards,
Erwan
2006 Aug 23 12:30 PM
Hi Erwan,
It means the memory id is indeed empty.
Why do you want to get the otf, when it is readily available in the close_form tables parameters?
Use that otf data and send to the subsequent processing.
Regards,
Ravi
hi Check sample code ::
FUNCTION zisa_container_pack_pdf .
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(DELIVERY) LIKE BAPIVBELN-VBELN
*" TABLES
*" IT_PDF STRUCTURE TBL1024
*" RETURN STRUCTURE BAPIRET2
*"----------------------------------------------------------------------
DATA: lt_pdfdata LIKE TABLE OF tline WITH HEADER LINE.
<b> DATA: lt_otf TYPE STANDARD TABLE OF itcoo WITH HEADER LINE,</b>
lt_doctab TYPE STANDARD TABLE OF docs WITH HEADER LINE,
lt_otfdata TYPE STANDARD TABLE OF itcoo WITH HEADER LINE.
DATA: x_nast LIKE nast, "Message Status
x_tnapr LIKE tnapr. "Processing programs for output.
DATA : len TYPE i.
*-- Calling the Subroutine Entry
*-- Get all the details from NAST table
*-- SALESDOCUMENTIN : Sales Document number (Importing parameter)
SELECT * UP TO 1 ROWS INTO nast FROM nast WHERE kappl = 'V2' AND
objky = delivery AND
kschl = 'ZDSP' AND
spras = sy-langu.
ENDSELECT.
IF sy-subrc = 0.
*-- Get all the details from TNAPR table
*-- 'ZDSP' : Output type defined for the Sales order
*-- '1' : Transmission medium : Printer
SELECT SINGLE * INTO tnapr
FROM tnapr WHERE kschl = 'ZDSP' AND
nacha = '1' AND
kappl = 'V2'.
IF sy-subrc = 0.
*-- Populate the return code as per the standard driver program
return_code = 999.
us_screen = 'X'.
*-- Populate the Transaction code in the NAST structure
*-- 'VL03N' : Sales order Display transaction
<b>nast-tcode = 'VL03N'.</b>
PERFORM entry IN PROGRAM zisa_vaddn01_fm USING nast
tnapr
return_code
us_screen.
ELSE.
return-type = 'E'.
return-message = 'No Form found in the TNAPR table'.
APPEND return.
CLEAR return.
ENDIF.
*-- Read OTF from memory
<b> CALL FUNCTION 'READ_OTF_FROM_MEMORY'
EXPORTING
memory_key = nast-objky
TABLES
otf = lt_otf
EXCEPTIONS
memory_empty = 1
OTHERS = 2.</b>
IF sy-subrc = 0.
*-- Convert the OTF data to PDF data
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
use_otf_mc_cmd = 'X'
IMPORTING
bin_filesize = v_bin
TABLES
otf = lt_otf
doctab_archive = it_doctab
lines = lt_pdfdata
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
IF sy-subrc <> 0.
return-type = 'E'.
return-message =
'An error occured in Converting OTF Data to PDF Data'.
APPEND return.
CLEAR return.
ELSE.
* Converting pdf data to raw data
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = lt_pdfdata
t_target_tab = it_pdf
EXCEPTIONS
convert_not_possible = 1
OTHERS = 2.
LOOP AT it_pdf.
len = len + STRLEN( it_pdf ).
ENDLOOP.
* if ( v_bin = len ).
* endif.
ENDIF.
ELSE.
return-type = 'E'.
return-message =
'An error occured in retrieving OTF Data from Memory'.
APPEND return.
CLEAR return.
ENDIF.
ELSE.
return-type = 'E'.
return-message = 'No NAST entry found with this Sales Order'.
APPEND return.
CLEAR return.
ENDIF.
ENDFUNCTION.Regards
Ashok P
2006 Aug 23 11:18 AM
Hi ,
Comment out memory key parameter form ur function
module and try.
EXPORTING
memory_key = nast-objky
TABLES
otf = lt_otf
EXCEPTIONS
memory_empty = 1
OTHERS = 2.
Regards
Amole
2006 Aug 23 12:24 PM
Hum...
No it doesn't work !
return code is always '1'.
Other idea ?
Thx a lot
2006 Aug 23 12:28 PM
hi Check sample code ::
FUNCTION zisa_container_pack_pdf .
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(DELIVERY) LIKE BAPIVBELN-VBELN
*" TABLES
*" IT_PDF STRUCTURE TBL1024
*" RETURN STRUCTURE BAPIRET2
*"----------------------------------------------------------------------
DATA: lt_pdfdata LIKE TABLE OF tline WITH HEADER LINE.
<b> DATA: lt_otf TYPE STANDARD TABLE OF itcoo WITH HEADER LINE,</b>
lt_doctab TYPE STANDARD TABLE OF docs WITH HEADER LINE,
lt_otfdata TYPE STANDARD TABLE OF itcoo WITH HEADER LINE.
DATA: x_nast LIKE nast, "Message Status
x_tnapr LIKE tnapr. "Processing programs for output.
DATA : len TYPE i.
*-- Calling the Subroutine Entry
*-- Get all the details from NAST table
*-- SALESDOCUMENTIN : Sales Document number (Importing parameter)
SELECT * UP TO 1 ROWS INTO nast FROM nast WHERE kappl = 'V2' AND
objky = delivery AND
kschl = 'ZDSP' AND
spras = sy-langu.
ENDSELECT.
IF sy-subrc = 0.
*-- Get all the details from TNAPR table
*-- 'ZDSP' : Output type defined for the Sales order
*-- '1' : Transmission medium : Printer
SELECT SINGLE * INTO tnapr
FROM tnapr WHERE kschl = 'ZDSP' AND
nacha = '1' AND
kappl = 'V2'.
IF sy-subrc = 0.
*-- Populate the return code as per the standard driver program
return_code = 999.
us_screen = 'X'.
*-- Populate the Transaction code in the NAST structure
*-- 'VL03N' : Sales order Display transaction
<b>nast-tcode = 'VL03N'.</b>
PERFORM entry IN PROGRAM zisa_vaddn01_fm USING nast
tnapr
return_code
us_screen.
ELSE.
return-type = 'E'.
return-message = 'No Form found in the TNAPR table'.
APPEND return.
CLEAR return.
ENDIF.
*-- Read OTF from memory
<b> CALL FUNCTION 'READ_OTF_FROM_MEMORY'
EXPORTING
memory_key = nast-objky
TABLES
otf = lt_otf
EXCEPTIONS
memory_empty = 1
OTHERS = 2.</b>
IF sy-subrc = 0.
*-- Convert the OTF data to PDF data
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
use_otf_mc_cmd = 'X'
IMPORTING
bin_filesize = v_bin
TABLES
otf = lt_otf
doctab_archive = it_doctab
lines = lt_pdfdata
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
IF sy-subrc <> 0.
return-type = 'E'.
return-message =
'An error occured in Converting OTF Data to PDF Data'.
APPEND return.
CLEAR return.
ELSE.
* Converting pdf data to raw data
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = lt_pdfdata
t_target_tab = it_pdf
EXCEPTIONS
convert_not_possible = 1
OTHERS = 2.
LOOP AT it_pdf.
len = len + STRLEN( it_pdf ).
ENDLOOP.
* if ( v_bin = len ).
* endif.
ENDIF.
ELSE.
return-type = 'E'.
return-message =
'An error occured in retrieving OTF Data from Memory'.
APPEND return.
CLEAR return.
ENDIF.
ELSE.
return-type = 'E'.
return-message = 'No NAST entry found with this Sales Order'.
APPEND return.
CLEAR return.
ENDIF.
ENDFUNCTION.Regards
Ashok P
2006 Aug 23 12:30 PM
Hi Erwan,
It means the memory id is indeed empty.
Why do you want to get the otf, when it is readily available in the close_form tables parameters?
Use that otf data and send to the subsequent processing.
Regards,
Ravi
2006 Aug 23 1:19 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |