cancel
Showing results for 
Search instead for 
Did you mean: 

workflow after save - send to me two message the same document

former_member626380
Participant
0 Kudos

hi all .

have a nice day .

i used badi BADI_RECN_CONTRACT to send to me message after create new contract recn and created workflow with this badi it will done and send to me workflow but it send two message the same document .

how to make this badi send to me one message only .

can you find below my badi .

thank you .

here is the Code

* Data declarations

DATA: ld_contract TYPE REF TO cl_recn_contract,

l_objnr type RECAOBJNR.

DATA:OBJECT_KEY TYPE SWO_TYPEID.

DATA : IT_CONTAINER TYPE TABLE OF SWR_CONT,

WA_CONTAINER LIKE LINE OF IT_CONTAINER.

DATA: G_KEY TYPE SWR_STRUCT-OBJECT_KEY.

DATA: G_return_code type sy-subrc,

GLF_event_id type swr_struct-event_id.

DATA: L_ACTIVE TYPE CNJ_STAT-STTXT_INT.

data: lit_vicncn type vicncn,

wa_vicncn type vicncn,

l_dbear type vicncn-dbear.

DATA: COMPCODE(4) TYPE C,

CONTRACTNUMBER(13) type C.

data: l_vicncn type vicncn,

w_vicncn type vicncn,

RECNDACTIV type vicncn-RECNDACTIV.

CLEAR COMPCODE.

CLEAR CONTRACTNUMBER.

CLEAR G_KEY.

*---------------------------- Object Key is storing in the IO_OBJECT paramerer in the Interface of IF_EX_RECN_CONTRACT.

ld_contract ?= io_object.

l_objnr = ld_contract->md_objnr.

COMPCODE = l_objnr+2(4).

CONTRACTNUMBER = l_objnr+6(13).

CONCATENATE COMPCODE CONTRACTNUMBER INTO G_KEY.

*............................ the above code is for retrieve value from IO_Object and seperate with IS, Company code and Contract (IS100100000020001)

*............................ IS 1001 20001

select single * from vicncn into l_vicncn

where bukrs = compcode

and recnnr = contractnumber.

if sy-subrc ne 0.

IF G_KEY IS NOT INITIAL.

*.....................When SAVE - trigger an EVENT CREATED

CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

EXPORTING

object_type = 'BUS1505'

object_key = G_KEY

event = 'CREATED'

commit_work = 'X'

event_language = sy-langu

language = sy-langu

user = sy-uname

* IFS_XML_CONTAINER =

IMPORTING

return_code = G_return_code

event_id = GLF_event_id

TABLES

input_container = it_container

* message_lines =

* message_struct =.

IF SY-SUBRC = 0.

ENDIF.

ENDIF.

If you want to Send a Notification after 'ACTIVATE' button then you need to continue the the below code

else.

*.....................When ACTIVE - trigger an EVENT ACTIVATED

CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

EXPORTING

object_type = 'BUS1505'

object_key = G_KEY

event = 'ACTIVATED'

commit_work = 'X'

event_language = sy-langu

language = sy-langu

user = sy-uname

* IFS_XML_CONTAINER =

IMPORTING

return_code = G_return_code

event_id = GLF_event_id

TABLES

input_container = it_container

* message_lines =

.

* message_struct =

endif.

*endif.

Sandra_Rossi
Active Contributor
0 Kudos

Please edit your question, select your code and press the "CODE" button to make it correctly colorized/indented, so that it's easier for us to analyze it. Thank you.

Accepted Solutions (0)

Answers (0)