How to declare variable in the scipt

data is coming from standard program .
rf140-stida key entry date.
bsik-bldat posting date
i want to display difference between  rf140-stida and bsik-bldat in scipt form it will give number of days.
how can i declare variables for this.
how to write code in my form.

Hi
U need to create a routine to calculate the difference:
/: DEFINE &DELTA& = SPACE
/: PERFORM <FORM NAME> IN PROGRAM <PROGRAN NAME>
/: USING &RF140-STIDA&
/: USING &BSIK-BLDAT&
/: CHANGING &DELTA&
&DELTA&
The routine has to be defined in your Z-PROGRAM and to have these interface:
FORM <FORM NAME>  TABLES IN_TAB_EM     STRUCTURE ITCSY
                                                   OUT_TAB_EM STRUCTURE ITCSY.
  DATA: DELTA TYPE I.
  DATA: DATE1 LIKE SY-DATUM,
             DATE2 LIKE SY-DATUM.
* ---> Rembember the date has the ouput format, so it has to be converted in the
* input format
  READ TABLE  IN_TAB_EM WITH KEY NAME = 'RF140-STIDA'.
  IF SY-SUBRC = 0.
     DATE1(4)     = IN_TAB_EM-VALUE+6(4).
     DATE1+4(2) = IN_TAB_EM-VALUE+3(2).
     DATE1+6(2) = IN_TAB_EM-VALUE(2). 
  ENDIF.
  READ TABLE  IN_TAB_EM WITH KEY NAME = 'BSIK-BLDAT'.
  IF SY-SUBRC = 0.
     DATE2(4)     = IN_TAB_EM-VALUE+6(4).
     DATE2+4(2) = IN_TAB_EM-VALUE+3(2).
     DATE2+6(2) = IN_TAB_EM-VALUE(2). 
  ENDIF.
  DELTA = DATE1 - DATE2.
  READ TABLE  OUT_TAB_EM WITH KEY NAME = 'DELTA'.
  IF SY-SUBRC = 0.
     WRITE DELTA TO OUT_TAB_EM-VALUE.
     MODIFY OUT_TAB_EM INDEX SY-TABIX.
  ENDIF.
ENDFORM.
Max

Similar Messages

  • How to declare variables in the script

    My total data is coming from standard print  program.
    i copied standard form into zform.
    i am dispaying regup-skfbt and regud-wrshb in my layout set.
    now i want to deduct regup-skfbt and regud-wrshb and display in layout set only.
    for the above issue how to solve.

    Hiiii
    write the subroutine in the layout
    ex: perform (performname) in program(program name)
         using (regup-skfbt )
         changing(regup-skfbt )
    goto se38 in the attributes types select the subroutine pool
    in tht write as follows:
    form <perform name> using in_par
                                    changing out_par
    read table in_par index 1.
    write ur code depends on ur business process
    modify out_par index sy-tabix.
    endform
    reward points if useful
    regards
    Jaipal

  • How to declare variables in standard text  - so10 t.code

    Hello Friends,
             How to declare variables in standard text  - so10 t.code? Your response will be appreciated much.
    Thanks
    Sri

    For Script & Smartform  Text - &VAR&

  • How to include variable in the text column in report painter?

    Dear Expert,
    Would like to seek for your help to include How to include variable in the text column in report painter?Please advice.
    Thank you.
    Regards,
    Karen
    Edited by: Karen Swee Ping Ho on Jun 17, 2011 2:48 AM

    Hi,
    Thank you for the promt reply.
    1) How I include the variable in the column header to display fiscal year which I have selected from the selection screen?
    which variable should i use?
    2) Where can i find more information about the characteristic and which variable to be use base on the characteristic?
    For example: I would like to display the fiscal year from the selection screen/input screen when execute the report which also will reflected to the element definition and will display the fiscal year also in the column text?
    3) Kindly advise base on question 2, the variable that i use in element definition it will also display  in selection screen?
    4) When execute the report the first selection screen input parameter it obtain from where it is from element definition?
    5) Please advice how to be done when report execute with first screen input selection will also reflect the element definition of column and rom with the selection of the fiscal year?
    Please help.
    many thanks
    Edited by: KH on Jun 18, 2011 7:18 AM

  • How to create Variables for the Key Figures

    Hi All,
    How to create Variables for the Key Figures
    Thanks
    Bhaskar

    Hi,
    It is not possible to create the variables on Key figures directly. But we can create a formula variable with processing type 'User Entry' ,SO that the user entered value can be used in the calculations of the query.
    With rgds,
    Anil Kumar Sharma .P

  • How create a variable in the TVARVC that calculate the last week

    Hi Gurus,
    i need create a Variable in the table TVARVC that calculate which was the last week to run a Program in BW,  i have no idea how can i do it, where do i must start? please can you tell me step by step, i will really appreciate it

    This blog should help you create a variable in TVARVC table:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9075b11a-6e43-2c10-b7be-cfa0e97ec0cc?quicklink=index&overridelayout=true
    you can leave out the information broadcasting part. But can you elaborate what exactly is the requirement.

  • How to declare variable Forms Personalization

    Hi
    I want to use a variable in a form to assign it to a procedure which I am calling in the form itself?
    How can i define such a variable
    I wanted to use global variable but i read somewhere global variable can only be used when passing parameters between several forms
    so is there any other way?

    Hi,
    Is your procedure a database procedure or attached as a library to the Form? If its in the database, you cannot use a global variable - however, if its attached to the form itself, yes, you can define a global variable and refer it in the procedure. (Its preferable to initialize such a variable in the WHEN-NEW-FORM-INSTANCE trigger to avoid any issues arising out of transactional problems).
    Rgds,
    Rakesh.

  • How to declare webservice in the application's xml file

    Hi
    Is there a way by which we can declare webservice in the application's xml file.if yes how..?
    please help

    I'm no expert, but I find that if you generate Java from a WSDL, the resulting code is fairly ugly and difficult to control. (Similarly, if you generate a WSDL from a Java class, the WSDL is pretty ugly).
    One way to encode "contants" in a WSDL is in a referenced schema, using an enumeration restriction, viz:
          <simpleType name="SuccessCode">
            <restriction base="string">
              <enumeration value="FAILURE"/>
              <enumeration value="SUCCESS"/>
            </restriction>
          </simpleType>Now, that would result in an enumeration-style class in your generated source. That's the best I can think of, others may be able to suggest something better. If you wrap the web service in an adapter that hides its ugliness, maybe you can map the constants across there.
    Like I say, I'm far from an expert, these are just my first thoughts.
    -Tim

  • How to use variable in the LIKE function along with % operators

    Hi,
    Is there any way i can use the variable in the Like function. That means i have query like
    SELECT * FROM Device WHERE DeviceName LIKE %v_MediaName%;
    Here "v_MediaName" is the userdefined variable which contains string. I want to retrieve all the records from the "DEVICE" table whose DeviceName LIKE %v_MediaName%;
    If i put it in a single quotes '%v_MediaName%' then the v_MediaName will be treaded as a string instead of a variable. I am using this query in a Procedure.
    please help me out to resolve the issue.
    thanks

    LIKE '%'||v_MediaName||'%';
    Will not make use of the indexes though.
    Message was edited by:
    satishkandi

  • How to declare variable for Table type in the ABAP Editor

    Hi!
    I have Table Type 'FIELDNAME_TAB' (Table of fieldnames). I want to pass the list of fieldnames to this Table Type in the ABAP Editor.
    Can anyone help me in this?

    You would declare the internal table like so.
    data: itab type FIELDNAME_TAB.
    data: wa like line of itab.
    wa = 'This_value'.
    append wa to itab.
    Regards.
    Rich Heilman
    Message was edited by:
            Rich Heilman

  • How to declare variable in an application

    I want to declare a pl sql variable in an application(form, report...)without editing the package code.
    Thanks
    null

    Thanks for information.
    Actually still I have a doubt which one is the best. And which way is the easiest way. Can you give a more explanation for me.
    I start to read about Log4J, and here is one of link I refer.
    [http://supportweb.cs.bham.ac.uk/docs/tutorials/docsystem/build/tutorials/log4j/log4j.html]
    My question on that is, on a text file I can do it, on Windows. But in Linux, Mac and so on. Please instruct me. I've never done such things before.

  • How to declare variable in solution file for use in project files.

    Hi Folks,
    Apologies if this is not the right place to ask, but I would like to declare a variable in my solution file that can used by all of the projects (prof files) in that solution.
    More specifically in the project files, references are stored using relative paths which cause issues if they don't exist. I would like to replace the relative paths with a variable set in the solution file that can easily be changed when the solution is
    built in a different location.
    So I would like to replace "../../../SomeProject"  with "$(SomeLocation)/SomeProject"  but set the $(SomeLocation) in the solution file.
    Regards
    Andy

    Hello Andy,
    Here is a common sln file:
    Microsoft Visual Studio Solution File, Format Version 12.00
    # Visual Studio 2013
    VisualStudioVersion = 12.0.30723.0
    MinimumVisualStudioVersion = 10.0.40219.1
    Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wpf_EntityFramework", "wpf_EntityFramework\wpf_EntityFramework.csproj", "{A282940A-5F76-4FF8-9568-8B7D14133259}"
    EndProject
    Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
    Debug|Any CPU = Debug|Any CPU
    Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
    {A282940A-5F76-4FF8-9568-8B7D14133259}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    {A282940A-5F76-4FF8-9568-8B7D14133259}.Debug|Any CPU.Build.0 = Debug|Any CPU
    {A282940A-5F76-4FF8-9568-8B7D14133259}.Release|Any CPU.ActiveCfg = Release|Any CPU
    {A282940A-5F76-4FF8-9568-8B7D14133259}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
    HideSolutionNode = FALSE
    EndGlobalSection
    EndGlobal
    And the Global Interface in the solution file is actually used for Visual Stuido add-ins. To know details, please read the following MSDN article:
    1. Persisting Information in Projects and Solutions
    Here you can find "If the Globals object is associated with the
    Solution2 object, then the value persists in the .sln file. These values are persisted when the solution file is saved."
    2.
    Solution2 Interface
    It's about the solution interface.
    As you can see although they may save something to your solution file, it is not intended for you to use it in your project.
    What's your projec type and can you alter to use some common ways?
    For example:
    1. If it is in project level, set your value public so that all classes can access the value.
    2. Or you can choose to create a xml/text file or any file that you can read by code, and then read the value out from that file.
    It will be much better than thinking about set value in the solution file.
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to use variables in the mail text while sending mails through workflows

    Dear All,
                   I had prepared a workflow in which i am sending mail to a administrator if personnel data of any employee is changed.But i want to send the personnel no of employee whose data have been changed.How can i send this personnel no in the mail.
                  Points will be rewarded for useful answer.

    Hi Anand,
    You have the "EmployeeNumber" field in the event container. Pass this into the workflow container by defining a Workflow Container element and subsequently use this container as a variable in your email using insert fields option and you will have the PersonNumber visible in your mail sent to the administrator.
    Regards,
    Karthik

  • How to pass variable in the place of numeric value?

    Hi,
    my requirement is i want to validate the selection screen block width.
    I have created tabbed selection screen.
    i need in which variable tab lengh values will be stored
    ex:-
    selection-screen: begin of tabbed block MYTAB for 10 lines,
                      TAB (20) button1 USER-COMMAND push1,
                      TAB (20) button2 USER-COMMAND push2,
    end of block MYTAB.
    here in the above code i want to pass variable instead of directly numeric value as 10.
    because based on some conditions i want to change the number of lines.
    how to do this...plz urgent, i will give all the points to anybody who given good answer.
    Thanks in Advance,
    venkat n

    Hi!
    And that's why God created macros.
    DEFINE seltab.
    selection-screen: begin of tabbed block MYTAB for &1 lines,
    TAB (20) button1 USER-COMMAND push1,
    TAB (20) button2 USER-COMMAND push2,
    end of block MYTAB.
    END-OF-DEFINITION.
    DATA: lv_lines TYPE i VALUE 10.
    seltab lv_lines.
    Regards
    Tamá

  • How can a  variable display the first character that's on the page?

    I'm creating a telephone directory and want each page to display the alphabet of the first listing on the page on the top - only one character.
    Can you tell me how to do this?

    Hmmmmm, seems I was wrong about the GREP styles. I just tried it and they don't get picked up. I consider that a bug, but it's probably "as designed."
    That leaves you having to work with nested styles only, or Find/Change. I think what you'll need to do is redefine the Paragraph style so it has two nested styles that apply the correct style to whatever needs to be styled at the start of the paragraph, one for the first character and the second for the rest of the word(s) if you can figure out a trigger (can InData add an end nested style character or is thew some punctuation you can use?), then find/change to remove the applied character style. For that I'd serach for ^.+ with the find format set to the character style that InData applied and the chane format set to [None], which will only remove it from the beginning of your paragraphs. If this is done correctly there will be no change in appearance since the redefined paragraph style will do the formatting.
    If that won't work, you can use find/change to apply a new style to the first characters. Search for ^. and set the change format to the new character style that you'll use in the variable. It needs to have the same attributes as the style applied by InData or the appearance will change.
    The second method is probably easier since you don't need to redfine the paragraph style, but both methods require you to use find/change to alter the text, which means if more text is added you'll need to re-do the find/change. Not a big deal, but don't forget. I'd be tempted to wait until the last minute and just ignore the headers for the moment, if editing is ongoing. I'd also test this on a copy of the file for safety.

Maybe you are looking for

  • How to collect other mac

    I'm using new iMac 27". I have Wifi and lan cable. How to collect other computer (Mac Os 10 and 9, PC win 7, XP)

  • How do I get my contacts off my old phone onto my new?

    Just got a new iphone 5 and I cant get my contacts onto the phone. I did it, but somehow they all got erased. waaaah!!!

  • HELP ON ERROR 1324 PLEASE??????????????????

    Can Somebody Please Help me??? Recently i've been away from the computer that holds all my ipod information.. my first mistake.. Of course somebody went playing with settings and driver charachters.. A new usb hub (multiple connections) has been conn

  • Mini not starting up after auto firmware update

    The software update program suggested an upload of a new firmware. The software update concluded and I was advised that the system needed to restart. The system shutdown but during restart did not progress beyond the apple icon and the little rotatin

  • Oracle apps directory structure

    Hi, I am currently studying the Oracle Apps system admin self study cds.... But there is no mention of the following Environment Files and Oracle Applications File System Could someone provide me with information or document regarding Product Directo