Skip to Content
author's profile photo
Former Member

Use of SAVE_TEXT in customer exits / BADI for purchase order

Hi All,

I am trying to save some long text by using SAVE_TEXT function module in a badi implementation for purchase order header text. The same is working fine if i try to update the PO header text via a report. But if i try using badi (the code is written in a PAI event for the BADI), then though the text transfer and save is successful during the code excution, but for the first time when i add any text its not visible in ME22N tcode. Since its an online event. But when i double click on that editor and the sap script editor gets opened. then i press back button, the text is appearing on the same small screen edtor . after this any number of time i edit or delete text, the save_text function module works fine.

My issue is why for the first time always i have to double click on the editor to open the sap script editor. I have also included commit_text in this case after save_text FM.

the requirement here goes like this. in one tab for PO header the user will enter some number (This is a customizing screen implemented through badi.) and the corresponsing discription should appear when user clicks on text tab in po header screen (me21n / me22n).

Kindly help.

Thanks

Mamata

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Aug 18, 2009 at 11:27 AM

    Hi,

    Try using COMMIT_TEXT Function module after save_text.

    KR Jaideep,

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Aug 01, 2013 at 05:28 AM

    Hello,

    The important part is where you are writing your logic. Write your logic in process_header method of the badi and there you use save_text and commit_text function modules.

    Also COMMIT_TEXT does not create any commit for current LUW. FOr the text modules it only

    generates in the text object a CALL FUNCTION... IN UPDATE

    TASK statement in accordance with the action to be executed (delete, create,

    change).

    http://help.sap.com/saphelp_nw70/helpdata/en/d6/0db93d494511d182b70000e829fbfe/content.htm

    Kindly check your logic and it will work fine.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 02, 2013 at 08:25 AM

    Hi mamata rath

    I have solve the problem which similar to yours. the code which is as the following

    DATA: textline TYPE tdline,

    name TYPE c LENGTH 70,

    glines TYPE TABLE OF tline,

    gline LIKE LINE OF glines,

    ls_header TYPE thead.

    CONCATENATE ch_eban-banfn ch_eban-bnfpo INTO name.

    ls_header-tdobject = 'EBAN'.

    ls_header-tdname = name.

    ls_header-tdid = 'B01'.

    ls_header-tdspras = sy-langu.

    CALL FUNCTION 'SAVE_TEXT'

    EXPORTING

    * CLIENT = SY-MANDT

    header = ls_header

    * INSERT = ' '

    * SAVEMODE_DIRECT = ' '

    * OWNER_SPECIFIED = ' '

    * LOCAL_CAT = ' '

    * IMPORTING

    * FUNCTION =

    * NEWHEADER =

    tables

    lines = glines

    EXCEPTIONS

    ID = 1

    LANGUAGE = 2

    NAME = 3

    OBJECT = 4

    OTHERS = 5

    .

    IF sy-subrc = 0.

    CALL FUNCTION 'COMMIT_TEXT'

    EXPORTING

    OBJECT = 'EBAN'

    NAME = name

    * ID = '*'

    * LANGUAGE = '*'

    * SAVEMODE_DIRECT = ' '

    * KEEP = ' '

    * LOCAL_CAT = ' '

    * IMPORTING

    * COMMIT_COUNT =

    * TABLES

    * T_OBJECT =

    * T_NAME =

    * T_ID =

    * T_LANGUAGE =

    .

    ENDIF.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Aug 02, 2013 at 08:37 AM

    Hi Mamta,

    I agree with Siddharth,

    The place where you have written the logic is very important.Please ensure you are using the correct BADI and the correct method.Also the same BADI gets called in many places, so make sure that you keep a check as to where the BADI should be triggered.

    Hope this hepls.

    Regards,

    Monami.

    Add comment
    10|10000 characters needed characters exceeded