SAP SCRIPT: Header text not printing - Custom Purchase Order.

Hello Experts,
I have used the standard MEDRUCK and copied to ZMEDRUCK. I want the PO header text to print in my form.
I have used subroutine-pool and called it in the form.
Here is my subroutine
FORM fetch_table_data TABLES in_tab STRUCTURE itcsy
                             out_tab STRUCTURE itcsy.
  TABLES EKKO.
  DATA: BEGIN OF header OCCURS 0,
          ld_txt1(163),
          ld_txt2(163),
          ld_txt3(163),
        END OF header.
  DATA: li_lines LIKE STANDARD TABLE OF tline WITH HEADER LINE,
        ID like THEAD-TDID,
        TNAME LIKE THEAD-TDNAME,
        TDOBJECT like THEAD-TDOBJECT.
  DATA  HTEXT LIKE EKKO-EBELN.
*  HTEXT = EKKO-EBELN.
  READ TABLE in_tab WITH KEY EKKO-EBELN.
  if sy-subrc = 0.
  TNAME = in_tab-value.
  ENDIF.
TNAME = EKKO-EBELN.
*CONCATENATE EKPO-ebeln EKPO-ebelp INTO v_item_text.
*MOVE v_head_text to HNAME.
CALL FUNCTION 'READ_TEXT'
  EXPORTING
*   CLIENT                        = SY-MANDT
    id                            = 'F01'
    language                      = 'E'
    name                          = TNAME
    object                        = 'EKKO'
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
* IMPORTING
*   HEADER                        = TNAME
  tables
    lines                         = li_lines
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.
CLEAR out_tab.
out_tab-VALUE = TNAME.
CONDENSE out_tab-VALUE.
MODIFY out_tab TRANSPORTING VALUE WHERE NAME = 'TNAME'.
ENDFORM.
And my script in the form is
PERFORM FETCH_TABLE_DATA IN PROGRAM ZMEDRUCK_SUBP2
USING &EKKO-EBELN&
CHANGING &TNAME&
ENDPERFORMpar RECEIVED FROM M/S     &TNAME&
The header text is still not flowing in my form.
What mistake i'm I doing here ?
How can I resolve this ?
Pls help !

Hi,
Data is li_lines internal table. 1st you have to read the text form the internal table line by sy-tabix.
At last you have to concatenate these variable into the out tab value.
you can use the following code
ORM fetch_table_data TABLES in_tab STRUCTURE itcsy
                             out_tab STRUCTURE itcsy.
  TABLES EKKO.
  DATA: BEGIN OF header OCCURS 0,
          ld_txt1(163),
          ld_txt2(163),
          ld_txt3(163),
        END OF header.
  DATA: li_lines LIKE STANDARD TABLE OF tline WITH HEADER LINE,
        ID like THEAD-TDID,
        TNAME LIKE THEAD-TDNAME,
        TDOBJECT like THEAD-TDOBJECT.
  DATA  HTEXT LIKE EKKO-EBELN.
READ TABLE in_tab WITH KEY EKKO-EBELN.
  if sy-subrc = 0.
  TNAME = in_tab-value.
  ENDIF.
ALL FUNCTION 'READ_TEXT'
  EXPORTING
  CLIENT                        = SY-MANDT
    id                            = 'F01'
    language                      = 'E'
    name                          = TNAME
    object                        = 'EKKO'
  ARCHIVE_HANDLE                = 0
  LOCAL_CAT                     = ' '
IMPORTING
  HEADER                        =
  tables
    lines                         = li_lines
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.
data : f_lines TYPE i,
DESCRIBE TABLE li_lines LINES f_lines.
data: lstr type String,
      lstr1 type string,
      lstr2 type string,
      lstr3 type string,
      lstr4 type string.
read table li_lines index 1.
lstr = li_lines
condense lstr.
clear li_lines
read table li_lines index 2.
lstr1 = li_lines
condense lstr.
clear li_lines
read table li_lines index 3.
lstr2 = li_lines
condense lstr.
clear li_lines
if f_lines GT 3.
ead table li_lines index 4.
lstr3 = li_lines
condense lstr.
clear li_lines
ead table li_lines index 5.
lstr4 = li_lines
condense lstr.
clear li_lines
endif.
data : v_text type text.
concatenate  lstr1 lstr2 lstr3 lstr4 into v_text separate by ' '.
CLEAR out_tab.
READ TABLE out_tab WITH KEY name = 'TNAME'.
out_tab-value = v_text
MODIFY out_tab INDEX sy-tabix.
Regards
Nayan Kumar

Similar Messages

  • 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.

  • Pulling the Header text  for all the purchase orders

    Hello,
    Please help in resolving the below:
    Is there any code in SAp to pull theHeader text for all the purchase orders in the data base,
    Any tcode to pull the specific text automatically to pull the text from the requsition ( Plant wise in sourcing).
    Thanks

    STXH Text header 
    STXL Text detail
    Chk the below message thread
    Table to read PO Header text and item text
    BR,
    Krishna

  • Header text not printed for scheduling agreement

    Hi All,
    I have issue with header text print out for scheduling agreement (SA).
    In SA when I am manually writing some note and then taking print out, system is giving me correct output with maual note.
    I have one standard text (ST) which I need to be printed in evry SA, so in SPRO I created new head text for vendor and in copying rule for text for SA, I created linkage of SA header text with Vendor head text.
    In vendor master, I inserted ST in newly created vendor header text.
    So now when ever I create new SA for vendor system will determin header text from vendor master.
    Now after creating SA when I check the SA, I am able to my ST in SA, but at the time of print out this ST in not printing.
    Please let me know what could be the reson.
    Regards,
    Sameer

    I dont understand about what you mean by expand.
    When you a print PO, PO text  (header or item) it will check to the configuration setting.
    The system didnt care if its adopted from vendor master or info record, or whatever you make in the copying rule.
    In your case : you create a standard text then it get copied into PO , then you set the standard text to the PO for print out, example the standard text : word is
    "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    Then in the PO the text appear will be like below(the same, because it get copied)
    "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    If you configure it in define text for SA, then it the print out it will also (the same)
    "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    So what text need to expand?

  • New field is not printed in Purchase Order (PO)

    I have added a new field in PO's Print Layout Designer (PLD). For example, I add a field called "Part Number" between "#" and "Description" fields. But when I print the PO, only "#" and "Description" fields are printed. The new "Part Number" field is ignored. I think there must be some sort of link between the new "Part Number" field in PLD and the "Item No." in the PO. This is the thing I missed. Can anybody give me a clue?

    hi..
    i think u missed to check the propery of perticular field which u have inserted. You please check the relate to and link to property of that field if there is any link, pl remove it. cause the linked field does not get value from db. so the field is not displayed. or check it the check box of visible is checked.
    I think it may help u.
    Regards,
    Chintesh Soni

  • Not able to print on Purchase order whatever we fill in item text

    not able to print on Purchase order whatever we fill in item text, from where can we link to get printed item text on purchase order

    while doing in quality whatever we fill in text in item details of p.o we are getting it printed on p.order
    but same thing when we are doing in production we are not able to print on purchase order. where we should look out
    for e.g in spro-mm-purchasing-purchase order..

  • Custom purchase order text

    Hi,
       I need to create new custom purchase order text to display in ME23N and to capture some data.
    I have created new text id and configured for the required PO document types. But I still don't see the new custom text appears in ME23N.
    As far as I understand, I need to add an entry to 'define text type and copying for po header text' under purchasing as a last step. But I cound't add to this as there is no way I could select the custom text id here.
    Also, is it possible not to print this text when we print POs? This is used only for internal purposes.
    Please let me know.
    Regards,
    Sundar.

    Hi,
    why dont you put text in Po suppliment in ME24, so that it would be on system.
    Regards
    Kedar Kulkarni

  • Item text in Purchase request is not copied to Purchase orders.why?

    que1:Item text in Purchase request is not copied to Purchase orders.why?
    que.2:where this item text is get stored, i mean to ask which table.
    please reply asp.
    SAP Learner.

    hi
    >que1:Item text in Purchase request is not copied to Purchase orders.why?
    spro >mm>Purchase Order>Texts for Purchase Orders>Define copying rules for item(line item) texts.
    spro >mm>Purchase Order>Texts for Purchase Orders> Define copying rules for header text.
    >que.2:where this item text is get stored, i mean to ask which table.
    use function module  READ_TEXT and table STXL
    regards
    KI

  • Spool - text not printing for 1st run

    Hi Experts,
    I am sending the Sap SCRIPT layouts from my print program to a spool request.
    When i execute my print program directly (without going to debuggng mode), some part of the texts (headings.. etc) are NOT seen on the layout.
    But when i run the print program via debugging mode and later turn the debug off then i am able to see the complete text on the layout from the spool.
    Please tell me what more i should have to do have complete texts on my layout on the direct exec of my print prgram?
    Thanks
    Dany

    Hi Pawan,
    The code is huge and is enclosed in loops.any ways the sample is here
       call function 'OPEN_FORM'                   
            exporting                              
                 application    = 'TX'             
                 archive_index  = ' '              
                 archive_params = ' '              
                 device         = 'PRINTER'        
                 dialog         = ' '              
                 form           = space            
                 language       = sy-langu         
                 options        = zoption          
            importing                              
                 language       = sy-langu         
            exceptions                             
                 others         = 1.               
    zoption has :
    zoption-tddest    = usr01-spld. 
    zoption-tdimmed   = 'X'.        
    zoption-tddelete  = 'X'.        
    zoption-tdprogram = sy-cprog.   
    loop at itab.
    call function 'START_FORM'       
           exporting                   
                form      = w_form     
                language  = sy-langu   
                startpage = 'FIRST'.   
    another loop contains the call to main  windows
    loop.
    endloop.
      call function 'END_FORM'                       
           importing                                 
                result                   = zitcpp    
           exceptions                                
                unopened                 = 1         
                bad_pageformat_for_print = 2         
                others                   = 3.        
    endoop
      call function 'CLOSE_FORM'                  
           importing                              
                result                   = zitcpp 
           exceptions                             
                unopened                 = 1      
                bad_pageformat_for_print = 2      
                send_error               = 3      
                others                   = 4.     
    zitcpp has :
    zitcpp-tddest    = usr01-spld.  
    zitcpp-tdimmed   = 'X'.         
    zitcpp-tddelete  = 'X'.         
    zitcpp-tdprogram = sy-cprog.    
    zitcpp-tdnewid = ' '.            
      Can you please help me with this?

  • Info record Po text not printing in Po

    Hi all,
             Info record po text not printing in po print out. Info record po text showing in po at item level but it was not printing in po. In info record No matl text checked. In material master no text maintained. please help on this
             Thanks in advance for your help

    Hi Mahesh,
    Follow the path:
    SPRO--> MM --> Purchasing --> Messages --> Texts for Messages ---> Define texts for Purchase Order
    Double click on "Texts for Document Item" under Dialog Structure
    Click on new entries and then Fill the following fields:
    Pur. Doc. Category: Purchase Order
    Print Operation: New
    Doc. Type: NB
    Item Category: Standard
    Text Object: Purchasing Doc. Item texts (EKPO)
    Text Id: Info Record PO Text (F02)
    Print Sequence: 2
    Print Priority: 1
    and then Save
    Hope this helps
    Thanks,
    Ankur

  • Purchase reqisition header note not copying to Purchase order header Note

    Hi
    can you help me any body  regarding this issue
    "purchase reqisition HEADER NOTE  not copying to Purchase order HEADER NOTE " .
    it is very urgent issue for me please.
    Thanks
    Madhu.

    hi madhu
    ans1.)  in ECC 6 it is not possible to copy PR text to PO text , becouse the only way to convert PR into PO is document flow and document flow will show you only line items.
    ans 2 )  PR text is used for maintaining text related to PR genration information , like which MRP run is giving this PR or other information which user wants to maintain .
    ans3.) if user have done same thing earliar then it may possible that he was using 4.7 or ECC 5  .
    let me konw what user is saying .
    regards
    ravikant dewangan

  • Custom Purchase order in SRM

    Hello Sap Experts
    In SRM server i need to develop one custom purchase order screen, these is my first application in srm.please it is critical for me,and i know only webdynpro application development.
    Thanks &Regards
    Chandu.

    I'm not sure there is a question here.  Please elaborate on what exactly you need help with in creating this custom screen.

  • Retrieving the Change Texts per Line Item (Purchase Order) - Very urgent

    Hi,
    How do you retrieve the Change Texts per Line Item (Purchase Order).
    Table T166T does not list these values per line item.
    Please help. This is very urgent & important.
    Best Regards,
    John

    if you are lookin out for change of item texts ...
    then use the function module ... READ_TEXT.
    and 2 tables r used ... STXH and TLINE ....
    double click on item data ...
    goto PO TEXT tab ....
    double click on text ...
    from menu ...
    goto header ... u'll get 4 fields that u need to consider ...
    TDID
    TDOBJECT
    TDHEAD
    TDNAME
    ALL THESE U'LL FIND IN  STXH
    ITEM TEXT is stored in TLINE
    Edited by: anjali rana on Mar 5, 2008 4:55 AM

  • Customer purchase order number in Billing document

    Hi Experts
    Billing documen --> Item double click --> Last Tab is PO Data
    Table (VBKD) --Field (BSTKD) -- Customer purchase order number
    How do I get populated my PO here in this field. I am not using the sales order. Only P.O --> D.O --> Billing.(inter Co. STO)
    Any help can be appreciated
    regards
    RG.

    Hi,
    You have the PO number in the delivery (in items, LIPS-VGBEL) or in VBFA table.So, you can achieve it in the copy rules from delivery to invoice (in a VOFM in VTFL). Check so the splitting of invoice (structure ZUK or field ZUKRI), so, see SAP Note 11162 - Invoice split criteria in billing document.
    I hope it helps you
    Regards
    Eduardo

  • Changing default printer in Purchase order

    Hi
    This is Mohammed. Khan, when we are working with these purchase Order T-codes (IW32, IW21, IW28, IW38) When ever we are trying to give purchase order print, than automatically it will take $MECH,at present this printer is not available in our landscape, if there I donu2019t know where this printer is defined exactly, I am searching this particular printer in Output devices(SPAD) but this is not available in that list, can any body tell me how to change the default printer, from purchase order printing list, and also let me know how to set different printer in the place of $MECH printer..
    Thank you,
    Regards,
    Mohammed. Khan

    Hi
    Try checking NACE transaction, for your output type the default printer assigned (in communication method). And also check defaults tab in user record in SU01 tcode.
    Thanks

Maybe you are looking for

  • IPhone 5 connection to my internet

    Trying to join my OWN network.  I keep getting the message 'unable to join network'.  My iPhones 4 and 4s had no problem, but my iPhone 5 does.  I am trying to update my software to 6.1.3.  HELP

  • Why did Google images suddenly stop loading in Firefox 17?

    Suddenly 3 aspects of Google stopped working in Firefox from my home computer: 1) autocomplete predictions 2) images 3) maps All these features work in IE, just not Firefox. I have been searching the Internet for a solution, because I was sure it cou

  • Can I uninstall and reinstall iMovie without paying for it again?

    My iMovie crashed recently, and I want to reinstall it again so that it will work. Basically, my iMovie '11 came with my OS X Mavericks update (so you could say it's preinstalled) and what I want to ask is this: can I open Launchpad and delete it fro

  • Database management software

    Hi Dudes, Couldn't find any better forum than this to get an answer to my question. I am looking for a software where I can create and manage a database. The target is to record scientific journal's title, author, source, year published, keywords and

  • Uninstalling adobe pdf XI trial version

    been trying to uninstall trial version of adobe pdf XI. Keep getting Error 1310 message. Anyone knows how to go about the uninstall?