‎2007 Apr 15 1:06 PM
Hello!
I am using this function in order to save text in sales order.
When i pass the table lines to the function it has for example 4 lines.
After saving i can see that the 4 lines where concatenated to each other.
I want to create a situation where the 4 lines will be one after the other.
Is it possible?
Regards
Yifat Bar
‎2007 Apr 15 6:15 PM
Hi,
Check this code. It is to save header note text on sales document. It insert text line by line instead of concatenating them.
----------------------------------------------------------------------*
----------------------------------------------------------------------*
DATA: l_objname LIKE thead-tdname,
l_vbeln LIKE vbak-vbeln.
DATA: lst_header LIKE thead. "Target Text Header
*" internal table for text to be inserted
DATA: lit_textline LIKE tline OCCURS 10 WITH HEADER LINE.
*" move sales document number
l_vbeln = 'Pass Sales document number here'.
l_objname = l_vbeln. "(or you can directly assing VBELN value here)
*" Create text header
lst_header-tdobject = 'VBBK'.
lst_header-tdname = l_objname.
lst_header-tdid = '0001'.
lst_header-tdspras = sy-langu.
lit_textline-tdformat = '*'. "User tdformat = '*', this means 'DEFAULT PARAGRATH'
lit_textline-tdline = 'This is 1st line'.
APPEND lit_textline.
lit_textline-tdformat = '*'.
lit_textline-tdline = 'This is 2nd line'.
APPEND lit_textline.
lit_textline-tdformat = '*'.
lit_textline-tdline = 'This is 3rd line'.
APPEND lit_textline.
lit_textline-tdformat = '*'.
lit_textline-tdline = 'This is 4th line'.
APPEND lit_textline.
* Save text
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = lst_header
insert = 'X'
savemode_direct = 'X'
TABLES
lines = lit_textline.
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,
RS
‎2007 Apr 15 1:34 PM
you concatenate cl_abap_char_utilities=>cr_lf at the end of each line to insert line breaks.
i guess this can also be achived by passing proper tdformat.
Raja
‎2007 Apr 15 6:15 PM
Hi,
Check this code. It is to save header note text on sales document. It insert text line by line instead of concatenating them.
----------------------------------------------------------------------*
----------------------------------------------------------------------*
DATA: l_objname LIKE thead-tdname,
l_vbeln LIKE vbak-vbeln.
DATA: lst_header LIKE thead. "Target Text Header
*" internal table for text to be inserted
DATA: lit_textline LIKE tline OCCURS 10 WITH HEADER LINE.
*" move sales document number
l_vbeln = 'Pass Sales document number here'.
l_objname = l_vbeln. "(or you can directly assing VBELN value here)
*" Create text header
lst_header-tdobject = 'VBBK'.
lst_header-tdname = l_objname.
lst_header-tdid = '0001'.
lst_header-tdspras = sy-langu.
lit_textline-tdformat = '*'. "User tdformat = '*', this means 'DEFAULT PARAGRATH'
lit_textline-tdline = 'This is 1st line'.
APPEND lit_textline.
lit_textline-tdformat = '*'.
lit_textline-tdline = 'This is 2nd line'.
APPEND lit_textline.
lit_textline-tdformat = '*'.
lit_textline-tdline = 'This is 3rd line'.
APPEND lit_textline.
lit_textline-tdformat = '*'.
lit_textline-tdline = 'This is 4th line'.
APPEND lit_textline.
* Save text
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = lst_header
insert = 'X'
savemode_direct = 'X'
TABLES
lines = lit_textline.
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,
RS