Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Function code is not working in Dialog programing

Hi,

I have added some 4 function codes to trigger when it is clicked. Like

SUBMIT

RESET

CANCEL

REQ_NUM

when I click on SUBMIT it is working and storing data to the database.

When I click on RESET its not working

When I click on Cancel its working and closing the program.

When I click on REQ_NUM its not working

The prg is as follows:

CASE SY-UCOMM.

WHEN 'SUBMIT'.

*********************************

*FOR INCREMENTING THE VALUE.

C_KNUMV = C_KNUMV + 1.

***********************************

  • USED FM TO GENERATE NUMBERS.

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

nr_range_nr = lc_number_range

object = lc_cond_object

IMPORTING

number = c_knumv.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*****************************************

  • Updating the record.

ZCHP_CUST_INFO-REQ_NUM = C_KNUMV.

ZCHP_CUST_INFO-CREATED_BY = CNAME.

ZCHP_CUST_INFO-REQUEST_TYPE = REQTYP.

ZCHP_CUST_INFO-PRIORITY_TYPE = PRIO_TYPE.

ZCHP_CUST_INFO-SHORT_TEXT = DESC.

ZCHP_CUST_INFO-CREATED_ON = EFFECTIVE_DATE.

ZCHP_CUST_INFO-MODE_OF_COMM = COMM_TYP.

ZCHP_CUST_INFO-ADDRESS = COMM.

*ENDIF.

INSERT ZCHP_CUST_INFO.

COMMIT WORK.

  • data input for the mail

************************************************************

*sending mail

************************************************************

*****************************************************

  • Send the document

When 'mail'.

select * from zchp_cust_info

appending table i_tab_chp where req_num = c_knumv.

LOOP AT I_TAB_CHP.

concatenate i_tab_chp-created_by i_tab_chp-req_num into CON_NAME.

*WRITE: / con_name.

ENDLOOP.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

DOCUMENT_TYPE = 'RAW'

DOCUMENT_DATA = DOC_CHNG

PUT_IN_OUTBOX = 'X'

TABLES

OBJECT_CONTENT = OBJCONT

RECEIVERS = RECLIST

EXCEPTIONS

TOO_MANY_RECEIVERS = 1

DOCUMENT_NOT_SENT = 2

OPERATION_NO_AUTHORIZATION = 4

OTHERS = 99.

CASE SY-SUBRC.

WHEN 0.

LOOP AT RECLIST.

IF RECLIST-RECEIVER = SPACE.

NAME = RECLIST-REC_ID.

ELSE.

NAME = RECLIST-RECEIVER.

ENDIF.

IF RECLIST-RETRN_CODE = 0.

WRITE: / NAME, ': succesfully sent'.

ELSE.

WRITE: / NAME, ': error occured'.

ENDIF.

ENDLOOP.

WHEN 1.

WRITE: / 'Too many receivers specified !'.

WHEN 2.

WRITE: / 'No receiver got the document !'.

WHEN 4.

WRITE: / 'Missing send authority !'.

WHEN OTHERS.

WRITE: / 'Unexpected error occurred !'.

ENDCASE.

COMMIT WORK.

WHEN 'RESET'.

CLEAR: CNAME,REQTYP,PRIO_TYPE,

DESC,EFFECTIVE_DATE,COMM_TYP,COMM.

WHEN 'CANCEL'.

LEAVE PROGRAM.

ENDCASE.

IF SY-SUBRC EQ 0.

MESSAGE ID '002' TYPE 'W' NUMBER '000'

WITH 'Clearing Record with number' c_knumv 'created'.

  • MESSAGE W000 with c_knumv.

*ENDIF.

*DATA : BEGIN OF IW21TRNS OCCURS 0,

  • CNAME LIKE ZCHP_CUST_INFO-CREATED_BY,

  • CMR_REQ_NO LIKE ZCHP_CUST_INFO-REQ_NUM,

  • ZCHP_CUST_INFO-REQUEST_TYPE

*

  • END OF IW21TRNS.

endif.

Could any one help please

Thanks in Advance,

Sunil.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question