2024 Feb 20 11:10 AM
Hi.
I am implementing a little custom program, which have purchaging Doc, vendor, a checkbox to use or not the Standard Text, and a text box.
It will change the Terms of Payment (Long Text) with the Standard Text if the checkbox is checked or with the manual text in the textbox.
After some checks, I save the Terms of Payment with this,
concatenate gv_ekko-ebeln '' into ls_name.
lwa_header-tdobject = 'EKKO'.
lwa_header-tdname = ls_name.
lwa_header-tdid = 'L07'.
lwa_header-tdspras = 'S'.
call function 'SAVE_TEXT'
exporting
client = sy-mandt
header = lwa_header
savemode_direct = 'X'
tables
lines = ls_lines
exceptions
id = 1
language = 2
name = 3
object = 4
others = 5.
But after consulting the document i saw the terms of Payment is empty (see image)
Any ideas to change the terms of payment?
Thanks in advance
2024 Feb 20 1:20 PM
Do you find your text in text header table (STXH) if not, did you check sy-subrc?
(Alt: Use BAPI_PO_CHANGE filling table parameters POTEXTHEADER and POTEXTITEM followed by BAPI_TRANSACTION_COMMIT)
Did you create the purchase order with Spanish language?
2024 Feb 21 8:48 AM
Hi
There is no information on STXH, and the sy-subrc eq 0..... Why?!?!?!?!?
2024 Feb 21 10:07 AM
2024 Feb 21 12:18 PM
Hi.
I Made This
DATA: BEGIN OF XTHEAD.
INCLUDE STRUCTURE THEAD.
data: END OF XTHEAD.
DATA: BEGIN OF ZZTLINE OCCURS 10.
INCLUDE STRUCTURE TLINE.
DATA: END OF ZZTLINE.
XTHEAD-TDID = 'L07'. "TEXT-ID
XTHEAD-TDSPRAS = 'S'. "Language
XTHEAD-TDNAME = '5500011017'. "identification
XTHEAD-TDOBJECT = 'EKKO'. "Object type top/position
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = XTHEAD-TDID
LANGUAGE = XTHEAD-TDSPRAS
NAME = XTHEAD-TDNAME
OBJECT = XTHEAD-TDOBJECT
IMPORTING
HEADER = XTHEAD
TABLES
LINES = ZZTLINE
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.
REFRESH ZZTLINE.
ZZTLINE-TDLINE = 'teste'.
APPEND ZZTLINE.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
HEADER = XTHEAD
IMPORTING
* FUNCTION = ZFUNCTION
NEWHEADER = XTHEAD
TABLES
LINES = ZZTLINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5.
ELSE.
XTHEAD-TDID = 'L07'. "TEXT-ID
XTHEAD-TDSPRAS = 'S'. "Language
XTHEAD-TDNAME = '5500011017'. "identification
XTHEAD-TDOBJECT = 'EKKO'. "Object type top/position
REFRESH ZZTLINE.
ZZTLINE-TDLINE = 'Teste'.
APPEND ZZTLINE.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
FID = XTHEAD-TDID
FLANGUAGE = XTHEAD-TDSPRAS
FNAME = XTHEAD-TDNAME
FOBJECT = XTHEAD-TDOBJECT
TABLES
FLINES = ZZTLINE
EXCEPTIONS
NO_INIT = 01
NO_SAVE = 02.
IF SY-SUBRC ne 0.
endif.
ENDIF.
And inserted the Text
But in the TCODE ME33 -> Scheduling Agreements the payment terms are empty.
Any idea?
Thanks in advance