Unable to print BSEG-SGTXT in Main window - SAP Script

Hi
I have an issue in Scripts.
I want to print BSEG-SGTXT in my Main Window and below is my code but i am unable to print the text. while debugging, i am getting value in zsgtxt field, but i am unable to get/print in script.
can any one help me why it's not printing? and plese suggest where it's wrong.
In Main window:
/:   PERFORM TEXT IN PROGRAM ZFIGS_CHECK_PRINTING     
/:   USING &REGUP-BELNR&                              
/:   CHANGING &ZSGTXT&                                
/:   ENDPERFORM                                       
CH   &ZSGTXT&           
In Subroutine pool:
FORM text TABLES intab STRUCTURE itcsy
                         outtab STRUCTURE itcsy.
  DATA: zbelnr(10),
        zsgtxt LIKE bseg-sgtxt.
  READ TABLE intab WITH KEY name = 'REGUP-BELNR' .
  IF sy-subrc = 0.
    MOVE intab-value TO zbelnr.
    SELECT SINGLE sgtxt INTO zsgtxt FROM bseg
          WHERE bukrs = '8140' AND
                belnr = zbelnr.
    IF sy-subrc = 0.
      MOVE zsgtxt TO outtab-value.
      MODIFY outtab INDEX sy-tabix.
    ENDIF.
  ENDIF.
ENDFORM.
Thanks,
Siva

Hi,
Can any one tell how to write loop statement in Main window to display BSEG-SGTXT. As i am getting text (BSEG-SGTXT) from subroutine pool and calling into Main window using Perform statement and printing duplicate text in multiple times insted of different text.
Thanks,
Siva

Similar Messages

  • Unable to print multiple line items in Z-SAP SCRIPT

    Hi ALL,
    We have a scenario where in we are calling the Driver program (RFKORD50) for Document Extract(F.64), Where in we have attached the Z-Script to the program(RFKORD50),
    Unable to print multiple items.
    1) Checked with all the elements in STD program for printing multiple items in main window but unable to get all the items we are able to fetch only 1 item .
    (&BSEG-BUZEI&,,     &BSEG-SGTXT&,,,,&BSEG-DMBTR&)
    2) I have also tried with external subroutine but it also didnot work.it is fetching the latest value.
    Ex: if we have 3 items say 1,2,3 first 2 items are not getting fetched it is taking 3rd item and printing it straight away(Problem is it is not going to script for fetching the first item).
    see the perform which i have used
    /: PERFORM ITEMS IN PROGRAM ZTFI_ZNV20296
    /:USING &BSEG-BUKRS&
    /:USING &BKPF-BELNR&
    /:USING &BSEG-GJAHR&
    /:CHANGING &V_BUZEI&
    /:CHANGING &V_SGTXT&
    /:CHANGING &V_DMBTR&
    /: ENDPERFORM
    IL  &V_BUZEI&,,     &V_SGTXT&,,,,&V_DMBTR&
    Please suggest me whetther we can call write_form from external subroutine. or is there any loop commands in SAP SCRIPT Form.
    Regards,
    Jana

    Hi!
    The LOOP is always within the printer program. In this case also.
    Just check out the RFKORI35 include, the LOOP begins in the 215th line (in 4.6C).
    SORT HBSEG BY BUKRS SORTP1 SORTP2 SORTP3 SORTP4 SORTP5
                          BELNR GJAHR BUZEI.
            LOOP AT HBSEG.
    *         WHERE BUKRS = SAVE_BUKRS.
              SAVE_BUKRS  = HBSEG-BUKRS.
              IF  ( HBSEG-KUNNR = SAVE_KUNNR
              AND   NOT SAVE_KUNNR IS INITIAL )
              OR  ( HBSEG-LIFNR = SAVE_LIFNR
              AND   NOT SAVE_LIFNR IS INITIAL ).
                CLEAR RF140-ELEMENT.
                RF140-ELEMENT = '521'.
                CALL FUNCTION 'WRITE_FORM'
                         EXPORTING  WINDOW    = 'MAIN'
                                    ELEMENT   = '521'
                         EXCEPTIONS WINDOW    = 1
                                    ELEMENT   = 2.
    You might try out to write your code within the 521 elemnt in the sapscript.
    Regards
    Tamás
    Edited by: Tamás Nyisztor on Jun 12, 2008 3:34 PM

  • Printing dynamic box in main window in scripts

    hi ,
    I want to print the dynamic box in main window of my script.
    Ex. Suppose the content of the main window is 5 lines so it should print box for 5 those lines only.

    Hi,
    Create a Main window with only 2 lines, Give a BOX command it will give u Border for entire Main window.
    /:BOX FRAME 10 TW
    For giving vertical lines Syntax is
    /:BOX XPOS 16 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
    It gives u a vertical line at 16 character. so for ur requirment add another command at another XPOS.
    Try this below just below ur ITEM ELEMENT which has the display fields.
    Main Window
    /E ITEM_A
    A,,,,&ITAB-ABC&,,&ITAB-XXX&,,&ITAB-CDE&,,&ITAB-GEF&
    /:BOX FRAME 10 TW
    /:BOX XPOS 16 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
    /:BOX XPOS 26 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
    /:BOX XPOS 36 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
    /:BOX XPOS 46 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
    Change XPOS according to ur requirement.
    Now add another main window to the same page with changing UPPER margin, U can add upto 99 Main windows in one page.
    So add upto ur Page is full.
    For headings
    Create a Variable window same as Main window, in place of fields, give descriptions.
    Make sure that u give BOX command below the field declaration, if u give above, for last record it will not print box.
    Regards
    Bala Krishna

  • Box in main  window of script is not printing

    Helllo Friends
    Box in main window of script is not printing but the same is available in print preview. I have use the following commands.
    Please help me.
    /:           BOX WIDTH '23.40' CM FRAME 20 TW
    /:           BOX XPOS '0.00' CM YPOS '1.40' CM WIDTH '23.40' CM FRAME 25 TW
    /:           BOX XPOS '0.00' CM YPOS '8.10' CM WIDTH '23.40' CM FRAME 25 TW
    /:           BOX XPOS '0.00' CM YPOS '9.00' CM WIDTH '23.40' CM FRAME 25 TW
    /:           SIZE  WIDTH '0.00' CM HEIGHT '8.10' CM
    /:           BOX XPOS '0.00' CM  FRAME 25 TW
    /:           BOX XPOS '0.50' CM  FRAME 10 TW
    Thanks In Advance
    Regards
    SUNITHA

    Try changing X postion to not equal to zero something else for example.
    /:           POSITION WINDOW
    /:           POSITION XORIGIN '-0.1' CH YORIGIN '+0.4' LN
    /:           SIZE WIDTH +0.7 CH HEIGHT +5.0 LN
    /:           BOX FRAME 7 TW
    /:           BOX HEIGHT '1.1' LN INTENSITY 15
    Nabheet

  • Maintianing multiple line items in main window  in scripts

    Hi folks,
      i want to print multiple line items in main window of script for eg 50 line items then my main window should continue in second page also. how to maintain this.
    can u provide me sample code for this..
    Thx in advance,
    Neelima.N

    You have an internal table with 50 lines, is it correct?
    Let's say, there's a MATNR field in your internal table.
    First do, what I wrote in my previous comment.
    The create an element in yout main window, like this:
    /E LINE_ITEMS
    /  &GS_MAIN-MATNR&
    In your printer program you have to code the following:
    LOOP AT gt_main INTO gs_main.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    WINDOW = 'MAIN'
    ELEMENT = 'LINE_ITEMS'.
    ENDLOOP.
    This code will loop all 50 of your table entries.
    In the MAIN window will fit 30 entries.
    When the LOOP is reaching the 30th entry, SAP will automatically create a new page (because of the NEXT PAGE statement you set in the page settings in the SAPScript) and will continue the printing.
    Regards
    Tamá

  • What is the use of MAIN WINDOW in SCRIPTS

    what is the use of MAIN WINDOW in SCRIPTS, y we con't create a script w/o main window.
    Title was edited by:
            Alvaro Tejada Galindo

    Hi
    See this
    What are the different types of windows in SAP Scripts?
    Windows are defined in the Layout sets which define the position and the text to displayed.
    The different types of windows are:
    MAIN - Main Window
    The main window is a continous window which can extend over several pages. If the text in the main window fills up a page, a new page is created.
    Only one main window can be defined in the SAP Script whereas upto 100 instances of main window can be created in a page.
    VAR - Variable Window
    This window can have the variable contents displayed on them. The contents of the window cannot exceed the window size. The content can be formatted for each page.
    CONST - Constant Window
    The constant window can have a fixed content and is formatted only once.
    Main Windows (MAIN)
    Each form must have one window of type MAIN. Such a window is called the main window of the form. For SAPscript forms, the main window has a central meaning:
    • It controls the page break.
    • It contains the text body that may cover several pages.
    • It allows to fix text elements at the upper and lower margins of the allocated page window (for example, for column headings).
    As soon as a window of type MAIN is full, SAPscript automatically triggers a page break and continues to output the remaining text in the main window of the subsequent page. Page windows of type MAIN have the same width throughout the form. The SAPscript composer thus avoids reformatting of the text after each page break.
    Variable Windows (VAR)
    The contents of variable windows is processed again for each page, on which the window appears. The system outputs only as much text as fits into the window. Text exceeding the window size is truncated; the system does not trigger a page break. Unlike constant windows, the page windows declared as variable windows may have different sizes on different form pages.
    Constant Windows (CONST)
    Starting with Release 4.0, the system internally processes windows of type CONST similar to windows of type VAR. Therefore, if you create a new window, always use type VAR.
    <b><REMOVED BY MODERATOR></b>
    Anji
    Message was edited by:
            Alvaro Tejada Galindo

  • How to create an Area and place main windows in scripts

    How to create an Area and place main windows in scripts ?

    hi prasad,
    jst create a page first and define page windows.
    here u can specicify whether the window is main or secondary.
    to adjust the window goto form  painter  do the adjustment.

  • Print data at new line in SAP Scripts

    Hi,
    Is there any way that i can print data at new line in sap scripts. I am looping my data and its printing in the same line but i need to print it at new line. Is there any formating options or any command to do that.
    Thanks

    Than you must take all the values from the internal table into the different variables and than print them.
    In program:
    READ TABLE ITAB INTO WA_TAB INDEX 1.
    IF SY-SUBRC = 0.
      VAR1 = WA_TAB-FIELD1.
    ENDIF.
    * read all the lines and fill the VAR variables
    In SAPScript:
    /E LINE_VAR
    /P &VAR1&
    /P &VAR2&
    /P &VAR3&
    /P &VAR4&
    Regards,
    Naimesh Patel

  • How to print items in the MAIN window of the NEXT page (smartform)?

    Dear forumers,
    There are two pages (FIRST and NEXT) in my smartform with the same MAIN windows in each of the pages. Whatever that are changed in FIRST-MAIN window will also be seen in NEXT-MAIN window.
    I will need to control the printing of table TABLE3 contents (already contained in the MAIN window) such that if a variable V_MAT_PRINT is 'X', the TABLE3 contents will only be printed in NEXT page and not printed in FIRST page at all.
    How may I achieve this? Please help.
    Thank you.

    >
    Mohammed Ahasanullah Mulla wrote:
    > Hi Deborah,
    >
    > I had also faced a similar situation,in my case it was three pages..However i will try to tell you for 2 pages..After the second table .Add a program lines and force a page break only if V_MAT_PRINT is 'X'. After the program lines add a command and make the go to new page as second page.This will solve your problem.I have done the same and its working fine .If you have any questions do ask.
    >
    > Thanks,
    > Ahsan
    Hi Ahsan,
    Here's my case.
    If V_MAT_PRINT is 'X', print the following:-
    FIRST page, MAIN window
    - TABLE1
    - TABLE2
    - TABLE4
    - TABLE5
    NEXT page, MAIN window
    - TABLE3
    If V_MAT_PRINT is not 'X', print the following (no additional controls / changes are needed, everything remains unchanged):-
    MAIN window
    - TABLE1
    - TABLE2
    - TABLE3
    - TABLE4
    - TABLE5
    In this case, is a page break suitable? I doubt it as TABLE4 and TABLE5 will still need to be printed back on the FIRST page regardless of the V_MAT_PRINT value.
    Please advise further. Thanks.

  • How to Print text in two main windows

    For printing label have created two main windows on a page. calling function write_form In ABAP Program under do loop for two times. 
    but program prints only one window. why is it so? how can i print text on two windows.
    do 2 times.
      COUNT = COUNT + 1.
    loop at itab WHERE DEPTT LT 200.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            ELEMENT  = 'TEST'
            FUNCTION = 'SET'
            TYPE     = 'BODY'
          WINDOW   = 'MAIN'
          EXCEPTIONS
           ELEMENT   = 1
           FUNCTION  = 2
           TYPE      = 3
           UNOPENED  = 4
           UNSTARTED = 5
           WINDOW    = 6
           OTHERS    = 7.
      endloop.
    enddo.
    Please guide.

    Since the information is variable and coming out of the print program, I can assume you want to print many labels but two to a page. Also, any page numbering, etc will need to be updated. This is easily accomplished with SAPScript but a feature people rarely use I believe. Here are the simple steps:
    1) On the Windows Screen: Creat a main window for the size of the label, etc knowing that you will be putting multiple windows on a page. For example, if page size is 8.5 x 11, maybe your window size is 6 X 4 or something similar. You only need one main window defined.
    2) Now go to Page Windows Screen. Add a window MAIN and down at the bottom where it says Window Type put in MAIN. Next to this field is a little field about two characters long. In here put in '01'.
    3) Now Add another window MAIN and down at the bottom put in '02'.
    Hopefully this gives you the idea. I've done this with up to 30 small windows in order to print variable window for labels on label stock such as Avery 8167, etc. 
    Good Luck!
    Tim Stadler
    Menasha Corporation

  • Printing digital signature in main window of sapscript at some location

    Hi,
    I want to print graphics in main window in sapscript. I want to position the graphic ( signature) at some position (preferably right aligned ). How to do that? Can we do that in .bmp graphics. In case we use .tiff format , how to do it. Tell me the steps involved as I have never used RSTXLDMC to upload .tiff files.
    Regards,
    D.Mallick

    Hi
    Just open rstxldmc in se38 and execute.
    It will gve you a screen. You need to fill the first two blocks only. Remaining are optional.
    File Name :  Give pathe+name of your .tiff file
    Type         : Bcol for colour     and bmon for mono
    Resolution      : say 75 (as you wish)
    Second block
       Text name :   only replace astrick by your name ZHEX-MACRO- has to be there.
    Actually  this program will convert .tiff file into text file.
    you can include this text file in any window. Text name is the name of the text file generated
    no more changes
    Now execute.
    Now you can use this text file  ZHEX-MACRO-name   in any windoow
    If useful, give me points
    cheers
    vamshi

  • Possible to print Int.Tab data in a window other than MAIN window in Script

    Hi,
      Can we print a internal table data in a window which is a VARIABLE Window in SAP Script? my requirement is not to print in MAIN Window.
    Thanks in Advance,
    Jakeer.

    Hi,
    You can do that.But main window is must.
    Create a text element and please check it maynot overflow if so data will be truncated.
    For not printing main window :
    Do one thing set the main window margint to the botom of the form.
    Then create a text element in main element
    NEW             
    NEW-PAGE        
    NEXT            
    NEW-PAGE = 'NEXT'

  • SAP Script: Printing the signature on main window at the end

    Hi,
    I am working on a SAP Script (Benefits enrollment form HR_BEN_ENRO).  I copied the HR_BEN_ENRO into ZHR_BEN_ENRO and making the necessary changes without modifying the driver program.
    The problem I am facing is as follows:
    In the main window there are so many Text elements.  At the end of the main window, after the last text element, I have put some text using Include statement.  The last text element is getting triggered for some employees and hence the text underneeth that is printing, but for some employees the last element is not triggering and hence nothing is printing underneeth that.
    Is there any solution to print the this text at the end of main window after printing all the remaining information.
    I also tried using BOTTOM & ENDBOTTOM. But in this case I don't know how to check that I am in last page of the main window.  I tried the following way:
    /: BOTTOM
    /: IF &PAGE& = SAPSCRIPT-FORMPAGES&
    SIGNATURE:__________   Date:__________
    /: ENDIF
    /: ENDBOTTOM
    In this case the value I am getting for &SAPSCRIPT-FORMPAGES& is 0 (zero).
    Any solution..please.
    Appreciate.

    How to link the ZHR_BEN_ENROL instead of HR_BEN_ENRO?
    I mean when I execute the TCODE: HRBEN0001 and select particular employee and click on Print form under Offer Selection area. Then standard program calls HR_BEN_ENRO. How to replace it with Zform?
    Thanks in advance.
    Regards,
    Krishna

  • Printing of boxes in Main window of SAP Script at 2 different locations

    Hi Experts,
      I have an requriement in SAP script, I want to draw two boxes. The first box will be at the beginging of main window with 0.5 cm, which is comming perfectly. After the first box I have to display the entries related to a particular table, after the completion of that table I need to draw another box of lenght 0.5cm and the entries related to another table, needs to be displayed.
    I am able to get the first box with intensity, but for the second box I am not getting exact position where i need to draw a dynamic box by filling intensity.
    For that reason i have drawn two ulines and wrote the text, is there any way to fill internsity in between those lines.
    Thanks
    Ravi.

    Hi Sujeet,
    I already tried with that command, the problem is in between two boxes I dont know how many lines of data will come.
    There is a need of drawing a box dynamically.
    Thanks
    Ravi

  • First Record is repeated twice in main window of script

    Dear All,
    I am developing a Script form, which contains 3 windows Header,Main and Footer. My Problem is that in Main window
    the first record is repeated twice and the remaining all records
    are ok. I am unable to solve this issue of stopping the duplicate
    first record. Your response might be helpfull to me.
    Regards,

    I came across this prob today too.
    I did some digging, maybe it is something with the window type, this prob only occurs when the type of the window is continuious, and it is only possible for the main window to be set to the continuious type.
    The only way, as far as I know, is that you can put those your wanna print in a text element. And by doing so, the prob is gone. But, do pay attention to those are not continuious type windows, and remember that they are variable. The content of the windows like those, are only kept until the next write_form is called to repaint the window content and any content of the ex-window would vanish without a trace. And if you also put the content of the variable windows in a text element, there will be some format confusion getting in the way.
    That is all I got, But I still have no idea about the course.

Maybe you are looking for