Header Text in MV45AFZZ

Hi,
I have a requirement that I need to capture an order header text in user exit save document (in mv45afzz) and download that info in a file (This file contains shipment info which needs to the sent to carrier provider and it needs to be instant - that is immediately after order creation)
In that user exit I tried function module read_text with name as 'XXXXXXXXXX' or by providing the order number but both doesn't get the result.  The header info is available in XTHEAD structure in that user exit.  For the text, I tried XTLINE / other TLINE internal tables, but I coundn't get a suitable table where I can get the text info.
Pl let me know your ideas.
Thanks,
Krish

Thanks Usha. 
But I already tried STXL but it doesn't show up in exit_Save_document in MV45AFZZ.  The text is just a single line probably less than 30 char. 
Thanks,
Krish

Similar Messages

  • Header Text Update(Sales Order) in - MV45AFZZ - USEREXIT_SAVE_DOCUMENT_PREP

    Hi,
    I am creating a sales order from third party systme and do saom validation in EXIT - MV45AFZZ(the exit called before saving Sales Order). Based on my validation I am appending the header text incase if it is available already else I key in some text incase if we don't have a text.
    Since we don't have the OBJECT NAME (Sales order number) at this point I am not able to do this. Can you please help me to resolve this.
    Thanks in Advance... <<Text removed>>
    Regards
    Mohan
    Edited by: Matt on Apr 9, 2009 9:58 AM - Do not offer points

    Write the same logic 'after sales order number has been generated', it will be done in USEREXIT_SAVE_DOCUMENT  user exit.

  • Erroneous Shipping Header Text in the Sales Order

    Hi ,
    We are facing one problem.Can you please help us..
    We seemed to have a recurring issue in SAP Production wherein an erroneous shipping text and supply location header text
    suddenly appears on the sales order header text.   As of this stage, our interim solution is to manually clear the erroneous text via invoking
    the SAVE_TEXT command directly in Production to clear out the text.   The problem with this approach is that we are "reactive"
    to the event meaning we only get to know of the issue after the National Order Centre reports the issue and by the time it reach
    IT it already affected quite a few sales and stock transport orders.  
    I
    a) an investigation to be conducted as to identify the root cause of this issue 
    b) permanent solution to be put in place to rectify the issue
    here's the text ID that got affected
    Text ID = Z022  (Shipping Text)
    Text ID = Z029  (Supply Location)
    Language = EN
    Text Name = XXXXXXXXXX
    Text Object = VBBK
    a list of programs that calls SAVE_TEXT and updates
    the above-mentioned text ID.  We have gone through the SD user-exit MV45AFZZ.
    The sample you see below is an STO.  As you know the STO is created inside the sales user-exit and uses the
    shipping instruction default from the originating sales order to pass on the text to the STO shipping text.
    We are unable to re-create this issue so this sorts of adds a layer of complexity.
    I found SAPLSTXD memory id..It is importing from this id..But there is no export in the program..
    Can you please help us where the text is exporting ..We need to find out the root cause of this issue and solution..
    Thanks in advance.
    Satish kumar.

    I found SAPLSTXD memory id..It is importing from this id..But there is no export in the program..
    Chances are it is set and exported at some point, then abandoned after processing for that document...it needs to be cleared probably, since your user is remaining in the same user context and therefore when another import is executed, the text stored there is brought in, even though not for that order/document....believe you'll find this is a programming error, need to export space or clear the ID after it is used...
    Check the other MV45AFZ* objects also...MV45AFZZ is not the only SD user exit...look at the inlcudes (named like mv45afz* )  in SE80 for program SAPMV45A.  I can't see SD (don't run at my employer), but you might also check copy requirements in transaction VOFM entries?  Some of the SD wizards can advise on that part.
    Try ABAP Scan program RSRSCAN1, probably as background job, if you don't find in MV45AFZ* members.  Sorry, that's the old program (but it might find for you).  Current version is program RPR_ABAP_SOURCE_SCAN.
    Edited by: BreakPoint on Sep 22, 2010 4:16 PM

  • Populate Header text in VA01

    HI All,
    There is a requirement to popuate the Header text of a sales order,
    When the item -VBAP-POSNR for example : item 20,50,70 has beyond deliver date then I have to populate the header text
    as -  'Item 20,50,70 has beyond deliver date'.
    For this Im using SAVE_TEXT... but unable to get the right functionality how to make use of it.
    Could anyone provide some pointers.
    Thanks.

    Plz refrer to followin code I have used it and it works. Originally i wrote this code to copy text from ref SO to internal SO.
    but it will work for u just change it a bit.
    USER EXIT is USEREXIT_SAVE_DOCUMENT in include MV45AFZZ.
      CONSTANTS: lc_language        TYPE thead-tdspras  VALUE 'E',
                   lc_object          TYPE thead-tdobject VALUE 'VBBP',
    BE CAREFUL with TEXT ID
    LOOP AT lt_text_copy INTO ls_text_copy WHERE matnr = l_matnr.
          Read the maintained text (w.r.t Reference Order)
              MOVE: ls_text_copy-tdid TO l_id,
                    ls_configuration-atwrt TO l_name.
          Wait for a few moments before reading the data.
              WAIT UP TO 20 SECONDS.
              CALL FUNCTION 'READ_TEXT'
                EXPORTING
                  id                      = l_id                   "(Text ID of text to be read)
                  language                = lc_language            "(Language of text to be read)
                  name                    = l_name                 "(Concatenated value of VBELN and POSNR)
                  object                  = lc_object              "(Object of text to be read)
                IMPORTING
                  header                  = ls_header              "(Object of text to be read)
                TABLES
                  lines                   = lt_lines               "(Lines of text read)
                EXCEPTIONS
                  id                      = 1
                  language                = 2
                  name                    = 3
                  not_found               = 4
                  object                  = 5
                  reference_check         = 6
                  wrong_access_to_archive = 7
                  OTHERS                  = 8.
         Create the text (w.r.t Current Sales Order)
         Name of the text to be created
              MOVE: p_vbak-vbeln TO l_vbeln,
                    ls_vbap-posnr TO l_posnr.
              CONCATENATE l_vbeln l_posnr INTO l_so_posnr.
              CLEAR l_name.
              MOVE l_so_posnr TO l_name.
          Wait for a few moments before writing the data.
              WAIT UP TO 20 SECONDS.
              CALL FUNCTION 'CREATE_TEXT'
                EXPORTING
                  fid         = l_id                       "(Text ID of the text to be created)
                  flanguage   = lc_language                "(Language of the text to be created)
                  fname       = l_name                     "(Name of the text to be created)
                  fobject     = lc_object                  "(Object of the text to be created)
                  save_direct = 'X'
                TABLES
                  flines      = lt_lines                   "(Lines of the text to be created)
                EXCEPTIONS
                  no_init     = 1
                  no_save     = 2
                  OTHERS      = 3.
              CALL FUNCTION 'SAVE_TEXT'
                EXPORTING
                  header          = ls_header
                  insert          = 'X'
                  savemode_direct = 'X'
                TABLES
                  lines           = lt_lines
                EXCEPTIONS
                  id              = 1
                  language        = 2
                  name            = 3
                  object          = 4
                  OTHERS          = 5.
              IF sy-subrc <> 0.
              ENDIF.
                Clear variables
              CLEAR: l_id, l_name.
            ENDLOOP.   "(END OF LOOPING ON TEXT IDs)
          ELSE.
            when material does not exists in the ztable.
            EXIT.
          ENDIF.
        ENDLOOP.       "(END OF LOOP ON THE SALES ORDER LINE ITEM)
         ENDCASE.
       ENDIF.
      ENDFORM.                    " ZZ_TEXT_COPY
    Edited by: Prasenjit Singh Bist on Aug 23, 2011 3:35 PM

  • User exit---to capture SO header text

    Hi all,
    Requirement is to maintain SO header texts (va02>goto>header-->texts) in a z table (i.e, acceptance numbers..like remark1, remark2,3  and 4).
    plz guide me from which structure we can capture this value..i mean runtime structure..
    I can use user-exit..MV45AFZZ--->userexit_delete_document
    or any otherwayz..?

    Hi Tuborg,
    Use Function module READ_TEXT.
    or u can follow the program.
    I think it will help u to fulfill ur requirement.
    *& Report  ZSO_TEXT_CHANGE
    REPORT  zso_text_change.
    TABLES : vbak,
             vbap,
             cfstructur.
    DATA : BEGIN OF itab OCCURS 0,
           vbeln LIKE vbak-vbeln,
           posnr LIKE vbap-posnr,
           text1(30),
           text2(30),
           text3(20),
           END OF itab.
    DATA : name LIKE stxh-tdname,
           l_tid LIKE stxh-tdid,
           obj LIKE stxh-tdid.
    *& CUSTOM CONTROL DATA DECLARATIONS
    DATA: init,
          container1 TYPE REF TO cl_gui_custom_container,
          container2 TYPE REF TO cl_gui_custom_container,
          container3 TYPE REF TO cl_gui_custom_container,
          editor1    TYPE REF TO cl_gui_textedit,
          editor2    TYPE REF TO cl_gui_textedit,
          editor3    TYPE REF TO cl_gui_textedit.
    DATA: event_tab TYPE cntl_simple_events,
          event     TYPE cntl_simple_event.
    data declarations for save long text
    TYPES: BEGIN OF type_text ,
           line(65),
    END OF type_text.
    DATA:text_tab1 TYPE STANDARD TABLE OF type_text,
         text_tab2 TYPE STANDARD TABLE OF type_text,
         text_tab3 TYPE STANDARD TABLE OF type_text,
         texttab1 LIKE LINE OF text_tab1,
         texttab2 LIKE LINE OF text_tab1,
         texttab3 LIKE LINE OF text_tab1,
                line(256) TYPE c,
                field LIKE line,
                lsel LIKE sy-lisel,
                lsel1 LIKE sy-lisel,
                lin LIKE sy-lilli,
                val(50),
                val_c(50),
                val_scr(50),
                scr_val(50),
                val1(6),
                l_posnr LIKE vbap-posnr,
                l_posnr1 LIKE vbap-posnr,
                l_text1(30),
                l_vbeln LIKE vbap-vbeln.
    DATA: textlines LIKE tline-tdline OCCURS 0.
    DATA: ls_thead LIKE thead.
    DATA: lt_tline1 LIKE TABLE OF tline WITH HEADER LINE,
          lt_tline2 LIKE TABLE OF tline WITH HEADER LINE,
          lt_tline3 LIKE TABLE OF tline WITH HEADER LINE.
    DATA BEGIN OF header OCCURS 10.
            INCLUDE STRUCTURE thead.
    DATA END OF header.
    DATA: gcontrol  LIKE cfcontrol,
            l_subrc LIKE sy-subrc.
    DATA: BEGIN OF pc_tab OCCURS 10,
            line LIKE tline-tdline,
          END OF pc_tab.
    DATA: BEGIN OF pc_tab1 OCCURS 10,
            line LIKE tline-tdline,
          END OF pc_tab1.
    DATA: long_file(23) TYPE c.
    PARAMETERS : vbeln LIKE vbak-vbeln OBLIGATORY.
    SELECT-OPTIONS : posnr FOR vbap-posnr.
    INITIALIZATION.
      CLEAR : pc_tab.
      REFRESH pc_tab.
    START-OF-SELECTION.
      SELECT vbeln posnr
      FROM vbap
      INTO TABLE itab
      WHERE vbeln = vbeln
      AND   posnr IN posnr.
    LOOP AT itab.
       itab-text1 = 'Material sales text'.
       itab-text2 = 'Technical Specifications'.
       itab-text3 = 'Packing Note'.
       MODIFY itab TRANSPORTING text1 text2 text3.
    ENDLOOP.
    END-OF-SELECTION.
      WRITE: /5 'Header Level Text' COLOR 5.
      SKIP 3.
      WRITE:  /5 'General Remarks in Amendment',
              /5 'General Specifications',
              /5 'Instructions to Accounts ',
              /5 'Instructions to Product Engg',
              /5 'Instructions to Electrical ',
              /5 'Instructions to Service  ',
              /5 'Instructions to Despatch ',
              /5 'Instructions to Works ',
              /5 'Instructions to MMD      ',
              /5 'Instructions to OED ',
              /5 'Instructions to Project Markt',
              /5 'Painting Details ',
              /5 'Docs. Reqd. for Insp. Call ',
              /5 'Docs. to be sent with Invoice ',
              /5 'Spl action plan for SO Exec',
              /5 'Spl. Inst. for record keeping ',
              /5 'Customer Comm. Address ',
              /5 'Customer Supplied Products ',
              /5 'Cust. prods/traceability reqts ',
              /5 'Qualification Tests ',
              /5 'Instrument Calib. data to Cust ',
              /5 'Test Cert. reqd. for submisn ',
              /5 'Customer Inspection Stages  ',
              /5 'Un resolved points  ',
              /5 'Regret Reason ',
              /5 'Terms of payment ',
              /5 'Additional Commercial Terms ',
              /5 'Escalation',
              /5 'Mode of Despatch Details ',
              /5 'Packing Details ',
              /5 'QAP Details ',
              /5 'Approved Transporters ',
              /5 'Eye Catch ',
              /5 'LOI Details ',
              /5 'Delivery Details ',
              /5 'Order Description ',
              /5 'Penalty / LD Clause ',
              /5 'Activity Completion Schedule ',
              /5 'Inspection Details',
              /5 'Checked By ',
              /5 'Authorised By',
              /5 'Distribution',
              /5 'Send Original&Dupl. Inv. to',
              /5 'Send Copies of Inv.&Challan to ',
              /5 'Send R/R & L/R to',
              /5 'Bankers Name & Address',
              /5 'Sales Tax Details',
              /5 'Excise Duty Details',
              /5 'CST Number & Date',
              /5 'SST Number & Date',
              /5 'Bank Charges Details',
              /5 'Price Basis Details',
              /5 'Freight Details',
              /5 'Customer Collection Details',
              /5 'Road Permit Details',
              /5 'Insurance Details'.
      SKIP 5.
      WRITE: /25 'Item Level Text' COLOR 5.
      ULINE AT /24(20).
      SKIP 3.
      LOOP AT itab.
        WRITE: /5 itab-posnr.
        l_text1 = 'Technical Specifications'.
        WRITE  : 20 l_text1.
        CLEAR l_text1.
        l_text1 = 'Material sales text'.
        WRITE  : 50 l_text1.
        CLEAR l_text1.
        l_text1 = 'Packing Note'.
        WRITE  : 80 l_text1.
        HIDE : l_text1.
      ENDLOOP.
      CLEAR itab.
    AT LINE-SELECTION.
      CLEAR : lsel, lsel1.
      REFRESH text_tab2.
      lsel = sy-lisel.
      SHIFT lsel LEFT DELETING LEADING space.
      l_posnr = lsel+0(6).
      val1 = l_posnr.
    lin = sy-lilli.
    READ LINE lin FIELD VALUE itab-text1 .
      GET CURSOR FIELD l_text1 VALUE val.
      val_c = val.
      IF l_posnr IS NOT INITIAL.
        IF val = val1.
          MESSAGE s398(00) WITH 'Select a Item text'.
        ELSE.
          PERFORM itab_text.
          CALL SCREEN 0100.
        ENDIF.
      ELSEIF l_posnr IS INITIAL.
        PERFORM read_text.
        CALL SCREEN 0100.
      ENDIF.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ZMENU'.
    SET TITLEBAR 'xxx'.
      IF l_posnr IS NOT INITIAL.
        CLEAR val_scr.
        CONCATENATE l_posnr '-' val INTO val_scr SEPARATED BY space.
        scr_val = val_scr.
      ELSE.
        scr_val = val.
      ENDIF.
      CLEAR :val_scr,l_posnr,val.
      INITIALIZING TEXT EDIT CUSTOM CONTROL
      IF init IS INITIAL.
        init = 'X'.
        CREATE OBJECT: container1 EXPORTING container_name = 'CUSTOM1',
                       editor1    EXPORTING parent = container1
    WORDWRAP SET SO THAT TEXT DOES NOT EXCEED THE INTERNAL TABLE FIELD
    *LENGTH.
    wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
    wordwrap_mode = cl_gui_textedit=>wordwrap_at_windowborder
    wordwrap_position = '60'
    wordwrap_to_linebreak_mode = cl_gui_textedit=>true,
                       container2 EXPORTING container_name = 'CUSTOM2',
                       editor2    EXPORTING parent = container2
    wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
    wordwrap_mode = cl_gui_textedit=>wordwrap_at_windowborder
    wordwrap_position = '60'
    wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
        CALL METHOD editor1->set_text_as_r3table
          EXPORTING
            table = text_tab1.
        CALL METHOD editor2->set_text_as_r3table
          EXPORTING
            table = text_tab2.
        CALL METHOD editor1->delete_text.
        CALL METHOD editor2->delete_text.
    ELSE.
       CALL METHOD editor2->delete_text.
      ENDIF.
      CALL METHOD editor1->set_text_as_r3table
        EXPORTING
          table = text_tab1.
      CALL METHOD editor2->set_text_as_r3table
        EXPORTING
          table = text_tab2.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'DOWNLOAD'.
          PERFORM header1.
          PERFORM header.
          PERFORM download ."changing COM_FILE LIKE LONG_FILE.
       WHEN 'SAVE'.
         PERFORM header1.
         PERFORM header.
        WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
          SET SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  read_text1
          text
    -->  p1        text
    <--  p2        text
    FORM read_text1 USING   p_l_tid.
      CLEAR : lt_tline1.
      REFRESH text_tab1.
      l_tid = p_l_tid.
      name = vbeln.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
      CLIENT                        = SY-MANDT
          id                            = p_l_tid
          language                      = 'E'
          name                          = name
          object                        = 'VBBK'
      ARCHIVE_HANDLE                = 0
      LOCAL_CAT                     = ' '
    IMPORTING
      HEADER                        =
        TABLES
          lines                         =  lt_tline1
    EXCEPTIONS
       id                            = 1
       language                      = 2
       name                          = 3
       not_found                     = 4
       object                        = 5
       reference_check               = 6
       wrong_access_to_archive       = 7
       OTHERS                        = 8
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        EXIT.
      ENDIF.
      LOOP AT lt_tline1 .
       move-corresponding lt_tline1 to TEXT_tab1.
        APPEND lt_tline1-tdline TO text_tab1 .
       move '/' to lt_tline3-tdformat.
      ENDLOOP.
      REFRESH text_tab2.
    ENDFORM.                    " read_text1
    *&      Form  read_text
          text
    -->  p1        text
    <--  p2        text
    FORM read_text .
      CASE lsel.
        WHEN 'General Remarks in Amendment'.
          PERFORM read_text1 USING 'Z070'.
        WHEN 'General Specifications'.
          PERFORM read_text1 USING 'Z001'.
        WHEN 'Instructions to Accounts'.
          PERFORM read_text1 USING 'Z002'.
        WHEN 'Instructions to Product Engg'.
          PERFORM read_text1 USING 'Z003'.
        WHEN 'Instructions to Electrical'.
          PERFORM read_text1 USING 'Z004'.
        WHEN 'Instructions to Service'.
          PERFORM read_text1 USING 'Z005'.
        WHEN 'Instructions to Despatch'.
          PERFORM read_text1 USING 'Z006'.
        WHEN 'Instructions to Works'.
          PERFORM read_text1 USING 'Z007'.
        WHEN 'Instructions to MMD'.
          PERFORM read_text1 USING 'Z008'.
        WHEN 'Instructions to OED'.
          PERFORM read_text1 USING 'Z009'.
        WHEN 'Instructions to Project Markt'.
          PERFORM read_text1 USING 'Z037'.
        WHEN 'Painting Details'.
          PERFORM read_text1 USING 'Z010'.
        WHEN 'Docs. Reqd. for Insp. Call'.
          PERFORM read_text1 USING 'Z011'.
        WHEN 'Docs. to be sent with Invoice'.
          PERFORM read_text1 USING 'Z012'.
        WHEN 'Spl action plan for SO Exec'.
          PERFORM read_text1 USING 'Z013'.
        WHEN 'Spl. Inst. for record keeping'.
          PERFORM read_text1 USING 'Z014'.
        WHEN 'Customer Comm. Address'.
          PERFORM read_text1 USING 'Z015'.
        WHEN 'Customer Supplied Products'.
          PERFORM read_text1 USING 'Z016'.
        WHEN 'Cust. prods/traceability reqts'.
          PERFORM read_text1 USING 'Z017'.
        WHEN 'Qualification Tests'.
          PERFORM read_text1 USING 'Z018'.
        WHEN 'Instrument Calib. data to Cust'.
          PERFORM read_text1 USING 'Z019'.
        WHEN 'Test Cert. reqd. for submisn '.
          PERFORM read_text1 USING 'Z020'.
        WHEN 'Customer Inspection Stages '.
          PERFORM read_text1 USING 'Z021'.
        WHEN 'Un resolved points '.
          PERFORM read_text1 USING 'Z022'.
        WHEN 'Regret Reason '.
          PERFORM read_text1 USING 'Z023'.
        WHEN 'Terms of payment '.
          PERFORM read_text1 USING 'Z120'.
        WHEN 'Previous Sales Order '.
          PERFORM read_text1 USING 'Z040'.
        WHEN 'Escalation'.
          PERFORM read_text1 USING 'Z041'.
        WHEN 'Mode of Despatch Details '.
          PERFORM read_text1 USING 'Z042'.
        WHEN 'Packing Details '.
          PERFORM read_text1 USING 'Z043'.
        WHEN 'QAP Details '.
          PERFORM read_text1 USING 'Z044'.
        WHEN 'Approved Transporters  '.
          PERFORM read_text1 USING 'Z045'.
        WHEN 'Eye Catch  '.
          PERFORM read_text1 USING 'Z046'.
        WHEN 'LOI Details  '.
          PERFORM read_text1 USING 'Z047'.
        WHEN 'Delivery Details  '.
          PERFORM read_text1 USING 'Z048'.
        WHEN 'Order Description  '.
          PERFORM read_text1 USING 'Z049'.
        WHEN 'Penalty / LD Clause '.
          PERFORM read_text1 USING 'Z050'.
        WHEN 'Activity Completion Schedule  '.
          PERFORM read_text1 USING 'Z051'.
        WHEN 'Inspection Details '.
          PERFORM read_text1 USING 'Z052'.
        WHEN 'Checked By '.
          PERFORM read_text1 USING 'Z053'.
        WHEN 'Authorised By  '.
          PERFORM read_text1 USING 'Z054'.
        WHEN 'Distribution '.
          PERFORM read_text1 USING 'Z055'.
        WHEN 'Send Original&Dupl. Inv. to  '.
          PERFORM read_text1 USING 'Z056'.
        WHEN 'Send Copies of Inv.&Challan to '.
          PERFORM read_text1 USING 'Z057'.
        WHEN 'Send R/R & L/R to  '.
          PERFORM read_text1 USING 'Z058'.
        WHEN 'Bankers Name & Address  '.
          PERFORM read_text1 USING 'Z059'.
        WHEN 'Sales Tax Details  '.
          PERFORM read_text1 USING 'Z060'.
        WHEN 'Excise Duty Details  '.
          PERFORM read_text1 USING 'Z061'.
        WHEN 'CST Number & Date  '.
          PERFORM read_text1 USING 'Z062'.
        WHEN 'SST Number & Date  '.
          PERFORM read_text1 USING 'Z063'.
        WHEN 'Bank Charges Details '.
          PERFORM read_text1 USING 'Z064'.
        WHEN 'Price Basis Details '.
          PERFORM read_text1 USING 'Z065'.
        WHEN 'Freight Details  '.
          PERFORM read_text1 USING 'Z066'.
        WHEN 'Customer Collection Details  '.
          PERFORM read_text1 USING 'Z067'.
        WHEN 'Road Permit Details  '.
          PERFORM read_text1 USING 'Z068'.
        WHEN 'Insurance Details '.
          PERFORM read_text1 USING 'Z069'.
      ENDCASE.
    ENDFORM.                    " read_text
    *&      Form  itab_text
          text
    -->  p1        text
    <--  p2        text
    FORM itab_text .
    LOOP AT itab WHERE posnr = posnr.
       IF itab-posnr = lsel.
       CASE lsel.
         WHEN lsel.
      READ TABLE itab WITH KEY posnr = l_posnr.
      lsel1 = l_posnr.
      l_posnr1 = l_posnr.
      SHIFT lsel1 LEFT DELETING LEADING space.
      CONCATENATE itab-vbeln lsel1 INTO lsel1.
      CASE val.
        WHEN 'Material sales text'.
          PERFORM read_text2 USING '0001'.
        WHEN 'Technical Specifications'.
          PERFORM read_text2 USING 'Z001'.
        WHEN 'Packing Note'.
          PERFORM read_text2 USING 'Z005'.
      ENDCASE.
       ENDIF.
    ENDLOOP.
    ENDFORM.                    " itab_text
    *&      Form  read_text2
          text
         -->P_LSEL  text
    FORM read_text2 USING  p_lsel.
      CLEAR : lt_tline1.
      REFRESH text_tab1.
      CLEAR name.
      CLEAR obj.
    DATA : name LIKE stxh-tdname.
      name = lsel1.
      obj = p_lsel.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
      CLIENT                        = SY-MANDT
          id                            = p_lsel
          language                      = 'E'
          name                          = name
          object                        = 'VBBP'
      ARCHIVE_HANDLE                = 0
      LOCAL_CAT                     = ' '
    IMPORTING
      HEADER                        =
        TABLES
          lines                         =  lt_tline1
    EXCEPTIONS
       id                            = 1
       language                      = 2
       name                          = 3
       not_found                     = 4
       object                        = 5
       reference_check               = 6
       wrong_access_to_archive       = 7
       OTHERS                        = 8
      IF sy-subrc <> 0.
        CLEAR lsel1.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        EXIT.
      ENDIF.
      LOOP AT lt_tline1 .
       move-corresponding lt_tline1 to TEXT_tab1.
        APPEND lt_tline1-tdline TO text_tab1 .
       move '/' to lt_tline3-tdformat.
      ENDLOOP.
    ENDFORM.                    " read_text2
    *&      Form  save_text
          text
    -->  p1        text
    <--  p2        text
    FORM save_text1 ."USING p_l_tid.
      CALL METHOD editor2->get_text_as_r3table
        IMPORTING
          table = text_tab2.
      CLEAR lt_tline2.
      REFRESH lt_tline2.
      MOVE '*' TO lt_tline2-tdformat.
      LOOP AT text_tab2 INTO texttab2.
        MOVE texttab2 TO lt_tline2-tdline.
        APPEND lt_tline2.
        MOVE '/' TO lt_tline2-tdformat.
      ENDLOOP.
    HEADER-TDOBJECT = 'VBBK'.
    HEADER-TDNAME = p_l_tid.
    HEADER-TDID = 'ZTC1'.
    HEADER-TDSPRAS = 'EN'.
      CALL FUNCTION 'SAVE_TEXT'
        EXPORTING
      CLIENT                = SY-MANDT
          header                = header
      INSERT                = ' '
       savemode_direct       = 'X'
      OWNER_SPECIFIED       = ' '
      LOCAL_CAT             = ' '
    IMPORTING
      FUNCTION              =
       newheader             = ls_thead
    TABLES
          lines                 = lt_tline2.
    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.
    ELSEIF sy-subrc  = 0.
       MESSAGE i398(00) WITH 'Text Saved'.
      ENDIF.
    ENDFORM.                    " save_text1
    *&      Form  header
          text
    -->  p1        text
    <--  p2        text
    FORM header .
      PERFORM save_text1 .
    ENDFORM.                    " header
    *&      Form  header1
          text
    -->  p1        text
    <--  p2        text
    FORM header1 .
      IF lsel1 IS NOT INITIAL.
        CLEAR header.
        REFRESH header.
        header-tdobject = 'VBBP'.
        header-tdname   = name.
        header-tdid     = obj.
        header-tdspras  = 'EN'.
        APPEND header.
      ELSEIF lsel1 IS INITIAL.
        CLEAR header.
        REFRESH header.
        header-tdobject = 'VBBK'.
        header-tdname = vbeln.
        header-tdid = l_tid.
        header-tdspras = 'EN'.
        APPEND header.
      ENDIF.
    ENDFORM.                                                    " header1
    *&      Form  download
          text
    -->  p1        text
    <--  p2        text
    FORM download ."CHANGING .
    DATA : dcp_file   LIKE long_file.
      DATA fullpath TYPE string.
      l_vbeln = vbeln.
      SHIFT l_vbeln LEFT DELETING LEADING '0'.
    concatenate 'C:\' l_vbeln '.txt' into   gcontrol-directory.
      CONCATENATE 'C:\' l_vbeln '.doc' INTO   fullpath.
    gcontrol-directory
      = 'C:\Text.txt'.
      = 'C:\Documents and Settings\Subhasis Mukherjee\Desktop\Text.txt'.
      CLEAR pc_tab.
      REFRESH pc_tab.
      IF l_posnr1 IS NOT INITIAL.
        CONCATENATE l_posnr1 '-' val_c INTO val_c SEPARATED BY space.
      ENDIF.
      pc_tab = val_c.
      APPEND pc_tab.
      pc_tab = 'Previous Text'.
      APPEND pc_tab.
         DO 2 TIMES.
      pc_tab = ''.
      APPEND pc_tab.
         ENDDO.
      LOOP AT text_tab1 INTO texttab1.
       IF sy-tabix = 1.
         IF l_posnr IS NOT INITIAL.
           CONCATENATE l_posnr '-' val INTO val SEPARATED BY space.
         ENDIF.
         pc_tab = val.
         APPEND pc_tab.
         pc_tab = 'Previous Text'.
         APPEND pc_tab.
         DO 2 TIMES.
         pc_tab = ''.
         APPEND pc_tab.
         ENDDO.
       ENDIF.
        pc_tab = texttab1-line.
        APPEND pc_tab.
       AT LAST.
         pc_tab = '***************************'.
         APPEND pc_tab.
       ENDAT.
      ENDLOOP.
      LOOP AT text_tab2 INTO texttab2.
        CLEAR pc_tab.
        IF sy-tabix = 1.
          DO 3 TIMES.
            pc_tab = ''.
            APPEND pc_tab.
          ENDDO.
          pc_tab = 'Changed Text'.
          APPEND pc_tab.
           DO 2 TIMES.
          pc_tab = ''.
          APPEND pc_tab.
           ENDDO.
        ENDIF.
        pc_tab = texttab2-line.
        APPEND pc_tab.
        AT LAST.
          pc_tab = '- - - - - - - - - - - - - - - - - - - - - - - - - - - '.
          APPEND pc_tab.
        ENDAT.
      ENDLOOP.
         CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
         EXPORTING
           window_title      = 'Path'
           default_extension = 'C:\'
           default_file_name = 'TEST.XLS'
         IMPORTING
           fullpath          = fullpath.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = fullpath
          filetype                = 'ASC'
          append                  = 'X'
        TABLES
          data_tab                = pc_tab
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        MESSAGE s001(00) WITH 'File downloaded successfully'.
      ENDIF.
    ENDFORM.                    " download
    Reward points pls if it is helpfull
    Regards
    Srimanta

  • Capture the Invoice Split Reason and update it in the invoice header text

    Hi All,
    We have a requirement where we need to capture the invoice split reason and update the reason in the one of the invoice header text.
    Problem is the routine where the split criteria is being determined is called a number of times, so how will we determine at what time of time do we need to capture the split reason. I mean at what iteration of the routine will we know that the split value is the right value.
    Is there any way to determine the number of iterations of a routine written for split?
    Require your valuable inputs for this issue....
    TIA
    Regards,
    Sharadendu

    Hi,
    Is your invoice split reason maintained in the header or item level?
    Try coding your logic in user exit MV45AFZZ and update header text using text id and save it in header text using
    FM [SAVE_TEXT|http://help.sap.com/saphelp_40b/helpdata/en/d6/0db8ef494511d182b70000e829fbfe/content.htm].
    Before this logic use FM [READ_TEXT|http://help.sap.com/saphelp_nw70/helpdata/en/d6/0db8c8494511d182b70000e829fbfe/content.htm] to determine if the header text is already updated. If yes,exit else save your HEADER_TEXT using SAVE_TEXT.
    This code can be written under FORM_USEREXIT_SAVE_DOCUMENT_PREPARE.
    Regards,
    Amit
    Edited by: Amit Iyer on Sep 1, 2009 8:46 PM

  • Header text is not changing when ship to party has changed

    Hello Team,
    I am facing one issue when ship to party has changed in sales order the header text is not re determining automatically,
    I have read some posts and found that using standard its not possible we need to write enhancement for that.
    I have written below code to change the header text but facing some issues, can you please help me on to resolve this issues.
    I am calling 'RV_TEXT_COPY' FM inside the include FV45PFAP_VBAP_FUELLEN_TEXTE ,
    then its saving header text correctly, but this include is calling whenever I click on Header Text tab,
    if suppose if I am changing ship to party and I am not clicking on Header Text tab then this FM will not call this is an issue
    and one more issue is even in screen data is changing after calling RV_TEXT_COPY FM
    but STXH table is not updating, its updating the first value when we created the order.
    Can any one tell me how to solve this issue, Thanks in advance!

    Hi Mac,
    I think the following user exits can help you. In the Include MV45AFZZ use the below exit points,
    1) USEREXIT_MOVE_FIELD_TO_VBKD
    2) USEREXIT_SAVE_DOCUMENT_PREPARE
    try to write your code logic here.
    Regards,
    Satish

  • Header text not getting populated in PO in R/3 from SRM!

    Hi,
    Our requirement is to automatically populate the email ID of the user in the header text once the PO is created in R/3 with reference to Shopping Cart in SRM.
    our scenario is classic.
    So far, we have used the following Badis in our development but seems to be not working.
    1.ME_Process_PO_Cust
    2.BBP_PO_INBOUND_BADI
    Need your inputs to solve this email querry.
    Regards,
    Archit Gandhi
    Edited by: Archit Gandhi on Feb 4, 2011 11:14 AM

    Check "Text Schema" & "Text Mapping" config part under Cross-Application Basic Settings..
    This should help you.. If you need help in configuration let me know..
    Thanks!!
    Bharath

  • Copy of header text

    Hi SAP Gurus,
    Is there any SAP std. possibility, If I entered the text in the Credit memo heder and which get copied into the output of the Invoice list(Credit memo list).
    If yes then please let me know how to configure.
    Thanks & Regards,
    Sachin

    Hi Sachin,
    To map your requirement you have to ask your Abaper to pick up the Text entered in the Header Text field by using Function module "READ_TEXT" (T-code - SE37).
    Firstly go to the Billing document> Header> Text and press the Display log icon available at the bottom where you have entered your Text. It will give you details like ID and Object name against the Text Type where you have entered your text.      
    Then Use T-code - SE37 then select "READ_TEXT" function module and Execute. System will ask you to enter your client code, ID, Language and the Billing document no. along with the Object Name and then execute. System will display the RESULT at the bottom. Ask your ABAPer to pick this data and use the same on Invoice.
    Hope the above meets your requirement.
    REWARD if it helps you!!
    Regards,
    Ajinkya

  • Billing Doc-Header-Texts copy Accounting Doc-Hader Texts?

    Dear gurus,
    I it possible to copy Billing Doc.-header- Text1 to
    Accounting Document>>>>>>"Doc. Header Text" field?

    Hello,
    the SAP note 301077 lists the available userexits in SD/FI interface.
    If, for example, you want to fill a BSEG field of customer line, userexit EXIT_SAPLV60B_002 is the good one.
    Instead if you want to fill a BSEG field of a G/L line, userexit EXIT_SAPLV60B_004 is the good one.
    Best regards,
    Ivano.

  • How to check if a user fills a header text in billing invoice

    Hi everybody and thanks in advance.
    My consultant wants to oblige all users to fill a header text when they create the billing invoice (vf01).
    I was looking for several user exits when I can manage this requisite.
    My problem is that when the user creates the invoice and push save button, I try to look for in the table STXH if the user created the header text. But I have not found anything, because the invoice has not created yet.
    Only when the billing invoice has saved, the header text is stored in the table STXH.
    I has been trying to find a structure wich contains the header data like xvbrk contains the data about type of invoice, etc.
    I have studied this user exits:
    userexit_number_range (module pool saplv60A, program rv60afzz)
    userexit_account_prep_komkcv (same module)
    userexit_account_prep_kompcv (same module)
    userexit_fill_vbrk_vbrp (same module)
    v60A0001 (Customer functions in the billing document).
    My question is: In which structure is the header text of billing invoice manage before push the save button?
    If I knew where it is, I could manage the data and check if the user filled the header text.
    Thank you very much, and sorry for my pour English.

    David,
    Place this code into USEREXIT_NUMBER_RANGE:
    DATA: CATALOG LIKE TCATALOG OCCURS 0 WITH HEADER LINE,
          MEMORY_ID(30).
    data: c_MEMORY_ID(30) VALUE 'SAPLSTXD'.
    DATA l_head type THEAD.
    DATA wa_head type THEAD.
    data: l_lines type table of TLine.
    data: l_line type TLine.
    DATA l_CATALOG type TCATALOG.
    IMPORT CATALOG FROM MEMORY ID 'SAPLSTXD'.
    loop at catalog into l_catalog.
       if  l_catalog-IS_REFTEXT is initial
       and l_catalog-keep is initial.
         concatenate c_memory_id l_catalog-id into memory_id.
         import thead to l_head
                tline to l_lines
           from memory id memory_id.
         loop at l_lines into l_line.
           message i000(zz) with l_line-TDLINE.
         endloop.
       endif.
    endloop.
    It will expose the text entered into the text ids in a message box (for now).  You will want to replace the MESSAGE statement with your own logic.
    You may also need to change the message numver/class from ZZ - as seen here "message i000(zz) with l_line-TDLINE."  with an appropriate message on your system.
    DON'T forget those points.

  • REPORT OR TABLE TO CAPTURE SALE ORDER AND DELIVERY ORDER HEADER TEXTS

    HI GURUS,
    where are the sale order header text is stored?
    How to retrieve the same in the form of report.
    the same for Delivery order header text..
    Regards
    Sri

    Hi Sri,
    just goto sales order header text and click on text u will get Text name, Text ID,and Text object
    pass these values to function module READ_TEXT .
    Regards,
    sksk.

  • Sale Order Header Text

    Hellow Friends
    I am creating a report , that contains sales order data - va02 , In ned to include Header text also . and warranty text also .
    Please Help me
    Ravi

    Hai   , chk this
            CALL FUNCTION 'READ_TEXT'
               EXPORTING
               CLIENT                        = SY-MANDT
                 id                            = '0014'
                 language                      = sy-langu
                 name                          = id
                 object                        = 'VBBK'
               ARCHIVE_HANDLE                = 0
               LOCAL_CAT                     = ' '
             IMPORTING
               HEADER                        =
               TABLES
                 lines                         = itab_w
              EXCEPTIONS
                id                            = 1
                language                      = 2
                name                          = 3
                not_found                     = 4
                object                        = 5
                reference_check               = 6
                wrong_access_to_archive       = 7
                OTHERS                        = 8
      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 itab_w INTO g_text3.
          MOVE : g_text3 TO g_text4 .
        ENDIF .
        APPEND g_text3 .
    *clear g_text4 .
      ENDLOOP.

  • Update Sale Order Header Text through Enhancement

    Hi Experts,
             I Have a requirement to update the sale order Header Text , when the sale order is opened in VA02 and saved.
    Here in I tried using edit_text, it updates sale order header text  directly in DB during run time even before the save action is completed.
    But I need to just fill the header text and that has to be saved during the save action only.
    I tried coding the same in the user exit (userexit_save_document) but this user exit gets triggered only when there is some changes made to the document when opened in VA02 & Saved.
    Is there any  user exist to pass sale Order Header text and save when save button is clicked irrespective of the document been changed or not.
    Thanks in advance
    Sathish

    Hi Brad Bohn,
        My actual requirement is to trigger an Idoc when the user goes to VA02 transaction and clicks save.
    IDoc gets triggered only when there is some changes to that document, that is through NAST table entry based on the output configurations in NACE transaction.
    Now that the user wants to trigger an IDoc even if there is no change (ie. to reprocess the IDoc) when he just opens a sale order in VA02 and click save.
    It is not possible to trigger an IDoc through configurations when there is no actual change in VA02 and saved.
    So it has to be forcefully sent by making some additions to the Order through coding, so I choose that Text box to fill some additional data and save .
    Kindly Let me Know any thing could be done for this scenario.
    Thanks in advance
    Sathish

  • SAP SCRIPT Header text and Item text not printing in customized PO

    Hello Experts,
                          I have copied the standard MEDRUCK to ZMEDRUCK and customized the form according to the requirement.
    I want to print the header text and Item text in my form.
    For Header text I have used :
    /: INCLUDE &EKKO-EBELN& OBJECT EKKO ID F01
    Problem 1: The text what I enter in header text is flowing only when I hit on print preview without saving the form. Once I save the SAP SCRIPT  and click on print preview the field is appearing blank. I also tried to print the form, but the field is appearing blank even on the print out.
    Problem 2: For item text the field is concatenation of  EBELN & EBELP. Can anyone suggest me how to concatenate and fetch the text in item text.

    Hi,
        Im getting an error in my subroutine pool for i_xtline which is to fetch ITEM TEXT., It says its not a in any internal table nor defined as data. How can I proceed further. I have pasted my code below. Please check and revert ASAP
    PROGRAM  ZMEDRUCK_SUBP1.
    TABLES: EKPO, EKKO.
    FORM fetch_table_data TABLES in_tab STRUCTURE itcsy
                                 out_tab STRUCTURE itcsy.
    data xname like THEAD-TDNAME.
    data i_xtline like xtline.
    clear i_xtline.
    refresh i_xtline.
    CONCATENATE EKPO-ebeln EKPO-ebelp INTO v_item_text.
    MOVE v_item_text to ITEMTXT.
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
      CLIENT                        = SY-MANDT
        id                            = F01
        language                      = EN
        name                          = ITEMTXT
        object                        = EKPO
      ARCHIVE_HANDLE                = 0
      LOCAL_CAT                     = ' '
    IMPORTING
      HEADER                        =
      tables
        lines                         = i_xtline
    EXCEPTIONS
       ID                            = 1
       LANGUAGE                      = 2
       NAME                          = 3
       NOT_FOUND                     = 4
       OBJECT                        = 5
       REFERENCE_CHECK               = 6
      WRONG_ACCESS_TO_ARCHIVE       = 7
      OTHERS                        = 8
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.

Maybe you are looking for