2011 Nov 19 6:26 AM
Hi,
i am using read_text function module, here i am passing parameters like :
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'ZST1'
LANGUAGE = SY-LANGU
NAME = W_NAME
OBJECT = 'TEXT'
TABLES
LINES = T_LINE
in w_name i am passing purchasing group. now functional consultant has maintained for "101" only, so if "212" comes then FM throws exception of NOT FOUND
"Text 212 ID ZST1 language EN not found " and program terminates because it exception,
so is there any solution that i can avoid this termination. i know its exception and fucn consulatn need to maintain, but if not maintain then how can we control through program?
Hi,
i am using read_text function module, here i am passing parameters like :
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'ZST1'
LANGUAGE = SY-LANGU
NAME = W_NAME
OBJECT = 'TEXT'
TABLES
LINES = T_LINE
in w_name i am passing purchasing group. now functional consultant has maintained for "101" only, so if "212" comes then FM throws exception of NOT FOUND
"Text 212 ID ZST1 language EN not found " and program terminates because it exception,
so is there any solution that i can avoid this termination. i know its exception and fucn consulatn need to maintain, but if not maintain then how can we control through program?
2011 Nov 19 6:30 AM
Hi,
Catch the exceptions from the function module using exceptions and after the function module call, write the logic for sy-subrc check and if it is not zero then you can raise a warning message or proceed further without doing anything.
{
CALL FUNCTION 'READ_TEXT'
EXPORTING CLIENT = SY-MANDT
OBJECT = ?...
NAME = ?...
ID = ?...
LANGUAGE = ?...
ARCHIVE_HANDLE = 0
IMPORTING HEADER =
TABLES LINES = ?...
EXCEPTIONS ID =
LANGUAGE =
NAME =
NOT_FOUND =
OBJECT =
REFERENCE_CHECK =
WRONG_ACCESS_TO_ARCHIVE =
IF sy-subrc <> 0.
ENDIF.
}
Regards.,
Prasanna
2011 Nov 19 8:41 AM
Hi Angel,
What you can do is you canwrite your piece of code which is likely to throw exception in TRY CATCH block like JAVA.
when the exceptionis raised handle it.
Cheers,
Ankitesh
2011 Nov 19 9:34 AM
Hello Guys,
i Solved it.
actually, i checked from STXH table the entry text name, if i dont find it, i will not call read_text function module.