2009 Jan 07 7:40 AM
Hi
I am new to ABAP.
Below is the driver program for Smartform,
after:
Step-1 Entering data at selection screen
Step-2 Pressing Execution Button
An error is displaying 'Document no. not found' but the problem is, as soon as the error appears, selection screen goes blank, its not staying.
Please suggest correction.
With warm regards.
Yogesh.
*&---------------------------------------------------------------------*
*& Report Z_MM_GPASS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_MM_GPASS.
tables: MSEG,ADRC,T001W,MAKT .
data: FM_NAME TYPE RS38L_FNAM.
*& Selection Screen
Selection-screen: begin of block b1 with frame title t1.
Parameter: Docno like MSEG-MBLNR ,
YEAR like MSEG-MJAHR .
selection-screen: end of block b1.
*& Comment on selection screen
At selection-screen output .
t1 = 'Selection-Screen' .
*& Data validation at selection screen
At selection-screen .
select single * from MSEG where MBLNR = docno and MJAHR = YEAR .
if sy-subrc <> 0.
message 'Document no. not found' type 'E'.
endif.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'Z_MM_PASS'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
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 FM_NAME
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
* CONTROL_PARAMETERS =
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
* OUTPUT_OPTIONS =
* USER_SETTINGS = 'X'
DOCNO = DOCNO
YEAR = YEAR
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
* 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.
Code Formattted by: Alvaro Tejada Galindo on Jan 7, 2009 2:30 PM
Hi
I am new to ABAP.
Below is the driver program for Smartform,
after:
Step-1 Entering data at selection screen
Step-2 Pressing Execution Button
An error is displaying 'Document no. not found' but the problem is, as soon as the error appears, selection screen goes blank, its not staying.
Please suggest correction.
With warm regards.
Yogesh.
*&---------------------------------------------------------------------*
*& Report Z_MM_GPASS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_MM_GPASS.
tables: MSEG,ADRC,T001W,MAKT .
data: FM_NAME TYPE RS38L_FNAM.
*& Selection Screen
Selection-screen: begin of block b1 with frame title t1.
Parameter: Docno like MSEG-MBLNR ,
YEAR like MSEG-MJAHR .
selection-screen: end of block b1.
*& Comment on selection screen
At selection-screen output .
t1 = 'Selection-Screen' .
*& Data validation at selection screen
At selection-screen .
select single * from MSEG where MBLNR = docno and MJAHR = YEAR .
if sy-subrc <> 0.
message 'Document no. not found' type 'E'.
endif.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'Z_MM_PASS'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
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 FM_NAME
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
* CONTROL_PARAMETERS =
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
* OUTPUT_OPTIONS =
* USER_SETTINGS = 'X'
DOCNO = DOCNO
YEAR = YEAR
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
* 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.
Code Formattted by: Alvaro Tejada Galindo on Jan 7, 2009 2:30 PM
2009 Jan 07 7:43 AM
Please keep a break point and check if the correct document number is passed. Looks like exception is triggered stating : 'Document Number not found'.
2009 Jan 07 7:52 AM
Hi,
Thanks 4 ur answer.
On passing valid Document Number and Year output of the smartform is coming properly, but this is not done.
FYKK
2009 Jan 07 7:51 AM
You are not catching the error returning from one of your function modules correctly?
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
This is why you screen is returning blank.Check the return code yourself and do something like this, depending on your requirement of course:
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
INTO mtext
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
write:/1 mtext.
ENDIF.
Edited by: Micky Oestreich on Jan 7, 2009 8:51 AM
Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 2:31 PM
2009 Jan 07 8:08 AM
I have replaced (1) with (2)
(1)
if sy-subrc <> 0.
message 'Document no. not found' type 'E'.
endif.
(2)
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
INTO mtext
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
write:/1 mtext.
ENDIF.
Program syntactically correct.
but still I'm facing the same problem, for your kind knowledge I don't know what is return code
Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 2:32 PM
2009 Jan 07 8:15 AM
*I have replaced
if sy-subrc <> 0.
message 'Document no. not found' type 'E'.
endif.
with
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
INTO mtext
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
write:/1 mtext.
ENDIF.
*Program sintactically correct.
*but still I'm facing the same problem, for your kind knowledge I don't know what is return code
Edited by: Yogesh Pathak on Jan 7, 2009 9:45 AM
Messege posted more than one time due to "SERVER ERROR" while posting., sorry for inconvenience.
Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 2:34 PM
2009 Jan 07 8:37 AM
For your understanding, the return code = SY-SUBRC.
If SY-SUBRC <> 0 (in case of function modules), this normally means something went 'wrong', in this case the document was not found.
2009 Jan 07 8:14 AM
Hi,
whenever you get an error message just display your error like this:
MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 DISPLAY LIKE 'E'.
STOP.
Regards,
Dev.
Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 2:33 PM
2009 Jan 07 8:54 AM
2009 Jan 07 9:10 AM
Hi,
after your validation please put the START-OF-SELECTION block before calling the smartform,
*& Data validation at selection screen
AT SELECTION-SCREEN .
SELECT SINGLE * FROM mseg WHERE mblnr = docno AND mjahr = year .
IF sy-subrc <> 0.
MESSAGE 'Document no. not found' TYPE 'E'.
ENDIF.
START-OF-SELECTION.
Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 2:35 PM
2009 Jan 07 8:31 AM
Hi,
The program terminates when type E error ocurs..hence in your case try to use Type 'I'..information
Regards
Vasavi Kotha
2009 Jan 07 9:01 AM
Hi,
Thanks for your reply
I have tried with 'I'
but the result is same
2009 Jan 07 8:51 AM
First I want to apoligize for the fact that my first reply was not correct, since I was looking at the wrong return code. Your problem is not caused by the function modules (return codes from that) but by the first return code after the select.
I recreated your report, but I don't seem to have this problem. Is this all the coding your are using, or has something changed.
2009 Jan 07 8:57 AM
Sir,
Please dont apoligize and thanks for your reply
after this driver program Smartform remains.
2009 Jan 07 9:01 AM
Hello Yogesh,
Welcome to SDN )
*& Data validation at selection screen
At selection-screen .
select single * from MSEG where MBLNR = docno and MJAHR = YEAR .
if sy-subrc 0.
message 'Document no. not found' type 'E'.
endif.
Change this to:
*& Data validation at selection screen
At selection-screen .
select single * from MSEG where MBLNR = docno and MJAHR = YEAR .
if sy-subrc 0.
* message 'Document no. not found' type 'E'.
message 'Document no. not found' type 'I'.
LEAVE LIST-PROCESSING.
endif.
This will solve the problem. You will get an information msg & will be directed back to the selectn-screen.
BR,
SUhas
2009 Jan 07 9:41 AM
Hi,
Thanks for your reply
I have done the same,
Information messages came, output of the form came on screen, with document no entered on selection screen, which was wrong document number.
2009 Jan 07 9:15 AM
Hi yogesh,
when never you are using events like at selection-screen output, at selection-screen you must be carefull.
I think you are not used the event 'START-OF-SELECTION' at the begining of the FM 'SSF_FUNCTION_MODULE_NAME'. use that event your problem will be solved.
2009 Jan 08 11:39 AM
Instead of executing program from Transaction SE38 (Driver Program) I was executing Smartforms program without making TCODE for the same and that was the reason, after showing error Selection Screen was getting blank. As I was directed from ABAP IBM Team Lead to do on my own and I was ignore in this case. So please pardon me for that, and many many thanks to who so ever reply my post. Once again Sorry for posting such a silly question, and thanks for replies. - Yogesh Pathak
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |