Manipulate file to remove CR LF s

use sed stream editor in Unix

eg :

sed -e s/^M//g infile > outfile

Sapscript call external Program

REPORT zmmm NO STANDARD PAGE HEADING MESSAGE-ID zz.

 

*———————————————————————*
* FORM GET_DOMVALUE *
*———————————————————————*
* …….. *
*———————————————————————*
* –> IN_TAB *
* –> OUT_TAB *
*———————————————————————*
FORM get_domvalue TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.

DATA: dom LIKE dd07l.
DATA: out1 LIKE dd07t-ddtext.

 

dom-domname = ‘ZZ_PAPERCORETYPE’.
READ TABLE in_tab INDEX 0.
MOVE in_tab-value TO dom-domvalue_l.

CALL FUNCTION ‘FI_CUST_READ_DOMVALUETEXT’
EXPORTING
domname = dom-domname
domvalue = dom-domvalue_l
spras = sy-langu
IMPORTING
ddtext = out1
EXCEPTIONS
text_not_found = 1
value_not_found = 2
OTHERS = 3.
.
IF sy-subrc EQ 0 AND out1 NS ‘NULL’.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

READ TABLE out_tab WITH KEY ‘LINE3’.
IF sy-subrc EQ 0.
out_tab-value = out1 .
MODIFY out_tab INDEX sy-tabix.
ENDIF.

ENDIF.

ENDFORM.

Posted in SAP

Convert to PDF sample code

CALL FUNCTION ‘SSF_FUNCTION_MODULE_NAME’
EXPORTING
formname = ‘YSDINV_L’
* VARIANT = ‘ ‘
* DIRECT_CALL = ‘ ‘
IMPORTING
fm_name = v_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
.
IF sy-subrc <> 0.
r_code = sy-subrc.
PERFORM protocol_update.

EXIT.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

w_ctrlop-getotf = ‘X’.
w_ctrlop-no_dialog = ‘X’.
w_compop-tdnoprev = ‘X’.
w_compop-TDDEST = ‘G112’.
*call smartform invoice
CALL FUNCTION v_form_name

EXPORTING
control_parameters = w_ctrlop

output_options = w_compop

user_settings = space
is_bil_invoice = ls_bil_invoice
is_nast = nast
is_repeat = ‘X’
IMPORTING
job_output_info = w_return
* job_output_options =

 

EXCEPTIONS formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
* error handling

r_code = sy-subrc.
PERFORM protocol_update.

ENDIF.

i_otf[] = w_return-otfdata[].

 

 

 

CALL FUNCTION ‘CONVERT_OTF’
EXPORTING
format = ‘PDF’
* max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.

IF sy-subrc <> 0.
r_code = sy-subrc.
PERFORM protocol_update.

ENDIF.

….

OPEN DATASET pinfil2 FOR OUTPUT IN BINARY MODE .