Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Report Problem

Former Member
0 Likes
688

Hi All.....

I developed a report out put goto 8 users mail box. i am getting DUMP.

Error is : <b>the field length not correct</b> Please help on this issue....

here is that report....

REPORT z_mail_cust_created .

DATA: t_container LIKE swcont OCCURS 0.

DATA: w_event_object_key LIKE sweinstcou-objkey,

w_event_object_type LIKE swetypecou-objtype,

w_event_object_event LIKE swetypecou-event.

DATA: w_element(15) TYPE c.

DATA: t_datainfo LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.

DATA: t_recipientid LIKE soxna-fullname OCCURS 0 WITH HEADER LINE.

DATA: t_objcont like SOLISTI1 OCCURS 0 WITH HEADER LINE.

DATA: w_tempstring LIKE tsktw-sourcetext.

DATA: t_receivers LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF gt_cust_data OCCURS 0,

kunnr LIKE knb1-kunnr, "Customer Number

bukrs LIKE knb1-bukrs, "Company Code

name1 LIKE kna1-name1, "Name 1

name2 LIKE kna1-name2, "Name 2

land1 LIKE kna1-land1, "Country Code

ort01 LIKE kna1-ort01, "City

pstlz LIKE kna1-pstlz, "Postal Code

regio LIKE kna1-regio, "Region Code

stras LIKE kna1-stras, "Street

telf1 LIKE kna1-telf1, "Tel Number

ktgrd LIKE knvv-ktgrd, "Account assignment grp

vkorg LIKE knvv-vkorg, "Sales Org

waers LIKE knvv-waers, "Currency

END OF gt_cust_data.

DATA: out_data like gt_cust_data occurs 0.

DATA: BEGIN OF gt_country OCCURS 0,

land1 LIKE t005t-land1, "Country Code

landx LIKE t005t-landx, "Country Desciption

END OF gt_country.

DATA: BEGIN OF gt_region OCCURS 0,

land1 LIKE t005u-land1, "Country Code

regio LIKE t005u-bland, "Region Code

bezei LIKE t005u-bezei, "Region Desciption

END OF gt_region.

DATA: BEGIN OF gt_account OCCURS 0,

ktgrd LIKE knvv-ktgrd, "Account assignment grp

vtext LIKE tvktt-vtext, "Account assignment grp text

END OF gt_account.

DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.

DATA: gv_eventid LIKE swedumevid-evtid.

data: begin of gt_container occurs 0.

include structure SWR_CONT.

data end of gt_container.

data: x_itab like gt_cust_data occurs 0.

DATA: w_subject_tx TYPE so_obj_des, " Email subject

w_gd_doc_data LIKE sodocchgi1,

w_tab_lines LIKE sy-tabix,

w_objkt_tx LIKE aeoi-objkt, " Material Number

w_prdha_tx LIKE mara-prdha, " Product Hirarachy

w_emailid_tx LIKE pa0105-usrid_long, " Email Id

w_temp(1) TYPE c.

  • Parameters

select-options p_date for sy-datum OBLIGATORY.

*------ Initillazation

INITIALIZATION.

  • Event of the object to be raised.

w_event_object_type = 'ZCUSTO1'.

w_event_object_event = 'CREATED'.

START-OF-SELECTION.

SELECT a~kunnr "Customer Number

a~bukrs "Company Code

b~name1 "Name 1

b~name2 "Name 2

b~land1 "Country Code

b~ort01 "City

b~pstlz "Postal Code

b~regio "Region Code

b~stras "city

b~telf1 "Tel Number

c~ktgrd "Account Assignment Group

c~vkorg "Sales Org

c~waers "Currency

FROM ( knb1 AS a

INNER JOIN kna1 AS b ON akunnr = bkunnr

INNER JOIN knvv AS c ON akunnr = ckunnr )

INTO TABLE gt_cust_data

WHERE a~erdat in p_date.

  • If there is no Data, exit the program.

IF gt_cust_data[] IS INITIAL.

MESSAGE s016(rp) WITH text-002.

EXIT.

ENDIF.

  • Get Country Description

SELECT land1 landx

INTO TABLE gt_country

FROM t005t FOR ALL ENTRIES IN gt_cust_data

WHERE land1 = gt_cust_data-land1 AND

spras = 'E'.

SORT gt_country BY land1.

DELETE ADJACENT DUPLICATES FROM gt_country COMPARING land1.

  • Get Land Desciption.

SELECT land1 bland bezei

INTO TABLE gt_region

FROM t005u FOR ALL ENTRIES IN gt_cust_data

WHERE land1 = gt_cust_data-land1 AND

bland = gt_cust_data-regio AND

spras = 'E'.

SORT gt_region BY land1 regio.

DELETE ADJACENT DUPLICATES FROM gt_region COMPARING land1 regio.

  • adding data *************************************************

w_gd_doc_data-doc_size = ( w_tab_lines - 1 )

  • 255 + STRLEN( t_objcont ).

w_gd_doc_data-obj_langu = sy-langu.

w_gd_doc_data-obj_name = 'SENDFILE'.

w_gd_doc_data-obj_descr = w_subject_tx.

w_gd_doc_data-sensitivty = 'O'.

CLEAR t_packing_list.

t_packing_list-head_start = 1.

t_packing_list-head_num = 0.

t_packing_list-body_start = 1.

t_packing_list-doc_type = 'RAW'.

t_packing_list-body_num = w_tab_lines.

APPEND t_packing_list.

  • Get Account Assignment Desciption.

SELECT ktgrd vtext

INTO TABLE gt_account

FROM tvktt FOR ALL ENTRIES IN gt_cust_data

WHERE ktgrd = gt_cust_data-ktgrd AND

spras = 'E'.

SORT gt_account BY ktgrd.

DELETE ADJACENT DUPLICATES FROM gt_account COMPARING ktgrd.

CLEAR gt_cust_data.

  • Add records to t_data Info, this will be passed in the mail.

  • loop at the customers created for which the mail is to be sent

LOOP AT gt_cust_data.

CLEAR t_datainfo.

REFRESH t_datainfo.

CLEAR gt_country.

CLEAR gt_region.

CLEAR gt_account.

CLEAR w_tempstring.

REFRESH t_container.

CLEAR t_container.

  • Adding Kunnr

IF NOT gt_cust_data-kunnr IS INITIAL.

WRITE gt_cust_data-kunnr TO w_tempstring NO-ZERO.

CONDENSE w_tempstring.

CONCATENATE 'Customer Number :' w_tempstring

INTO t_datainfo SEPARATED BY space.

APPEND t_datainfo.

CLEAR t_datainfo.

  • Object Key

CLEAR w_event_object_key.

w_event_object_key = gt_cust_data-kunnr.

ELSE.

CONTINUE.

ENDIF.

  • Adding Bukrs

IF NOT gt_cust_data-bukrs IS INITIAL.

CONCATENATE 'Company Code :' gt_cust_data-bukrs

INTO t_datainfo SEPARATED BY space.

APPEND t_datainfo.

CLEAR t_datainfo.

ENDIF.

    • Adding Sales Organization.

IF NOT gt_cust_data-vkorg IS INITIAL.

CONCATENATE 'Sales organization :' gt_cust_data-vkorg

INTO t_datainfo SEPARATED BY space.

APPEND t_datainfo.

CLEAR t_datainfo.

ENDIF.

  • Adding Name

IF NOT gt_cust_data-name1 IS INITIAL OR

NOT gt_cust_data-name2 IS INITIAL.

CONCATENATE 'Customer Name :'

gt_cust_data-name1

gt_cust_data-name2

INTO t_datainfo SEPARATED BY space.

APPEND t_datainfo.

CLEAR t_datainfo.

ENDIF.

  • Street/House number

IF NOT gt_cust_data-stras IS INITIAL.

CONCATENATE 'Street/House number :' gt_cust_data-stras

INTO t_datainfo SEPARATED BY space.

APPEND t_datainfo.

CLEAR t_datainfo.

ENDIF.

  • City

IF NOT gt_cust_data-ort01 IS INITIAL.

CONCATENATE 'City :' gt_cust_data-ort01

INTO t_datainfo SEPARATED BY space.

APPEND t_datainfo.

CLEAR t_datainfo.

ENDIF.

  • Postal Code

IF NOT gt_cust_data-pstlz IS INITIAL.

CONCATENATE 'Postal Code :' gt_cust_data-pstlz

INTO t_datainfo SEPARATED BY space.

APPEND t_datainfo.

CLEAR t_datainfo.

ENDIF.

  • Region

IF NOT gt_cust_data-regio IS INITIAL.

READ TABLE gt_region WITH KEY land1 = gt_cust_data-land1

regio = gt_cust_data-regio.

IF sy-subrc = 0.

CONCATENATE 'Region :' gt_region-bezei

INTO t_datainfo SEPARATED BY space.

ELSE.

CONCATENATE 'Region :' gt_cust_data-regio

INTO t_datainfo SEPARATED BY space.

ENDIF.

APPEND t_datainfo.

CLEAR t_datainfo.

ENDIF.

  • Country

IF NOT gt_cust_data-land1 IS INITIAL.

READ TABLE gt_country WITH KEY land1 = gt_cust_data-land1.

IF sy-subrc = 0.

CONCATENATE 'Country :' gt_country-landx "CH001

INTO t_datainfo SEPARATED BY space.

ELSE.

CONCATENATE 'Country :' gt_cust_data-land1 "CH001

INTO t_datainfo SEPARATED BY space.

ENDIF.

APPEND t_datainfo.

CLEAR t_datainfo.

ENDIF.

  • Telephone Number

IF NOT gt_cust_data-telf1 IS INITIAL.

CONCATENATE 'Telephone Number :' gt_cust_data-telf1

INTO t_datainfo SEPARATED BY space.

APPEND t_datainfo.

CLEAR t_datainfo.

ENDIF.

  • Account Assignment Group

IF NOT gt_cust_data-ktgrd IS INITIAL.

READ TABLE gt_account WITH KEY ktgrd = gt_cust_data-ktgrd.

IF sy-subrc = 0.

CONCATENATE 'Account Assignment Group :' gt_account-vtext

INTO t_datainfo SEPARATED BY space.

ELSE.

CONCATENATE 'Account Assignment Group :' gt_cust_data-ktgrd

INTO t_datainfo SEPARATED BY space.

ENDIF.

APPEND t_datainfo.

CLEAR t_datainfo.

ENDIF.

IF NOT gt_cust_data-waers IS INITIAL.

CONCATENATE 'Currency :' gt_cust_data-waers

INTO t_datainfo SEPARATED BY space.

APPEND t_datainfo.

CLEAR t_datainfo.

ENDIF.

  • get the receipent for the e-mail

CLEAR t_recipientid.

REFRESH t_recipientid.

IF NOT gt_cust_data-bukrs IS INITIAL.

SELECT

email

INTO TABLE

t_recipientid

FROM

ztfied

WHERE

bukrs = gt_cust_data-bukrs AND

wf_name = 'CUST_NEW'.

ELSE.

SELECT

x~email

INTO TABLE

t_recipientid

FROM ztfied AS x

INNER JOIN tvko AS y

ON xbukrs = ybukrs

WHERE

y~vkorg = gt_cust_data-vkorg AND

wf_name = 'CUST_NEW'.

ENDIF.

  • Pass the recepients.

CLEAR gv_eventid.

  • Build the event Container

refresh gt_container.

clear gt_container.

loop at t_datainfo.

clear gt_container.

gt_container-element = 'DATAINFO'.

gt_container-value = t_datainfo.

append gt_container.

clear gt_container.

endloop.

loop at t_recipientid.

clear gt_container.

gt_container-element = 'RECIPIENTID'.

gt_container-value = t_recipientid.

append gt_container.

clear gt_container.

endloop.

IF NOT t_recipientid[] IS INITIAL.

LOOP AT t_recipientid.

t_receivers-receiver = t_recipientid.

t_receivers-rec_type = 'U'.

APPEND t_receivers .

CLEAR t_receivers.

ENDLOOP.

ENDIF.

ENDLOOP.

      • Call the FM to post the message to ECR coordinators

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = t_packing_list

TABLES

  • packing_list = t_packing_list

contents_txt = t_datainfo

receivers = t_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.

***

    • raise the Event for starting the workflow to send the e-mail

  • CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

  • EXPORTING

  • object_type = w_event_object_type

  • object_key = w_event_object_key

  • event = w_event_object_event

    • COMMIT_WORK = 'X'

    • EVENT_LANGUAGE = SY-LANGU

  • IMPORTING

    • RETURN_CODE =

  • EVENT_ID = gv_eventid

  • TABLES

  • INPUT_CONTAINER = gt_container

    • MESSAGE_LINES =

    • MESSAGE_STRUCT =

  • .

  • wait up to 2 seconds.

COMMIT WORK.

  • ENDIF.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
625

Hi

Use the same length for that field, which is giving error.

Might be different in Fun module and in declaration check it and use the same length

Otherwise declare a similar field and move the data into that and pass the to fun module.

Reward points if useful

Regards

Anji

3 REPLIES 3
Read only

Former Member
0 Likes
626

Hi

Use the same length for that field, which is giving error.

Might be different in Fun module and in declaration check it and use the same length

Otherwise declare a similar field and move the data into that and pass the to fun module.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
625

Hi sri,

you might be trying to meve a field to another with different length or passing any value to fm with wrong type,please mention the lines,as you can see in the dump report,where exactly the problem is.go to ST 22 transaction and see the dump analysis and see where the arrow mark "-->" is.

Read only

0 Likes
625

Thanks for Reply...

I checked all i am not able to find it..

please help me ...