09-22-2008 11:46 AM
Hi all,
How to read and display the sales order header text in SCRIPTS?
Sachin.
09-22-2008 11:48 AM
hi,
DATA: tdname like thead-tdname..
data : t_line LIKE tline OCCURS 0 WITH HEADER LINE.
tdname = VBDKA-VBELN.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = '0002'
LANGUAGE = 'E'
NAME = tdname
OBJECT = 'VBBK'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES = t_line
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 <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Vikram.S
09-22-2008 11:48 AM
hi,
DATA: tdname like thead-tdname..
data : t_line LIKE tline OCCURS 0 WITH HEADER LINE.
tdname = VBDKA-VBELN.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = '0002'
LANGUAGE = 'E'
NAME = tdname
OBJECT = 'VBBK'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES = t_line
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 <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Vikram.S
09-22-2008 11:49 AM
In the Driver Program, call function READ_TEXT .
Loop at internal table LINES returned by this FM and concatenate the data .
pass this value to SAP Script.
09-22-2008 11:50 AM
hi.
in so10 you can fill in your texti.e. create a text object......
then pass the name of this text object in the function module READ_TEXT.
after that pass the output of the function module in different text lines and then use theses in your scripts.
then this text you can pass into different text lines.
09-22-2008 11:51 AM
Hi,
Check this sample code
EPORT z_test1.
TABLES:
thead.
PARAMETERS:
p_vbeln TYPE vbak-vbeln.
PARAMETERS:
p_textid TYPE thead-tdid.
DATA:
BEGIN OF t_thead OCCURS 0.
INCLUDE STRUCTURE thead.
DATA:
END OF t_thead.
DATA:
w_line TYPE i,
w_idx TYPE i,
w_flag TYPE i.
DATA:
BEGIN OF t_tline OCCURS 0.
INCLUDE STRUCTURE tline.
DATA:
END OF t_tline.
DATA:
w_test TYPE thead-tdname.
START-OF-SELECTION.
w_test = p_vbeln.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = p_textid
language = sy-langu
name = w_test
object = 'VBBK'
TABLES
lines = t_tline
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.
MESSAGE 'NO TEXT EXITS FOR THIS TEXT ID' TYPE 'I'.
ENDIF.
END-OF-SELECTION.
LOOP AT t_tline.
WRITE: / t_tline-tdline.
ENDLOOP.
Regards
Abhijeet