Skip to Content
avatar image
Former Member

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 26, 2015 at 10:51 AM

    note: for the above code without the external commit FM also its falling.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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.


      Capture.PNG (7.1 kB)
  • Oct 26, 2015 at 11:03 AM

    Hi,

    I am using functions:

    CALL FUNCTION 'READ_TEXT' 

    CALL FUNCTION 'SAVE_TEXT'

    Those functions are released and well documented .

    I do not see CREATE_TEXT function here.


    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 26, 2015 at 11:54 AM

    thanks a lot ROY!!!!!

    the mistake i did is ....

    am passing the Fname to one variable and then assigning that variable to the function module like below

    CALL FUNCTION 'CREATE_TEXT'

       EXPORTING

         fid         = 'ST'

         flanguage   = 'E'

         fname       = lv_fname

         fobject     = 'TEXT'

         save_direct = 'X'

         fformat     = '*'

       TABLES

         flines      = lt_string.



    the problem is lv_fname value is in lower case letter so its failling to create .... now i changed that to upper case when it assigning to the variable then its working fine....


    thanks roy again....

    Add comment
    10|10000 characters needed characters exceeded