Step by step code for dialog program

i created a ztable with 4 fields having some data in it.
my requirement is:
create a screen with 4 fields from ur ztable with SAVE and CANCEL as push buttons.
if i enter some data in my fields and  select SAVE, a pop-up-box should appear saying whether u want to save the data or not?
if i click 'yes' in my pop-up data should be saved in my ztable
saying 'data is saved successfully'.else if i click 'no' it should come out of the txion.
if i select CANCEL it should be in the same screen.

Hi nani,
First you need to create a screen with 4 inputs fields as you mentioned.
To create a screen,follow these steps:
1) Go to SE80.There you will find two drop down boxes.
Select program in the first list box and give the name of the program you want in the second list bo.
2)Click on SAVE.
3)Right click on the program name and there you will find a small menu.Go to CREATE--->SCREEN.
4)A window would open now.There give a number to the screen and a description to it and press on SAVE.Now the screen is created.
Now you need to add the input fields in the screen.To do this follow these steps:
1)Click on the layout button which you will finid on the top of the scrren window.This leads you to the screen painter.
2)In the screen painter you will find a list of buttons on the left hand side.
3)Select the button which says input/output field.
4)Now paste the input/output field in the screen.
5)Double click on it and a pop up will open.There you need to give the name of the field.
Here you will have to give the name in this format: <Ztable_name>-<field_name>.
For e.g: ztm09ekko-ebeln.
By giving the name of the field same as the field name in the Ztable,the field will be linked to the Ztable field.
Follow the same steps for the rest of the input/output fields creation.
Now you need to create two push buttons.The steps are:
1)Go to the screen layout again and now select push buttons from the menu on the left hand side.
2)Paste in on the screen.
3)Double click on it and a popup will open.There you need to give the name of the push button.Here you will also find a field by name Fct.Code.This is the field for the function code of the push button.
Give an appropriate function code name like SAVE and CANCEL in your case.
After doing all this,you need to activate the screen.
Now to make the push buttons working,you need to write a code for it.
To write the code,exit the screen layout and click on the flow logic tab that you  will find above.
Go through this code and you will easily understand how to write it for your requirement.
You can use the same code in your program just by changing the table names.
In this code a function module is called to display the popup.The popup contains three options-Yes,No and Cancel.When selecting Yes,The details present in the input fields will be saved in the Ztables.If NO is selected in the popup,then the transaction will be exited.
In the function module,answer holds the user command.
e_answer needs to be created by user.The statement for it is :
DATA :e_answer type c.
In the function module as you can see, J indicates Yes and N indicates No.
And if you click on the CANCEL push button,
The same screen is retained as per your requirement.
In the PAI module of that Screen,
write this code:
CASE SY-UCOMM.
when SAVE.
CALL FUNCTION 'C14A_POPUP_SAVE_WITH_CANCEL'
IMPORTING
e_answer = answer.
IF answer = 'N'.
***Leaving the transaction****
LEAVE TRANSACTION.
ELSEIF answer = 'J'.
***The right side of the equation is the name of the input field in the screen.The left hand side of the ****equation is the field name in the ZTable ztm09_ekpo.**
ztm09_ekpo-ebeln = ztm09_ekko-ebeln.    "ztm09_ekko is the name of the Z Table.
MODIFY ztm09_ekpo.
when CANCEL.
set data hold on.
endcase.
Revert for any querries.
Reward points if helpfull.
Regards,
Kaushik

Similar Messages

  • Need code for dialog program

    Hi All,
    My requirement is to create a selection screen with
    1. browse field - selection for the  files to be uploaded
    2. Checkbox - Test run the transaction without parking the entries
    3. Two push button Execute and Cancel
      Execute - to lunch the program
      Cancel - cancel the program and return to menu
    Please provive the code and procedure to create screen. i am new for dialog program.
    Thanks,
    Madhu

    Rather than waiting for someone here to write the code for you, you'd be better off looking at the examples in SAP as already mentioned and reading the SAP help at[http://help.sap.com/saphelp_47x200/helpdata/en/9f/dba66935c111d1829f0000e829fbfe/frameset.htm]

  • Can any one give step by step screen shots for dialog programming

    can any one give step by step screen shots for dialog programming ..
    thanks
    venki...

    Hi
    see the following links and example programs and practice the same dialog pool program
    Check the below link:
    http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
    http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
    http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
    http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
    http://www.geocities.com/ZSAPcHAT
    http://www.allsaplinks.com/files/using_table_in_screen.pdf
    http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://www.sap-img.com/
    http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
    http://www.sapgenie.com/links/abap.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
    You can also check the transaction ABAPDOCU which gives you lot of sample programs.
    Also you can see the below examples...
    <b>Go to se38 and give demodynpro and press F4.
    YOu will get a list of demo module pool programs.
    One more T-Code is ABAPDOCU.
    YOu can find more examples there.
    See the prgrams:
    DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement
    DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB</b>
    http://www.geocities.com/ZSAPcHAT
    http://www.allsaplinks.com/files/using_table_in_screen.pdf
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Can anyone help me wid d codes for  Generated Program for gate pass

    can anyone help me wid d codes for  Generated Program for gate pass in MM
    Message was edited by:
            Ronei Shedi

    Hi
    There is no std business process in SAP for Gate pass for the Material entry
    before GR stock entry into the stores.
    You have to write a Z program based on the details of Purchase order tables EKKO and EKPO.
    This will mainly check whether the correct PO qty was delivered or not with proper quality.
    So use the PO tables EKKO and EKPO and fetch the data and use it
    Since this is client specific there is no feneralised program for it.
    Reward points if useful
    Regards
    Anji

  • How to create Background job for Dialog program

    Hi Experts,
    I have copied Standard tcode to Z-tcode (CS12 tcode).
    Now my requirement is to create background job for this program (but program is not a 'E' type its 'I').
    How we can schedule Dialog program to Background.
    Pls suggest me.
    Regards
    SK

    Hi do as below :
    Reefer below :
    Bakcground Job Creation
    You will have to submit your report using Submit statement ,
    then inside the submitted report write open_job.
    Regards,
    Uma

  • I need material for dialog programming

    Hi Experts,
    I need material on dialog programming...... so please reply to my mail
    id [email protected]..  or give some links....
    regards,
    Kali

    Hi,
    DIALOG Programming
    http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://www.sap-img.com/
    http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
    http://www.sapgenie.com/links/abap.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
    http://www.allsaplinks.com/dialog_programming.html
    http://sap.mis.cmich.edu/sap-abap/abap09/
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
    http://sap.mis.cmich.edu/abap-00/
    http://www.allsaplinks.com/files/using_table_in_screen.pdf
    http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
    http://www.sapgenie.com/links/abap.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://help.sap.com
    http://www.sapgenie.com/abap/example_code.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
    http://www.allsaplinks.com/dialog_programming.html
    http://www.sapbrain.com/TUTORIALS/default.html
    http://www.sappoint.com/abap/spmp.pdf
    http://sappoint.com/abap.html
    http://www.sap-img.com/abap.htm
    http://sap.ittoolbox.com/code/archives.asp?i=10&t=450&a=t
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://www.sap-img.com/abap/
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://www.sap-img.com/
    http://www.sappoint.com/faq/faqdiapr.pdf
    http://www.allsaplinks.com/dialog_programming.html
    Rgds,
    Prakash

  • I want code for these programs

    5)     Write a program to perform the following:
    •     Accept a number ‘N’ and a range of company codes from the user.
    •     Retrieve the first N customers from the table KNA1.
    •     For each customer, retrieve the company codes it has been maintained for, (If the company code falls within the user specified range) from the table KNB1.
    •     Display the data in the ascending order of company codes for each customer, in the following format.
    Customer 1
         Company code1
         Company code2
    Customer 2
         Company code 3
    If the user doesn’t specify a value for N, retrieve all the customers.
    6)     Write a program to display top three records from SFLIGHT which have the highest flight price for a given airline carrier. If the user doesn’t specify an airline carrier, display the information for all the airline carriers.
    Display the following details in the list.
    a)     CARRID, CONNID, FLDATE, PRICE.
    b)     Print the summary information for each flight & for each airline.
    7)     Create an include program for all the data declarations needed, to display the following information from tables SBOOK and SCUSTOM.
    CARRID     CONNID     FLDATE     CUSTOMID     NAME          WUNIT
    AI          0001          02/28/1996     00000012     RADETZKY     KG
    AI          0002          02/28/1997     00000020     BECKER     KG
    AI          0003          02/28/1998     00000035     BRUCHER     KG
    Write a program using the above include program, and display details for the user specified combination of airline carrier and connection, from the tables SBOOK and SCUSTOM in the format given above.
    8)     Write a program to perform the following:
    a)     Display the names and ages in years, of all the programmers.
    b)     Calculate and display the average selling cost for packages that have been developed in Pascal.
    c)     Display the names and dates of birth of all programmers born in January.
    d)     Determine as to which package sold the highest number of copies. Display the name and number of copies sold by that particular package.
    e)     Display the total number and names of programmers who have done the PGDCA course.
    f)     Display the details of packages whose sales (sales cost * number of copies sold) crossed the 7000 mark.
    g)     Display the revenue earned through the sales of packages developed in “C”. Revenue should be calculated as the difference between sales and the development cost.
    h)     Display the details of the packages for which development costs have been recovered, i.e. Sales for that package is greater than the cost for development of the package
    i)     Display the cost and the name of the costliest software package (with respect to dev cost) developed in each language.
    j)     Display the age of the oldest male programmer.
    k)     Display the experience (in years) of each programmer along with his or her name. (In both ascending & descending order of their experience).
    l)     Display the list of all the programmers who celebrate their birthday during the current month.
    m)     Display each language name, with average development cost, average selling cost and average price per copy of packages developed in that language.
    n)     Display all the programmers’ details along with the costliest and cheapest packages developed by them.
    o)     Display the programmer-wise details of each package, for which the Development cost has not yet been recovered i.e. the Sales revenue is less than the development cost. Display the following details in the list, Programmer name, package name, total development cost, sales revenue and the amount that is yet to be recovered for that package.
    p)     Display the details of the least & the most experienced programmers
    q)     Display the language, which is known by only one programmer.
    r)     Display the language that is used to develop the most number of packages.
    s)     Display the details of the programmers and the cheapest packages developed by them in each language.
    t)     Display the language used by each programmer to develop the highest and lowest selling cost packages.
    u)     Display the number and names of packages developed by the female programmers whose salary is more than the highest paid male programmer.
    9)     Write a program to perform the following:
    •     Accept a material type (field MTART in table MARA) from the user.
    •     Display all the materials of the user specified material type. Also display the plants that they have been maintained for, if any, in the following format:
    Material1
         Plant1
         Plant2
    Material2
         Plant1
         Plant2
    NOTE:
    a)     Plant specific data for a material is available in the table MARC
    b)     Write two programs (a) & (b) with one making use of JOINS and the other without JOINS to get the required output.
    10)     Write a program to perform the following using JOINS:
    •     Accept a sales document type from the user. (Use table VBAK)
    •     Display all the sales documents (of the user specified type) and their corresponding item details whose net value (field NETWR in table VBAP) is less than 1000, in the following format: (Use table VBAP)
    Sales document 1
                   Sales document item 1          Material 1
                   Sales document item 2          Material 2
    Sales document 2
                   Sales document item 1          Material 1
                   Sales document item 2          Material 2
    11)     Write a program to perform the following using only one SQL statement:
    •     Accept a range of carrier id and connection id from the user.
    •     Display the following flight details in the following format:
    (Use the tables SPFLI, SFLIGHT, SBOOK, SCUSTOM)
    CARRID      CONNID     CITYFROM
                                  FLDATE     PRICE
         BOOKID      CUSTOMER NAME
         BOOKID      CUSTOMER NAME          BOOKID      CUSTOMER NAME
                                  FLDATE     PRICE
         BOOKID      CUSTOMER NAME
         BOOKID      CUSTOMER NAME
         BOOKID      CUSTOMER NAME

    Devika,
    I hope u r new to ABAP world.!!
    All these questions/programs are just for your practice purpose...try to solve this... Don;t worry if error occurs or if it takes time to solve,....
    Till u get confident in abap programming practice these programs ....then BLAST the programs in real time...
    Wish u best of luck!!!
    Rgds,
    Lakshmiraj

  • Need code for this program in pl/sql

    Hi,
    was looking for a pl/sql code for the following case
    If there are two employees from the EMP table. i want all the names of the managers common to the two employees....
    to explain in detail : if employee1 and employee2 have the same manager mgr1....mgr1 should be displayed.
    else if employee 1 and employee2 have no immediate manager in common...meaning team leader of employee 1 and employee2 are different but the project managers for both the employee is same..in this case the project manager's name should be displayed......
    else in worst case when there are no managers common between these two employees.........the CEO who is at the highest level is common....then display CEO's name
    it's hierchiacal structure......
    thanks,
    Preethi

    Why PL/SQL? Why not look at if this can be done using SQL firstly? SQL is the preferred language for crunching Oracle data. Not PL/SQL.
    Think data sets.
    One method to do this in SQL would be to build a hierarchical list of managers for each employee. E.g.
    LEVEL MANAGER
    1     Jack
    2     John
    10     Dan the CEOOnce you have such a list for each employee, you can join these two lists on matching names. Then you simply need to find the matching join that has the lowest level.
    I'm sure there are other approaches. But unless you put together some test data, put together some SQLs and play around with this problem, you are not going to learn anything.
    And no, copying and pasting an answer that someone is inevitable to post in response is NOT learning anything new.
    So why not try and solve this problem yourself? Gain some new knowledge. That will only do your career well as your employer is after all expecting you to write the code to solve this problem - and not for members of this forum to supply the code for you.

  • How to assign Transaction code for report program?

    All,
    I have developed a custom report. I want to associate it to a transaction code. How to do it?

    Hi,
    Please follow the steps for creating a transaction for report..
    GOTO SE93
    Give the transaction code.
    Press create button..
    Enter the short description..
    Choose the radio button which says "Program and selection screen(report transaction)".
    Press Enter..
    Give the program name..
    Remove the Selection screen "1000" if you want.
    Save the transaction code..
    Regards

  • Cannot write the suitable source codes for running program

    I want to write a program that help student to compile program and run program by using some test cases. For the compiled part, i have been wrote it successfully, but for the run part, i cannot pass the test cases to the program for running. Could any ppl help me to find the problem on the followng codes, why the error will on there? how do i change it? Thanks!
    //<!--start get Program Test Case File-->
    java.io.BufferedReader TestCaseBuf = null;
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:compas", "sa", "password");
    stmt = con.createStatement();
    String strSQL = "SELECT testValue FROM TEST_CASE WHERE progID='"+progID+"'";
    stmt = con.createStatement();
    rs = stmt.executeQuery(strSQL);
    try
    while (rs.next())
    TestCaseBuf = new java.io.BufferedReader(new java.io.InputStreamReader(rs.getBinaryStream("testValue")));                         
    finally
    if (rs != null)
         rs.close();
    if (stmt != null)
         stmt.close();
    //<!--end get Program Test Case File-->
    //<!--start run program -->
    String[ ] args2 = new String[ ]
         "java", "-cp", System.getProperty("user.dir"), FileName
    try
         Runtime rt = Runtime.getRuntime();
         Process proc = rt.exec(args2);
         java.io.BufferedReader ireader = new java.io.BufferedReader(new java.io.InputStreamReader(proc.getInputStream()));
         java.io.PrintWriter pwriter = new java.io.PrintWriter(proc.getOutputStream());
    String atestcase = null;
         String line= null;
         try
    while ((atestcase = TestCaseBuf.readLine()) != null) <------------I found that error seems on here!!!!
         pwriter.write(atestcase+"\r");
    pwriter.flush();     
    if (atestcase != null)
              if ((line = ireader.readLine()) != null)
              FileOutput = FileOutput + line +"\r\n";
    else {break; }
         } //while
         catch (java.io.IOException e)
         out.println("[IOException]. Printing Stack Trace");
         e.printStackTrace();
         pwriter.close();
         ireader.close();
    catch (java.io.IOException e)
    out.println("[IOException]. Printing Stack Trace");
    e.printStackTrace();
    //<!--end run program -->

    Whats the error message??
    Just a guess, but could be (without seeing the error) that you've already closed the TestCaseBuf reader by closing the result set, hence when you go to read it, you're reading on closed reader.
    Give this a go...Put the //<!--run program --> code into the result set while loop
    while (rs.next())
    TestCaseBuf = new java.io.BufferedReader(new java.io.InputStreamReader(rs.getBinaryStream("testValue")));
    //<!--start run program -->
    ...some code
    //<!--end run program -->
    } Hard to tell without the error message

  • Need help writing a code for this program

    Design a code that reads a sentence and prints each individual word on a different line

    tsith's suggestion is excellent. Run it and see what happens. I just did that myself and doing so I learned something new about the Scanner class.
    Before you run it, add a couple of extra System.out.println for (hopefully) illustrating debugging purposes:
    import java.lang.String;
    import java.util.Scanner;
    public class Sentence {
        // main line of program
        public static void main(String[] args) {
            boolean z;
            String a;
            Scanner keyboard = new Scanner(System.in);
            System.out.print("Enter sentence: ");
            z = keyboard.hasNext();
            while (z) {
                System.out.println("z = " + z + ". Fetching the next word...");
                a = keyboard.next();
                System.out.println(a);
            System.out.println("Done!");
    }Let us know if the program ever prints "Done!" to the console. While you are waiting, read what the javadocs has to say about the Scanner class, and pay extra attention to what it says about the hasNext() and next() methods:
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html

  • Having a few problems with the codes for this program.

    i type in the code. in notepad, then compile it to java, but i always seem to get 3 errors. if anyone can help, id really appreciate it.
    using java:
    Calculate the salary at the end of two weeks. You know that:
    ? For the first 40 hours worked in a week the pay rate is $10/hour and after that
    initial 40 hours the pay rate is $15/hour.
    ? If the total salary (week1+week2) is less than $500, the employee will receive 10%
    bonus. If the salary is between $500 and $1000, the employee will receive 5%
    bonus. If the salary is between $1000 and $2000, the employee will receive 1%
    bonus.

    Well, maybe if you showed your code and the complete and exact "messages", we could help you.

  • Please help with code for a program

    Write a program which comutes the value of an investment over a 5 year period.The porgrm should display the value of an investment for each of the 5years were the initial investment and interest rate are to be specified by the user.It should compute and present value in the first year,compute and display value for the second year up to the last year(use a while or do...while loop).While there are more years to process ask the user for the next input,compute the value for the next year and output.

    jverd wrote:
    So what you're saying is that you're a lazy, stupid, unethical cheater and you want someone else to do your homework for you so that you can take credit you don't deserve and get a grade you didn't earn.
    Go to hell.But he's willing to pay big bucks (10 duke stars!) for this, so let's race to get those precious dukes.

  • Need sample code for component programming

    I see samples page here:
    /docs/DOC-8061#61
    want to download "Web Dynpro Component Interface Definitions in Practice" sample, but only empty folders structure provided in download link.
    ("zip file" link )
    How to get full sample project according whay is written on this page?
    May be someone have this or like this sample ?
    (with some description than)
    I need to develop such type of application
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f07c3625-c971-2910-3a9c-ce131487f82c
    components, component interface usage, also for GP, but do not see code samples for this.
    Can you help with it?
    thanks
    Edited by: Vladimir Grigoryev on Aug 7, 2008 10:01 AM

    Hallo Vladimir,
    sorry me, but I have absolutely no idea what your problem really is. I provided you with all required information to download, import, build, deploy and run my Web Dynpro Java Sample application on "Component Interface Definitions in Practice". This material is enriched with in-depth technical documentation on the underlying concepts (you already linked to all these resources in the initial message of this thread; your second link is pointing to my powerpoint presentation on this sampel) to answer your last message about "but code is not sufficient".
    PLEASE read the [Readme.txt|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0e4528f-c471-2910-66a0-dd459f975dc2] file to successfully install the local Web Dynpro DCs comprising the sample application metadata.
    NOTE: This sample is based on SAP NetWeaver 7.0, NOT on NetWeaver CE 7.1!!!
    I do not want to repeat all my descriptions in this mail thread.
    Regards, Bertram

  • Code for UpLoad program to load Custom PA infotype

    I need to develope UpLoad program to load Custom PA infotype which I created with 9001.
    Can you please give the complete code to Write upload program using standard available FM .
    Points will be awarded........
    Thanks
    Raj

    As this is a custom Infotype and no code is readily available, I would suugest that you try transction SHDB and record loading data into this Infotype.  This interm can be converted to a program which you can then tweek.  If I get stuck writting a BDC upload program then this is where I start.
    Regards
    J

Maybe you are looking for