RE:SAVE_TEXT AND COMMIT_TEXT

HAI ALL,
I UPLOADED DATA FROM FLAT FILE TO INTERNAL TABLE FOR MM01 AND THEN USING SAVE_TEXT AND COMMIT_TEXT I AM TRYING TO SAVE THE DATA BUT IT IS NOT GETTING SAVED.
I AM SENDING MY CODE PLEASE TRY TO GIVE SOME SUGGESTIONS
DATA:BEGIN OF TB_ITAB OCCURS 0,
     FIELD LIKE TLINE-TDFORMAT,
     FIELD1 LIKE TLINE-TDLINE,
     END OF TB_ITAB.
DATA:I_ITAB LIKE STANDARD TABLE OF TLINE WITH HEADER LINE,
     WA_LINE TYPE TLINE.
DATA:HEADER LIKE THEAD.
CALL FUNCTION 'UPLOAD'
EXPORTING
  CODEPAGE                      = ' '
    FILENAME                      = 'C:\Documents and Settings\grptrainee1\Desktop\NEW.TXT'
    FILETYPE                      = 'DAT'
  ITEM                          = ' '
  FILEMASK_MASK                 = ' '
  FILEMASK_TEXT                 = ' '
  FILETYPE_NO_CHANGE            = ' '
  FILEMASK_ALL                  = ' '
  FILETYPE_NO_SHOW              = ' '
  LINE_EXIT                     = ' '
  USER_FORM                     = ' '
  USER_PROG                     = ' '
  SILENT                        = 'S'
IMPORTING
  FILESIZE                      =
  CANCEL                        =
  ACT_FILENAME                  =
  ACT_FILETYPE                  =
  TABLES
    DATA_TAB                      = I_ITAB
EXCEPTIONS
  CONVERSION_ERROR              = 1
  INVALID_TABLE_WIDTH           = 2
  INVALID_TYPE                  = 3
  NO_BATCH                      = 4
  UNKNOWN_ERROR                 = 5
  GUI_REFUSE_FILETRANSFER       = 6
  OTHERS                        = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT I_ITAB.
MOVE: I_ITAB-TDFORMAT TO TB_ITAB-FIELD,
     I_ITAB-TDLINE  TO TB_ITAB-FIELD1.
APPEND TB_ITAB.
ENDLOOP.
HEADER-TDOBJECT = 'MATERIAL'.
HEADER-TDNAME = '0000000000000516'.
HEADER-TDID = 'BEST'.
HEADER-TDSPRAS = 'EN'.
CALL FUNCTION 'SAVE_TEXT'
  EXPORTING
    CLIENT                = SY-MANDT
    HEADER                = HEADER
   INSERT                = 'X'
   SAVEMODE_DIRECT       = 'X'
  OWNER_SPECIFIED       = 'X'
  LOCAL_CAT             = 'X'
IMPORTING
  FUNCTION              =
   NEWHEADER             = HEADER1
  TABLES
    LINES                 = TB_ITAB
EXCEPTIONS
  ID                    = 1
  LANGUAGE              = 2
  NAME                  = 3
  OBJECT                = 4
  OTHERS                = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
   OBJECT                = 'MATERIAL'
   NAME                  = '0000000000000516'
   ID                    = 'BEST'
   LANGUAGE              =  SY-LANGU
   SAVEMODE_DIRECT       = 'X'
   KEEP                  = 'X'
  LOCAL_CAT             = ' '
IMPORTING
   COMMIT_COUNT          = SY-INDEX
TABLES
  T_OBJECT              =
  T_NAME                =
  T_ID                  =
  T_LANGUAGE            =
LOOP AT I_ITAB.
WRITE:/ I_ITAB-TDFORMAT,
        I_ITAB-TDLINE.
ENDLOOP.
LOOP AT TB_ITAB.
WRITE:/ TB_ITAB-FIELD,
        TB_ITAB-FIELD1.
ENDLOOP.

DATA:BEGIN OF TB_ITAB OCCURS 0,
     FIELD LIKE TLINE-TDFORMAT,
     FIELD1 LIKE TLINE-TDLINE,
     END OF TB_ITAB.
DATA:I_ITAB LIKE STANDARD TABLE OF TLINE WITH HEADER LINE,
     WA_LINE TYPE TLINE.
DATA:HEADER LIKE THEAD.
CALL FUNCTION 'UPLOAD'
EXPORTING
  CODEPAGE                      = ' '*
    FILENAME                      = 'C:\Documents and Settings\grptrainee1\Desktop\NEW.TXT'
    FILETYPE                      = 'DAT'
  ITEM                          = ' '*
  FILEMASK_MASK                 = ' '*
  FILEMASK_TEXT                 = ' '*
  FILETYPE_NO_CHANGE            = ' '*
  FILEMASK_ALL                  = ' '*
  FILETYPE_NO_SHOW              = ' '*
  LINE_EXIT                     = ' '*
  USER_FORM                     = ' '*
  USER_PROG                     = ' '*
  SILENT                        = 'S'*
IMPORTING*
  FILESIZE                      =*
  CANCEL                        =*
  ACT_FILENAME                  =*
  ACT_FILETYPE                  =*
  TABLES
    DATA_TAB                      = I_ITAB
EXCEPTIONS*
  CONVERSION_ERROR              = 1*
  INVALID_TABLE_WIDTH           = 2*
  INVALID_TYPE                  = 3*
  NO_BATCH                      = 4*
  UNKNOWN_ERROR                 = 5*
  GUI_REFUSE_FILETRANSFER       = 6*
  OTHERS                        = 7*
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO*
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.*
ENDIF.
LOOP AT I_ITAB.
MOVE: I_ITAB-TDFORMAT TO TB_ITAB-FIELD,
     I_ITAB-TDLINE  TO TB_ITAB-FIELD1.
APPEND TB_ITAB.
ENDLOOP.
HEADER-TDOBJECT = 'MATERIAL'.
HEADER-TDNAME = '0000000000000516'.
HEADER-TDID = 'BEST'.
HEADER-TDSPRAS = 'EN'.
CALL FUNCTION 'SAVE_TEXT'
  EXPORTING
    CLIENT                = SY-MANDT
    HEADER                = HEADER
    INSERT                = ' '
   SAVEMODE_DIRECT       = 'X'
  OWNER_SPECIFIED       = 'X'*
  LOCAL_CAT             = 'X'*
IMPORTING
  FUNCTION              = ' '*
    NEWHEADER             = HEADER
  TABLES
    LINES                 = TB_ITAB
EXCEPTIONS*
  ID                    = 1*
  LANGUAGE              = 2*
  NAME                  = 3*
  OBJECT                = 4*
  OTHERS                = 5*
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO*
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.*
ENDIF.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
   OBJECT                = 'MATERIAL'
   NAME                  = '0000000000000516'
   ID                    = 'BEST'
   LANGUAGE              =  SY-LANGU
   SAVEMODE_DIRECT       = 'X'
   KEEP                  = 'X'
  LOCAL_CAT             = ' '*
IMPORTING
   COMMIT_COUNT          = SY-TABIX
TABLES*
  T_OBJECT              =*
  T_NAME                =*
  T_ID                  =*
  T_LANGUAGE            =*
LOOP AT I_ITAB.
WRITE:/ I_ITAB-TDFORMAT,
        I_ITAB-TDLINE.
ENDLOOP.
LOOP AT TB_ITAB.
WRITE:/ TB_ITAB-FIELD,
        TB_ITAB-FIELD1.
ENDLOOP.

Similar Messages

  • Differences between the FMs of SAVE_TEXT and CREATE_TEXT.

    Hi Experts,
    Let me know that, the differences between the FMs of SAVE_TEXT and CREATE_TEXT.
    Like, Wht Wht scenarioes demand each FM?
    Which is best one, if both perform same functionality.
    replies appreciated.
    thanq

    CREATE_TEXT is used to create a new Text. It uses the SAVE_TEXT inside it.
    SAVE_TEXT is used to update the existing text.
    Regards,
    Naimesh Patel

  • Using SAVE_TEXT in VF01 for item texts

    Hi guys,
    A colleague wants to save an item text in the billing process (VF01 transaction). As you should know, there is no billing document number yet when we are creating the invoice using that transaction. He is programming at RV60AFZZ include, FORM userexit_save_document_prepare. This is his try:
    LOOP AT xvbrp.
             CONCATENATE xvbrp-vbeln xvbrp-posnr INTO lw_thead-tdname.
    *        CONCATENATE c_objectname xvbrp-posnr INTO lw_thead-tdname.
             lw_thead-tdid = 'ZZZZ'.
             lw_thead-tdobject = 'VBBP'.
             lw_thead-tdspras = 'E'.
             lw_thead-tdfuser = sy-uname.
             lw_thead-tdfdate = sy-datum.
             lw_thead-tdftime = sy-uzeit.
             CALL FUNCTION 'SAVE_TEXT'
               EXPORTING
                 client          = sy-mandt
                 header          = lw_thead
                 savemode_direct = 'X'
               TABLES
                 lines           = t_tline
               EXCEPTIONS
                 id              = 1
                 language        = 2
                 name            = 3
                 object          = 4
                 OTHERS          = 5.
             IF sy-subrc = 0.
               CALL FUNCTION 'COMMIT_TEXT'
               EXPORTING
                 OBJECT   = lw_thead-tdobject
                 NAME     = lw_thead-tdname
                 ID       = lw_thead-tdid
                 LANGUAGE = lw_thead-tdspras
               EXCEPTIONS
                 OTHERS   = 1.
               IF SY-SUBRC NE 0.
               ENDIF.
               CLEAR: lw_thead-tdname.
             ENDIF.
           ENDLOOP.
    But he is not saving the text, we dont know why. Constant c_objectname has been defined so:
    c_objectname TYPE vbeln_vf VALUE 'XXXXXXXXXX'.
    But without success... We saw XXXXXXXXXX000010 as tdname in debugger...  Do you know if the issue is the TDNAME field? What should be a correct value for LW_THEAD-TDNAME? We know the item position but not the billing document number yet, where can we get correct tdname?... or did he fail in some other point?
    Thank you!

    Hi guys,
    one of my workmates got the answer. I share that: there is a user exit call '001' in the include LV60AB07 (FORM XVBRK_KIDNO_FILL). The FM for that user exit is EXIT_SAPLV60A_001 (Billing User Exit. Processing KIDNO (Payment Reference Number)). My friend put code logic inside the include of that FM (ZXVVFU09). We used that because there the structure XVBRK already has value for the field VBELN (the number of the billing document) and we can use SAVE_TEXT and COMMIT_TEXT there without problem, concatenating billing number and item in the header. I am not sure if the billing document already was created at this point, but worked fine for us. Thanks anyway! 

  • Probelem with SAVE_TEXT

    Hi all ,
    My requirement is to copy the partner function address to the text tab in the VA01 transaction .I am using SAVE_TEXT and COMMIT_TEXT function modules.
    I am getting the values in the STXH table But i am getting the text in the text tab.
    I writing the text to Object VBBP id Z005 .
    According to some threads i need to set the flag for the field LTXSP( Long text exist in the language)
    Can u please help in in setting the flag for the long text for VA01 transaction.?
    regards
    pavee

    Hi,
    this is my code. i am executing this code in the user exit USEREXIT_SAVE_DOCUMENT _PREPARE .
    Pl solve the problem.advace thanks
    li_ithead-tdobject = 'VBBP'.
    li_ithead-tdid = 'Z005'.
    li_ithead-tdspras = sy-langu.
    CONCATENATE lw_adrc-name1 lw_adrc-street INTO li_tline-tdline SEPARATED BY space.
    li_tline-tdformat = '*'.
    APPEND li_tline .
    CONCATENATE lw_adrc-str_supply1 lw_adrc-city1 INTO li_tline-tdline
    SEPARATED BY space.
    APPEND li_tline .
    CONCATENATE lw_adrc-post_code1 lw_adrc-tel_number INTO li_tline-tdline
    SEPARATED BY space.
    APPEND li_tline .
    describe table li_tline lines lv_lines.
    li_ithead-tdtxtlines = lv_lines.
    /* here i am geeting lv_lines =3.
    CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
    client = sy-mandt
    header = li_ithead
    insert = 'X'
    savemode_direct = 'X'
    TABLES
    lines = li_tline
    EXCEPTIONS
    OTHERS = 1.
    if sy-subrc ne 0.
    exit. */ program is exiting here......
    endif.
    CALL FUNCTION 'COMMIT_TEXT'
    EXPORTING
    object = 'VBBP'
    id = 'Z005'
    language = sy-langu.
    if sy-subrc ne 0.
    exit.
    endif.

  • Problem with long text

    Hi folks,
    iam uploading longtext in transaction KP06 in bdc programing using create_text.
    now my problem is if i pass selection criteria
    case 1:
    Vertion : N0
    fiscal year : 2007
    planner profile: CCPLAN4
    then the budeget plan data uploading successfully along with long text.
    case2: Vertion : N1
    in this case also everthing wrking fine
    case3: Vertion : 001
    in this case budgetplan data uploading sucessfully but longtext is not uploading,
    i debbug the proragm , create_text also returning sy-subrc = 0. but if i check in KP06  the long text is not there.
    data declaration
    vertion : VERSN type C(3)
    can u tell me the problem is in logic or with FM ?
    note : i checked with save_text also.
    regards
    neeru

    HI Naimesh,
    the FM Create_text internally contains both FMs save_text and commit_text,
    even i debug the FM in case of vertion N1, N0 and 001,
    all the cases sy-subrc = 0.
    code:
    CLEAR G_OBJNR.
    LOOP AT RECORD.
    COST = RECORD-BDC01.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = COST
        IMPORTING
          output = COST.
        CONCATENATE 'KS' p_kokrs record-bdc00 INTO g_objnr.
            SELECT SINGLE * FROM COSP WHERE OBJNR = g_objnr
                              AND GJAHR = P_GJAHR
                              AND VERSN = p_ver
                              AND KSTAR = COST.
      IF SY-SUBRC = 0.
          LEDNR = COSP-LEDNR.
          OBJNR = COSP-OBJNR.
          GJAHR = COSP-GJAHR.
          WRTTP = COSP-WRTTP.
          VERSN = COSP-VERSN.
          KSTAR = COSP-KSTAR.
          HRKFT = COSP-HRKFT.
          VRGNG = COSP-VRGNG.
          VBUND = COSP-VBUND.
          PARGB = COSP-PARGB.
          BEKNZ = COSP-BEKNZ.
          TWAER = COSP-TWAER.
    CONCATENATE LEDNR OBJNR INTO OBJNR.
    CONCATENATE OBJNR GJAHR INTO TNAME1 separated BY SPACE10.
    CONCATENATE TNAME1 WRTTP VERSN INTO TNAME2.
    CONCATENATE TNAME2 KSTAR INTO TNAME3 separated BY SPACE.
    CONCATENATE TNAME3 VRGNG INTO TNAME4 separated BY SPACE4.
    CONCATENATE TNAME4 BEKNZ INTO TNAME5 separated BY SPACE10.
    CONCATENATE TNAME5 TWAER INTO TNAME.
    I_THEAD-TDOBJECT = 'CCSS'.
    I_THEAD-TDID = 'COSP'.
    I_THEAD-TDNAME = TNAME.
    I_THEAD-TDSPRAS = 'E'.
    APPEND I_THEAD.
    i_tline-tdformat = '*'.
    I_TLINE-TDLINE = RECORD-LONGTEXT.
    APPEND I_TLINE.
    loop at i_thead.
    CALL FUNCTION 'CREATE_TEXT'
      EXPORTING
        FID               = I_THEAD-TDID
        FLANGUAGE         = I_THEAD-TDSPRAS
        FNAME             = I_THEAD-TDNAME
        FOBJECT           = I_THEAD-TDOBJECT
      SAVE_DIRECT       = 'X'
      FFORMAT           = '*'
      TABLES
        FLINES            = i_tline
    EXCEPTIONS
      NO_INIT           = 1
      NO_SAVE           = 2
      OTHERS            = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDLOOP.
    CLEAR I_TLINE.
    REFRESH I_TLINE.
    CLEAR I_THEAD.
    REFRESH I_THEAD.
      SELECT SINGLE * from cokp into itab WHERE OBJNR = g_objnr
                              AND GJAHR = P_GJAHR
                              AND VERSN = p_ver
                              AND KSTAR = COST.
    if sy-subrc = 0.
       itab-TXFLG = 'X'.
       append itab.
       write:/ 'Text saved for', record-bdc00 , record-bdc01.
       else.
          write:/ 'Text saved for', record-bdc00 , record-bdc01.
          ENDIF.
    ENDIF.
    my program wrking fine but the long text is not visible for vertion 001.
    regards
    niru

  • How to populate the attribute of the characteristics in Contract?

    Hi Experts,
       I need to populate the attribute "Truck Net Value" of the characteristics during the Contract creation with reference to Sales Order. Brief description of the scenerio:
               We are using  a variant material in the Sales Order. This material has different attributes which the end user need to populate during the SO creation. Now I have to create a Contract with reference to Sales Order. While creating the Contract with reference to Sales Order I want to populate the attribute "Truch Net Value" of the Sales Order with some value and update the Sales Order.  So to update the attibute of the Sales Order during Contract Creation. Is there any function module that I can use for this purpose? I know where to write the code in the standard program? But I don't know how to populate the attibute?
    Thanks
    MAN

    Hi,
    Welcome to SCN!!!
    After the contract is created, you can call the BAPI BAPI_SALESORDER_CHANGE along with COMMIT to change the order texts. Alternatively you can use FMs SAVE_TEXT and COMMIT_TEXT to change any kind of texts.
    You can check the parameters to be passed by placing the breakpoints in these FMs, change and save the text manually from VA02 in the sales order.
    Thanks,
    Vinod.

  • Updation of higher level item text to lower level item text

    Hi All,
    while creating sales order VA01   i need to pass the value of higher level item text to lower level item text
    for that i read the text of the higher level item text using the fm read_text
    and pass the text to the lower level items using save_text and commit_text
    this coding works only when the lower order item  text is empty
    my queries are
    1. if the lower level item having some text that text will be replaced by the higher level item text, that is happening but showing error that I/O error , how to solve this
    2. while gone to VA02 and add one more item then also same error is happening how to solve this please help me.
    regards
    krishna

    got the solution

  • Creating screen for header text

    Hi Experts,
    I am creating a Z transaction for our business process. In the header part the users want to enter header texts as it is available in SO/PO etc. I know the function modules read_text, save_text and commit_text.
    I would like to know how I will be able to create the texts types and assign it with my document numbers.
    Thanks,
    Abdullah

    This is described in [sap library - SAPscript Control Tables and Structures|http://help.sap.com/saphelp_nw2004s/helpdata/en/d6/0db81a494511d182b70000e829fbfe/frameset.htm] (transaction SE75, tables TTXOB, TTXID, etc.)
    To make a relationship between a text (primary key TDOBJECT, TDID, TDNAME, TDSPRAS) and a document, concatenate document primary key into TDNAME field.

  • Calling SAP Script Editor from Report

    Hi,
    Can any one solve this Problem.
    How to call SAPscript  Editor i.e. MS word editor (where we are giving Text elements or Text variables or Text.
    I want to call the above text editor from my report.
    Can any one give answer for this.
    Thanks & Regards,
    Kumar.

    Moarach,
    you need to open a editor for entering the text. You can do that using the function module HR_CALL_TEXTEDITOR. After you have entered the text and clicked on SAVE you get the data returned in an internal table EDITOR_TEXT.
    You can then save the text to a text ID using SAVE_TEXT and COMMIT_TEXT function modules.
    either:
    You will have to use the FM: READ_TEXT, EDIT_TEXT, SAVE_TEXT to achieve this functionality.
    This will basically open the text editor as a pop up box ( size will be as sap script editor) for entering some comments against a Purchase Order.
    For this FMs, you 'll require Text id, text name, text object and language as parameters to be passed.
    thead-tdname = 'Purchase Order No'. " Name
    thead-tdid = 'ZQH1'. " Text ID - E.g. To be created in your system
    thead-tdobject = 'VBBK'. " Texts: application object
    thead-tdspras = sy-langu. " Language Key
    Hope this helps.
    Amit.

  • How to update CC02 Chng Header Long Text?

      Hello everyone,
         I'm trying to better understand how to dynamically update the long text in transaction CC02 from a custom program. I have debugged through CC02 and found that it uses SAVE_TEXT and COMMIT_TEXT so I too, have tried the same.
    What I've found is that as long as a Change Header Long Text was created first in CC02, the code below works successfully without issue, and is reflected when I go into CC02 - I can see my changes.
    On the other hand, if the Change Header Long Text was not already created, and I create it for the first time, this text is stored and I can successfully read it using READ_TEXT Function Modules. However CC02 does not show this saved text. Therefore, any changes made in CC02 will then overwrite my changes made in my custom program.
    I have explored the INSERT parameter of SAVE_TEXT, and pass an X if the Change Header Long Text does not already exist (Determined using READ_TEXT). However, this did not seem to yield any success.
    Can anyone explain why this works correctly when it is already created, but does not work correctly if I am creating the long text for the first time in my program?
    CALL FUNCTION 'SAVE_TEXT'
          EXPORTING
            client          = sy-mandt
            header          = lwa_thead
            savemode_direct = c_x
    *        insert          = i_new_longtxt
          TABLES
            lines           = lwa_ltext_tmp
          EXCEPTIONS
            id              = 1
            language        = 2
            name            = 3
            object          = 4
            OTHERS          = 5.
        IF sy-subrc = 0.
          CALL FUNCTION 'COMMIT_TEXT'
          EXPORTING
            object          = lwa_thead-tdobject
            name            = lwa_thead-tdname
            id              = lwa_thead-tdid
            language        = s_lang
          IMPORTING
            commit_count    = iv_updated_texts.
        ENDIF.
    Useful hints or tips will be rewarded! Thank you!

    Hi Custodio,
    Thanks for the reply. To further elaborate, the parameters I've tried passing through lwa_thead are the following:
    CONSTANTS:
        w_tdid            TYPE thead-tdid       VALUE 'AENR', " Change Master Table
        w_tdobject        TYPE thead-tdobject   VALUE 'CHANGE', " Static Object
        w_linesize        TYPE thead-tdlinesize VALUE '72', " 72 characters per line
        w_tdform          TYPE thead-tdform     VALUE 'ECM_LTXT', " Form Name in CC02 Header Long Text
       * Setup header information
      lwa_thead-tdid        = w_tdid. " AENR (Change master table)
      lwa_thead-tdobject    = w_tdobject. " CHANGE
      lwa_thead-tdname      = w_tdname. " Client + ECM
      lwa_thead-tdspras     = s_lang. " Language
      lwa_thead-tdlinesize  = w_linesize. " Characters per line
      lwa_thead-tdform      = w_tdform. " Form ECM_LTXT
      lwa_thead-TDLUSER     = SY-UNAME. " Changed by User
      lwa_thead-TDLDATE     = SY-DATUM. " Date changed
      lwa_thead-TDLTIME     = SY-UZEIT. " Time changed
      lwa_thead-TDLRELES    = SY-SAPRL. " SAP Release
      lwa_thead-TDTXTLINES  = l_records. " Number of records
    For testing purposes, I even mocked the following tran code and program name from CC02 in tdmacode1 to see if that triggered a different result. This did not visibly change anything as far as I could tell.
        w_tdmacode1       TYPE thead-tdmacode1  VALUE 'CC02SAPMC29C',
        lwa_thead-tdmacode1   = w_tdmacode1.

  • ME23N - Header Text

    Hi Gurus,
                 In ME23N transaction, I want to default the Header text value(long Text).Can you please let me know how to do that.
    Thanks in advance,
    Ashok...

    "EXIT_SAPMM06E_013" is called during PO save. This will have the PO number.
    Use INIT_TEXT, SAVE_TEXT and COMMIT_TEXT function modules in this exit to default the header text.

  • SAVE_TEXT problem

    Hello All,
    I am copying text from sales order and inserting into the production order.
    I have used read_text, save_text and commit text.
    In the debuggin i can see all the data getting populated, even iam getting sy-subrc = 0 in the save_text FM. <b>However text is not copied into the production order.</b>
    Also i have a entry in STXH table.
    I have posted my code for your reference
    FORM ADD_LONG_TEXT1.
      DATA: ID        LIKE  THEAD-TDID VALUE 'KOPF',
            LANGUAGE  LIKE  THEAD-TDSPRAS,
            NAME      LIKE  THEAD-TDNAME,
            OBJECT    LIKE  THEAD-TDOBJECT VALUE 'AUFK'.
      DATA: TLINES LIKE TLINE OCCURS 0 WITH HEADER LINE.
      DATA: IT_THEAD  LIKE THEAD OCCURS 0 WITH HEADER LINE.
    *Prepare text criteria
      CONCATENATE SY-MANDT txt-aufnr INTO NAME.
      LANGUAGE = SY-LANGU.
    *Begin of insert
    MOVE id TO IT_THEAD-TDID.
    MOVE language to IT_THEAD-TDSPRAS.
    MOVE NAME to IT_THEAD-TDNAME.
    MOVE OBJECT to IT_THEAD-TDOBJECT.
    append it_thead.
    *clear it_thead.
    *End of insert
    *First read text for existing data
      CALL FUNCTION 'READ_TEXT'
           EXPORTING
                ID                      = ID
                LANGUAGE                = LANGUAGE
                NAME                    = NAME
                OBJECT                  = OBJECT
           TABLES
                LINES                   = TLINES
           EXCEPTIONS
                ID                      = 1
                LANGUAGE                = 2
                NAME                    = 3
                NOT_FOUND               = 4
                OBJECT                  = 5
                REFERENCE_CHECK         = 6
                WRONG_ACCESS_TO_ARCHIVE = 7
                OTHERS                  = 8.
    *Append/Insert new text data
      LOOP AT txt-tline INTO wa_bdc.
        CLEAR TLINES.
        TLINES-TDFORMAT = '*'.
        TLINES-TDLINE = wa_bdc-tdline.
        APPEND TLINES.
      ENDLOOP.
    Secondly append new text data to existing data
    CALL FUNCTION 'SAVE_TEXT'
      EXPORTING
       CLIENT                = SY-MANDT
        HEADER                = it_thead
       INSERT                = ' '
       SAVEMODE_DIRECT       = 'X'
      OWNER_SPECIFIED       = ' '
      LOCAL_CAT             = ' '
    IMPORTING
      FUNCTION              =
      NEWHEADER             =
      TABLES
        LINES                 = TLINES
    EXCEPTIONS
       ID                    = 1
       LANGUAGE              = 2
       NAME                  = 3
       OBJECT                = 4
       OTHERS                = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'COMMIT_TEXT'
    EXPORTING
      OBJECT                = OBJECT
      NAME                  = NAME
      ID                    = ID
      LANGUAGE              = LANGUAGE
      SAVEMODE_DIRECT       = 'X'
      KEEP                  = ' '
      LOCAL_CAT             = ' '
    IMPORTING
      COMMIT_COUNT          =
    TABLES
      T_OBJECT              =
      T_NAME                =
      T_ID                  =
      T_LANGUAGE            =
    ENDFORM.                     "ADD_LONG_TEXT

    Hi,
    This is not a user exit, iam not sure about the update task.
    It is a normal report program, have to copy the sales text to prod order and mark the user status check for TXTU .
    This piece of code.
    SELECT SINGLE matnr INTO i_matnr FROM vbap
                          WHERE vbeln = afpo-kdauf AND posnr = afpo-kdpos.
          SELECT SINGLE mtart INTO i_mtart FROM mara
                                            WHERE matnr = i_matnr-matnr.
          IF i_mtart-mtart NE 'ZPPG'. " or i_mtart-mtart NE 'HALB'.
            IF txt-t_user CS 'TXTU'.
            ELSE.
    If the status was changed write out the Order and Date.
              PERFORM ADD_LONG_TEXT1. 
              IF sy-subrc = 0.
                READ TABLE GT_STATUS WITH KEY TXT04 = 'TXTU'.
                IF SY-SUBRC = 0.
                  PERFORM UPDATE_USER_STATUS
                          USING txt-aufnr GT_STATUS-ESTAT  ''. "D01K956913+
                ENDIF.
                WRITE: / txt-aufnr.
              ELSE.
                FORMAT COLOR COL_NEGATIVE.
                WRITE: /  txt-aufnr.
                FORMAT COLOR OFF.
              ENDIF.
            ENDIF.

  • Problem in populating PO item text using FM:SAVE_TEXT

    Hi All,
    I am having an issue with SAVE_TEXT FM,
    I need to populate the item text field:
    This FM works fine if the Item text field is blank and i am populating it with text, say "This is a test case",
    How ever if the text field is already populated say the item text field has "Testing", my requirement is i will append the new text to the previously existing, in this case it should come as "Testing This is a test case",
    For doing this i am reading the existing text using READ_TEXT FM and concatenating both the texts separated by space, and passing this to i_lines, how ever the O/P which i get in the text field is "Testing".
    Please advice.
    The cod is shown below:
    CALL FUNCTION 'SAVE_TEXT'
        EXPORTING
        CLIENT                = SY-MANDT
         header                = t_head
         insert                = 'X'
         savemode_direct       = 'X'
        OWNER_SPECIFIED       = ' '
        LOCAL_CAT             = ' '
      IMPORTING
        FUNCTION              =
        NEWHEADER             =
        TABLES
          lines                 = i_lines
       EXCEPTIONS
         id                    = 1
         language              = 2
         name                  = 3
         object                = 4
         OTHERS                = 5.

    hi,
    once u use the save_text also
    with save_text u are updating the STXH table .
    there is one field in stxh table which is once updated shows the text in the sceen.
    or u can run a bdc put the default text where u want to put and afterwards when u use create_text and commit_text,u ll be able to see the text in the screen.
    regards
    kanishak

  • SAVE_TEXT to implement long text for Material, BOM, documents etc...

    Hello,
    we are working on a process to download longtexts from one system and to upload into another system to add missing long text there for different objects.
    We are using SAVE_TEXT and it is working fine for documents in DRAW/DRAT.
    Here we got what we expected. Long texts are uploaded and can be edited in the
    transaction CV02N.
    But then we started with material and with BOMs (bill of material).
    Result of upload:
    STXH is filled with entries but in MM02 and CS02 we cannot see the added long texts.
    Seems that the connection between material and bom and their texts is missing.
    For BOM we are not totally wrong. If there is a longtext in the BOM we can add longtext (we READ_TEXT the existing longtext and add our text. Then we do a update) and can see the added longtext in CSxx transactions.
    But if there is only a short text, our insert via SAVE_TEXT is not working.
    Is there something we are doing wrong or don´t we understand something?
    Any help is appreciated.
    Best regard
    Dirk

    Hello Naren,
    oh, this answer was bringing light into my confusion.
    My problem is that there will be some import files with any long text for any object in R/3 like
    material with x textids , bom, equipment etc...
    Is there any chance to find out easily which text object combination with textid belongs to a specific long text. The TTXID table is only a listing w/o any explanantion???????
    Update longtext in BOM header -> set STZU-LTXSP
    Update longtext alternative in BOM header -> set STKO-LTXSP
    Update longtext in BOM position  -> set STPO-LTXSP
    And what is the text ID DPO for?
    My other problem now is with Material long text import.
    I checked the SDN threats but could not find the answer.
    This is my abap that is not running for material.
    I can see the long text entries from READ_TEXT, but not in STXH and STXL.
    zs_textline_c [ ]  = zs_textline_b [ ] .
    CALL FUNCTION 'INIT_TEXT'
        EXPORTING
          id            = wa_header-tdid
          language = wa_header-tdspras
          name      = wa_header-tdname
          object     = wa_header-tdobject
        IMPORTING
          header   = wa_header_b
        TABLES
          lines    = zs_textline_c
        EXCEPTIONS
          id       = 1
          language = 2
          name     = 3
          object   = 4
          OTHERS   = 5.
      IF sy-subrc <> 0.
      ENDIF.
      CALL FUNCTION 'SAVE_TEXT'
            EXPORTING
              client                = sy-mandt
              header                = wa_header_b
              insert                = 'X'
              savemode_direct       = 'X'
                     owner_specified       = 'X'
              local_cat             = ' '
            IMPORTING
              function              = l_result
            NEWHEADER             =
            TABLES
              lines                 = zs_textline_b
            EXCEPTIONS
              id                    = 1
              language         = 2
              name              = 3
              object             = 4
              OTHERS        = 5
      IF sy-subrc <> 0.
      ENDIF.
      CALL FUNCTION 'COMMIT_TEXT'.
      COMMIT WORK.
    Your help is welcome!
    Best regards
    Dirk
    Edited by: Dirk Meinhard on Mar 31, 2009 4:33 PM

  • Unable to create text using SAVE_TEXT FM

    Dear Experts,
    I' m trying to automaticly create a text in Create measurement Document (IK11 in PM) when notification is created . For this in program IMRC0004 on exit i put FM SAVE_TEXT but its not working as it should.
    BAPI_ALM_NOTIF_CREATE & BAPI_ALM_NOTIF_SAVE is used to create notification & in order to create text SAVE_TEXT  is used.
    But when the document is saved the specific text is not created. In debug the FM returns with no error.
    Can anyone help me?

    Hi,
    try to check the FM READ_TEXT by passing the same parameters used in SAVE_TEXT and check.whether read text is working.
    if read text is workingthen save text is working.
    and also see the parameter    SAVEMODE_DIRECT import parameter in save_text if it is X it will save every tiome if it is space it will save at LUW(when Logical unit of work executes)
    Prabhudas

Maybe you are looking for