Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Tutorial Dynpro

Former Member
0 Likes
4,937

Hello Experts,

via google I found many definitions about what a dynpro is. But I am more interested about how to make a dynpro. Therefore I want to ask if you can recommend a tutorial or something like that showing how to create a very simple dynpro. Knowing just how to put a field and a buttton on a dynpro and knowing how to conenct them to the abap code would be just finde for me.

I am not asking you to write a tutorial for me, but maybe you know some site explaining this.

thank you.

Edited by: Daniel Gerne on Apr 30, 2008 11:49 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,418

Try link

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb2d33358411d1829f0000e829fbfe/frameset.htm

which explains it starting from SE80 - this transaction allows you to see the code hierarchy as well as the program logic you are working around. As the help explains, a module pool should start with the name SAPM and as it's custom code the next letter should be Z or Y... and then add something extra on the end useful to you e.g. "SAPMZMYDEMO1"... assuming this name doesn't already exist, SAP will ask you if you want to create it - and if you want to create a "TOP include" too... you do want the top include as it's where you define global variables etc. Save and compile. You can then add a screen to the module pool in SE80 (right click on the program name) and go from there... you will also need to create a transaction code that will take you into the starting screen (you can do this in SE80 too)... As you have discovered, double clicking on keywords will often trigger SAP asking if you want to create that thing. As the postings above indicate, look at other simple examples in SAP to get a feel for the way it works... there's also a Tcode called BIBS that has demo screen layouts and some shell code behind these.

Jonathan

14 REPLIES 14
Read only

0 Likes
3,418

Hi,

unfortunately the link about sap dynpros doesn't show in which transaction I need to do which step. I want to make a simple non-web-dynpro.

Read only

0 Likes
3,418

In the graphical Screenpainter I added a button and a textfield. So now I need to know how to put my ABAP Report in the buton-click-event so that the text-fields value will be its parameter (The abap report needs exactly one parameter). At the button's attributes I can choose groups and a Functiongroup. Is this where I add my Report's name?

Read only

0 Likes
3,418

Have a look a the help on ABAP User Dialogs on http://help.sap.com eg http://help.sap.com/saphelp_47x200/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm. It is worth spending some time reading through it all and getting a grasp of the basics before doing any programming, even if what you want to do seems to be something very simple.

Read only

3,418

As Christine says, it's probably worth some background reading and code browsing to get a feel for dynpro processing... but to answer your couple of questions (somewhat simplified):

There isn't a "button click event" unlike some other languages... { I could rant here a bit about 3 tier client server and mainframe history etc but won't.. } but basically when you set a function-code on the button in the dynpo - when it is clicked, you are able to see the value of that function code e.g. "ZPUSH1" by looking at a system variable sy-ucomm which you pick up in a module {or form you call from the module} that you define on the "process after input" side of the screen flow... you can then react to this in your code e.g.


case sy-ucomm.
  when 'ZPUSH1'
    perform submit_report.
  when 'ZBYE'.
    leave to screen 0.
  when others.
*" issue a message perhaps... etc
endcase.

As for the submitting a report with the dynpro screen variable, check out the "submit" verb (F1 on the word in your ABAP editor} .. you'll need something like:


submit z_my_report and return "assuming you want to come back
  with p_parm = g_field_name. "p_parm is name of variable in report, g_field_name is from your dynpro

Jonathan

Read only

0 Likes
3,418

Hi Jonathan,

thanks for the code. But where do I need to put this in? SE38?

I want the dynpro to call the report not the other way round. Maybe I described the situation wrong, sorry for that.

What I did in the meantime is:

In Tab Flowlogic of screenpainter (It is the third one I am not sure how It's called in the english version) I got these two something like events PEO and PAI I am reading about in articles about dynpros. With a doubleclick on the module under PAI, I could choose my ABAP Report there. Then it brought me to the source of the abap code but at the very end it added this:

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0001  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0001 INPUT.

ENDMODULE.                 " USER_COMMAND_0001  INPUT

So going back to screenpainter->TEST it still won't start my report.

Hope you can help me out. thank you.

Read only

0 Likes
3,418

Your screen can't call your program if you don't tell it which program to call. Add a SY-UCOMM check and then a CALL TRANSACTION or a SUBMIT program to the MODULE you've just created.

There are LOTS of examples of simple dynpro processing in SAP transaction ABAPDOCU, which you should have a look at if you haven't already. By the way, when working with a dynpro always call it in SE80 or, if you must use SE38, click on the Display Object List option - dynpros are made up of a number of different elements and it is useful to have them all listed.

Read only

Former Member
0 Likes
3,419

Try link

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb2d33358411d1829f0000e829fbfe/frameset.htm

which explains it starting from SE80 - this transaction allows you to see the code hierarchy as well as the program logic you are working around. As the help explains, a module pool should start with the name SAPM and as it's custom code the next letter should be Z or Y... and then add something extra on the end useful to you e.g. "SAPMZMYDEMO1"... assuming this name doesn't already exist, SAP will ask you if you want to create it - and if you want to create a "TOP include" too... you do want the top include as it's where you define global variables etc. Save and compile. You can then add a screen to the module pool in SE80 (right click on the program name) and go from there... you will also need to create a transaction code that will take you into the starting screen (you can do this in SE80 too)... As you have discovered, double clicking on keywords will often trigger SAP asking if you want to create that thing. As the postings above indicate, look at other simple examples in SAP to get a feel for the way it works... there's also a Tcode called BIBS that has demo screen layouts and some shell code behind these.

Jonathan

Read only

0 Likes
3,418

Hi,

I'm just trying to get an example from ABAPDOKU working. I hope you can help me with that:

REPORT  Z_DG_DYNPRO_TEST.

DATA: input  TYPE i,
      output TYPE i,
      radio1(1) TYPE c, radio2(1) TYPE c, radio3(1) TYPE c,
      box1(1) TYPE c, box2(1) TYPE c, box3(1) TYPE c, exit(1) TYPE c.

CALL SCREEN 100.

MODULE init_screen_100 OUTPUT.
  CLEAR input.
  radio1 = 'X'.
  CLEAR: radio2, radio3.
ENDMODULE.

MODULE user_command_0100 INPUT.
  output = input.
  box1 = radio1.
  box2 = radio2.
  box3 = radio3.
  IF exit NE space.
    LEAVE PROGRAM.
  ENDIF.
ENDMODULE.

That's the code from ABAPDOKU. So I created a dynpro for the abap report with Number 100.

At the next point I am not sure if I did that right: In the code there are 2 modules and in the dynpro there are also 2 modules (in the register flowlogic). So I did rename the modulenames in the dynpro so they fit to the ones in aba report.

I also created 3 radiobuttons and 3 boxes called radio1-3 and box1-3.

It doesn't seem to be working. Though the dynpro is found all radio buttons are selected but the code says at init only radio1 should be activated.

I think I didn't map these modules right.

Can you tell me what to do so it is working?

thank you.

Read only

0 Likes
3,418

If you've copied the SAP original exactly (with name changes) then your version should work in the same way. I think you may have missed out the essential but rather obscure step of grouping the radio buttons together. You do this in the graphical screen editor by selecting all the buttons and then choosing Edit -> Grouping -> Radio button group. There must be something in the http://help.sap.com documentation that deals with radio buttons.

Read only

0 Likes
3,418

ok thx I forgot that.

But my problem is something else I think. Maybe I misunderstood, what the code is doing:

MODULE init_screen_100 OUTPUT.
  CLEAR input.
  radio2 = 'X'.
  CLEAR: radio1, radio3.
ENDMODULE.

As I understood the code this means that the screen when I start the report should have radiobutton2 selected. But when I start the report there is always radio1 selected. no matter how I alter the code It's always the first one. Could the problem be that I declared chars named radiobutton1-3? So the X goes to the char only and not to the radiobuttons in the dynpro?

edit:

I found the problem: When I doubleclick on the module name in se38. I got the message modulexyz is not used in dynpro 100.

So the modulename in se38 and the dynpro is the same but they don't refer to each other. So how do I change that?

Edited by: Daniel Gerne on May 2, 2008 2:54 PM

Read only

0 Likes
3,418

>

> I found the problem: When I doubleclick on the module name in se38. I got the message modulexyz is not used in dynpro 100.

> So the modulename in se38 and the dynpro is the same but they don't refer to each other. So how do I change that?

>

I've no idea how you can change that since I've no idea how you've got yourself into this situation. At the risk of repeating myself, go and read the documentation so that you have some idea how the various elements of a module pool or an executable program with screens work together before doing anything else. It will save you time and effort in the long run.

Read only

0 Likes
3,418

How do I test a dynpro. I created one in se51 and filled both modules with a hello world code. So where is the write command written to? (when testing a dynpro in se51). Just want to see if it works so I can put in other code.

Read only

0 Likes
3,418

ok now I inserted a label to write the hello world to. Problem is, that I created the label in screenpainter after created the module object at FLOWLOGIC. So the abap code in the module doesn't know the label. How can I tell the module to "reload" the screen so it recognizes the label. Thing is that the radio buttons I created BEFORE creating the module object are recognized.

So this must be the problem. So where do I reload the objects in the screen.