How to create SAPScript program? step-by-step process?

Hi everybody
Can anybody please provide some information on how to create SAP Script program?
Please provide step-by-step process if possible as examples given in abap certification program
thanks

Hi
here is the sample program for SAP SCRIPTS
*& Report  ZHMR_POANNEX                                                *
     MODULE Materials Management
      Objective :Calling program for ANNEXURE FOR P.O
      text ................................................
      text ................................................
      text ................................................
REPORT  ZHMR_POANNEX                            .
TABLES :EKKO,STXH.
PARAMETERS
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE text-001.
PARAMETERS : P_EBELN LIKE EKKO-EBELN.
SELECTION-SCREEN END OF BLOCK BLK.
DATA DECLARATION
DATA : V_LIFNR LIKE EKKO-LIFNR,
       V_AEDAT LIKE EKKO-AEDAT,
       V_NAME  LIKE LFA1-NAME1,
       V_ADRNR LIKE LFA1-ADRNR,
       V_BSTYP LIKE EKKO-BSTYP.
DATA : BEGIN OF IT_ADRC OCCURS 0,
       NAME1  LIKE ADRC-NAME1,
       STREET LIKE ADRC-STREET,
       CITY1  LIKE ADRC-CITY1,
       POST_CODE1 LIKE ADRC-POST_CODE1,
       COUNTRY LIKE ADRC-COUNTRY,
       END OF IT_ADRC.
DATA : IT_TEXT LIKE TLINE OCCURS 0 WITH HEADER LINE,
       IT_NOTE LIKE TLINE OCCURS 0 WITH HEADER LINE,
       IT_DEL  LIKE TLINE OCCURS 0 WITH HEADER LINE,
       IT_SHIP LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA : V_ID  LIKE THEAD-TDID ,
       V_LAN LIKE THEAD-TDSPRAS,
       V_NAME1 LIKE THEAD-TDNAME ,
       V_OBJ LIKE THEAD-TDOBJECT VALUE 'EKKO',
       N1 TYPE I,N2 TYPE I,N3 TYPE I ,N4 TYPE I.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT         = P_EBELN
IMPORTING
   OUTPUT        = P_EBELN.
TO GET VENDOR NAME ,,PO DATE
SELECT SINGLE
             LIFNR
             AEDAT
             BSTYP
             FROM EKKO
             INTO (V_LIFNR, V_AEDAT,V_BSTYP)
             WHERE EBELN EQ P_EBELN.
IF SY-SUBRC EQ 0.
SELECT SINGLE NAME1 ADRNR
              FROM LFA1
              INTO (V_NAME,V_ADRNR)
              WHERE LIFNR EQ V_LIFNR.
  IF SY-SUBRC EQ 0.
SELECT NAME1
        STREET
        CITY1
        POST_CODE1
        COUNTRY
        FROM ADRC
        INTO CORRESPONDING FIELDS OF TABLE IT_ADRC
        WHERE ADDRNUMBER EQ V_ADRNR.
IF SY-SUBRC NE 0.
ENDIF.
  ENDIF.
ENDIF.
*TO GET HEADER TEXT
  IF V_BSTYP = 'L'.
    V_ID = 'L01'.
  ELSEIF V_BSTYP = 'F'.
    V_ID = 'F01'.
  ENDIF.
  V_NAME1 = P_EBELN.
SELECT SINGLE TDID INTO V_ID FROM STXH WHERE TDOBJECT EQ V_OBJ AND
                                  TDNAME EQ V_NAME1 AND
                                  TDID EQ V_ID .
  IF SY-SUBRC EQ 0.
CALL FUNCTION 'READ_TEXT'
  EXPORTING
   CLIENT                        = SY-MANDT
    ID                            = V_ID
    LANGUAGE                      = SY-LANGU
    NAME                          = V_NAME1
    OBJECT                        = V_OBJ
  TABLES
    LINES                         = IT_TEXT.
ENDIF.
*TO GET HEADER NOTE
  IF V_BSTYP = 'L'.
    V_ID = 'L02'.
  ELSEIF V_BSTYP = 'F'.
    V_ID = 'F02'.
  ENDIF.
SELECT SINGLE TDID INTO V_ID FROM STXH WHERE TDOBJECT EQ V_OBJ AND
                                  TDNAME EQ V_NAME1 AND
                                  TDID EQ V_ID .
  IF SY-SUBRC EQ 0.
CALL FUNCTION 'READ_TEXT'
  EXPORTING
   CLIENT                        = SY-MANDT
    ID                            = V_ID
    LANGUAGE                      = SY-LANGU
    NAME                          = V_NAME1
    OBJECT                        = V_OBJ
  TABLES
    LINES                         = IT_NOTE.
ENDIF.
*TO GET TERMS OF DELIVERY
  IF V_BSTYP = 'L'.
    V_ID = 'L05'.
  ELSEIF V_BSTYP = 'F'.
    V_ID = 'F05'.
  ENDIF.
SELECT SINGLE TDID INTO V_ID FROM STXH WHERE TDOBJECT EQ V_OBJ AND
                                  TDNAME EQ V_NAME1 AND
                                  TDID EQ V_ID .
  IF SY-SUBRC EQ 0.
CALL FUNCTION 'READ_TEXT'
  EXPORTING
   CLIENT                        = SY-MANDT
    ID                            = V_ID
    LANGUAGE                      = SY-LANGU
    NAME                          = V_NAME1
    OBJECT                        = V_OBJ
  TABLES
    LINES                         = IT_DEL.
ENDIF.
*TO GET SHIPPING INSTRUCTIONS
IF V_BSTYP = 'L'.
    V_ID = 'L06'.
  ELSEIF V_BSTYP = 'F'.
    V_ID = 'F06'.
  ENDIF.
SELECT SINGLE TDID INTO V_ID FROM STXH WHERE TDOBJECT EQ V_OBJ AND
                                  TDNAME EQ V_NAME1 AND
                                  TDID EQ V_ID .
  IF SY-SUBRC EQ 0.
CALL FUNCTION 'READ_TEXT'
  EXPORTING
   CLIENT                        = SY-MANDT
    ID                            = V_ID
    LANGUAGE                      = SY-LANGU
    NAME                          = V_NAME1
    OBJECT                        = V_OBJ
  TABLES
    LINES                         = IT_SHIP.
ENDIF.
OPEN FORM
DESCRIBE TABLE IT_TEXT LINES N1.
DESCRIBE TABLE IT_NOTE LINES N2.
DESCRIBE TABLE IT_DEL LINES N3.
DESCRIBE TABLE IT_SHIP LINES N4.
IF NOT ( N1 = 0 AND N2 = 0 AND N3 = 0 AND N4 = 0 ).
CALL FUNCTION 'OPEN_FORM'
EXPORTING
   FORM                              = 'ZHML001_POANNEX'
   LANGUAGE                          = SY-LANGU.
else.
message 'For This P.O no annexure is maintained.' type 'I'.
endif.
WRITE FORM
LOOP AT IT_ADRC.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
   ELEMENT                        = 'HEADER'
   WINDOW                         = 'HEADER'.
ENDLOOP.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
   ELEMENT                        = 'FOTTER'
   WINDOW                         = 'FOTTER'.
IF NOT IT_TEXT[] IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
   ELEMENT                        = 'TEXT1'
   WINDOW                         = 'MAIN'.
LOOP AT IT_TEXT.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
   ELEMENT                        = 'TEXT'
   WINDOW                         = 'MAIN'.
ENDLOOP.
ENDIF.
IF NOT IT_NOTE[] IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
   ELEMENT                        = 'NOTE1'
   WINDOW                         = 'MAIN'.
LOOP AT IT_NOTE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
   ELEMENT                        = 'NOTE'
   WINDOW                         = 'MAIN'.
ENDLOOP.
ENDIF.
IF NOT IT_DEL[] IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
   ELEMENT                        = 'DEL1'
   WINDOW                         = 'MAIN'.
LOOP AT IT_DEL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
   ELEMENT                        = 'DEL'
   WINDOW                         = 'MAIN'.
ENDLOOP.
ENDIF.
IF NOT IT_SHIP[] IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
   ELEMENT                        = 'SHIP1'
   WINDOW                         = 'MAIN'.
LOOP AT IT_SHIP.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
   ELEMENT                        = 'SHIP'
   WINDOW                         = 'MAIN'.
ENDLOOP.
ENDIF.
CLOSE FORM
CALL FUNCTION 'CLOSE_FORM'.
Reward if it is helpful.
Regards,
Sangeetha.A

Similar Messages

  • How to execute sapscript programe in SAP

    hi
    i created sapscript programe i want to execute how can i do it please help me
    thanks in advanced.

    Hi,
    two ways.
    1. Simply by executing program by F8 and giving values in selection screen. You have used FMs like open_form and write_form and close_form etc. hence form will be called
    2. Form and print program will be assigned to output type in NACE transaction.
    Now this will be called when via standard transaction like VA03 -> print option and set output type
    at this time based on output type print progral will be called.
    *Hope this may give you a bit of idea.

  • HELP! PDF objects - How to create a program line object?

    Hi Experts,
    I would like to know how to create a Program lines object (icon cog wheels). I need to create additional coding inside the context tab but when I try to right click on a folder --> create -->graphic,address,text,alternative...single record... No
    program lines can be created.
    Hope someone could help me.
    Thanks,
    Jeff

    There are two ways of doing it, depending on what you want to accomplish. Both require that you edit the file ~/.bashrc (I assume you use bash)
    1) If the application places all the executable files in a given directory (let's say /opt/Application/bin/), you can access all those executables directly by simply telling your shell where to look (in the same way the shell automatically looks for executable files in eg. /usr/bin). In ~/.bashrc, you would have to add a line that looks like this:
    PATH="$PATH:/opt/Application/bin"
    2) If you just want to make a traditional "shortcut" that executes a given command, this can be done with alias. Add this command to your ~/.bashrc:
    alias shortcut="some command"
    In this case, typing shortcut into a terminal will be interpreted just like if you had typed some command instead.
    In order to try out these changes, either restart your terminal or run this command:
    source ~/.bashrc
    [EDIT]
    I was obviously beaten to it
    Last edited by Peanut (2009-05-26 23:12:47)

  • How to create a program that will accept a series of strings of 0 and 1 onl

    how to create a program that will accept a series of strings of 0 and 1 only then displays 0 as 48 and displays 1 as 49.

    Isn't one thread enough for your homework?
    http://forum.java.sun.com/thread.jspa?threadID=5253850&messageID=10051155#10051155

  • How to create a program that accepts 5 digits from the user between 0 and 9

    how to create a program that accepts 5 digits from the user between 0 and 9 then put them in ascending order using link-list method..

    You can use a scanner to get user input from the command line.
    import java.util.*;
    public class Test {
        private List<Integer> list;
        private Scanner in;
        public static void main (String... args) {
            new Test ();
        public Test () {
            list = new LinkedList<Integer> ();
            in = new Scanner (System.in);
            for (int i = 0; i < 5; i ++) {
                System.out.format ("Please enter a number (%d more): ", (5 - i));
                list.add (in.nextInt ());
            Collections.sort(list, new Comparator<Integer> () {
                public int compare (Integer i1, Integer i2) {
                    return i2 - i1;
            System.out.println (list);
    }

  • How to create function module step by step

    hi experts,
    i am new to ABAP.
    can anybody tell me the step by step process on how to create a function module for adding two numbers without using editor screen.
    ex: 2+3=5.

    Hi,
    You can only create function modules and function groups using the Function Builder in the ABAP Workbench. For further information, refer to Creating New Function Modules. This section uses an example to illustrate how a function module is created from the point of view of ABAP programming.
    Function Groups and Function Modules:
    Firstly, we create a new function group DEMO_SPFLI to hold the function module. Then, we can create the new function module.
    Parameter Interface:
    You can specify the types of interface parameters in function modules in the
    same way as the parameter interfaces of subroutines. Since function
    modules can be used anywhere in the system, their interfaces can only contain
    references to data types that are declared systemwide. These are the elementary
    ABAP data types, the systemwide generic types, such as ANY TABLE, and types
    defined in the ABAP Dictionary. You cannot use LIKE to refer to data types
    declared in the main program.
    Exceptions:
    Our function module needs an exception that it can trigger if there are no entries
    in table SPFLI that meet the selection criterion. The exception NOT_FOUND
    serves this function.
    Source Code:
    Having defined the parameter interface and exceptions, we can now write the
    source code of our function module. To do this, choose Source code in the
    Function Builder. This opens the ABAP Editor for the include program
    L<fgrp>U<xx> (see Function Groups). This is the include that will
    hold the program code for the function module;
    Data in Function Modules
    You can use the TYPES and DATA statements to create local data types and
    objects. The interface parameters also behave like local data objects. In
    addition, you can access all of the global data of the main program. This data is
    defined in the include program L<fgrp>TOP. To open this include, choose Goto
      Global data. The global data behaves like the instance attributes of a class.
    The first time you call a function module in a particular function group, the data is
    loaded into memory. It can then be accessed and changed by all of the function
    modules in the group. The system retains the values until the next time a function
    module is called.
    Calling Subroutines
    You use subroutines for local modularization. Function modules can
    also use this technique. The function module that they call are defined in the
    corresponding main program.
    If you only want to call a subroutine from a single function module, it is best to
    define them in the same include program as the function module itself, directly
    after the ENDFUNCTION statement. These subroutines can be called from all
    function modules in the function group, but for clarity, they should only be called
    from the function module that precedes them.
    If you want to define a subroutine that will be called from several different function
    modules, you can define a special include program for it with the name
    L<fgrp>F<xx>.
    Raising Exceptions
    There are two ABAP statements for raising exceptions. They can only be used in
    function modules:
    RAISE <except>.
    and
    MESSAGE..... RAISING <except>.
    The effect of these statements depends on whether the calling program handles
    the exception or not. If the name <except> of the exception or OTHERS occurs
    in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is
    handled by the calling program.
    If the calling program does not handle the exception
      The RAISE statement terminates the program and switches to debugging mode.
      The MESSAGE ..... RAISING statement display the specified message. How the
    processing continues depends on the message type.
    If the calling program handles the exception, both statements return control to the
    program. No values are transferred. The MESSAGE ..... RAISING statement
    does not display a message. Instead, it fills the system fields SY-MSGID, SYMSGTY,
    SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
    Source Code of READ_SPFLI_INTO_TABLE
    The entire source code of READ_SPFLI_INTO_TABLE looks like this:
    FUNCTION READ_SPFLI_INTO_TABLE.
    ""Local interface:
    *" IMPORTING
    *" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
    *" EXPORTING
    *" VALUE(ITAB) TYPE SPFLI_TAB
    *" EXCEPTIONS
    *" NOT_FOUND
    SELECT * FROM SPFLI INTO TABLE ITAB WHERE CARRID = ID.
    IF SY-SUBRC NE 0.
    MESSAGE E007(AT) RAISING NOT_FOUND.
    ENDIF.
    ENDFUNCTION.
    The function module reads all of the data from the database table SPFLI where
    the key field CARRID is equal to the import parameter ID and places the entries
    that it finds into the internal table SPFLI_TAB. If it cannot find any entries, the
    exception NOT_FOUND is triggered using MESSAGE...RAISING. Otherwise, the
    table is passed to the caller as an exporting parameter.
    Regards,
    Chandru

  • How to create a Quick Step to create an appointment but keep the formatting

    I created a Quick Step in Outlook 2013 to create an appointment from a selected email.  The process works except the appointment is created with only the text from the email; all formatting and graphics are lost.  I guess this is the expected
    behavior since the Action is called "Create an appoint with text of message."  Is there a way to set this up so the formatting is retained?

    Hi,
    This is expected and not changeable currently.
    Regards,
    Melon Chen
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • How to create sale order step by step

    Hi all,
    I am new in SAP SD and how to create sale order. Please give step by step guid for this please.
    Thanks,
    Suresh.

    Please go through the forum rules.  First you have to search the forum to find answers to your queries.  If it is not there, then you can very well post the same.
    thanks
    G. Lakshmipathi

  • How to create a program in alv.

    Hi Experts,
    I am new to Alv programming. I am learning alv programming myself.I dont know anything about that. so can u please guide me how to create an alv program. give some documents to learn about alv.i ve searched it but i could not find any subsequent documents or materials here. please help me to learn.
    My some doubts are below.
    1.why are we using Type pools?
    2.How many type pools are there?
    3. give some links to learn alv.
    Thanks in advance.
    Urs
    Goreddem.

    HI,
    There are basically two types of ALV reports are there
    list and grid.
    List mode is good old list processing with standard functionalities,
    and grid mode is using a new OCX object displaying grids.
    For list check this
    http://www.scribd.com/doc/7345300/basic-ALV-1-Step-by-Step
    For Grid checkout this might be helpful.
    http://help.sap.com/printdocu/core/print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    http://help.sap.com/saphelp_sm32/helpdata/en/8d/e994374c9cd355e10000009b38f8cf/content.htm
    Regards and Best wishes.

  • How to Create another program instance in iphone from a COPY previous proj

    Say I've created one program by starting Xcode afresh.
    Now I want to create another program using the previous program as a base, I copy and paste the project folder and rename it, unfortunately, when I run the program, it replaces the previous program in my iPhone.
    How do I tell xcode it's a new program ?
    Message was edited by: Bracer-J

    Thank you

  • How to created Freely Programmed F4 help in Select Options

    hi,all
       I have a probelm about how to created a Freely Programmed F4 help in Select Options,and put help value into select options field
      Thanks and Best Regards

    Hi Haung,
    You need to use FREE_HELP not the component name.
    Modify you code as below:
       LT_RANGE_TABLE_V = wd_this->m_handler_V->create_range_table( 'ZCYPHDATE' ).
      wd_this->M_HANDLER_V->add_selection_field(
          i_id                         = 'ZCYPHDATE'
          it_result                    = LT_RANGE_TABLE_V
          i_value_help_type            = if_wd_value_help_handler=>CO_PREFIX_APPLDEV
          i_value_help_id              = 'FREE_HELP'
          i_no_intervals               = abap_false ).
    Hope this helps you.
    Regards,
    Rama

  • How to create one program from few programs

    Hi.
    I have for example 5 programs and I would like to create one program in which i could switch between this 5 programs. One of these should be running all the time and the others should start when i will switch to them. I need solution or something like that.
    Thanks.

    You can do a search on "dynamically called" sub vi's.
    See the tiny example below of how to call it.  You can actually call multiple VI's and they will run in parallel, although you have to be careful when doing this.
    You would have to wire False to  "Wait till done"
    You can stop/close the VI using property node.  If you wired False to "Auto Dispose Ref", then make sure you do close ALL references before exiting your program.
    Message Edited by Ray.R on 04-27-2010 08:19 AM
    Attachments:
    callByReference.png ‏16 KB

  • How to create a program in J2EE using eclipse

    Hello
    I am planning to start with J2EE. i have downloaded glassfish v3, maven, derby and JUnit and eclipse. But i am not getting how to start with it.
    please guide me.i am following apress publication's Antonio Goncalves. How to write a program , how to deploy with glassfish then.
    really confused..
    thanking in advance

    abhinav291988 wrote:
    Hello
    I am planning to start with J2EE. i have downloaded glassfish v3, maven, derby and JUnit and eclipse. But i am not getting how to start with it.
    please guide me.i am following apress publication's Antonio Goncalves. How to write a program , how to deploy with glassfish then.
    really confused..
    thanking in advanceIn terms of learning how to use Eclipse [http://eclipsetutorial.sourceforge.net/]
    In terms of learning how to use Java EE [http://java.sun.com/javaee/5/docs/tutorial/doc/]
    In terms of how to write a program [http://java.sun.com/docs/books/tutorial/]
    If you have a specific question to ask, then please repost. My suggestion would be to take the Eclipse tutorial to familiarize yourself, and then follow along in your book. If the book is too advanced, buy one aimed more at beginners. Online tutorials should also help you out.
    - Saish

  • How to create a value only  article and process it

    pls tell me how to create a value only article,  group article and
    hierarchy article and process the same in Is-retail

    Hi,
    Pl use the following link:
    http://help.sap.com/saphelp_ides/helpdata/en/fa/6a376542ef11d2a64b00104b57eaa3/frameset.htm
    Regards,
    S.V.ManiKumaar

  • How to create a 20 step Stack Sequence

    I am working on my GUI interface for a 20 step temp profile. I am using the flat sequence logic. But I see a flaw in my logic. I am passing the temperature to all sequences at the same time. How can I run step 1,2,3??  I have developed a senior moment.
    Solved!
    Go to Solution.
    Attachments:
    tempsys.llb ‏131 KB

    Howdy,
    I would recommend you putting your Temp and Soak controls into arrays, and utilize a State Machine, rather than the Sequence structure. You'll get much better performance, and your code will be much easier to work with in the long run.
    If you need more help after trying that, just ask!

Maybe you are looking for