‎2008 Feb 13 8:52 AM
Hi Gurus,
I am stuck with a problem. My program is throwing dump as data incompactible type.I figured out it as I need to send data to a functional module of Hex type.
Can you please tell me how to convert data to hex format.
Thank you very much in advance
‎2008 Feb 13 9:45 AM
Hi somi it took me some time but i tried to code it for you
if you could easily understand it
just create any report and attach this code to it
you might have to some corrections in it
just see to it
and remember at least reward if your query is solved
DATA: itab_aux LIKE SOLI OCCURS 0 WITH HEADER LINE.
DATA: itab LIKE solix OCCURS 0 WITH HEADER LINE.
DATA: itab_tmp LIKE solix OCCURS 0 WITH HEADER LINE.
CLEAR itab_aux.
REFRESH itab_aux.
CONCATENATE 'Hello' 'How R' 'u!' INTO itab_aux-line separated by space.
APPEND itab_aux.
CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
EXPORTING
ip_solitab = itab_aux[]
IMPORTING
ep_solixtab = itab_tmp[].
clear itab.
loop at itab_tmp.
itab-line = itab_tmp-line.
append itab.
endloop.
CALL FUNCTION 'SO_SOLIXTAB_TO_SOLITAB'
EXPORTING
ip_solixtab = itab[]
IMPORTING
EP_SOLITAB = itab_aux[]
.
loop at itab_aux.
write itab_aux-line.
endloop.
reward if useful
‎2008 Feb 13 8:54 AM
Kindly look at this two function module may be this help you
FM : SO_SOLITAB_TO_SOLIXTAB
FM : SO_SOLIXTAB_TO_SOLITAB
Reward points if useful
‎2008 Feb 13 8:55 AM
I think SO_SOLITAB_TO_SOLIXTAB will work for you
i didnt checked yet
‎2008 Feb 13 8:57 AM
Hello Somi ,
I think you are little bit wrong...
As per my knowledge and understanding There is NO FM in SAP which want data in Hexdecimal.
can you define which FM you are using and what data you are passing.
Regards
Swati..
Edited by: Swati Namdev on Feb 13, 2008 2:30 PM
‎2008 Feb 13 9:05 AM
SO_DOCUMENT_SEND_API1
here in this we need
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
sender_address = w_sender
sender_address_type = w_type
IMPORTING
sent_to_all = sent_to_all
NEW_OBJECT_ID =
SENDER_ID =
TABLES
packing_list =
object_header =
CONTENTS_BIN =
contents_txt =
contents_hex = Here we need
OBJECT_PARA =
OBJECT_PARB =
receivers =
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8
.
IF sy-subrc <> 0.
Edited by: somi baba on Feb 13, 2008 10:05 AM
‎2008 Feb 13 9:42 AM
HI ,
If ur data is in text format.
If ur sending mail from a report,then u first need to send to spool(The Report Output)
using FM:GET_PRINT_PARAMETERS
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = false
report = p_repid
user = sy-uname
IMPORTING
out_parameters = mstr_print_parms
valid = mc_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
After getting print parms,
convert them into PDF format using...
*-- Convert Spool to PDF
gd_buffer is type string
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = mi_rqident
no_dialog = space
dst_device = mstr_print_parms-pdest
IMPORTING
pdf_bytecount = mi_bytecount
TABLES
pdf = it_mtab_pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
IF sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
CLEAR gd_buffer.
LOOP AT it_mtab_pdf INTO is_mtab_pdf.
TRANSLATE is_mtab_pdf USING ' ~'.
CONCATENATE gd_buffer is_mtab_pdf INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
is_objbin = gd_buffer.
APPEND is_objbin TO it_objbin.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDIF.
CLEAR mi_rqident.
REFRESH it_mtab_pdf.
Create Message Body
Title and Description
is_doc_chng-obj_name = 'MAIL'.
is_doc_chng-obj_descr = 'TEST MAIL'.
main text
is_objtxt-line = This is an automatically generated mail. Please do not reply to it.'.
APPEND is_objtxt TO it_objtxt.
is_objtxt-line = space.
APPEND is_objtxt TO it_objtxt.
Write Packing List (Main)
DESCRIBE TABLE it_objtxt LINES w_lines_tx.
READ TABLE it_objtxt INTO is_objtxt INDEX w_lines_tx.
is_doc_chng-doc_size = ( w_lines_tx - 1 ) * 255 + STRLEN( is_objtxt ).
CLEAR is_objpack-transf_bin.
is_objpack-head_start = 1.
is_objpack-head_num = 0.
is_objpack-body_start = 1.
is_objpack-body_num = w_lines_tx.
is_objpack-doc_type = c_raw.
APPEND is_objpack TO it_objpack.
Create Message Attachment
Write Packing List (Attachment)
DESCRIBE TABLE it_objbin LINES w_lines_tx.
READ TABLE it_objbin INTO is_objbin INDEX w_lines_tx.
is_objpack-doc_size = ( w_lines_tx - 1 ) * 255 + STRLEN( is_objbin ).
is_objpack-transf_bin = 'X'.
is_objpack-head_start = 1.
is_objpack-head_num = 0.
is_objpack-body_start = 1.
is_objpack-body_num = w_lines_tx.
is_objpack-doc_type = c_pdf.
is_objpack-obj_name = 'LETTER'.
is_objpack-obj_descr = 'Report: LETTER'.
APPEND is_objpack TO it_objpack.
SENDING THE MAILS TO VENDORS/PURCHASING GROUPS
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = is_doc_chng
put_in_outbox = c_x
commit_work = c_x
TABLES
packing_list = it_objpack
contents_bin = it_objbin
contents_txt = it_objtxt
receivers = it_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
I think this code may help u......
regards......
‎2008 Feb 13 9:45 AM
Hi somi it took me some time but i tried to code it for you
if you could easily understand it
just create any report and attach this code to it
you might have to some corrections in it
just see to it
and remember at least reward if your query is solved
DATA: itab_aux LIKE SOLI OCCURS 0 WITH HEADER LINE.
DATA: itab LIKE solix OCCURS 0 WITH HEADER LINE.
DATA: itab_tmp LIKE solix OCCURS 0 WITH HEADER LINE.
CLEAR itab_aux.
REFRESH itab_aux.
CONCATENATE 'Hello' 'How R' 'u!' INTO itab_aux-line separated by space.
APPEND itab_aux.
CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
EXPORTING
ip_solitab = itab_aux[]
IMPORTING
ep_solixtab = itab_tmp[].
clear itab.
loop at itab_tmp.
itab-line = itab_tmp-line.
append itab.
endloop.
CALL FUNCTION 'SO_SOLIXTAB_TO_SOLITAB'
EXPORTING
ip_solixtab = itab[]
IMPORTING
EP_SOLITAB = itab_aux[]
.
loop at itab_aux.
write itab_aux-line.
endloop.
reward if useful
‎2008 Feb 13 10:26 AM
ThNAK YOU VERY MUCH
It helped me a lot
Sumesh the code is running withot any correction
thank once again