If statment in sap script

hi,
IF ( &STAX3& = '4.00' OR &STAX3& = '12.50' )
XXXXXX,,  ,,&text3& &STAX1&%   ,,,,  &TOT_STAX1(C.0)&
XXXXXX,,  ,,&text3& &STAX2&%   ,,,,  &TOT_STAX2(C.0)&
,,,,&text51&,,,,&tot_tcost&
,,,,,,,,&TOT_FINAL(C.0)&
ELSE
XXXXXX,,  ,,&text3& &STAX&%   ,,,,  &TOT_STAX(C.0)&
,,,,&text51&,,,,&tot_tcost&
,,,,,,,,&TOT_FINAL(C.0)&
ENDIF
i am using this code.
i have one doubt in if statment we can use this syntax
IF ( &STAX3& = '4.00' OR &STAX3& = '12.50' )
this is correct or not.
if i use this code if statment is not excuting.
pls clarify my doubt.

Hi Venkat,
Usually we'll write all the logical ABAP statements in Subroutine pool, instead of writing them in the script form directly.
Use PERFORM statement in the script form as shown below & write the code u want in that....
/:   PERFORM GET_MERCANTIL IN PROGRAM cust_invoice
/:   USING &RKWA-BUKRS&
/:   USING &RKWA-LIFNR&
/:   USING &BKPF-GJAHR&
/:   CHANGING &V_MERCANTIL&
/:   ENDPERFORM
GT   Insc.Reg.Mercantil    &V_MERCANTIL&
GT is the paragraph format.
Go to SE38 & create the program,cust_invoice ( called as Subroutine pool ) & write the FORMs in that....
U can use the normal ABAP coding in that....
Hope this will work.
Try this out & let me know if there are any issues.
Reward points, if useful.
Pavan.

Similar Messages

  • PROTECT-ENDPROTECT problem in SAP Script

    In SAP Script MAIN Window I have 10 different elements to print differet stuff related with each delivery line item.
    Like Material Number
    Material Description
    Long text [Has formatted text and I am reading that text and printed in some format some lines under material number and some under materail desc.]
    and other information required by client.
    Loop at Delivery item table.
    CALL FUNCTION 'CONTROL_FORM'
           EXPORTING
                command = 'PROTECT'.
    Print differnt elements.
    Loop at lond text internal table.
    print in proper format as I mentioned.
    endloop.
      CALL FUNCTION 'CONTROL_FORM'
           EXPORTING
                command = 'ENDPROTECT'.
    ENDLOOP.
    My problem is PROTECT ENDPROTECT is not working properly.
    It is printing only 1 item with other info on first page as there are enough space left to print minimum three items with details.
    on next page it is priting only 3-4 items as there are enough sapce to ptint at lease 10 items with details.
    The only good thing is it is not spliting the Item details and other text.[Main window on next page has bigger size]
    Any idea why PROTECT - ENDPOTECT not behaving properly.
    Thanks
    Aman
    Message was edited by: Amandeep  Singh

    Hello,
    Try to do like, Put PROTECT and ENDPROTECT in the SAPScript itself.
    Like
    Element 1
    Protect
    ..matnr....
    element 2
    ...desc....
    element 3 (long text)
    ...text
    ....text
    element 4
    endprotect
    call the element 4 in the loop statment, whenever required.
    Hope it will work.
    Regards,
    Naimesh.

  • Problem in SAP-Script Conditional Block

    Hi All,
    I am creating one report form using SAP Script, which uses standard driver program. There is a control statement like,
    { Consider W=1, X=0 , Y=0 & Z=0 }
    /: IF ((X==0 AND Y==0) OR (Z==0 OR W==0)  OR ...) { lot of OR & AND stament used in this conditional statment }
    /: ELSE
    /: ENDIF
    Here is a mistery, it executes both if and else statement. Please give me some idea on this, and why such a weird output is displaying?
    <<removed by moderator>>
    Edited by: kishan P on Sep 13, 2010 4:17 PM

    Hi..
    The syntax of the command could be incorrect. Check for full stops, variables etc.
    http://help.sap.com/saphelp_40b/helpdata/en/d1/80325f454211d189710000e8322d00/content.htm
    Please check the above link's last paragraph which says :
    "If a syntax error occurs in the interpretation of this command, then the command is not executed. This may have an unexpected effect on the subsequent text output. For example, if the IF statement is incorrect, then all following ELSEIF and ELSE commands will be ignored, since the opening IF command is u2018missingu2019. This will cause all the text lines attached to the ELSEIF and ELSE commands to be printed."
    Regards,
    Karthik

  • ATR labels any stanard forms or sap script

    hi guys,
    actually i got one object for forms. the objectname ATR lables can you any one help to me is there any standard smart forms and print programs for the ATR lables.
    please send me a mail to [email protected]
    thanks and regards, 
    shrikrishna.

    Hi,
    In a warehouse we have lot of activities like GOORS RECEIPT, PUTAWAY, PICK SCAN, LOAD SCAN etc.,Generally all the warehouses use somekind of scanners which connect to SAP CONSOLE. You have to findout which type of scanner they are using to scan a material. There are lot of 3rd party scanners available which connect to SAP CONCOLE. These SCanars generate a barcode and will store in some tables of SAP. Example for Material they will put the barcode number in long text field. If they are not using any scanners then there is a BAPI called barcode_generate(goto SE37 put barcode and press F4) which generates a barcode.
    You need to write a program and call the BAPI, this BAPI generates some RANDOM NUMBER and store this number in a table where you want to store. Find what type of output they want, if they want somthing like a statment with company logo then write a sap script or a smartform  and call the same in a program. This will solve your problem.
    Before starting the desing, ask your self followig questions.
    1) How they scan in WM? they have any scanners, if so how it is operating.
    2) Is the barcodes generated by scanner or they need SAP to generate the barcodes.
    3) If 3rd party scanner generates the barcodes then what is the format?
    4)How this scanners are connected to SAP
    I worked in a warehouse project where they have a scanners which connect to SAP console and generate barcodes. Based on that sap system automatically creates a material and also like create transfer orders, transfer requests etc.
    some Warehouses just scan the material, then it triggers  ZTRANSACTION OR a ZPROGRAM which uses a BAPI , this BAPI creates a barcode and the program stores this barcode in one of the master table and also this ZPROGRAM triggers a SAP SCRIPT or SMART FORM which collect this barcode and other details and print it in a desired format with company logo etc.,
    Thanks&Regards,
    -Suresh revuru

  • If Statement in SAP Scripts

    Hi All,
    I have written the below If statement in  SAP scripts but when i execute the same the controll doent check the second line entries. If firtst line doesnot satisfy it goes to the else part. Kindly suggest what is wrong in this..
    /:           IF &T156T-BWART& = '321' OR &T156T-BWART& = '322' OR
    /:           &T156T-BWART& = '349' OR &T156T-BWART& = '350' OR
    /:           &T156T-BWART& = '312' OR &T156T-BWART& = '326' OR
    /:           &T156T-BWART& = '343' OR &T156T-BWART& = '344'.
    /:           ELSE
    /:           ENDIF.

    Hi neha,
    Try to use the '/E' fo rnext line
    /E->Extended line
    Here is a code:
    /: IF &T156T-BWART& = '321' OR &T156T-BWART& = '322' OR
    /E  &T156T-BWART& = '349' OR &T156T-BWART& = '350' OR
    /E  &T156T-BWART& = '312' OR &T156T-BWART& = '326' OR
    /E &T156T-BWART& = '343' OR &T156T-BWART& = '344'.
    /: ELSE
    /: ENDIF.
    Hope this helps you.
    Regards,
    Rajani

  • 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 the text in points wise in sap script

    hi friends,
    how to print the text in points wise in sap script.
    ex: if suppose paragraph consists of 15 lines. then according to one sentence or one fullstop (.) it should give point 1. like that...
    1. hai how ru.
    2. what r  u doing.
    3.where r u.
    like this i want numbering.. waiting for ur replys.
    thanks,
    kiran

    declare a counter
    data : cnt type char 4.
    print :
    cnt = cnt + 1.
    &cnt& &text&
    cnt = cnt + 1. and so on.
    or.
    if the data is in an internal table
    loop at internal_table.
    cnt = cnt + 1.
    write form.
    in script -&cnt& &text&
    endloop.
    Edited by: NIKHILKUMAR POOJARI on Nov 17, 2008 11:18 AM

  • 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   !@#$%^&*( )

  • In SAP Script how to hard code my Company address in footer window

    Hi All ,
    In SAP Script how to hard code my Company address in footer window .
    Ex : in YB_F140_ACC_STAT this script i want to keep my company address, i want to hard coad , i dont want to use any field from table.
    Please give me step by step.
    Thanks
    Sridhar

    Hi,
    You can make use of standard text...
    create a standard text in SO10 with your company address
    and in the footer window of your script.. use include text and provide the name of the standard text you created in SO10.
    In the text editor... goto insert > text> standard
    You get popup give the name of the text name id and language
    regards
    padma

  • What is the diff b/w Sap Scripts and Smart Forms

    Hi,
          Whats the diff b/w SAP Scripts and Smart Forms..
             I need the internal explanation for both Smart Forms and SAP Scripts mean when we execute what happens whether Print Program r Forms starts execution 1st  and SIMILARLY FOR SMARTFORMS WHETHER FM'S  R FORMS.
    Thanks & Regards,
    Gopi.

    Hi
    Difference with SMARTFORMS vs. SapScript(SE71)
    The Following are the differences :-
    a) Multiple page formats are possible in smartforms which is not the case in SAPScripts
    b) It is possible to have a smartform without a main window .
    c) Labels cannot be created in smartforms.
    d) Routines can be written in smartforms tool.
    e) Smartforms generates a function module when activated.
    f) Unlike sapscripts (RSTXSCRP), you cannot upload/download Smartform to your local harddisk.
    It was said that it was provided in CRM 3.0 version, but not available in R/3. You can download smartforms into Local PC in a XML format. In the same way you can upload this XML format into Smartform. From the smartform editor itself you can call download option, if you are working in CRM 3.0 environment.
    In R3 also, you can download into XML format. However, it's not sure about uploading. Refer to the program 'SF_XSF_DEMO'.
    In 4.7 Enterprise, other have seen this utlity which is completey missing in 4.6c. There is functionality to downlaod a complete form or only a particular node. (Utilities -> Download form). It will create a XML file and save it in the hard disk.
    For others, if you want to download/upload the Smartforms source, you will need the help from the Basis people. What you can do is to create a Transport and then FTP down to your local harddisk. When you need the Smartform source in another system, you have FTP up the Smartforms file back to the SAP server. Finally, the Basis team, will tp it into your system.
    g) The protect and endprotect command in sapscript doesn't work with smartforms. For example on a invoice: First data of position no 80. is printed on page one, other data of position no 80 is printed on page 2. And there's nothing you can do about it. Actually, there is something you can do about it. By using a folder node and checking the 'protect' checkbox, everything in that folder will be page protected.
    check out this link:
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    Reward points if helpful.
    Regards,
    Swathi.

  • SAP SCRIPT code problem

    521
    - Heading for trans. w/out sp.G/L indicators (item sorting method 2)-
    Transactions without special G/L indicators
    522
    - Heading for trans. with sp.G/L indicators (item sorting method 2)-
    &T074T-LTEXT&
    523
    - Heading for open item list of line items -
    &ULINE(71)&
    <K>Invoice No,,Reference.,,Inv.Date,,                   Due date,,,,
                 Balance</>
    &ULINE(71)&
    PERFORM GET_DATE IN PROGRAM ZREPORT
    USING &BSID-BELNR&
    CHANGING &S_DATE&
    ENDPERFORM.
                                                                                    530
    - Line items    Customer open items -
    &BSID-BELNR&,,&RF140-BELEGNUM&,,&BSID-BLDAT&,,&S_DATE&,,
    FORM get_date tables
            int_cond structure itcsy
            outt_cond structure itcsy.
    BREAK SNAGI.
    tables : bseg.
    data : w_belnr type ITCSY-value.
    DATA due_date TYPE rfpos-faedt.
    READ TABLE OUTT_COND WITH KEY name = 'S_DATE'.
      IF sy-subrc = 0.
        outt_cond-value = S_itab11.
        MODIFY outt_cond INDEX sy-tabix.
       ENDIF.
    SELECT SINGLE
    shkzg zfbdt zbd1t zbd2t zbd3t rebzg
    FROM bseg
    INTO CORRESPONDING FIELDS OF bseg
    WHERE
    *bukrs = bukrs AND
    belnr = int_cond-value.
    *AND vbeln = belnr.
    CALL FUNCTION 'NET_DUE_DATE_GET'
    EXPORTING
    i_zfbdt = bseg-zfbdt
    i_zbd1t = bseg-zbd1t
    i_zbd2t = bseg-zbd2t
    i_zbd3t = bseg-zbd3t
    i_shkzg = bseg-shkzg
    i_rebzg = bseg-rebzg
    I_KOART = 'D'
    IMPORTING
    e_faedt = due_date.
    outt_cond-value = due_date.
    MODIFY outt_cond INDEX sy-tabix.
    ENDFORM.
    Now the problem is that,it is int_cond-value is always picking up the first invoice number.
    and the net due date is always same for all invoices..?
    should I loop in the sap script or in the form..?

    Solved my self.
    just placing the perform and endform in 530

  • Use of IF statement in SAP Scripts

    Can u tell me how to use IF statement in SAP Scripts.
    The problem is
    if &sy-tabix& eq '1'
    total
    else
    total1.
    endif.
    this sy-tabix is not working

    i think sy-tabix will not work here....
    do like this..
    data : vtabix type i.
    loop at itab.
    vtabix = sy-tabix.
    write_form...for the text element..
    endloop.
    in form layout
    /: if &vtabix(c)& eq 1
    /:endif
    regards
    shiba dutta

  • Internal table in sap script

    Hello All ,
    I  have got a internal table with tracking numbers and I want to print all the numbers in that internal table on sap script.
    Please advise.
    Thanks
    Moderator message:  please search for available information before asking.
    locked by: Thomas Zloch on Sep 13, 2010 1:09 PM

    Hi,
    You can create a sub-routine and pass all the table entries in variables and then you can print them.

  • In sap scripts how to display the driver program

    Hi,
        I Want to know the sap scripts How to display the output to driver program

    Hi,
    Go to NACE Transaction.
    Select application for ex: if sales V1.
    Click on output types.
    Select the output type for ex : BA00
    Double click on Processing routines.
    There you can find the Driver Program name and Script/smart form name.
    Reward if useful.
    Thanks,
    Raju

  • In SAP Scripts How to write the fields 90  Degrees to regular format

    Hi ,
    I am working with SAP Scripts . Sometimes you may want to print text vertically.
    I have got a requiremnt in which there we have to write some data which is to be written 90 degres to regular output.
    please let me know if there is any printer setting for that .
    Regards.
    Rohit.

    Dear friend,
    For printing the text verticaly you need to made a
    print controle at printer level.
    select a command and in that you have to go in tab general
    attribute.
    and in front of :Include Printer Control: give the z print controle.
    in my company basis people had made one print controle
    ZR090.
    YOU have to use this command two times between
    the text .
    first command will move the printer at 90 degree and then
    write the text and second will move back to horizental.
    I dont know how this ZR090 can be made.
    rest wht i have written is very true and currently working.
    hope this will solve your problem.
    rewards are expected.
    Thanks and Regards
    vivek kumar srivastava

Maybe you are looking for

  • Links default to wrong folder

    Why is it when I go to relink a placed image in the Links pallette it always directs me to the wrong folder (not the one the image lives in but elsewhere). I believe that it is taken me to the last folder I navigated to. thoughts?

  • How do I sort clips in the Project panel library (bin) alphabetically by file name?

    Two questions: How do I sort clip thumbnails in the Project Panel library (bin) alphabetically by file name? How do I "select" a group of 25 consecutive clips on the time line to form a group without having to click on each individual clip one at a t

  • [Solved] Overheating/fan/sensors issues after kernel updates

    Hi all, I realise there has been a bit of correspondence on this already.  I'm after some advice for my specific situation: 1. My laptop is an acer aspire 5315.  I has well understood overheating issues that arrise due to BIOS problems 2. Fan control

  • FUnction Module to Calculate future date after 'x' years

    Hi Gurus, Can anyone tell me the Standard Function Module which will take today's date as i/p & return the date after 10 years. e.g say input date is 18.05.2010 & input year is 10.              output = 17.05.2020 Regards, Rohit.

  • Is it possible to use Deliverable GUID in a MS Project Formula?

    Is it possible to reference Deliverable GUID in a MS Project Formula?  I created a formula and it appears that the formula is not processing the field.  I then tried to see if I could just get a formula in a generic text field to spit out the Deliver