Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Create_Text

Hi experts,

am Using the function module "Create_text" to create the some standard text in the TCode  "SO10" but its falling to create . also am using the commit function to it.

note : while debugging i found that internal commit is available for this FM but still am using external commit FM still its falling.

If i run the same FM in se37 itself by giving the same data it is creating the STD text on the above tcode but failing to create inside the program.

below i attached the sample code with the FM "Create_text" please take a look and let me know where am doin the mistake...

{Code}

DATA: lt_string TYPE STANDARD TABLE OF tline.

DATA: lv_comit TYPE sy-index.

CALL FUNCTION 'CREATE_TEXT'

   EXPORTING

     fid         = 'ST'

     flanguage   = 'E'

     fname       = 'ZTES'

     fobject     = 'TEXT'

     save_direct = 'X'

     fformat     = '*'

   TABLES

     flines      = lt_string.

 

IF sy-subrc = 0.

   WRITE: ' FM sucessful'.

ELSE.

   WRITE: 'FM error'.

ENDIF.

CALL FUNCTION 'COMMIT_TEXT'

   EXPORTING

     object          = 'TEXT'

     name            = 'ZTES'

     id              = 'ST'

     language        = 'E'

     savemode_direct = 'X'

     keep            = 'X'

*   LOCAL_CAT       = ' '

   IMPORTING

     commit_count    = lv_comit.

*       TABLES

*         T_OBJECT              =

*         T_NAME                =

*         T_ID                  =

*         T_LANGUAGE            =

.

 

IF sy-subrc = 0.

   WRITE: / lv_comit.

ELSE.

   WRITE: 'commit error'.

* Implement suitable error handling here

ENDIF.

{code}

for the above code is not returning any error. but also its giving lv_comit = 0. means nothing is got commited

pleaselet me know where am doing the mistake.

Former Member
Former Member replied

I just tested it in my system . After passing flines in CREATE_TEXT it creates the standard text perfectly . You don't need the COMMIT_TEXT also.

DATA: lt_string TYPE STANDARD TABLE OF tline.

DATA: lv_comit TYPE sy-index.

DATA : wa_lines TYPE LINE OF tlinetab.

wa_lines-tdformat = '*'.

wa_lines-tdline = 'Test'.

APPEND wa_lines TO lt_string.

CALL FUNCTION 'CREATE_TEXT'

   EXPORTING

     fid         = 'ST'

     flanguage   = 'E'

     fname       = 'ZTES'

     fobject     = 'TEXT'

     save_direct = 'X'

     fformat     = '*'

   TABLES

     flines      = lt_string.

IF sy-subrc = 0.

   WRITE: ' FM sucessful'.

ELSE.

   WRITE: 'FM error'.

ENDIF.


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question