Skip to Content
0
Jul 19, 2013 at 08:34 AM

wants to stop printing smartforms on error message

89 Views

Hi all,

i have some smartforms associated with my ZPROGRAMS, my requirement is that "If i have used a ESTAMP No. (TT here) for any Sales Document

then on the same day, it will get printed again for the same sales order, but not get printed for any other Sales order value, and for other day, my smartforms should not get printed for any Sales order for previously used ESTAMP No.".

For which i have written some code, in which on condition where i don't want to get printed my smartforms, it issues the warning message, but also

prints my smartforms, so my issue is to stop printing of smartform on error messages.

Please sujjest me what can i do to stop printing on error message, my code are

FORM get_form .

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = sform

* VARIANT = ' '

* DIRECT_CALL = ' '

IMPORTING

fm_name = fname

* EXCEPTIONS

* NO_FORM = 1

* NO_FUNCTION_MODULE = 2

* OTHERS = 3

.

IF sy-subrc <> 0.

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

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

ENDIF.

CALL FUNCTION fname

EXPORTING

* ARCHIVE_INDEX =

* ARCHIVE_INDEX_TAB =

* ARCHIVE_PARAMETERS =

* CONTROL_PARAMETERS =

* MAIL_APPL_OBJ =

* MAIL_RECIPIENT =

* MAIL_SENDER =

* OUTPUT_OPTIONS =

* USER_SETTINGS = 'X'

control_parameters = p_control_parameters

output_options = i_output_options

user_settings = 'X'

wa = wa

yy = yy

rr = rr

TT = TT

* mm = mm

* IMPORTING

* DOCUMENT_OUTPUT_INFO =

* JOB_OUTPUT_INFO =

* JOB_OUTPUT_OPTIONS =

TABLES

itab = itab

itab1 = itab5

itab2 = it_tab

* EXCEPTIONS

* FORMATTING_ERROR = 1

* INTERNAL_ERROR = 2

* SEND_ERROR = 3

* USER_CANCELED = 4

* OTHERS = 5

.

IF sy-subrc <> 0.

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

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

ENDIF.

if prin = 'X'.

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

****BREAK-POINT.

DATA : MATNR TYPE VBAP-MATNR.

SELECT * FROM ZALLOTMENT INTO TABLE IT_ESTAMP.

LOOP AT IT_ESTAMP INTO WA_ESTAMP.

IF WA_ESTAMP-ESTAMP = TT

AND WA_ESTAMP-DATUM EQ SY-DATUM

AND WA_ESTAMP-DOCUMENT EQ P_VBELN.

MESSAGE 'ESTAMP No. has already been used.' TYPE 'W'.

ELSEIF ( WA_ESTAMP-ESTAMP = TT )

AND ( WA_ESTAMP-DATUM EQ SY-DATUM )

AND ( WA_ESTAMP-DOCUMENT NE P_VBELN ).

MESSAGE 'ESTAMP No has already been used for some other sales order.' TYPE 'E'.

ELSEIF WA_ESTAMP-ESTAMP = TT

AND WA_ESTAMP-DATUM NE SY-DATUM.

MESSAGE 'ESTAMP No. has already been used.' TYPE 'E'.

ENDIF.

ENDLOOP.

CLEAR WA_ESTAMP.

SELECT SINGLE MATNR ARKTX FROM VBAP INTO (MATNR, WA_ESTAMP-UNIT_NO) WHERE VBELN EQ P_VBELN.

SELECT SINGLE ATWRT FROM AUSP INTO WA_ESTAMP-BLOCK WHERE OBJEK = MATNR AND ATINN EQ 2.

SELECT SINGLE ATWRT FROM AUSP INTO WA_ESTAMP-TOWER WHERE OBJEK = MATNR AND ATINN EQ 32.

SELECT SINGLE ERDAT FROM ZST_SFAL_PRINT INTO WA_ESTAMP-DATUM WHERE VBELN = P_VBELN.

WA_ESTAMP-MANDT = SY-MANDT.

WA_ESTAMP-DOCUMENT = P_VBELN.

WA_ESTAMP-CRMNAME = SS.

WA_ESTAMP-ESTAMP = TT.

WA_ESTAMP-DATUM = SY-DATUM.

MODIFY ZALLOTMENT FROM WA_ESTAMP.

CLEAR WA_ESTAMP.