Hi Aneel.
After each generated FM call, make sure you get the errors as well whenever there is any exception. Call FM SSF_READ_ERRORS to retrieve the error message. Pass these message back to the NAST protocol if the SmartForm is being called from the Output control.
Check the below code.Hope this will help you.
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = SPACE
IMPORTING job_output_info = ls_job_info
EXCEPTIONS formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
*
DATA: LT_ERRORTAB TYPE TSFERROR.
FIELD-SYMBOLS: <FS_ERRORTAB> TYPE LINE OF TSFERROR.
*
* get smart form protocoll
CALL FUNCTION 'SSF_READ_ERRORS'
IMPORTING
ERRORTAB = LT_ERRORTAB.
*
* add smartform protocoll to nast protocoll
LOOP AT LT_ERRORTAB ASSIGNING <FS_ERRORTAB>.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
MSG_ARBGB = <FS_ERRORTAB>-MSGID
MSG_NR = <FS_ERRORTAB>-MSGNO
MSG_TY = <FS_ERRORTAB>-MSGTY
MSG_V1 = <FS_ERRORTAB>-MSGV1
MSG_V2 = <FS_ERRORTAB>-MSGV2
MSG_V3 = <FS_ERRORTAB>-MSGV3
MSG_V4 = <FS_ERRORTAB>-MSGV4
EXCEPTIONS
OTHERS = 1.
ENDLOOP.
ELSE.
*
*
ENDIF.
Thanks
KH