on 07-24-2008 4:16 PM
Hi,
i can't use text include in smartforms, so i use read_text.
But i have a problem when no text exists.
In text include for that they are a case for no error if no text exists.
How can do when i use read_text for not have error if no text exists please?
DATA: BEGIN OF it_lines occurs 0,
tdformat TYPE tline-tdformat,
tdline TYPE tline-tdline,
END OF it_lines.
DATA : str_lines like tline.
DATA : Z0001_ADVTEXTE1 type TDLINE.
DATA : Z0001_ADVTEXTE2 type TDLINE.
DATA : Z010_LIB1 type TDLINE.
DATA : Z010_LIB2 type TDLINE.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = '0001'
language = SY-LANGU
name = '0050000027000010'
object = 'VBBP'
tables
lines = it_lines.
.
READ TABLE it_lines into str_lines index 3.
Z0001_ADVTEXTE1 = str_lines-tdline+0(132).
READ TABLE it_lines into str_lines index 4.
Z0001_ADVTEXTE2 = str_lines-tdline+0(132).
Concatenate Z0001_ADVTEXTE1 Z0001_ADVTEXTE2 into Z0001_ADVTEXTE separated by ''.
Thanks.
hi,
For your code add the following code, just before calling the read_text write the select query like this,
And if sy-subrc is initial then call the Function module
Along with that code uncomment the exceptions also of the Function Module
DATA: BEGIN OF it_lines occurs 0,
tdformat TYPE tline-tdformat,
tdline TYPE tline-tdline,
END OF it_lines.
DATA : str_lines like tline.
DATA : Z0001_ADVTEXTE1 type TDLINE.
DATA : Z0001_ADVTEXTE2 type TDLINE.
DATA : Z010_LIB1 type TDLINE.
DATA : Z010_LIB2 type TDLINE.
DATA : it_stxh type table of stxh.
select * from stxh
into table it_stxh
where TDOBJECT = 'VBBP'
TDNAME = '0050000027000010'
TDID = '0001'
TDSPRAS = 'EN'.
if sy-subrc is initial.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = '0001'
language = SY-LANGU
name = '0050000027000010'
object = 'VBBP'
tables
lines = it_lines.
.
endif.
READ TABLE it_lines into str_lines index 3.
Z0001_ADVTEXTE1 = str_lines-tdline+0(132).
READ TABLE it_lines into str_lines index 4.
Z0001_ADVTEXTE2 = str_lines-tdline+0(132).
Concatenate Z0001_ADVTEXTE1 Z0001_ADVTEXTE2 into Z0001_ADVTEXTE separated by ''.
Hope this solve your problem,
reward if it is helpfull,
Regards,
KP
Edited by: krishna prasad on Jul 25, 2008 6:08 AM
Edited by: krishna prasad on Jul 25, 2008 6:21 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep, it's what i have use and that's work thanks RP.
And thanks Bruno too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Spawn,
If I didn't misunderstood the question, you can use the exceptions provided in READ_TEXT function, to catch the errors.
Try something like this:
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = '0001'
language = SY-LANGU
name = '0050000027000010'
object = 'VBBP'
tables
lines = it_lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
IF sy-subrc NE 0.
* ERROR - do something?
ENDIF.
Then, you can check the error by consulting sy-subrc variable.
Kind regards,
Bruno
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.