Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Scheduling agreement changing terms of Payment

0 Kudos

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)

marcobranco1975_5_0-1708427310457.png

Any ideas to change the terms of payment?

 

Thanks in advance

4 REPLIES 4

raymond_giuseppi
Active Contributor
0 Kudos

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?

 

0 Kudos

Hi

There is no information on STXH, and the sy-subrc eq 0..... Why?!?!?!?!?


0 Kudos
  • SAVE_TEXT wont be able to check validity of a field such as TDNAME / EBELN
  • Also add insert = abap_true in the call of the FM.

0 Kudos

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

marcobranco1975_5_0-1708517741362.png

But in the TCODE ME33 -> Scheduling Agreements the payment terms are empty.

marcobranco1975_5_1-1708517891955.png

Any idea?
Thanks in advance