Problem in Printing the values in SAP Script

Hi,
I have to print the material, description, quantity and value in the invoice.. the problem i face is.. the variables which is of size 40 characters. only prints the data and gets trimmed because of which the data displayed in the invoice not in order.
can any one tell me how to find the length of the variable or is there any way to protect the variable from getting trimmed.
Advance Thanks..
Guhapriyan S

Hi again,
1. what problem are u facing ?
  (there is no sapscript symbol / system symbol
   for finding out the length )
  (In abap u can use strlen)
2.  data and gets trimmed
   what is the meaning of it ?
3. do u mean to say that  !
  ABCDEF                     123 45
  GEF                        123 45
  is getting pritned like
  ABCDEF 123 45  ?
  GEF  123 45
4. If so , then use TABS
5. This happens because SPACE
   is different in different varlues of
   ABCDEF and GEF !
regards,
amit m.
Message was edited by: Amit Mittal

Similar Messages

  • Script- problem in printing the values in from internal table

    Hi all,
    I have a requiremnt that i for a particular document no there are number of invoices are there. i.e for a single document no there are 20 invoices in that. i shoudl display the invoice number , invoice date, invoice amount , number of days of intrest , start date of interest, end date of interest and intrest amount.
    The problem is i should take the invoice number, invoice date, number of days  from TABLE <b>BSEG</b> and  inovice amount and start date, end date from table<b> INTITIT</b>.  for a particular document number there are diffent invoce numbers in both the table.
    i can display everthing but the prob is with invoice amount. it is repating only one values is displying in the ouput. The invoice number in INTITIT Is not changing. I have to write the syntax for that .Please help me The value in Bseg is chaing as per given syntax shown below.
    data:   begin of hbseg occurs 10.
            include structure hsortp.
            include structure bseg.
    data:   end of hbseg.
    data: begin of hsortp,
            sortp1 like sortp1,
            sortp2 like sortp2,
            sortp3 like sortp3,
            sortp4 like sortp4,
            sortp5 like sortp5,
            EKVBD  LIKE KNB1-EKVBD,
          end   of hsortp.
    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 bseg.
                move-corresponding hbseg to bseg.
                 *bseg = bseg.
                if bkpf-waers ne *bkpf-waers.
                  perform curr_document_convert_bseg
                              using
                                 bkpf-budat
                                 *bkpf-waers
                                 *bkpf-hwaer
                                 bkpf-waers
                              changing
                                 bseg.
                  if not bseg-pycur is initial.
                    alw_waers = bseg-pycur.
                    perform currency_get_subsequent
                                using
                                   save_repid
                                   bkpf-budat
                                   bkpf-bukrs
                                changing
                                   alw_waers.
                    if alw_waers ne bseg-pycur.
                      bseg-pycur = alw_waers.
                      perform convert_foreign_to_foreign_cur
                                  using
                                     bkpf-budat
                                     *bkpf-waers
                                     *bkpf-hwaer
                                     bseg-pycur
                                  changing
                                     bseg-pyamt.
                    endif.
                  endif.
                endif.
                perform fill_waehrungsfelder_bseg.
                perform fill_waehrungsfelder_bseg_2.
                if bseg-sgtxt(1) ne '*'.
                  bseg-sgtxt = space.
                else.
                  bseg-sgtxt = bseg-sgtxt+1.
                endif.
                clear save_bschl.
                clear save_umskz.
                clear tbslt.
                save_bschl = bseg-bschl.
                save_umskz = bseg-umskz.
                perform read_tbslt.
    ADDING VARIBLE V_GSALDF BY SUNIL 5.11.07******
               v_gsaldf = rf140-gsaldf + rf140-wrshb.
               rf140-gsaldf = v_gsaldf.
               clear v_gsaldf.
    SUNIL *********************
                 *rf140-gsaldf = *rf140-gsaldf + *rf140-wrshb.
                if  xmultk is initial
                and xactiv is initial
                and linecnt = '1'
                and not      xumsst is initial
                and not save_xumstn is initial.
                  if bkpf-bstat = 'V'.
                    perform read_vbset.
                  else.
                    perform read_bset.
                  endif.
                  describe table hbset lines linecnt.
                  if linecnt = '1'.
                    loop at hbset.
                      move-corresponding hbset to bset.
                       *bset = bset.
                      if bkpf-waers ne *bkpf-waers.
                        perform curr_document_convert_bset
                                    using
                                       bkpf-budat
                                       *bkpf-waers
                                       *bkpf-hwaer
                                       bkpf-waers
                                    changing
                                       bset.
                      endif.
                      clear rf140-msatz.
                      clear rf140-vtext.
                      save_ktosl = bset-ktosl.
                      perform read_t687t.
                      rf140-msatz = bset-kbetr / 10.
                       *rf140-msatz = rf140-msatz.
                      rf140-vtext = save_vtext.
                       *rf140-vtext = rf140-vtext.
                      if bset-shkzg = 'H'.
                        rf140-mwshb = bset-fwste.
                         *rf140-mwshb = *bset-fwste.
                        rf140-mdshb = bset-hwste.
                         *rf140-mdshb = *bset-hwste.
                      else.
                        rf140-mwshb = 0 - bset-fwste.
                         *rf140-mwshb = 0 - *bset-fwste.
                        rf140-mdshb = 0 - bset-hwste.
                         *rf140-mdshb = 0 - *bset-hwste.
                      endif.
                      exit.
                    endloop.
                    rf140-wrshb = rf140-wrshb - rf140-mwshb.
                     *rf140-wrshb = *rf140-wrshb - *rf140-mwshb.
                    rf140-dmshb = rf140-dmshb - rf140-mdshb.
                     *rf140-dmshb = *rf140-dmshb - *rf140-mdshb.
                  endif.
                endif.
    *****************Begin of Change by Karthikeyan J********************
                i_count = i_count + 1.
                clear rf140-element.
                clear: it_bseg, i_wrbtr,i_totday,i_tempday,i_day,i_bday.
    comparing with fields belnr AND SELECT * FROM INTITIT added by sunil 3.11.07*********
                select single * from bseg into
                corresponding fields of it_bseg where belnr = bseg-rebzg  anD GJAHR = BSEG-GJAHR.
                select single * from intitit into corresponding fields of  it_intitit where gjahr = bseg-gjahr and belnr_to = bseg-belnr and buzei = '2' OR BELNR = INTITIT-BELNR .
    added by Jayshree on 09/01/2007
                MOVE ' ' TO it_kna1-name1.
                SELECT SINGLE name1
                INTO CORRESPONDING FIELDS OF it_kna1
                FROM ( vbpa AS a INNER JOIN kna1 AS b ON akunnr = bkunnr )
                WHERE a~vbeln = it_bseg-vbeln
                  AND a~parvw = 'zd'.
                SELECT SINGLE fkdat
                INTO CORRESPONDING FIELDS OF it_kna1
                FROM vbrk
                WHERE vbrk~vbeln = it_bseg-vbeln.
    added by Jayshree on 01/02/2007
              CONCATENATE  it_kna1-fkdat6(2) it_kna1-fkdat4(2) it_kna1-fkdat+2(2)
                INTO vfkdat SEPARATED BY '.'.
              CONCATENATE  it_bseg-augdt6(2) it_bseg-augdt4(2) it_bseg-augdt+2(2)
                INTO vaugdt SEPARATED BY '.'.
                i_wrbtr = i_wrbtr + it_bseg-wrbtr.
    added as on 29.06.2007 by jayshree again transport  on 21.07.2007
                tot_wrbtr = tot_wrbtr + i_wrbtr.
                i_totday = it_bseg-zbd1t + it_bseg-zbd2t + it_bseg-zbd3t.
                CALL FUNCTION 'fima_date_create'
                  EXPORTING
                    i_date                        = it_bseg-zfbdt
                 I_FLG_END_OF_MONTH            = ' '
                 I_YEARS                       = 0
                 I_MONTHS                      = 0
                   i_days                        = i_totday
                 I_CALENDAR_DAYS               = 0
                 I_SET_LAST_DAY_OF_MONTH       = ' '
                 IMPORTING
                   e_date                        = i_bday
                 E_FLG_END_OF_MONTH            =
                 E_DAYS_OF_I_DATE              =
    added by JAYSHREE 01.02.2007
                CONCATENATE  i_bday6(2) i_bday4(2) i_bday+2(2)
                INTO vbday SEPARATED BY '.'.
                i_day = it_bseg-augdt - i_bday.
            CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
              EXPORTING
                date1                         = it_bseg-zfbdt
                date2                         = it_bseg-augdt
               OUTPUT_FORMAT                 = '01'
             IMPORTING
               YEARS                         =
               MONTHS                        =
               DAYS                          = i_day
             EXCEPTIONS
               INVALID_DATES_SPECIFIED       = 1
               OTHERS                        = 2
            IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ENDIF.
    *added by sunil 5.11.07 ***********
    *read table it_intitit with key BELNR_TO = BSEG-BELNR  .
    *LOOP AT IT_INTITIT.
                rf140-element = '521'.
                CALL FUNCTION 'write_form'
                  EXPORTING
                    window  = 'main'
                    element = '521'
                  EXCEPTIONS
                    window  = 1
                    element = 2.
                IF sy-subrc = 1.
                  window = 'main'.
                  PERFORM message_window.
                ENDIF.
                IF sy-subrc = 2.
                  window = 'main'.
                  ereignis = '521'.
                  PERFORM message_element.
                ENDIF.
                IF save_xumstn IS INITIAL.
    *-------Umsatzsteuer -
                  IF xactiv IS INITIAL.
                    save_waers = rf140-waers.
                    PERFORM tax_data.
                    CLEAR taxlines.
                    DESCRIBE TABLE atax LINES taxlines.
                    IF NOT taxlines IS INITIAL.
                      LOOP AT atax.
                        CLEAR ereignis.
                        CLEAR rf140-msatz.
                        CLEAR rf140-vtext.
                        rf140-msatz = atax-msatz.
                         *rf140-msatz = atax-msatz.
                        rf140-vtext = atax-vtext.
                         *rf140-vtext = atax-vtext.
    *******begin of change by karthikeyan on 10.03.06*********************
                        IF sy-tabix = '1'.
                          ereignis = '522'.
                          v_stax = rf140-msatz * rf140-gsaldf / 100.
                        ELSE.
                          ereignis = '523'.
                          v_ecs = rf140-msatz * v_stax / 100.
                          v_total = rf140-gsaldf + v_stax + v_ecs.
                        ENDIF.
                        CALL FUNCTION 'hr_in_chg_inr_wrds'
                          EXPORTING
                            amt_in_num               = v_total
                          IMPORTING
                            amt_in_words             = v_spell
                        EXCEPTIONS
                          DATA_TYPE_MISMATCH       = 1
                          OTHERS                   = 2
                        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                        ENDIF.
    ***************************end of change******************************
                        CLEAR rf140-element.
                        rf140-element = ereignis.
                        IF NOT ereignis IS INITIAL.
                          CALL FUNCTION 'write_form'
                            EXPORTING
                              window  = 'main'
                              element = ereignis
                            EXCEPTIONS
                              window  = 1
                              element = 2.
                          IF sy-subrc = 1.
                            window = 'main'.
                            PERFORM message_window.
                          ENDIF.
                          IF sy-subrc = 2.
                            window = 'main'.
                            PERFORM message_element.
                          ENDIF.
                        ENDIF.
                      ENDLOOP.
                    ENDIF.
                  ENDIF.
                ENDIF.
               ENDLOOP.
              ENDIF.
            ENDLOOP.
    '521' is the element name in the main  window where i should display the values. before select qurey the values are coming in the bseg but not in table INTITIT.  Belnr is the document no with ref to that
    there are number  of invoices nos. so in both the tables it is selecting single value and displaying but in bseg the invoice number is getting refreshed and new number is coming in that place i.e in field bseg-rebzg but in INTITIT  in belnr only it is taking single value it is not getting refreshed.
       move-corresponding hbseg to bseg.
                 *bseg = bseg.
                if bkpf-waers ne *bkpf-waers.
    this is the syntax whr the values in bseg are getting refresh and new invoice number is selecting.
    How to write the syntax for INTITIT? As per invoice number it is giving new values.
    The invoice number in Bseg is different campare to in table INTITIT. in output is shoud show the fields as follows
    it_besg-rebzg(invoice number of besg) it_besg-zuonr(invoice date) INTITIT-INT_BASAMT(base amount) i_day (no of days ) INTITIT-INT_BEGIN (INTREST START DATE) INTITIT-INT_end(INTREST END DATE)  rf140-wrshb(INTREST AMOUNT).
    THE VALUE OF IT_BESG-REBZG IS CHANGING  BUT THE VALUE IN INTITIT-BELNR ( INVOICE NUMBER) IS NOT CHANGING THAT IS WHY IT IS SHOWING
    ONLY SINGLE RECORD.
    for both the table documet no is same. in besg-belnr is the document no. in intitit-BELNR_TO is the document no.
    here in bseg-rebzg is chaning but in INTITIT-BELNR IS  not changing.
    If i take loop at INTITIT. ALL the values are repating so i am unable to take loop. so i want to write
    a syntax such that intitit-belnr should be refreshed and also for every loop it shoud take new invoice no.
    Please help me out it is very urgent.
    <b>USEFUL ANSWERS WILL BE REWARDED.</b>
    regards,
    Sunil kumar.

    assumption: some mistake in ur posting that, How belnr and date r same for both header records, so i guess, either one is different.
    try with AT NEW - ENDAT.
    AT NEW belnr.
    here use looping, READing of ur itabs.---> so, u need to build couple of itabs to move forth and back.
    ENDAT.
    pls. note that, when u use this AT NEW all the CHAR fileds of itab wuld show as STARS **.....so, this is the necessity behind building new itabs.
    thanq
    Edited by: SAP ABAPer on Dec 30, 2008 6:24 PM

  • How to print the Totals in SAP Scripts..?

    Hi,
    I have an SAP Script layout. Currently I am displaying the Line items in the layout. The new requirement has come up to display the TOTAL of the amount value in the layout at the end of the line items. Can someone tell me how to display the Sum of the Amount value at the end of the Line items in an SAP Script.
    The Print program for this layout is standard program. Can this be handled within the layout..? Someone please provide me some sample code if available.
    Thanks in advance.
    Best regards,
    Paddu.

    Hi,
    Thank you for your reply.
    My Standard print program doesn't provide the total value.  Could you please tell me where exactly we need to write the logic in the Layout. I mean, do we need to write under separate element..? and in the External subroutine, how would be the logic. It would be greatful if you provide some sample code.
    Thanks & Regards,
    Paddu.

  • Problem in printing the output of a script.

    dear friends,
    I have a script program which is running fine and the it has generated the desired output in one page on the screen. But when i am transfering the output to the printer the same output is splitting into 3 pages and special character is printing in begining and ending of every line. In the first page It is printing the special character, in the second it is printing the first line output and in the third page rest of the output.
    In my script i have only the main window. i want the script output to be printed only in one page on the printer . Please help me with your suggestions.

    Sravan,
    Check ur printer as sometimes it so happens that the printers act up and spoil output...

  • Sap script: Printing the values got from work area in a row

    Hi ,
    I need to print the values which I m getting from a work area like
    A1     A2
    A3     A4
    and so on
    but I m getting it as
    A1
    A2
    A3
    A4.
    Any solutions to this will be highly appreciated.
    Regards,
    Vivek

    Dear vivek,
    how is your work are structure - is it only with single field ?
    In your script after the each value give an extended line comman "=" which will take first and second values for print and after the second value give "line feed" or "carriage return"  command.
    Hope this solves your problem
    Thanks
    venugopal
    Reward accordingly

  • Printing text in back side of the page in sap script

    hi everybody,
      I had a problem on printing the terms and conditions of purchase order delivery in the back side of page in sapscript.
      plz help me by solving this,
      Thanks in advance
    sudheer

    HI,
    Welcome to SDN..
    Use DUPLEX mode in script form.
    <b>Goto Pages in Script and in Print Attributes try Print mode 'D'</b>
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/90/78f07e030211d399b90000e83dd9fc/frameset.htm
    http://solutions.brother.com/Library/pdf/SAP_install_latest.pdf
    Regards
    SAB

  • Problem in printing the JTable values

    Dear Friends,
    I have to print the JTable values (on paper using print dialogue box).
    I'm using jtableObj.print to print the table values. But jtableObj.print takes more time to print the table values because it prints the values as a image(approximately 5 mins to print 10 pages).
    My code is ,
    boolean complete = tableObj.print(mode, header, footer, showPrintDialog, null, interactive,
                                  null);Could anyone please tell me how to reduce the time?
    Thanks in advance

    Hi again,
    1. what problem are u facing ?
      (there is no sapscript symbol / system symbol
       for finding out the length )
      (In abap u can use strlen)
    2.  data and gets trimmed
       what is the meaning of it ?
    3. do u mean to say that  !
      ABCDEF                     123 45
      GEF                        123 45
      is getting pritned like
      ABCDEF 123 45  ?
      GEF  123 45
    4. If so , then use TABS
    5. This happens because SPACE
       is different in different varlues of
       ABCDEF and GEF !
    regards,
    amit m.
    Message was edited by: Amit Mittal

  • How to find the print program for a sap script

    Hey Experts,
    How to find the print program for a sap script (espicially when it is a custom script(Z*))?
    Thanks a ton,

    Thanx Vijay,
    Actually when I searched for the program in both the tables it didnt show up ther.
    But when I did check in the texts of script, I found it.
    Good job.
    Thanks all.
    Vijay, a small doubt.
    But why didn't it show up in those 2 tables when all the print programs for standard scripts show up usually?
    thnx once again.
    Message was edited by: dev a

  • How to get the last page  SAP Script form

    How to get the last page  SAP Script form.
    I want to print a specific information in the last page of SAP form (Script). Please tell me how to get the last page number.
    Regards

    Hi
    You have to check the system variable &NEXTPAGE&, if it's 0 it means you're in the last page.
    From SAP Help:
    This symbol is used to print the number of the following page. The output format is the same as with &PAGE& .
    Note that on the last page of the output, in each window that is not of type MAIN, &NEXTPAGE& has the value 0.
    /: IF &NEXTPAGE& = '0'
       Last page
    /: ENDIF
    Max

  • Pass value in SAP Script

    How can u pass value in SAP Script?& where?

    Hi,
    PASSING TABLE VALUES AS AN ARGUMENT TO SAPSCRIPT:
    In the line editor, specify the table field arguments enclosed by '&' symbol as follows:
    /E  ELEMENT
         &KNA1-KUNNR& ,, &KNA1-NAME1& ,, &KNA1-LAND1&
    Save -> Activate.
    In the Print Program, specify following code:
    TABLES KNA1.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
       FORM                              = 'ZSHABFORM1'
       LANGUAGE                          = SY-LANGU.
    SELECT * FROM KNA1.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'ELEMENT'
       WINDOW                         = 'MAIN'.
    ENDSELECT.
    CALL FUNCTION 'CLOSE_FORM'.
    Save -> Activate -> Execute.
    Regards,
    Priya.

  • How to print last page in sap script in ladscape format?

    Hi all,
    can any 1 tell me How to print last page in sap script in ladscape format?
    Thanks In advance.
    Pravin

    Hi Pravin Sherkar,
    we can do this in SAP Scripts.
    we need to create two pages, one of landscape and another of potrait.
    now after filling the data at last we need to call the page which is of format landscape using START_FORM  function module.
    You can use condition &PAGE& = &FORMPAGES&.
    Please check this link
    Printing Portrait/Landscape in sapscript
    Re: Landscape and potrait in same layout?
    http://www.sap-img.com/ts013.htm
    Best regards,
    raam

  • How to print Special Characters in Sap-Scripts

    How to print Special Characters in Sap-Scripts
    Thanks,
    Ravi

    Hi
    if u want print special characters we can use hot codes i.e '  '  (single inverted commas). in between these hot codes insert u r special characters.
    write    '    !@#$%^&*( )  '.
    for the above write statement output is
    output is   !@#$%^&*( )

  • How to print Vertical barcode in SAP script

    I want to print barcode related items in SAP script . can you plz tell me any one
    1.How to print vertical barcode in SAP script ?
    2.How to print vertical text in SAP script ?

    1.
    Create the character format in se71, in that select standard barcode. like
    Char.format: C1 Description: Barcode
    Barcode: BC_CD39 save the character format.
    you can select from the list.
    in the form coding, can you use barcode like
    <C1> program variablr <>.
    <C1> &itab-matnr <>.    "--->like this
    Then it shows the barcode in output.
    check this.
    2. for vertical text ..
    if this is a window text then its possible but
    like
    S
    H
    I
    P
    T
    O
    This is possible in giving the window name but in the layout i never tried this.
    If u can tell the scenario(with data reference) then may be i can try but not sure that this will give me hit.
    regards,
    vijay.

  • How to insert the style in sap-script? and in smart form?

    how to insert the style in sap-script? and in smart form?

    Hi..,
    For SAP scripts u need to create them in SE72 ...
    and u can include them in the script editor as..
    /: STYLE <STYLE-NAME>
    P1 text...............  (*** P1 is the Paragraph format created in SE72 )
    /: STYLE *
    For smartforms u need to go for the transaction (tcode) SMARTSTYLES... here u can create paragraph and character formats globally...
    <b>Sunil, plz do remember to close all your threads, when ur problem is solved !!</b>
    reward all helpful answers,
    sai ramesh

  • How to print different pages of sap script  from diff. trays of printer

    Hi All,
    I have the requirement in SAP script. How to print different pages from different trays in the printer.
    For example  page 1 logo and address has to print from tray-1,
                        page 2 main data print from tray-2,
                        page 3 footer data print from tray-3.
    will appreciate if u come up with solutions asap.
    Thanks in advance.

    Hi,
    May be the links given below might help you,
    SAPScript:Selecting Different Tray in SAPscript
    Print to different output tray in SAPscript/Print Workbench
    Regards,
    Hema.
    Reward points if it is useful.

Maybe you are looking for