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: 

Use of SAVE_TEXT in customer exits / BADI for purchase order

Former Member
0 Kudos

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

6 REPLIES 6

jaideepsharma
Active Contributor
0 Kudos

Hi,

Try using COMMIT_TEXT Function module after save_text.

KR Jaideep,

0 Kudos

I have already tried with commit_text after save_text. This issue is happening only for the first time if there is no text .

0 Kudos

Compare to use CREATE_TEXT, will have the same issue.... why?

former_member206395
Participant
0 Kudos

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.

former_member186413
Participant
0 Kudos

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.

Former Member
0 Kudos

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.