Summing in sap script

all,
i am trying to sum the totals by page.. i cannot store the sum in a global variable..coz that only gives me net total(not by page)..tried using summing command..it's not working...any thoughts...appreciate ur help..
Regrads..
mob.

Hi
I think you have two possibility:
- To use command SUMMING:
/: SUMMING PROGRAM_SYMBOL INTO TOTAL_SYMBOL
The PROGRAM_SYMBOL is the global variable you want to sum, TOTAL_SYMBOL is a variable defined in the sapscript:
/: DEFINE TOTAL_SYMBOL = '0'.
You should try to define TOTAL_SYMBOL just once (for example in a window you use only once).
- To use a routine to sum:
/: PERFORM DO_SUM IN ZMYPROGRAM USING PROGRAM_SYMBOL
                                CHANGING TOTAL_SYMBOL.
Max

Similar Messages

  • Using Sum field in Sap script

    Hi all,
    I am trying to add content of field (Tax VAT) in sap script and put into another symbol using following command
    /:SUMMING program symbol INTO sum symbol
    but after running me22n tcode to display the PO error occured
    <b>Overwriting a protected field</b>Error analysis
        The program tried to assign a new value to the field "<SM_SUM>" even though
        it is protected against changes.
    I am modifying medruck std PO script and using standard prog. for it i.e. SAPFM06P.
    Please tell me wheather it is necessary to make sum symbol dynamically define in SAPFM06P and how to do this.
    with regards
    Rajvinder Sahni

    Hi...
    If you need to summ numbers or do any operation, in your SAP Script you can call subritunes and do all the operations you need.
    On your SAP script write:
    /: PERFORM subrutine IN PROGRAM Zprogram
    /: USING &PAR1&
    /: CHANGING &PAR2&
    /: ENDPERFORM
    PS: You can use as many USING AND CHANGING as you need.
    And the zprogram goes;
    FORM subrutine TABLES t_in STRUCTURE itcsy
    t_out STRUCTURE itcsy.
    data: par1 type n.
    Read the value on PAR1
    READ TABLE t_in WITH KEY 'PAR1'.
    CHECK sy-subrc = 0.
    PAR1 = t_IN-value.
    DO WHATEVER YOU NEED TO DO
    ADD 1 TO PAR1.
    SEND THE VALUES BACK
    READ TABLE t_OUT WITH KEY 'PAR2'.
    t_sal-value = PAR1 .
    MODIFY t_OUT INDEX sy-tabix.
    ENDFORM.
    Hope this helps,
    Gabriel

  • Calculation of values in a dunning form (SAP Script)

    Hi Experts!
    I want to add values to a sum (dunning-amount + dunning-fee + interest) in a dunning form (SAP Script; Z150_DUNN_02).Therefore I'm using a subroutine (Z_FI_KX_DUNN_02_INTEREST) to summarize. Problem is the format of the output-field &Z_FAEBT&. It's not similar to field &MHNK-FAEBT& which was formerly printed (without calculation of interest and dunning-fees.
    /:   DEFINE &Z_FAEHW& := &MHNK-FAEHW&                 
    /:   DEFINE &Z_ZINHW& := &MHNK-ZINHW&                 
    /:   DEFINE &Z_MHNGH& := &MHNK-MHNGH&                 
    /:   DEFINE &Z_FAEBT& := &MHNK-FAEBT&                 
    /:   PERFORM ZFAEBT IN PROGRAM Z_FI_KX_DUNN_02_INTEREST
    /:   USING &Z_FAEHW&                                  
    /:   USING &Z_ZINHW&                                  
    /:   USING &Z_MHNGH&                                  
    /:   CHANGING &Z_FAEBT&                               
    /:   ENDPERFORM                                       
    /:   ENDIF                                            
    A3   &MHNK-WAERS& &Z_FAEBT(C)&       
    It would be fine to get a hint how to format the field &Z_FAEBT& correctly. Must be done in the subroutine Z_FI_KX_DUNN_02_INTEREST by a special WRITE-command? Is it possible to add these values only in the form?
    Thanks for support!
    Regards, Bernd

    hi!
    I defined the field like you said! After moving this field to a numeric field to add the different amounts the
    following error occurred:
    Runtime errors         CONVT_NO_NUMBER           
    Exception              CX_SY_CONVERSION_NO_NUMBER
    Occurred on     16.06.2009 at   15:15:25  
    Unable to interpret " 1.316,59" as a number.     
    Definition:
    FORM zfaebt TABLES in_par STRUCTURE itcsy
                       out_par STRUCTURE itcsy.
      TABLES: mhnk.
      DATA: z_faehw_num LIKE mhnk-faehw,
            z_zinhw_num LIKE mhnk-zinhw,
            z_mhngh_num LIKE mhnk-mhngh,
            z_faebt_num LIKE mhnk-faebt.
      DATA: z_faehw TYPE string,
            z_zinhw TYPE string,
            z_mhngh TYPE string,
            z_faebt TYPE string.
    statement:
      READ TABLE in_par WITH KEY 'Z_FAEHW'.
      CHECK sy-subrc = 0.
      z_faehw = in_par-value.
      z_faehw_num = z_faehw.
    I suppose a type-conflict.
    Regard, Bernd

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

  • How to display the number of line items in sap-script report?

    Hi friends,
    I need a help regarding the SAP Script. In my script (report) I create two pages and created three windows (MAIN, HEADER, FOOTER) for each pages. Now the problem is while displaying the fewer line item which can come under the main window of the 1st page these line items are comming perfectly but for the remaining line items that comes on the second page the table headings and the boexs are not comming.
    Also it is displaying the total and the amount in text in every pages that should be display in last page.
    Here if I eleminate or comments the total and the amount in text for the first page the same is reflected in second page. Also I need to display the page-nor for each pages to displayed.
    I am requesting all the people out there kindly help me to solve this issues.
    Thanks and Regards

    There is no pre built solution for this. But we can show total pages in the report body.
    one way is Create a other column in the report with code sum(count(1))/25. that gives you total number of pages. 25 here is no of rows in each page. The code you can write in narrative "Total pages in the report are @5" and out put may be "Total Pages in the report are 30".
    If you are using pivot tables, you can try this.
    http://oraclebizint.wordpress.com/2008/01/17/oracle-bi-101332-pagination-in-pivot-tables/
    - Madan

  • How can i update regup-sgtxt field in sap script

    Hi experts,
    I have created sap script for payment print prog. In that one field is amount discription "REGUP-SGTXT". i want to use field "REGUP-SGTXT" as a discription. for sap script payment print i use T-Code f-43, fb03,f-58... now in whic T-code i fiiled the value of "REGUP-SGTXT"?? how can i update value in my sap script?? cause i ceateed so many doc no but "REGUP-SGTXT" its blank... so how can i fill this fiels???
    Give me suggetion
    Zenithi

    Hi
    Most of the times this text won't get populated
    So better write an external PERFORM subroutine in the SCRIPT and fetch it from BSEG/BKPF tables using BELNR field and use in the cheque printing.
    see the sample code for subroutines
    How to call a subroutine form SAPscripts
    The Form :
    /:PERFORM CDE_CENT IN PROGRAM ZKRPMM_PERFORM_Z1MEDRUCK
    /:USING &EKKO-EBELN&
    /:CHANGING &CDECENT&
    /:ENDPERFORM
    The report :
    REPORT zkrpmm_perform_z1medruck .
    DATA : BEGIN OF it_input_table OCCURS 10.
    INCLUDE STRUCTURE itcsy.
    DATA : END OF it_input_table.
    déclaration de la table output_table contenant les
    variables exportées
    DATA : BEGIN OF it_output_table OCCURS 0.
    INCLUDE STRUCTURE itcsy.
    DATA : END OF it_output_table.
    DATA : w_ebeln LIKE ekko-ebeln,
    w_vbeln LIKE vbak-vbeln,
    w_zcdffa LIKE vbak-zcdffa.
    FORM CDE_CENT
    FORM cde_cent TABLES input output.
    it_input_table[] = input[].
    it_output_table[] = output[].
    READ TABLE it_input_table INDEX 1.
    MOVE it_input_table-value TO w_ebeln.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = w_ebeln
    IMPORTING
    output = w_ebeln.
    SELECT SINGLE zcdffa FROM ekko
    INTO w_zcdffa
    WHERE ebeln = w_ebeln.
    it_output_table-name = 'CDECENT'.
    MOVE w_zcdffa TO it_output_table-value.
    MODIFY it_output_table INDEX 1.
    output[] = it_output_table[].
    ENDFORM.
    /: PERFORM
    /: USING &INVAR1&
    /: USING &INVAR2&
    /: CHANGING &OUTVAR1&
    /: CHANGING &OUTVAR2&
    /: ENDPERFORM
    INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.
    OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.
    Example:
    In script form
    /: PERFORM READ_TEXTS IN PROGRAM 'Z08M1_FORM_EKFORM1'
    /: USING &EKKO-EKORG&
    /: USING &EKPO-WERKS&
    /: USING &EKKO-EKGRP&
    /: USING &EKKO-BSTYP&
    /: CHANGING &COMPNAME&
    /: CHANGING &SENDADR&
    /: CHANGING &INVCADR&
    /: CHANGING &COMPADR&
    /: CHANGING &COVERLTR&
    /: CHANGING &SHIPADR&
    /: CHANGING &REMINDER&
    /: CHANGING &REJECTION&
    /: CHANGING &POSTADR&
    /: CHANGING &LOGO&
    /: ENDPERFORM
    In program
    FORM Read_texts - To extract the standard texts from the table *
    FORM READ_TEXTS TABLES IN_PAR STRUCTURE ITCSY
    OUT_PAR STRUCTURE ITCSY.
    DATA : L_EKORG TYPE EKORG,
    L_WERKS TYPE WERKS_D,
    L_BSTYP TYPE BSTYP,
    L_EKGRP TYPE BKGRP.
    READ TABLE IN_PAR WITH KEY 'EKKO-EKORG' .
    CHECK SY-SUBRC = 0.
    L_EKORG = IN_PAR-VALUE.
    READ TABLE IN_PAR WITH KEY 'EKPO-WERKS' .
    CHECK SY-SUBRC = 0.
    L_WERKS = IN_PAR-VALUE.
    READ TABLE IN_PAR WITH KEY 'EKKO-EKGRP' .
    CHECK SY-SUBRC = 0.
    L_EKGRP = IN_PAR-VALUE.
    READ TABLE IN_PAR WITH KEY 'EKKO-BSTYP' .
    CHECK SY-SUBRC = 0.
    L_BSTYP = IN_PAR-VALUE.
    CLEAR Z08M1_ORG_TEXTS.
    SELECT SINGLE * FROM Z08M1_ORG_TEXTS WHERE EKORG = L_EKORG
    AND WERKS = L_WERKS
    AND EKGRP = L_EKGRP
    AND BSTYP = L_BSTYP.
    IF SY-SUBRC NE 0.
    SELECT SINGLE * FROM Z08M1_ORG_TEXTS WHERE EKORG = L_EKORG
    AND WERKS = L_WERKS
    AND EKGRP = L_EKGRP
    AND BSTYP = SPACE.
    ENDIF.
    READ TABLE OUT_PAR WITH KEY 'COMPNAME'.
    OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_COMP.
    MODIFY OUT_PAR INDEX SY-TABIX.
    READ TABLE OUT_PAR WITH KEY 'SENDADR'.
    OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_ADRS.
    MODIFY OUT_PAR INDEX SY-TABIX.
    READ TABLE OUT_PAR WITH KEY 'INVCADR'.
    OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_INVC.
    MODIFY OUT_PAR INDEX SY-TABIX.
    READ TABLE OUT_PAR WITH KEY 'COMPADR'.
    OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_CPAD.
    MODIFY OUT_PAR INDEX SY-TABIX.
    READ TABLE OUT_PAR WITH KEY 'COVERLTR'.
    OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_COVR.
    MODIFY OUT_PAR INDEX SY-TABIX.
    READ TABLE OUT_PAR WITH KEY 'SHIPADR'.
    OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_SHIP.
    MODIFY OUT_PAR INDEX SY-TABIX.
    READ TABLE OUT_PAR WITH KEY 'REMINDER'.
    OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_RMDR.
    MODIFY OUT_PAR INDEX SY-TABIX.
    READ TABLE OUT_PAR WITH KEY 'REJECTION'.
    OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_RJCT.
    MODIFY OUT_PAR INDEX SY-TABIX.
    READ TABLE OUT_PAR WITH KEY 'POSTADR'.
    OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_POST.
    MODIFY OUT_PAR INDEX SY-TABIX.
    READ TABLE OUT_PAR WITH KEY 'LOGO'.
    OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_LOGO.
    MODIFY OUT_PAR INDEX SY-TABIX.
    ENDFORM.
    REPORT ZMPO1 .
    form get_freight tables in_par structure itcsy out_par structure itcsy.
    tables: ekko,konv,t685t.
    data: begin of itab occurs 0,
             ebeln like ekko-ebeln,
             knumv like ekko-knumv,
           end of itab.
    data: begin of itab1 occurs 0,
             knumv like konv-knumv,
             kposn like konv-kposn,
             kschl like konv-kschl,
             kbetr like konv-kbetr,
             waers like konv-waers,
             kwert like konv-kwert,
           end of itab1.
    data: begin of iout occurs 0,
             kschl like konv-kschl,
             vtext like t685t-vtext,
             kbetr like konv-kbetr,
             kwert like konv-kwert,
           end of iout.
    data v_po like ekko-ebeln.
    read table in_par with key 'EKKO-EBELN'.
    if sy-subrc = 0.
       v_po = in_par-value.
       select
         ebeln
         knumv
      from ekko
      into table itab
      where ebeln = v_po.
      if sy-subrc = 0.
        loop at itab.
          select
            knumv
            kposn
            kschl
            kbetr
            waers
            kwert
          into table itab1
          from konv
          where knumv = itab-knumv and
                kappl = 'M'.
        endloop.
        loop at itab1.
          if itab1-kposn <> 0.
            select single * from t685t
                              where kschl = itab1-kschl
                                and kappl = 'M'
                                and spras = 'EN'.
            iout-vtext = t685t-vtext.
            iout-kschl = itab1-kschl.
            iout-kbetr = itab1-kbetr.
            iout-kwert = itab1-kwert.
            append iout.
            clear iout.
          endif.
        endloop.
        sort itab1 by kposn.
        loop at iout.
          sort iout by kschl.
          if ( iout-kschl eq 'GSDC' OR
               iout-kschl eq 'GSFR' OR
               iout-kschl eq 'GSIR' ).
            at end of kschl.
              read table iout index sy-tabix.
              sum.
             write:/ iout-kschl,iout-vtext,iout-kwert.
          out_par-name = 'A1'.
          out_par-value = iout-vtext.
          append out_par.
          out_par-name = 'A2'.
          out_par-value = iout-kwert.
          append out_par.
              endat.
            endif.
          endloop.
        endif.
      endif.
    endform.
    IN THE FORM I AM WRITING THIS CODE.
    /:DEFINE &A1& = ' '
    /:DEFINE &A2& = ' '
    /:PERFORM GET_FREIGHT IN PROGRAM ZMFORM_PO1
    /:USING &EKKO-EBELN&
    /:CHANGING &A1&
    /:CHANGING &A2&
    /:ENDPERFORM
    &A1&
    &A2&
    This Code is to be written in the PO form under ADDRESS window.
    /:DEFINE &A1& = ' '
    /:DEFINE &A2& = ' '
    /:DEFINE &A3& = ' '
    /:DEFINE &A4& = ' '
    /:DEFINE &A5& = ' '
    /:DEFINE &A6& = ' '
    /:PERFORM GET_VENDOR IN PROGRAM ZMFORM_PO
    /:USING &EKKO-EBELN&
    /:CHANGING &A1&
    /:CHANGING &A2&
    /:CHANGING &A3&
    /:CHANGING &A4&
    /:CHANGING &A5&
    /:CHANGING &A6&
    /:ENDPERFORM
    &A1&
    &A2&
    &A3&
    &A4&
    &A5&
    &A6&
    Regards
    Anji

  • PO changes in SAP Script

    Hi,
    I'm using standard program for my Purchase Order calculation in SAP Script in 4.6B. this is the stucture of my program
    ZIND_MM_PO(main Program) => INCLUDE ZFM06PE02_IND(one of the includes) =>Form entry_neu(one of the forms inside the include)=>Z_ME_PRINTPO(one of the function modules  inside the form) =>vt_atotal(one of the varables used for total calculation inside the FM)
    i need to print the vt_atotal variable in my PO(which is the sum of all tax values which is calculated based on some condition types).
    i've tried taking out  the variable by assigning it in the export variable.
    and in the editor screen of the script i've calle the particular perform Form entry_neu using the variable vt_atotal.
    I'm not getting the value.....
    the problem is... it is having the value inside the function module but not bringing it outside...
    is there any other way to print the variables in my PO output?
    thanks in advance
    Jegadesh

    Hi
    It appears that you have copied the STd driver program of SAP SAPMF06P into Zprogram and you are using
    Have you attached the std one in NACE tcode for the Output type NEU  against the form ZMEDRUCK (Copy of MEDRUCK) correctly.
    I think you are not using external subrotuine PERFORM in the script?
    If you wrote the code correctly for the Total it will come into script
    Check where the data of that code is coming into script? I mean in which TEXT ELEMENT is triggering for that code
    you have to write under that TEXT ELEMENT only in script.
    Regards
    Anji

  • PO Print SAP scripts:Grand total field -- High priority

    Hi experts
    In a PO print out, For example in one line item ,I have conditions printed as below
    Line iem 1.
    Gross price -- 1000
    VAT% 40
    Service Tax -
    123.36
    Net. Incl. Disc. 1163.36
    Line iem 2.
    Gross price -- 500
    VAT% 20
    Service Tax -
    61.8
    Net. Incl. Disc. 581.8
    Grand total----
    1500
    (desired tgrand total 1163.36+581.8)
    I have many line items like this and the total of all conditions at individual line item printed is correct.
    But at the bottom of the PO print, in the "Grand Total" the sum of only the Gross values is printed (Not the total of the Net. Incl. vlaues of line items).
    I got info from our developer that we are using SAP scripts (not smart forms).
    Please guide me if anyone has come accros a issue like this and got the answer. This is urgent.
    Thank you
    MRao

    To calculate grand totals and sub totals in sap scripts you have to use subroutines.
    Say if you have to add the unit price (KOMVD-KBERT) then in the main window where ever that value is picked write this routine
    /: DEFINE &TOT_PRICE&
    /: PERFORM F_GET_PRICE IN PROGRAM <subroutine prog name>
    /:USING &KOMVD-KBERT&
    /:CHANGING &TOT_PRICE&
    /:ENDPERFORM
    Then write the variable where ever you want it to be printed (mostly grant total will be in footer window)
    Then create subroutine pool program and you have to write the following code.
    FORM F_GET_PRICE tables int_cond structure itcsy
                                               outt_cond structure itcsy.
    data : value type kbert.
    statics   value1 type kbert.
    Read int_cond table index 1.
    value = int_cond-value.
    value1 = value1 + value.
    Read outt_cond table index 1.
    outt_cond-value = value1.
    Modify outt_cond index 1.
    ENDFORM.
    I have given a rough example,
    Note:Int_cond-value and outt_cond-value are characters.
    Close the thread once your question is answered.
    Regards,
    SaiRam

  • PO for item of service Level short and long text using sap script

    Please let me know how to do the PO for item of service Level short and long text using sap script.
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on May 5, 2009 10:25 AM

    Hi ,
          In the transaction related to PO select the path goto->header texts and then details of the texts like ID,objectname,language,name.Pass all theses details to 'READ_TEXT '   FM. Then you will get text lines described for a perticular Po ,similarly for item also.
    Thanks,
    Suma.

  • Regarding summing statement in scripts

    Hi,
    please give one small example code for SUMMING statement in SAP Scripts.
    Thanks,
    Srinivas

    Hi,
    /:SUMMING &NETPR& INTO V_TOTAL
    loop
      write form for main window
    endloop.
    For every time(loop pass) the value will be added to v_total ,this will be defined in script.
    Regards,
    Ferry Lianto

  • Summing command in script

    hi experts,
         anybody knows how to use summing command in script.
    pl explain with an example.
    Thanks!
    Edited by: Ranganayahi Chandirasekaran on Mar 6, 2008 12:58 PM

    Hi Chandirasekaran,
    Try the following link,
    Link: [http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb3d07455611d189710000e8322d00/frameset.htm]
    Reward if helpful.

  • PO to PDF Local fileUsing Sap Script

    Hi Exports
    I am trying new report po(sapscript) to pdf conversion in local system any sample code available
    Thanks and regards
    Suresh

    Hi
    Thanks for your Reply
    In the following code how will change
    *& SUBROUTINE-POOL ZPORDER                                             *
    INCLUDE fm06ptop.
    TABLES: t001,adrc,kna1,lfa1,vbak,t005t,stxl,resb,makt,t685t,A053,T685.
    DATA: t_xekkn LIKE ekkn OCCURS 0 WITH HEADER LINE,
          t_xeket LIKE eket OCCURS 0 WITH HEADER LINE,
          t_xekpo LIKE ekpo OCCURS 0 WITH HEADER LINE,
          t_xkomv LIKE komv OCCURS 0 WITH HEADER LINE,
          ctxt LIKE tline OCCURS 0 WITH HEADER LINE,
          count TYPE i VALUE 0,
          t_netwr TYPE ekkn-netwr,
          werks like ekpo-werks,
          t_totqty TYPE ekkn-menge,
          qtytot type p decimals 3,
          amttot type p decimals 2,
          nettotal type p decimals 2,
          t_itemdate(8) TYPE c,
          w_ex(1),
          t_itemdate1(8) TYPE c,
          spstyp like ekpo-pstyp,
          sknttp like ekpo-knttp,
          KSCHL  LIKE A053-KSCHL,
          price  like ekko-ebeln,
          PO LIKE ekko-ebeln,
          ICT TYPE N.
    DATA tdname LIKE stxl-tdname.
    data: ORDNO like vbkd-bstkd.
    DATA :BEGIN OF v_term OCCURS 0,
           content(20),
          END OF v_term.
    DATA :printtype(10) TYPE c.
       MOVE-CORRESPONDING t_xekpo TO icond.
       APPEND icond.
    FORM entry_neu USING ent_retco ent_screen.
      DATA: l_druvo LIKE t166k-druvo,
            l_nast  LIKE nast,
            l_from_memory,
            l_doc   TYPE meein_purchase_doc_print.
      CLEAR ent_retco.
      printtype = nast-kschl.
      IF nast-aende EQ space.
        l_druvo = '1'.
      ELSE.
        l_druvo = '2'.
      ENDIF.
      CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
        EXPORTING
          ix_nast        = nast
          ix_screen      = ent_screen
        IMPORTING
          ex_retco       = ent_retco
          ex_nast        = l_nast
          doc            = l_doc
        CHANGING
          cx_druvo       = l_druvo
          cx_from_memory = l_from_memory.
    PERFORM val_chk USING l_doc.
    select sum( netwr ) into amttot from ekpo
      where ebeln eq l_doc-xekko-ebeln and loekz eq ' '.
    endselect.
    SELECT  single rlwrt INTO l_doc-xekko-rlwrt from ekko where EBELN  eq nast-OBJKY.
    price = amttot.
      IF l_doc-xekko-frgke EQ 'R' OR PRICE EQ 0.
        PERFORM display_sscript USING l_doc.
      ELSE.
    if sy-ucomm EQ 'PRNT'  .
        MESSAGE ID '8E' TYPE 'E' NUMBER '000'
                   WITH 'P.O has not been released'.
      ENDIF.
    endif.
    ENDFORM.                    "entry_neu
    &      Form  DISPLAY_SSCRIPT                                         &
    &      Display SAP Script                                            &
    FORM display_sscript USING l_doc.
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          device   = 'PRINTER'
          dialog   = 'X'
          form     = 'ZPORDER_FORM'
          language = sy-langu
        EXCEPTIONS
          canceled = 1
          device   = 2
          form     = 3
          options  = 4
          unclosed = 5
          OTHERS   = 11.
      PERFORM header_disp USING l_doc.
      PERFORM main_disp USING l_doc.
      CALL FUNCTION 'CLOSE_FORM'
        EXCEPTIONS
          unopened = 1
          OTHERS   = 5.
    ENDFORM.                    " DISPLAY_SSCRIPT
    &      Form  HEADER_DISP                                             &
    &      CHECKING Header Part                                           &
    FORM val_chk USING l_doc TYPE meein_purchase_doc_print .
           PO = l_doc-xekko-ebeln.
    ENDFORM.
    &      Form  HEADER_DISP                                             &
    &      Display Header Part                                           &
    FORM header_disp USING l_doc TYPE meein_purchase_doc_print .
      DATA : cst(30),
             tngst(30).
    CLEAR : ICT.
    *ADDRESS
      SELECT SINGLE adrnr INTO (t001-adrnr) FROM t001
                          WHERE bukrs EQ l_doc-xekko-bukrs.
    *<--Modified by Bala Manikandan--
    >
      SELECT SINGLE name1 street city1 post_code1 country
                    tel_number fax_number str_suppl1 str_suppl2
                    INTO (adrc-name1,adrc-street,adrc-city1,
                    adrc-post_code1,adrc-country,adrc-tel_number,
                    adrc-fax_number,adrc-str_suppl1,adrc-str_suppl2)
                    FROM adrc WHERE addrnumber EQ t001-adrnr.
    *VENDOR
      SELECT SINGLE anred name1 stras ort01 ort02 pstlz land1
      INTO (lfa1-anred,lfa1-name1,lfa1-stras,lfa1-ort01,lfa1-ort02,
            lfa1-pstlz,lfa1-land1)
            FROM lfa1 WHERE lifnr EQ l_doc-xekko-lifnr.
      SELECT SINGLE landx FROM t005t INTO t005t-landx
                                     WHERE land1 EQ lfa1-land1 AND
                                           spras EQ 'EN'.
      PERFORM set_text_symbol USING:
                      '&ADRC-NAME1&'         adrc-name1,
                      '&ADRC-STR_SUPPL1&'    adrc-str_suppl1,
                      '&ADRC-STR_SUPPL2&'    adrc-str_suppl2,
                      '&ADRC-STREET&'        adrc-street,
                      '&ADRC-CITY&'          adrc-city1,
                      '&ADRC-POST_CODE1&'    adrc-post_code1,
                      '&ADRC-COUNTRY&'       adrc-country,
                      '&ADRC-TEL_NUMBER&'    adrc-tel_number,
                      '&ADRC-FAX_NUMBER&'    adrc-fax_number,
                      '&LFA1-NAME1&'         lfa1-name1,
                      '&LFA1-ANRED&'         lfa1-anred,
                      '&LFA1-STRAS&'         lfa1-stras,
                      '&LFA1-ORT01&'         lfa1-ort01,
                      '&LFA1-ORT02&'         lfa1-ort02,
                      '&LFA1-PSTLZ&'         lfa1-pstlz,
                      '&t005t-landx&'        t005t-landx,
                      '&LFA1-NAME1&'         lfa1-name1,
                      '&L_DOC-XEKKO-EBELN&'  l_doc-xekko-ebeln,
                      '&L_DOC-XEKKO-AEDAT&'  l_doc-xekko-aedat,
                      '&L_DOC-XEKKO-BEDAT&'  l_doc-xekko-bedat.
    select single werks into werks from ekpo
      where ebeln eq l_doc-xekko-ebeln.
    perform set_text_symbol using:
          '&werks&'  werks.
      IF l_doc-xekko-bukrs EQ 'JKCH'.
        cst   = '611805'.
        tngst = '2500907'.
      ENDIF.
      PERFORM set_text_symbol USING:
                      '&CST&' cst,
                      '&TNGST&' tngst.
    CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'PDF'
          function  = 'SET'
          window    = 'PDF'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'TITLE'
          function  = 'SET'
          window    = 'TITLE'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'FMNO'
          function  = 'SET'
          window    = 'FMNO'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'LOGO'
          function  = 'SET'
          window    = 'LOGO'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'VENDOR'
          function  = 'SET'
          window    = 'VENDOR'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'ITEM_HEADER'
          function  = 'SET'
          window    = 'HITEM'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'FOOTER1'
          function  = 'SET'
          window    = 'WINDOW1'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'FOOTER2'
          function  = 'SET'
          window    = 'WINDOW2'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      select single pstyp knttp into (spstyp, sknttp)
        from ekpo where ebeln eq l_doc-xekko-ebeln.
      PERFORM set_text_symbol USING:
                      '&pstyp&' spstyp,
                      '&knttp&' sknttp.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'PORDER'
          function  = 'SET'
          window    = 'WINDOW4'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
    ENDFORM.                    " HEADER_DISP
    &      Form  MAIN_DISP                                               &
    &      Main window Display                                           &
    FORM  main_disp USING l_doc TYPE meein_purchase_doc_print .
      DATA: BEGIN OF zekpo,
              matnr LIKE ekpo-matnr,
              meins LIKE ekpo-meins,
              menge LIKE ekpo-menge,
              netwr LIKE ekpo-netwr,
              brtwr LIKE ekpo-brtwr,
              netpr LIKE ekpo-netpr,
              txz01 LIKE ekpo-txz01,
              vbeln LIKE ekkn-vbeln,
              vbelp LIKE ekkn-vbelp,
              eindt LIKE eket-eindt,
              ebeln LIKE ekpo-ebeln,
              ebelp LIKE ekpo-ebelp,
              mwskz LIKE ekpo-mwskz,
              Txjcd like ekpo-Txjcd,
              charg LIKE eket-charg,
              pstyp LIKE ekpo-pstyp,
              LOEKZ LIKE ekpo-LOEKZ,
              lgort like ekpo-lgort,
            END OF zekpo.
      DATA : po_tot LIKE komv-kwert,
             item_tot LIKE komv-kwert,
             item_price LIKE komv-kwert,
             freight LIKE komv-kwert,
             posnr(4),
             comp TYPE i,
             t1_ekpo LIKE zekpo OCCURS 0 WITH HEADER LINE,
             t2_ekpo LIKE zekpo OCCURS 0 WITH HEADER LINE,
             itab_comp LIKE zekpo OCCURS 0 WITH HEADER LINE,
             t3_ekpo LIKE zekpo OCCURS 0 WITH HEADER LINE,
             totpr1 type p decimals 2,
             totpr2 type p decimals 3,
             netpr1 type p decimals 2,
             netpr2 type p decimals 3,
             amttot1 type p decimals 2,
             amttot2 type p decimals 3,
             amttot3 type p decimals 2,
             v_amountno(20) type c,
             decim type p.
      SELECT * FROM eket INTO CORRESPONDING FIELDS OF TABLE
                        l_doc-xeket WHERE ebeln EQ l_doc-xekko-ebeln.
      SELECT SINGLE waers rlwrt FROM ekko INTO (l_doc-xekko-waers,
                 l_doc-xekko-rlwrt) WHERE ebeln EQ l_doc-xekko-ebeln.
      select sum( menge ) into qtytot from ekpo
      where ebeln eq l_doc-xekko-ebeln and loekz eq ' '.
      select sum( netwr ) into amttot from ekpo
      where ebeln eq l_doc-xekko-ebeln and loekz eq ' '.
    select sum( effwr ) into amttot from ekpo
    where ebeln eq l_doc-xekko-ebeln and loekz eq ' '.
      LOOP AT l_doc-xekpo INTO t_xekpo WHERE LOEKZ EQ SPACE.
        CLEAR t_xekkn.
        READ TABLE l_doc-xekkn WITH KEY ebeln = t_xekpo-ebeln
                                        ebelp = t_xekpo-ebelp
             INTO t_xekkn.
        SELECT SINGLE kunnr INTO vbak-kunnr FROM vbak
                                    WHERE vbeln EQ t_xekkn-vbeln.
        SELECT SINGLE name1 INTO kna1-name1 FROM kna1
                                    WHERE kunnr EQ vbak-kunnr.
       clear t_xeket.
        READ TABLE l_doc-xeket WITH KEY ebeln = t_xekpo-ebeln
                                        ebelp = t_xekpo-ebelp
                                        etenr = 1
                   INTO t_xeket.
        CLEAR: item_price, item_tot,po_tot.
    Add the for SUM of the mat depends on the sale order and del date.
        MOVE-CORRESPONDING t_xekpo TO t1_ekpo.
        t1_ekpo-vbeln = t_xekkn-vbeln.
        t1_ekpo-eindt = t_xeket-eindt.
        t1_ekpo-vbelp = t_xekkn-vbelp.
        t1_ekpo-charg = t_xeket-charg.
        APPEND t1_ekpo.
      ENDLOOP.
      select single bstkd into ordno from vbkd where vbeln = t1_ekpo-vbeln.
    amttot = t_xekpo-effwr.
      LOOP AT t1_ekpo  WHERE LOEKZ EQ SPACE..
        MOVE-CORRESPONDING t1_ekpo TO t2_ekpo.
        APPEND t2_ekpo.
        MOVE-CORRESPONDING t1_ekpo TO itab_comp.
        APPEND itab_comp.
        item_price = t1_ekpo-brtwr / t1_ekpo-menge.
      For decimal place check
        select single currdec into decim from tcurx
          where currkey = l_doc-xekko-waers.
          if decim = 3.
            netpr2 = item_price / 10.
            totpr2 = t1_ekpo-brtwr / 10.
            amttot2 = amttot / 10.
          elseif decim = 2.
            netpr1 = item_price.
            totpr1 = t1_ekpo-brtwr.
            amttot1 = amttot.
          else.
            netpr1 = item_price.
            totpr1 = t1_ekpo-brtwr.
            amttot1 = amttot.
          endif.
        amttot3 = amttot1.
        posnr = t3_ekpo-vbelp+2(4).
        WRITE t3_ekpo-eindt TO t_itemdate DD/MM/YY.
        DATA: Yebelp LIKE  t1_ekpo-ebelp.
        Yebelp = t1_ekpo-ebelp / 10 .
        PERFORM set_text_symbol USING:
               '&T_XEKET-CHARG&'   t1_ekpo-charg, "t1_ekpo-eindt,
               '&DELDT&'           t_itemdate,
               '&VBAK-VBELN&'      t1_ekpo-vbeln,
               '&VBAK-VBELP&'      posnr,
               '&VBAK-KUNNR1&'     kna1-name1,
               '&T_XEKPO-TXZ01&'   t1_ekpo-txz01(34),
               '&T_XEKPO-MATNR&'   t1_ekpo-matnr,
               '&T_XEKPO-MENGE&'   t1_ekpo-menge,
               '&T_XEKPO-MEINS&'   t1_ekpo-meins,
               '&L_DOC-XEKKO-WAERS&' l_doc-xekko-waers,
               '&T_XEKPO-NETPR&'   t1_ekpo-netpr,
               '&T_XEKPO-NETWR&'   t1_ekpo-netwr,
               '&RATE&'            item_price,
               '&T_XEKPO-BRTWR&'   t1_ekpo-brtwr,
               '&T_XEKPO-EBELP1&'  Yebelp ,
               '&T_XEKET-EINDT&'   t1_ekpo-eindt,
               '&ordno&'           ordno,
               '&LGORT&'           t1_ekpo-lgort,
               '&ekkn-gsber&'      t_xekkn-gsber,
               '&decim&'           decim,
               '&netpr1&'          netpr1,
               '&netpr2&'          netpr2,
               '&amttot1&'         amttot1,
               '&amttot2&'         amttot2,
               '&totpr1&'          totpr1,
               '&totpr2&'          totpr2.
                  '&CNT&' count.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element  = 'ITEM_LINE'
            function = 'APPEND'
            window   = 'MAIN'
          EXCEPTIONS
            OTHERS   = 7.
      if t1_ekpo-lgort = 'RT01'.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element   = 'REVNO'
            function  = 'SET'
            window    = 'REVNO'
          EXCEPTIONS
            OTHERS    = 7.
      endif.
        IF sy-subrc EQ 0.
          count = count + 2.
        ENDIF.
        CONCATENATE t1_ekpo-ebeln  t1_ekpo-ebelp INTO tdname.
        SELECT SINGLE * FROM stxl WHERE relid EQ 'TX' AND
                                            tdobject EQ 'EKPO' AND
                                            tdname EQ tdname AND
                                            tdid EQ 'F01' AND
                                            tdspras EQ 'EN'.
        IF sy-subrc EQ 0.
          CALL FUNCTION 'READ_TEXT'
            EXPORTING
              client   = sy-mandt
              id       = stxl-tdid
              language = stxl-tdspras
              name     = stxl-tdname
              object   = stxl-tdobject
            TABLES
              lines    = ctxt
            EXCEPTIONS
              OTHERS   = 8.
          IF sy-subrc EQ 0.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_TEXT_HEAD'.
            LOOP AT ctxt.
              IF ( ctxt-tdline IS NOT INITIAL ).
                PERFORM set_text_symbol USING: '&TEXT_LINE1&' ctxt-tdline.
                CALL FUNCTION 'WRITE_FORM'
                  EXPORTING
                    element  = 'ITEM_TEXT'
                    function = 'APPEND'
                    window   = 'MAIN'
                  EXCEPTIONS
                    OTHERS   = 7.
              ENDIF. "if not line is  initial
            ENDLOOP.
          ENDIF. "if read text is successful
        ENDIF. "If table read is successful
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element  = 'ITEM_TEXT_LINE'
            function = 'SET'
            window   = 'MAIN'
          EXCEPTIONS
            OTHERS   = 7.
      ENDLOOP.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element   = 'REVNO'
            function  = 'SET'
            window    = 'REVNO'
          EXCEPTIONS
            OTHERS    = 7.
      t_netwr = 0.
      t_totqty = 0.
      LOOP AT t1_ekpo  WHERE LOEKZ EQ SPACE..
        CLEAR zekpo.
        LOOP AT t2_ekpo
          WHERE vbeln = t1_ekpo-vbeln.
          " Matnr, Dev date and Rate is EQ.
          IF ( t2_ekpo-matnr = t1_ekpo-matnr
              AND t2_ekpo-eindt = t1_ekpo-eindt
              AND t2_ekpo-netpr = t1_ekpo-netpr ).
            zekpo-matnr = t2_ekpo-matnr.
            zekpo-meins = t2_ekpo-meins.
            zekpo-menge = t2_ekpo-menge + zekpo-menge.
            zekpo-netwr = t2_ekpo-netwr + zekpo-netwr.
           t_netwr = t_netwr + t2_ekpo-netwr.  " Total price
           t_totqty = t_totqty + t2_ekpo-menge.  "Total Qty
          zekpo-netpr = t2_ekpo-netpr + zekpo-netpr.
            zekpo-netpr = t2_ekpo-netpr.
            zekpo-txz01 = t2_ekpo-txz01.
            zekpo-vbeln = t2_ekpo-vbeln.
            zekpo-vbelp = t2_ekpo-vbelp.
            zekpo-eindt = t2_ekpo-eindt.
            zekpo-ebeln = t2_ekpo-ebeln.
            zekpo-ebelp = t2_ekpo-ebelp.
          ENDIF.
        ENDLOOP.
    *Place to notice
        MOVE-CORRESPONDING zekpo TO t3_ekpo.
        APPEND t3_ekpo.
       DELETE t1_ekpo WHERE vbeln = zekpo-vbeln
                        AND matnr = zekpo-matnr
                         AND eindt = zekpo-eindt.
       DELETE t2_ekpo WHERE vbeln = zekpo-vbeln
                        AND matnr = zekpo-matnr
                         AND eindt = zekpo-eindt.
    *Changed by srini 31/12/2007
        DELETE t1_ekpo WHERE vbeln = zekpo-vbeln
                         AND matnr = zekpo-matnr
                          AND eindt = zekpo-eindt
                           AND netpr =  zekpo-netpr.
        DELETE t2_ekpo WHERE vbeln = zekpo-vbeln
                         AND matnr = zekpo-matnr
                          AND eindt = zekpo-eindt
                            AND netpr =  zekpo-netpr.
      ENDLOOP.
           IF t_xkomv-kschl NE 'FRA1' AND t_xkomv-kschl NE 'FRB1'.
           item_tot = item_tot + t_xkomv-kwert.
         ELSE.
           freight  = freight + t_xkomv-kwert.
         ENDIF.
      LOOP AT t3_ekpo WHERE LOEKZ EQ SPACE..
        LOOP AT l_doc-xtkomv INTO t_xkomv. " WHERE kposn EQ t3_ekpo-ebelp.
         icond-KNUMV = Ic-KNUMV .
         icond-KPOSN = Ic-KPOSN .
         icond-KSCHL = Ic-KSCHL .
         icond-KAWRT = IC-KAWRT .
         APPEND t_xkomv-icOND.
         APPEND .
        ENDLOOP.
      ENDLOOP.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'ITEM_HEADER'
          function  = 'SET'
          window    = 'HITEM'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      po_tot = po_tot + freight.
      SELECT waers rlwrt FROM ekko INTO (l_doc-xekko-waers,
          l_doc-xekko-rlwrt) WHERE ebeln EQ l_doc-xekko-ebeln.
      ENDSELECT.
      PERFORM set_text_symbol USING:
                            '&L_DOC-XEKKO-WAERS&' l_doc-xekko-waers,
                            '&FREIGHT&'  freight,
                           '&L_DOC-XEKKO-RLWRT&' t_netwr,
                           '&L_DOC-XEKKO-TotQty&' t_totqty,
                            '&qtytot&'  qtytot,
                            '&amttot&'  amttot,
                            '&CNT&' count.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'FRIGHT'
          function  = 'APPEND'
          window    = 'MAIN'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      IF sy-subrc EQ 0.
        count = count + 2.
      ENDIF.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'TOTAL'
          function  = 'SET'
          window    = 'MAIN'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      IF sy-subrc EQ 0.
        count = count + 2.
      ENDIF.
      clear : amttot1, amttot2.
    *P.O Summary
    CLEAR t_xekpo.
    REFRESH t_xekpo.
    t_xekpo[] = l_doc-xekpo[].
    SORT t_xekpo BY matnr.
    LOOP AT t_xekpo.
       AT NEW matnr.
         SUM.
         PERFORM set_text_symbol USING:
                  '&T_XEKPO-TXZ01&' t_xekpo-txz01,
                  '&T_XEKPO-MENGE&' t_xekpo-menge.
         CALL FUNCTION 'WRITE_FORM'
           EXPORTING
             element   = 'SUM_MATNR'
             function  = 'APPEND'
             window    = 'MAIN'
           EXCEPTIONS
             element   = 1
             function  = 2
             type      = 3
             unopened  = 4
             unstarted = 5
             window    = 6
             OTHERS    = 7.
         IF sy-subrc EQ 0.
           count = count + 1.
         ENDIF.
       ENDAT.
    ENDLOOP.
      comp = 0.
      LOOP AT itab_comp WHERE pstyp = 3  AND LOEKZ EQ SPACE..
        SELECT * FROM resb WHERE ebeln = l_doc-xekko-ebeln AND
                                   ebelp = itab_comp-ebelp AND
                                   baugr = itab_comp-matnr.
          SELECT SINGLE maktx FROM makt INTO makt-maktx WHERE
                                   matnr EQ resb-matnr.
          IF  comp = 0.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element  = 'COMP'
                function = 'SET'
                window   = 'MAIN'
              EXCEPTIONS
                OTHERS   = 7.
            comp = 1 .
          ENDIF.
          PERFORM set_text_symbol USING:
               '&T_XEKPO-MATNR&' makt-maktx,
               '&T_XEKET-EINDT&' resb-charg,
               '&T_XEKPO-MENGE&' resb-bdmng,
               '&T_XEKPO-MEINS&' resb-meins,
               '&T_XEKPO-EBELP1&' itab_comp-ebelp.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element  = 'COMP1'
              function = 'APPEND'
              window   = 'MAIN'
            EXCEPTIONS
              OTHERS   = 7.
          IF sy-subrc EQ 0.
            count = count + 2.
          ENDIF.
        ENDSELECT.
      ENDLOOP.
    Find the total price for each item from condition table
      DATA:  con_amt LIKE freight.
      DATA:  def TYPE string,
              sep(2) TYPE c,
              sep1(3) TYPE c,
              kwer(15) TYPE c,
              txt(15) TYPE c,
              con_win(1),
              con1(1),
              con(1),
              grpr1 type p decimals 2,
              grpr2 type p decimals 3.
      con = 1.
      DATA:  ic LIKE l_doc-xtkomv WITH HEADER LINE.
      DATA: begin of icond occurs 0,
        KSCHL like komv-KSCHL ,
        KWERT like komv-KWERT ,
        KNUMV like komv-KNUMV ,
        KPOSN like komv-KPOSN ,
      end of icond.
    *loop at t3_ekpo.
      LOOP AT l_doc-xtkomv INTO IC WHERE kinak eq space.
    kposn EQ t3_ekpo-ebelp.
        APPEND ic.
      ENDLOOP.
    *endloop.
      LOOP AT IC.
        icond-KSCHL = Ic-KSCHL .
        icond-KWERT = IC-KWERT .
        icond-KNUMV = Ic-KNUMV .
        icond-KPOSN = Ic-KPOSN .
        APPEND icOND.
      ENDLOOP.
      con_win = 0.
      sort icond by KSCHL.
      LOOP AT icond .
        AT END OF KSCHL.
          SUM.
           w_ex = 'X'.
         IF w_ex = 'X'.
          IF  con_win = 0.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element  = 'CON'
                function = 'SET'
                window   = 'MAIN'
              EXCEPTIONS
                OTHERS   = 7.
            con_win = 1 .
          ENDIF.
          CLEAR t685t-vtext.
          SELECT SINGLE vtext INTO t685t-vtext FROM t685t
                                WHERE kschl = icond-kschl AND
                                      spras = 'EN'.
          IF icond-KWERT NE 0.
          if decim = 3.
            grpr2 = icond-kwert / 10.
          elseif decim = 2.
            grpr1 = icond-kwert.
          else.
            grpr1 = icond-kwert.
          endif.
            PERFORM set_text_symbol USING:
                     '&icond-kwert&' icond-KWERT,
                     '&grpr1&'       grpr1,
                     '&grpr2&'       grpr2,
                     '&t685t-vtext&' t685t-vtext.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element  = 'CON_WIN1'
                function = 'APPEND'
                window   = 'MAIN'
              EXCEPTIONS
                OTHERS   = 7.
            IF sy-subrc EQ 0.
              con_win = 1.
            ENDIF.
          ENDIF.
          CLEAR: w_ex,icond-KWERT .
        ENDAT.
      ENDLOOP.
      CLEAR zekpo.
      SORT t3_ekpo BY matnr.
      LOOP AT t3_ekpo  WHERE LOEKZ EQ SPACE.
       MOVE-CORRESPONDING t3_ekpo TO zekpo.
        MOVE t3_ekpo-txz01 TO zekpo-txz01.
        AT NEW matnr.
          SUM.
         PERFORM set_text_symbol USING:
                  '&T_XEKPO-TXZ01&' zekpo-txz01,
                  '&T_XEKPO-MENGE&' zekpo-menge.
          PERFORM set_text_symbol USING:
                   '&T_XEKPO-TXZ01&' zekpo-txz01,
                   '&T_XEKPO-MENGE&' t3_ekpo-menge.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element   = 'SUM_MATNR'
              function  = 'APPEND'
              window    = 'MAIN'
            EXCEPTIONS
              element   = 1
              function  = 2
              type      = 3
              unopened  = 4
              unstarted = 5
              window    = 6
              OTHERS    = 7.
          IF sy-subrc EQ 0.
            count = count + 1.
          ENDIF.
        ENDAT.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'LINE5'
          function  = 'APPEND'
          window    = 'MAIN'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
      IF sy-subrc EQ 0.
        count = count + 1.
      ENDIF.
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    *Tax Code Printed Here
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      SELECT SINGLE mwskz Txjcd FROM ekpo INTO
      (t3_ekpo-mwskz, t3_ekpo-Txjcd)
      WHERE ebeln = t3_ekpo-ebeln
      and   EBELP = t3_ekpo-EBELP.
    select single KSCHL INTO A053-KSCHL FROM A053
    WHERE MWSKZ EQ T3_EKPO-MWSKZ AND
          TXJCD EQ T3_EKPO-TXJCD.
    SELECT SINGLE VTEXT INTO T685T-VTEXT
    FROM T685T WHERE KSCHL EQ A053-KSCHL.
    DATA : GT type p decimals 2,
           PER(5).
    vat cal.
        if T3_EKPO-MWSKZ eq 'X1'.
          GT = T3_EKPO-NETWR * 4 / 100.
           GT = GT + ( T3_EKPO-NETWR * 4 / 100 ).
           PER = '4%'.
           ICT = ICT + 1.
        ELSEIF T3_EKPO-MWSKZ eq 'X3'.
          GT = T3_EKPO-NETWR *  125 / 1000.
           GT = GT + ( T3_EKPO-NETWR *  125 / 1000 ).
           PER = '12.5%'.
           ICT = ICT + 1.
         ELSEIF T3_EKPO-MWSKZ eq 'X5'.
           GT = T3_EKPO-NETWR *  2 / 100.
            GT = GT + ( T3_EKPO-NETWR *  2 / 100 ).
            PER = '2%'.
            ICT = ICT + 1.
          ELSEif T3_EKPO-MWSKZ eq 'Z1'.
          GT = T3_EKPO-NETWR * 4 / 100.
           GT = GT + ( T3_EKPO-NETWR * 4 / 100 ).
           PER = '4%'.
           ICT = ICT + 1.
            ELSEIF T3_EKPO-MWSKZ eq 'Z3'.
          GT = T3_EKPO-NETWR *  125 / 1000.
           GT = GT + ( T3_EKPO-NETWR *  125 / 1000 ).
           PER = '12.5%'.
           ICT = ICT + 1.
        ELSE.
        ENDIF.
        nettotal = amttot3 + GT.
    ENDLOOP.
      PERFORM set_text_symbol USING:
                   '&EKPO-MWSKZ&' t3_ekpo-mwskz,
                   '&GT&' GT,
                   '&ICT&' ICT,
                   '&nettotal&' nettotal,
                   '&per&' per,
                   '&VTEXT&' T685T-VTEXT,
    *Added by srini
                 '&printtype&' printtype.
                   '&printtype&' nast-kschl.
      PERFORM word_disp USING t_netwr l_doc-xekko-waers.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element   = 'TAX_CODE'
          function  = 'SET'
          window    = 'MAIN'
        EXCEPTIONS
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          OTHERS    = 7.
    clear : T3_EKPO-MWSKZ,GT,PER,T685T-VTEXT.
    *terms and Condition from Master Table
    *Terms and Condition
    *Get header Text Data
      CONCATENATE t3_ekpo-ebeln  t3_ekpo-ebelp INTO tdname.
      SELECT SINGLE * FROM stxl WHERE relid EQ 'TX' AND
                                          tdobject EQ 'EKPO' AND
                                          tdname EQ tdname AND
                                          tdid EQ 'F03' AND
                                          tdspras EQ 'EN'.
      IF sy-subrc EQ 0.
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
            client                        = sy-mandt
            id                            = stxl-tdid
            language                      = stxl-tdspras
            name                          = stxl-tdname
            object                        = stxl-tdobject
        ARCHIVE_HANDLE                = 0
        LOCAL_CAT                     = ' '
      IMPORTING
        HEADER                        =
          TABLES
            lines                         = ctxt
       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 EQ 0.
          LOOP AT ctxt.
            IF ( ctxt-tdline IS NOT INITIAL ).
              PERFORM set_text_symbol USING: '&TEXT_LINE1&' ctxt-tdline.
              CALL FUNCTION 'WRITE_FORM'
                EXPORTING
                  element   = 'TEXT_LINE1'
                  function  = 'APPEND'
                  window    = 'WINDOW0'
                EXCEPTIONS
                  element   = 1
                  function  = 2
                  type      = 3
                  unopened  = 4
                  unstarted = 5
                  window    = 6
                  OTHERS    = 7.
              IF sy-subrc EQ 0.
                count = count + 2.
              ENDIF.
           CALL FUNCTION 'WRITE_FORM'
             EXPORTING
               element   = 'TEXT_LINE'
               function  = 'APPEND'
               window    = 'MAIN'
             EXCEPTIONS
               element   = 1
               function  = 2
               type      = 3
               unopened  = 4
               unstarted = 5
               window    = 6
               OTHERS    = 7.
           IF sy-subrc EQ 0.
             count = count + 1.
           ENDIF.
            ENDIF. "if not line is  initial
          ENDLOOP.
        ENDIF. "if read text is successful
      ENDIF. "If table read is successful
    *Get header Text Data
      SELECT SINGLE * FROM stxl WHERE relid EQ 'TX' AND
                                          tdobject EQ 'EKKO' AND
                                          tdname EQ l_doc-xekko-ebeln AND
                                          tdid EQ 'F05' AND
                                          tdspras EQ 'EN'.
      IF sy-subrc EQ 0.
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
            client                        = sy-mandt
            id                            = stxl-tdid
            language                      = stxl-tdspras
            name                          = stxl-tdname
            object                        = stxl-tdobject
        ARCHIVE_HANDLE                = 0
        LOCAL_CAT                     = ' '
      IMPORTING
        HEADER                        =
          TABLES
            lines                         = ctxt
       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 EQ 0.
          LOOP AT ctxt.
            IF ( ctxt-tdline IS NOT INITIAL ).
              PERFORM set_text_symbol USING: '&TEXT_LINE&' ctxt-tdline.
              CALL FUNCTION 'WRITE_FORM'
                EXPORTING
                  element   = 'TEXT_LINE'
                  function  = 'APPEND'
                  window    = 'MAIN'
                EXCEPTIONS
                  element   = 1
                  function  = 2
                  type      = 3
                  unopened  = 4
                  unstarted = 5
                  window    = 6
                  OTHERS    = 7.
              IF sy-subrc EQ 0.
                count = count + 1.
              ENDIF.
            ENDIF. "if not line is  initial
          ENDLOOP.

  • Sap scripts print modes

    What are the print modes available in the sap scripts?

    Hi
    Parent Topic: SAPScript
    HOWTO:Sap script
    Edit this entry - Discuss - Rename - Watch - History - 
    Major contributors: gopang, cmurphy262 | All Contributors
    Your votes have been tallied! See which wiki entry took top honors and find out who is this year's Wiki Ironman.  View the winners. 
    White Papers
    Do You Need a Fax Server? A Special Guide on Fax Servers and SAP Electronic Document Delivery
    Achieving Real-Time Supply Chain Integration
    E-Invoicing for Business Process Efficiency with SAP(R) Systems
    Jobs
    SAP Consultants (Any City) - SD, MM, PP, FI/CO, CS, ABAP (Dice) 
    SAP ABAP LEAD (Dice) 
    SAP ABAP Workflow Developer -Contract (Dice) 
    Community Content
    3 days until GO-LIVE!!! (Blogs)
    RE: RE: RE: RE: RE: Lost connection when using tcode FS00 (Groups)
    SAP SCRIPT
    Table of contents Show TOCHide TOC 
    1. 1 Concepts
    1.1. 1.1 Modifying SAP Forms
    1.2. 1.2 Forms: Concepts
    1.3. 1.3 Client and Language Versioning: Concepts
    2. 2 Componentes
    2.1. 2.1 Header Data
    2.2. 2.2 Paragraph Formats and Attributes
    2.2.1. 2.2.1 Standard Paragraph Attributes
    2.2.2. 2.2.2 Font Attributes for Paragraphs
    2.2.3. 2.2.3 Tabs in Paragraph Formats
    2.2.4. 2.2.4 Paragraph and Heading Numbering
    2.3. 2.3 Character Formats and Attributes
    2.3.1. 2.3.1 Standard Attributes for Character Formats
    2.3.2. 2.3.2 Font Attributes for Character Formats
    2.4. 2.4 Windows
    2.4.1. 2.4.1 Default Paragraph
    2.5. 2.5 Pages
    2.5.1. 2.5.1 Defining Follow-On Pages in Duplex Print Modes
    2.5.2. 2.5.2 Testing Tray Selection and Print Mode Selection
    2.6. 2.6 Page Windows
    2.7. 2.7 Text Elements
    2.7.1. 2.7.1 Default Text Element
    2.8. 2.8 Main Window
    3. 3 Técnicas
    3.1. 3.1 Displaying Versions of Forms
    3.2. 3.2 Including Graphics
    3.2.1. 3.2.1 Using Boxes, Lines, and Shading
    3.2.2. 3.2.2 Supported Printers
    3.2.3. 3.2.3 Boxes, Lines, Shading: BOX, POSITION, SIZE
    3.2.3.1. 3.2.3.1 BOX Command
    3.2.3.2. 3.2.3.2 POSITION Command
    3.2.3.3. 3.2.3.3 SIZE Command
    3.2.4. 3.2.4 Pre-Setting BOX Position Arguments
    3.2.5. 3.2.5 Using the Commands in Texts and Forms
    3.2.6. 3.2.6 Tips and Guidelines
    4. 4 Design Tools
    4.1. 4.1 Form Components
    4.2. 4.2 Processing in Overview
    4.2.1. 4.2.1 Defining Header Data
    4.2.1.1. 4.2.1.1 Completing the Header Data After Defining the Attributes
    4.2.1.2. 4.2.1.2 Passing Data to an External Program
    4.2.2. 4.2.2 Defining Paragraph Formats
    4.2.3. 4.2.3 Defining Character Formats
    4.2.4. 4.2.4 Defining Pages
    4.2.5. 4.2.5 Defining Windows
    4.2.6. 4.2.6 Using Text Elements in Page Windows
    4.2.7. 4.2.7 Defining Page Windows
    4.2.7.1. 4.2.7.1 Filling Page Windows with Text
    4.2.8. 4.2.8 Using Text Elements in Page Windows
    4.2.9. 4.2.9 Defining Main Windows in Page Windows
    4.3. 4.3 Test-Printing a Form
    5. 5 Releasing Forms
    6. 6 SAPscript Control Commands
    6.1. 6.1 Syntax of Control Commands
    6.2. 6.2 Explicit Page Break: NEW-PAGE
    6.3. 6.3 Preventing Page Breaks: PROTECT
    6.4. 6.4 Next Main Window: NEW-WINDOW
    6.5. 6.5 Assigning a Value to a Text Symbol: DEFINE
    6.6. 6.6 Formatting Date Fields: SET DATE MASK
    6.7. 6.7 Formatting Time Fields: SET TIME MASK
    6.8. 6.8 Country-Dependent Formatting: SET COUNTRY
    6.9. 6.9 Position of the Leading Sign: SET SIGN
    6.10. 6.10 Initializing Numbered Paragraphs: RESET
    6.11. 6.11 Including Other Texts: INCLUDE
    6.12. 6.12 Changing the Style: STYLE
    6.13. 6.13 Formatting Addresses: ADDRESS
    6.13.1. 6.13.1 Parameters
    6.14. 6.14 Setting a Footer Text in the Main Window: BOTTOM
    6.15. 6.15 Conditional Text: IF
    6.16. 6.16 Finding a Match: CASE
    6.17. 6.17 Calling ABAP Subroutines: PERFORM
    6.18. 6.18 Inserting Print Controls: PRINT-CONTROL
    6.19. 6.19 Boxes, Lines, Shading: BOX, POSITION, SIZE
    6.20. 6.20 Hexadecimal Data: HEX, ENDHEX
    6.21. 6.21 Summing a Program Symbol: SUMMING
    6.21.1. 6.21.1 Summing and Carrying Forward is Incorrect
    7. 7 SAPscript Symbols
    7.1. 7.1 Syntax of Symbols
    7.2. 7.2 System Symbols
    7.2.1. 7.2.1 Current Date
    7.2.2. 7.2.2 Current Day Number
    7.2.3. 7.2.3 Current Month Number
    7.2.4. 7.2.4 Current Year Number
    7.2.5. 7.2.5 Current Day Name (Long Form)
    7.2.6. 7.2.6 Current Month Name (Long Form)
    7.2.7. 7.2.7 Current Time
    7.2.8. 7.2.8 Hours Component of Current Time
    7.2.9. 7.2.9 Minutes Component of Current Time
    7.2.10. 7.2.10 Seconds Component of Current Time
    7.2.11. 7.2.11 Current Page Number
    7.2.12. 7.2.12 Page Number of the Next Page
    7.2.13. 7.2.13 Selected Device Type
    7.2.14. 7.2.14 Spaces
    7.2.15. 7.2.15 Underline
    7.2.16. 7.2.16 Vertical Line
    7.3. 7.3 Program Symbols
    7.3.1. 7.3.1 SYST: System Fields in the ABAP Programming Environment
    7.3.2. 7.3.2 USR03: User Address Data
    7.3.3. 7.3.3 SAPSCRIPT: General SAPscript Fields
    7.4. 7.4 Standard Symbols
    7.5. 7.5 Text Symbols
    7.6. 7.6 Formatting Options
    7.6.1. 7.6.1 Offset
    7.6.2. 7.6.2 Output Length
    7.6.3. 7.6.3 Omitting the Leading Sign
    7.6.4. 7.6.4 Leading Sign to the Left
    7.6.5. 7.6.5 Leading Sign to the Right
    7.6.6. 7.6.6 Omitting Leading Zeros
    7.6.7. 7.6.7 Space Compression
    7.6.8. 7.6.8 Number of Decimal Places
    7.6.9. 7.6.9 Omitting the Separator for ‘Thousands’
    7.6.10. 7.6.10 Specifying an Exponent for Floating Point Numbers
    7.6.11. 7.6.11 Right-Justified Output
    7.6.12. 7.6.12 Fill Characters
    7.6.13. 7.6.13 Suppressing Output of Initial Values
    7.6.14. 7.6.14 Ignoring Conversion Routines
    7.6.15. 7.6.15 Changing the Value of a Counter
    7.6.16. 7.6.16 Preceding and Subsequent Texts (Pre-Text / Post-Text)
    7.7. 7.7 Country-Dependent Formatting
    7.7.1. 7.7.1 Date Mask
    7.7.2. 7.7.2 Time Mask
    7.8. 7.8 Formatting Conventions
    7.8.1. 7.8.1 Primary Formatting of System Symbols
    7.8.2. 7.8.2 Primary Formatting of Standard Symbols
    7.8.3. 7.8.3 Primary Formatting of Program Symbols
    7.8.4. 7.8.4 Primary Formatting of Text Symbols
    7.8.5. 7.8.5 End Formatting
    1 Concepts Edit section
    1.1 Modifying SAP Forms Edit section
    If you want to modify SAP forms, set up your development environment as follows:
    1. Make sure that no SAP-standard forms are stored as client-specific copies in your development client. Such forms should be held only in client 000, the SAP development and installation client. If you access an SAP-standard form from another client, then the central copy in client 000 is used.
    If you need to remove SAP-standard objects from your development client, see Notes 10388 and 3355 in the SAP Online Service System (OSS). These notes explain the procedure for saving modified forms and then deleting all forms.
    2. To modify SAP standard forms,
    Copy the forms you need from client 000 to your development client.
    Rename the forms using a name from the customer name reserve (names starting with Y or Z).
    Copy the forms to one of your own Y or Z development classes.
    Renaming the SAP standard object makes it possible to manage and transport your changes with the SAP workbench organizer. The organizer is not activated for SAP-standard objects that are modified in clients other than 000.
    3. To put your modifications into effect, you must also modify the ABAP print program used to print documents that use this form. You should rename such print programs and store them in your own Y or Z development classes.
    You can use the SAP Customizing System to replace the SAP print program with your modified print program in the affected applications
    1.2 Forms: Concepts Edit section
    Forms are used to control the page layout and also the text formatting in your documents. Before formatting a document for output to the screen or to a printer, you must assign a form to it. If you do not specify a form for a document, then the SYSTEM form is assigned to the document by default.
    Application-specific forms are used in SAP applications to specify the page layout for such special documents as invoice or checks. These forms specify the structure of the information on the page(s) of such a document. They define, for example, the address header, item lines, the footer, and so on. There are two ways to format texts with forms:
    In the standard SAPscript text processing (Tools &#61614; Word processing &#61614; Standard text), you can select a form for a document. You can then type text into the main window of the form and output the document in the format defined in the form.
    For example, you can select a form for a letter. You can then type the body text of the letter in the main window. When you print the letter, the default text elements in the other windows of the form (heading, footer, and so on) are printed with the body text.
    A document can be generated by a print program in one of the SAP applications. The print program uses a form to generate the document. Most correspondence and document generation in the SAP System are handled by way of print programs.
    A print program selects the text elements that are to be printed in the windows of a form. It may also collect information from the user or ask the user to input text directly, as in some correspondence functions. The print program may also provide data for variables defined in the form.
    Finally, the print program uses the form to format the document for display or printing.
    1.3 Client and Language Versioning: Concepts Edit section
    Forms and styles are client-specific. That is, a form or style other than the SAP standard in client 000 is available only in the client in which it was created.
    Forms and styles are also language-specific. That is, the definitions and texts in a form or style are defined for a particular language. Forms and styles can be translated using the standard SAP translation tools.
    Client 000 Defaulting: SAPscript accords forms and styles in client 000 a special status.
    If a form or style that is used in a document is not available in the client in which the document is being printed, then SAPscript checks for the form or style in client 000. If it is found there, then the client 000 version is used to print the document.
    SAP standard forms and styles are always held in client 000. You can take advantage of the client 000 defaulting as well by storing your Yxxx and Zxxx forms and styles there. That way, if a local version of a form or style is not present in a client, the client 000 version is used instead.
    Language rules: SAPscript uses the following rules to manage versions of forms and styles in different languages:
    The language in which a form or style is created is its "original language." You can translate a form or style into other languages using SAP’s translation tools.
    If a form or style is needed only in its original language and need not be translated, then you can indicate this in the language attributes in the header data. The form or style then does not appear in work lists in the translation tools.
    In versions other than the original language version, changes to a form or style are limited only to translation of texts. No changes to definitions and attributes are permitted.
    2 Componentes Edit section
    2.1 Header Data Edit section
    You can find header data in both form and style maintenance. In style maintenance, it is used primarily to present important information – information designed to make it easier for the end user to select a style. The header data in form maintenance, on the other hand, is used for information and control purposes. For this reason, the header data of a form will be described in more detail.
    Below, the header data is described as it appears in the alphanumeric Form Painter.
    Like the header data of a style, the header data of a form comprises two parts: the data set by the system and the data you are expected to enter. The latter is dealt with separately.
    Device-independent entries.
    Description
    A short explanatory description of the form (also applies to the style), designed to make selection easier for the end user.
    Form class
    You can assign a form to a class to help you organize and search for forms. The default set of classes is the set of program classes in your system.
    Start page
    Tells the print program which page format in a form to use first for printing.
    Default paragraph
    Paragraph set to * in standard text maintenance.
    Tab stop
    A grid set at specified intervals in all windows defined in the form. However, you should note that the tab stops are only valid in paragraphs where you have not defined your own tabs.
    Language, Original language, Translation applic
    Use these fields to record the master language and language of the current version of a form. Marking Translation applic makes the form accessible for translation from the SAP System’s translation tools (transaction SE63).
    Device-dependent entries.
    You can only enter values here that are supported in the R/3 printer definition. If you make other entries, this leads to errors in the check routine.
    Page format
    Determined from the spool administration table with transaction SPAD. Make sure there is a printer assignment – there must be an additional spool format for the printer with the same page format.
    Orientation
    Depends on the page format selected. This can also be determined from the spool administration table. Please note that the formats landscape and portrait are not supported by all printers.
    Lines per inch (LPI)
    Basis for converting the unit of measurement LN in style and form maintenance. The value 6.00 is set by the system, as this value is supported by all printers.
    Characters per inch (CPI)
    Basis for converting the unit of measurement CH in style and form maintenance. The value 10.00 is set by the system, as this value is supported by all printers.
    Font attributes
    With these fields, you can set the default font for a form. The default font applies if other objects do not specify a font. SAPscript suggests a default font, which you can change.
    2.2 Paragraph Formats and Attributes Edit section
    In SAPscript, paragraphs are formatted using formats and their corresponding attributes. Text processing is simplified by the use of different paragraph attribute groups:
    Standard
    Font
    Tabs
    Outline
    There are naming conventions for paragraph tags:
    The paragraph tag can have one or two characters.
    The first character in the paragraph tag must be a letter, the second a letter, number, or blank; special characters are not valid.
    The paragraph format must be identified in the Description field.
    2.2.1 Standard Paragraph Attributes Edit section
    In the Standard attribute group, you find the general attributes that can be defined in paragraph formats:
    Description
    Precise explanation of your paragraph tag, so that the user can immediately identify it.
    Left or right margin
    Amount of space between the paragraph and the left or right border of the form window.
    Indent first line
    Indent of the first line of a paragraph. If the value is positive, it is indented to the right, if it is negative, it is indented to the left.
    If you specify a negative value, then you must place the minus sign after the number: 1- .
    Space before and space after
    Space before and space after control the amount of space between paragraphs. The actual space between paragraphs results from the space after the preceding paragraph and the space before the following paragraph.
    Alignment
    Alignment of a paragraph.
    Left-aligned
    LEFT
    Right-aligned RIGHT
    Centered CENTER
    Justified BLOCK
    Line spacing
    Spacing between the lines. The default value is 1 line; the LPI value (lines per inch) in the header data is used to calculate the line spacing.
    No blank lines
    Suppression of blank lines. You can control whether the blank lines of a paragraph should be suppressed in the printout or not:
    No entry
    blank lines not suppressed
    X blank lines suppressed
    Page protection
    Cohesion of a paragraph. It is possible to determine whether or not a paragraph can be divided by a page break.
    No entry
    no page protection (default)
    X all lines of the paragraph are on one page
    Next paragraph same page
    Cohesion of two adjacent paragraphs. Here you can define whether the subsequent paragraph should begin on the same page (that is, at least the first line of the subsequent paragraph must be on the same page).
    No entry
    subsequent paragraph is output on the same page or the next page, depending on the amount of space (default)
    X subsequent paragraph begins on the same page
    2.2.2 Font Attributes for Paragraphs Edit section
    You can specify font attributes for paragraph formats. They control the font used in the text. You can specify these attributes both for the default font in the header and for particular paragraph formats:
    Font family
    Enter a font supported in the SAPscript font maintenance.
    Font size
    Enter the size of a character font. It is measured in 1/10 point.
    Bold/Italic
    Specify whether to use bold-face printing or italics.
    Underlined
    Mark this attribute to underline entire blocks of text.
    When defining a paragraph format, use More to specify these underline attributes:
    Spacing between the base line and the underline
    Thickness
    Intensity
    Intensity is expressed in percent: 0 % is a black underline; 100 % is no underline.
    If you defined default underlining in the header, then the fields for underline attributes are already displayed on the screen.
    The following selection criteria apply to the font attributes bold, italics, and underlined:
    Off attribute is not set
    Retain inherited
    On attribute is set
    The combination of font family, font size, bold type attribute and italics attribute is referred to as a system font or SAP font. To use the SAPscript font maintenance, choose Tools &#61614; Word processing &#61614; Font.
    2.2.3 Tabs in Paragraph Formats Edit section
    You can define as many tab positions as you require for each paragraph format. The text can be aligned in different ways:
    Left-aligned with LEFT
    Right-aligned with RIGHT
    Centered with CENTER
    At the sign with SIGN
    At the comma or decimal point with DECIMAL
    You can control the tab feed in a paragraph with tab positions. The tab stops you define in the paragraph format replace the tab spacing you defined in the header data of the form. However, this depends on the extent to which you have defined tab stops in the paragraph format. If there are fewer tabs in the paragraph formats than in the header data, the tab stops of the header data are used for the rest of the line. The tab stops are represented as, , in the text editor.
    You can use different units of measurement to define a tab position:
    CH Characters
    CM Centimeters
    MM Millimeters
    PT Points
    TW Twips (1/20 point)
    The unit of measurement CH is converted to an absolute unit of measurement using the CPI value (characters per inch) from the header data of the form.
    2.2.4 Paragraph and Heading Numbering Edit section
    The paragraph numbering and marking attributes are used to structure texts into chapters, subchapters, and sections. Numbering is carried out automatically by SAPscript.
    You can create an outline with the entry options available:
    Outline
    Enter the name of the highest-level paragraph in an outline hierarchy here. The outline hierarchy is created by assigning this paragraph to all outline paragraphs.
    Outline level
    Enter the level in the outline hierarchy. The outline levels of the paragraphs are numbered upwards from 1; the highest outline level therefore has the outline number 1.
    Number margin
    Specify the space between numbering and window border. Note that your numbering may extend into the text area of the paragraph if the difference between the left margin and the number margin is not great enough to hold the numbering characters.
    Left/right delimiter
    Specify the character that precedes or follows the numbering.
    Number chaining
    Specify whether you want the paragraph numbering of the paragraph to be preceded by the numbering of all higher paragraphs in the hierarchy.
    Example for number chaining
    with   without
    3.     3.
    3.1     1.
    3.2     2.
    3.2.1     1.
    Character string
    Specify the numbering format. The numbering can be assigned a different font or character format to the rest of the paragraph.
    Numbering type
    ARABIC
    Arabic numerals: 1, 2, 3.
    CHAR Fixed character: letter or numeral, entered in the field
    LETTER Letters: A-Z
    ROMAN Roman numerals: I, II, III, IV
    Depending upon the numbering type that you select, the following attributes may also apply:
    Fixed character
    Define the fixed character to be used for numbering. You should only make an entry in the field Fixed character if you have specified CHAR as the numbering type. Fixed characters include + - and o .
    Output length
    Enter the number of characters for Arabic numerals.
    Upper case
    Specify for letters or Roman numerals.
    2.3 Character Formats and Attributes Edit section
    Character formats, as opposed to paragraph attributes, allow you to format entire blocks of text within a paragraph.
    Character attribute groups can be:
    Standard
    Font
    When you define character formats, observe the following naming conventions:
    The character format can have one or two characters.
    The first character must be a letter, the second a letter, number, or blank; special characters are not valid.
    Enter a simple explanation in the field Description. It is intended to help the user make a selection.
    2.3.1 Standard Attributes for Character Formats Edit section
    Marker
    Links a search key to the selected character string when the end user uses this character format. Examples include glossary, hypertext, and data element links. Here, selected character strings are assigned the appropriate key.
    Bar code
    Bar code that is required for certain variables and is known to the printer, for example EAN8. The character string is printed as a bar code if the character string concerned is selected.
    Bar code names, such as EAN8, refer to system bar codes. These are defined in the SAPscript font maintenance (Tools &#61614; Word processing &#61614; Font).
    Protected
    The character string is not split by a line break, but printed together on the next line.
    Hidden
    The character string is not printed. The text is only visible in the text editor.
    Superscript/subscript
    The character string is printed half a line higher or lower.
    The following options are available for defining these attribute types:
    Off
    Attribute is not set
    Retain Attribute is inherited
    On Attribute is set
    2.3.2 Font Attributes for Character Formats Edit section
    Font attributes can be specified for character formats as well as for paragraph formats. You have the same options as for defining font attributes for paragraph formats.
    2.4 Windows Edit section
    Windows are defined in form maintenance. They represent areas that are positioned on pages – as page windows – and in which at a later time text is printed. You must define at least one window for each form. Otherwise, SAPscript cannot format the text.
    You can assign window names and window types. However, note that you can define only one main window per form.
    Use one of these window types:
    MAIN
    Main window in which continuous text is printed. This is the window used by dialog users of a print program and form. For example, the body text of a letter would be entered in MAIN.
    The text in the main window can extend over several pages. If the text fills one page, output continues in the window of the next and subsequent pages, as long as MAIN has been defined for these pages.
    VAR
    Window with variable contents. The text can vary on each page in which the window is positioned. Variable windows are formatted for each page.
    To every window you can assign text, which is printed in the corresponding window when the form is formatted. To assign text, use text elements, which are stored with the form.
    To create and maintain text elements with the SAPscript Editor, choose Text elements. Should the text selected for the window exceed the window size, then the text is cut off.
    CONST
    Window with constant contents that is formatted only once.
    Currently, CONST windows are processed in the same way as VAR windows. You should only use windows of type VAR.
    2.4.1 Default Paragraph Edit section
    For a particular window, you can override the default paragraph format that is set in the form header. Enter the default format that should apply in the window in the Default paragraph field in the window definition screen.
    2.5 Pages Edit section
    You must define at least one page for every form. And you must designate a "first" page in the form header. Otherwise text formatting is not possible. In addition, you should inform the system which page is to be used after reaching the end of the first page. If you do not specify a next page, the output of your text ends at the end of the current page.
    To define a page, give it a name and specify attributes for it:
    Name of the next page
    Page counter mode
    INC Increases the counter by 1
    HOLD Counter remains unchanged
    START Sets the counter to 1
    You can display the contents of the page counter with the system symbol&PAGE&.
    Numbering type of the page counter
    ARABIC Arabic numerals
    LETTER Letters
    ROMAN Roman numerals
    Although CHAR is displayed as an entry option for the numbering type of the page counter, internally CHAR is converted to ARABIC.
    Output length for page numbering with numerals
    Upper or lower case for numbering with Roman numerals or letters
    Resource name
    With Resource name, you specify that the paper for this page should be taken from a particular paper tray at the printer.
    In Resource name, enter the print control that has been defined for switching to the paper tray you want to use. In printer types pre-defined by SAP, these print controls are generally as follows:
    TRY01 Select first paper tray
    TRY02 Select second paper tray (if available at the printer)
    TRY03 Select third paper tray (if available at the printer)
    TRYEN Print envelopes (if available at the printer)
    TRYMN Switch the printer to manual paper feed (if available at the printer). The printer pauses until you feed a sheet of paper into it.
    TRYME Switch the printer to manual envelope feed (if available at the printer). The printer pauses until you feed an envelope into it.
    You can use all tray selection print controls except TRY03 with suitably equipped printers that are defined with the following SAP device types: HPLJSTND, HPLJ_II, HPLJIIID, HPLJ4, LX4039, and SNI20XX8.
    You can use TRY01, TRY02, TRY03, and TRYMN on suitably equipped printers that are defined with these device types: KYOF1000, KYOF1200, KYOFS1500.
    See the spool system (transaction SPAD) to check on how your printers are defined.
    Print mode
    With Print mode, you can specify single- or double-sided printing for a page. You can choose from the following values:
    ' ' Currently active printing mode continues unchanged.
    S The page is printed in simplex mode. That is, the printer should print on only one side of the paper. If another mode was previously active, then the printer is switched to simplex mode with the start of the page.
    D The page is printed on the first side of a sheet in duplex mode. If another mode was previously active, then the printer is switched to duplex mode with the start of the pageand continues in this mode.
    T The page is printed on the first side of a sheet in tumble duplex mode. That is, the printer prints on both sides. The page on the second side is always inverted, so that the footer of the second page is printed opposite the header of the first page.
    If another mode was previously active, then the printer is switched to tumble duplex mode with the start of the page and continues printing in this mode.
    Print modes are currently supported for printers that use the PCL-5 language. These are printers that are defined with the following SAP device types: HPLJ_II, HPLJIIID, HPLJ4, LX4039, SNI20XX8.
    See the spool system (transaction SPAD) to check on how your printers are defined.
    The print controls for these functions are SPMSI (begin simplex printing); SPMDU (begin duplex printing); SPMTU (begin tumble duplex printing); SPMFS (print on first side of sheet in duplex or tumble duplex mode); and SPMBS (print on second side of sheet in duplex or tumble duplex mode).
    2.5.1 Defining Follow-On Pages in Duplex Print Modes Edit section
    You switch to duplex or tumble duplex mode with a form page for which one of these modes is specified. To continue printing in the current mode, for follow-on pages you must define another page in which the Print mode field is empty. Otherwise, the following pages after the mode switch will continue to be printed only on the front sides of new sheets of paper.
    The reason: When SAPscript sends a page with Print mode D or T to the printer, it not only sets the print mode accordingly. To ensure that the first page in the new mode is correctly output, SAPscript also instructs the printer to output the page on the front side of a sheet. If SAPscript sends a sequence of D or T pages to the printer, the output is printed only on the front side of each sheet.
    You define a first page named FIRST for a form to be printed in duplex mode. You therefore set the Print mode in FIRST to D.
    To make the duplex printing work correctly, you must define a second page FOLLOWER in which Print mode is left empty. In the form definition, you specify FOLLOWER as the follow-on page for FIRST and for itself as well.
    Your text is then printed in duplex mode. FIRST switches the printer to duplex mode and forces printing of the first page on the front side of a new sheet. FOLLOWER accepts the duplex mode and sends no further mode print controls to the printer. The printer therefore alternately prints FOLLOWER pages on the fronts and backs of sheets.
    2.5.2 Testing Tray Selection and Print Mode Selection Edit section
    SAP provides predefined SAPscript documents with which you can test whether tray selection and print mode selection are working properly on your printers.
    For tray selection, print the SAPscript document SAPSCRIPT-TRAYTEST, ID ST, Language D or E.
    For print mode selection, print the SAPscript document SAPSCRIPT-PRINTMODETEST, ID ST, Language D or E.
    2.6 Page Windows Edit section
    When you define page windows, the window names are linked to page names. You must specify the position and size of the window on the assigned page.
    Define the position of a window by specifying the left margin and upper margin and the size of a window by specifying its width and height.
    Left margin
    Space between the window and left margin of the page
    Upper margin Space between the window and upper margin of the page
    Window width Width of the window depending on the page format selected
    Window height Height of the window depending on the page format selected
    Note that the width of the main window must be the same on all pages. All other window types can have different sizes and positions on different pages.
    To print multiple columns, define several main windows on a page. As text entry is continuous, once the first main window has been filled, output continues in the second main window.
    Rewards if helpfull
    Regards
    Pavan

  • Comma not seen in the amount value in SAp Script

    Hi,
    I am printing the folllowing values which contain amounts in SAP Script.
    <Z>Sum total,,,,,,&REGUD-SWRBT(13)&,,&REGUD-SWABZ(9)&,, &regud-swnet(13)&</>
    Both the values are printed as the following
    REGUD-SWRBT  = 20000,000.00
    regud-swnet         = 20000,000.00
    I want the same to be printed as below.
    (ie the comma seperator to be printed in the second set of 3 zeroes as well)
    REGUD-SWRBT  = 20,000,000.00
    regud-swnet         = 20,000,000.00
    Can any one suggest me please.
    Thanks !!
    Regards

    Hi Adarsh,
    Actually the problem here is that the field length of the field SWRBT is only 13 and the extra comma you want, can not be accommodated there.
    You will have to declare a variable of about 14-15 field length and then
    pass this value in it. Definitely the comma will appear.
    Hope this is Useful.
    Thanks,
    Daya.

  • Regarding SAP Script Output validation in Layout set

    Hi All,
    I have a issue in SAP Script Output.
    I have a <b>Standard Print Program</b>. and layout set.
    I can do validations only in Layout set.
    The actual issue is i have a <b>internal table field</b> in <b>print program</b> that i am displaying in <b>layout set</b>. Now i want it to be subtracted with number <b>20</b>, since i can not edit code in <b>Print Program</b>. i want to subtract that internal table field with 20 in layout set itself.
    Can anybody tell me how can i solve this issue.
    <b>Note:</b>  I need to do calculation only in layout set.
    Can anybody give me the solution.
    Thanks in advance.
    Thanks & Regards,
    Rayeez.

    Hi,
    Thanks for that reply.
    so with <b>SUMMING</b> command i can do calculation.
    I am already having <b>i_tab1-sum</b> coming from print program and i have declared one symbol using
    DEFINE &v_val& = 20 in layout set.
    Then i want to subtract &v_val& with &i_tab1-sum&.
    using the follow syntax tell me wether syntax is correct or not.
    SUMMING &i_tab1-sum&-&v_val& INTO &i_tab1-sum&.
    will it work.
    once again thanks for that reply.
    Thanks & Regards,
    Rayeez.

Maybe you are looking for

  • Creation of new EBO

    I need to know wherther oracle recommends creation of new EBO? if yes how I shall create that.Our situation is like that , we need to pass sourcing ALLOCATION_PERCENT,VENDOR_ID,VENDOR_SITE_ID to pass from PIM to custom legacy system.Please let me kno

  • Image won't open in Photoshop

    Situation: Image file is on desktop. What I'm trying to do: Right click on image, then open in Photoshop. Problem: Photoshop opens, but image does not. However: I can go to <file>, <open>in Photoshop, then find the image via that route, and then it w

  • Missing getTaskInfos() method in worker control

    In my data palette, I added a worker control to a JPF file. I can see the getTaskInfo() method but it is missing the getTaskInfos() method. Why can't I see the getTaskInfos()? I just downloaded the latest version of the platform a few weeks ago, so I

  • Addition of field to field catalog in order to create condition table

    hi,    I need to add field to SAP 5.0 Field Catalog to allow for creation of custom Condition Table. A field named “Serial no. profile”  exists in SAP 4.6c. The equivalent should be added or created in the SAP 5.0 Field Catalog. How do i do this. Plz

  • Aurora updated to 35.0a2 (x86 en-US) and I lost all the passwords in Save Password Editor

    The computer is used for my office and Mozilla was set to automatically update. Prior to the update earlier today, I looked into Save Password Editor 2.8.1. Later, after Aurora updated to 35.0a2, the add on (Save Password Editor) did not exist. I dow