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

Dailog Programing

Former Member
0 Likes
1,144

Hai All,

As per my requirement i have to create 3 screens and using those 3 screens i have to enter the data in to data base.

How to work on this type of tasks and how to write the code for the designed screens please help me out...

Thanking one and all.....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,106

hi

chk this link

u will find step by step procedure of dialog programming

<b>

plz reward if useful

9 REPLIES 9
Read only

Former Member
0 Likes
1,107

hi

chk this link

u will find step by step procedure of dialog programming

<b>

plz reward if useful

Read only

Former Member
0 Likes
1,106

Hi Venkata

U have not given any details regarding ur requirement

well.. in dialog programming when u use screen

u need to do database updates in PAI event..

All the coding related to screen display is done in PBO event..

Thanks

Read only

0 Likes
1,106

Hai Rashmi,

I have to use an emp table and dept table to do this task where the first screen has to contain two push buttons to select the specified table(emp/dept) and the next screen has to contain those fields in which the data has to entered and from there the data has to filled in to data base.

Thanks and regards,

Srikanth

Read only

0 Likes
1,106

Hi Venkat,

Do this way ...

====================================================

Assume three screen numbers are 100 , 101 and 102.

In screen 100, you will keep two buttons namely EMP and DEPT.

In screen 101, you will have fields of two tables (EMP and DEPT) by default (only those fields which u want user to enter )

In screen 102, you will have message showing the status or etc.

<u>Flow logic corresponding to screen 100</u>

PBO

PAI

Code to be executed when the user does any interaction with the screen. At the end of PAI the system goes to the PBO of the next or the current screen i.e., 101 (in this case )

Module user_command_0100 input.

where this user_command_0100 will have

case sy-ucomm.

if <emp_button>.

flag_E = 'X'.

ELSE.

FLAG_D = 'X'.

endcase.

<u>Flow logic corresponding to screen 101</u>

PBO

based on FLAG_E or FLAG_D, you will make either EMP or DEPT tables appear to the user.

PAI

After user enters the fields and click on update or modify or exit, you have to write code according to the user command.

<u>Flow logic corresponding to screen 102</u>

PBO

Display the status message

PAI (optional)

You can keep a button to go to screen 100, when the user is satisfied with the message

======================================================

Hope this will give you some brief idea.

Let me know if you need any other details.

Regards,

Vicky

PS: Award points if helpful

Read only

Former Member
0 Likes
1,106

check the sample programs in se38:

demodynpro and press f4.

Check this link:

Regards,

Ravi

Read only

Read only

Former Member
0 Likes
1,106

Hi venkat,

check this link which has step by step instructions to design a transaction or dialog programming.

http://www.thespot4sap.com/Articles/SAP_Design_Dynpro.asp

hope this will be of some help to you.

Regards,

Vicky

PS: Award points if helpful

Read only

rahulkavuri
Active Contributor
0 Likes
1,106

In SE80 u need to define these screens and includes for this purpose as it is not possible to explain the whole thing

Go to SE38 and paste this code

*&---------------------------------------------------------------------*
*& Module pool       Z50660_TRANPRAC                                   *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*


INCLUDE Z50660_TRANPRACTOP                      .    " global Data

 INCLUDE Z50660_TRANPRACO01                      .  " PBO-Modules     *
 INCLUDE Z50660_TRANPRACI01                      .  " PAI-Modules     *
* INCLUDE Z50660_TRANPRACF01                      .  " FORM-Routines   *

<b>Open the same thing now in Se80 and in include Z50660_TRANPRACTOP paste this</b>

*&---------------------------------------------------------------------*
*& Include Z50660_TRANPRACTOP                                Module poo*
*&                                                                     *
*&---------------------------------------------------------------------*

PROGRAM  Z50660_TRANPRAC MESSAGE-ID ZZ.

TABLES:VBAK,VBAP.

DATA: V_VBELN LIKE VBAK-VBELN,
      V_VKORG LIKE VBAK-VKORG,
      V_VTWEG LIKE VBAK-VTWEG,
      V_SUBSCR TYPE SY-DYNNR VALUE '0200',
      R1(1),R2(1),
      FLAG1(1),FLAG2(1),FLAG3(1).

DATA: V1_VBELN LIKE VBAK-VBELN,       "HEADER DATA VARIABLES
      V_ERDAT LIKE VBAK-ERDAT,
      V_ERNAM LIKE VBAK-ERNAM,
      V_VBTYP LIKE VBAK-VBTYP,
      V_WAERK LIKE VBAK-WAERK.

DATA: BEGIN OF IT_VBAP OCCURS 0,      "ITEM DETAILS INTERNAL TABLE
        VBELN LIKE VBAP-VBELN,
        POSNR LIKE VBAP-POSNR,
        MATNR LIKE VBAP-MATNR,
        MATKL LIKE VBAP-MATKL,
        NETWR LIKE VBAP-NETWR,
      END OF IT_VBAP.
DATA:OK_CODE TYPE OK.

DATA: WA_VBAP LIKE VBAP.

CONTROLS TC TYPE TABLEVIEW USING SCREEN '0300'.


<b>For include Z50660_TRANPRACO01</b> 
*&---------------------------------------------------------------------*
*&  Include           Z50660_TRANPRACO01                               *
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'CMST'.
*  SET TITLEBAR 'xxx'.

ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  MODE  OUTPUT
*&---------------------------------------------------------------------*
*       TO SET MODE FOR INITIAL DISPLAY
*----------------------------------------------------------------------*
MODULE MODE OUTPUT.
LOOP AT SCREEN.
 IF SCREEN-GROUP1 = 'G2'.
  SCREEN-INPUT = 0.
  MODIFY SCREEN.
 ENDIF.
ENDLOOP.

IF FLAG1 = 'X'.
LOOP AT SCREEN.
 IF SCREEN-GROUP1 = 'G1'.
  SCREEN-INPUT = 0.
  MODIFY SCREEN.
 ENDIF.
 IF SCREEN-GROUP2 = 'G2'.
   SCREEN-INVISIBLE = '1'.
   MODIFY SCREEN.
 ENDIF.
ENDLOOP.
ENDIF.

IF FLAG2 = 'X'.
 LOOP AT SCREEN.
   IF SCREEN-GROUP2 = 'G2'.
   SCREEN-INVISIBLE = '0'.
   MODIFY SCREEN.
   ENDIF.
 ENDLOOP.
ENDIF.

ENDMODULE.                 " MODE  OUTPUT

<b>

Now in Z50660_TRANPRACI01</b>

*&---------------------------------------------------------------------*
*&  Include           Z50660_TRANPRACI01                               *
*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*&      Module  STATUS_0400  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0400 OUTPUT.
  SET PF-STATUS 'CMST'.
*  SET TITLEBAR 'xxx'.

ENDMODULE.                 " STATUS_0400  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  SET_COMMON_STAT  INPUT
*&---------------------------------------------------------------------*
*       TO SET COMMON STATUS
*----------------------------------------------------------------------*
MODULE SET_COMMON_STAT INPUT.

IF R1 = 'X'.
  V_SUBSCR = '0200'.
ELSE.
  V_SUBSCR = '0300'.
ENDIF.

CASE SY-UCOMM.

WHEN 'DISPLAY'.
    CLEAR SY-UCOMM.
    FLAG1 = 'X'.
    CLEAR FLAG2.
    CALL SCREEN 0400.

WHEN 'CHANGE'.
    CLEAR SY-UCOMM.
    FLAG2 = 'X'.
    CLEAR FLAG1.
    CALL SCREEN 0400.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
  CLEAR SY-UCOMM.
  LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE.                 " SET_COMMON_STAT  INPUT
*&---------------------------------------------------------------------*
*&      Module  CHECK_INPUT  INPUT
*&---------------------------------------------------------------------*
*       TO CHECK THE GIVEN SELECTION CRITERIA
*----------------------------------------------------------------------*
MODULE CHECK_INPUT INPUT.

IF V_VBELN IS INITIAL.
   MESSAGE E000(ZZ) WITH 'PLEASE ENTER A VALID SALES'
                         'DOCUMENT NUMBER'.
 ELSEIF V_VKORG IS INITIAL.
   MESSAGE E000(ZZ) WITH 'PLEASE ENTER A VALID SALES'
                         'ORGANIZATION'.

   ELSEIF V_VTWEG IS INITIAL.
    MESSAGE E000(ZZ) WITH 'PLEASE ENTER A VALID'
                         'DISTRIBUTION CHANNEL'.
   ELSE.
   SELECT SINGLE * FROM VBAK
          WHERE VBELN = V_VBELN
            AND VKORG = V_VKORG
            AND VTWEG = V_VTWEG.
    IF SY-SUBRC <> 0.
     MESSAGE I000(ZZ) WITH 'NO RECORDS FOR GIVEN SEARCH CRITERIA'.
    ENDIF.
ENDIF.

ENDMODULE.                 " CHECK_INPUT  INPUT
*&---------------------------------------------------------------------*
*&      Module  POPULATE_HEADER  INPUT
*&---------------------------------------------------------------------*
*       TO POPULATE HEADER DATA
*----------------------------------------------------------------------*
MODULE POPULATE_HEADER INPUT.

  SELECT SINGLE VBELN ERDAT ERNAM VBTYP WAERK
                FROM VBAK
                INTO  (V1_VBELN,V_ERDAT,V_ERNAM,V_VBTYP,V_WAERK)
                WHERE VBELN = V_VBELN.

ENDMODULE.                 " POPULATE_HEADER  INPUT
*&---------------------------------------------------------------------*
*&      Module  POPULATE_ITEM  INPUT
*&---------------------------------------------------------------------*
*       TO POULATE ITEM DETAILS
*----------------------------------------------------------------------*
MODULE POPULATE_ITEM INPUT.

SELECT VBELN POSNR MATNR MATKL NETWR
             FROM VBAP
             INTO TABLE IT_VBAP
             WHERE VBELN = V_VBELN.

ENDMODULE.                 " POPULATE_ITEM  INPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0400  INPUT
*&---------------------------------------------------------------------*
*       CODE FOR INSERT AND MODIFY  BUTTONS
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0400 INPUT.

IF SY-UCOMM = 'MOD'.
   CLEAR SY-UCOMM.
   FLAG3 = 'X'.
ENDIF.


ENDMODULE.                 " USER_COMMAND_0400  INPUT
*&---------------------------------------------------------------------*
*&      Module  MODIFY_IT_VBAP  INPUT
*&---------------------------------------------------------------------*
*       TO MODIFY INTERNAL TABLE
*----------------------------------------------------------------------*
MODULE MODIFY_IT_VBAP INPUT.

IF FLAG3 = 'X'.
 MODIFY IT_VBAP INDEX TC-CURRENT_LINE.
  MOVE-CORRESPONDING IT_VBAP TO WA_VBAP.
 MODIFY VBAP FROM WA_VBAP.
ENDIF.
ENDMODULE.                 " MODIFY_IT_VBAP  INPUT

Come back to SE80 and define the screens and goto screen painter to define the screens 100,200,300,400

PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
 FIELD: V_VBELN,V_VKORG,V_VTWEG MODULE CHECK_INPUT.
 MODULE POPULATE_HEADER.
 MODULE POPULATE_ITEM.
 MODULE SET_COMMON_STAT.

PROCESS BEFORE OUTPUT.
* MODULE STATUS_0200.
MODULE MODE.
*
PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0200.

PROCESS BEFORE OUTPUT.
* MODULE STATUS_0300.
LOOP AT IT_VBAP WITH CONTROL TC CURSOR TC-CURRENT_LINE.
ENDLOOP.
MODULE MODE.
*
PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0300.
LOOP AT IT_VBAP.
MODULE MODIFY_IT_VBAP.
ENDLOOP.

PROCESS BEFORE OUTPUT.
 MODULE STATUS_0400.
 CALL SUBSCREEN SSA INCLUDING SY-REPID V_SUBSCR.
 MODULE MODE.

*
PROCESS AFTER INPUT.
CALL SUBSCREEN SSA.
MODULE SET_COMMON_STAT.
MODULE USER_COMMAND_0400.

U need to use screen painter to define the fields for each of them

Read only

Former Member
0 Likes
1,106

Hi,

here is the example which will give you a good idea of how to insert the data into the database using screen.

create a report and create a screen 100.

on the screen create 2 input boxes

for our case IN_AIRLINE

and IN_FLIGHTNO

copy paste the following code


*&---------------------------------------------------------------------*
*& Report  ZDIALOGPROGRAM                                              *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  ZDIALOGPROGRAM                                              .


call screen 100.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
data : ok_code type sy-ucomm,
       in_airline like spfli-carrid,
       in_flightno like spfli-connid,
       wa type spfli.

case ok_code.
   when 'SAVE'.
       wa-carrid = in_airline.
       wa-connid = in_flightno.
       insert into spfli values wa.
       leave to screen 0.
endcase.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'STAT'.
*  SET TITLEBAR 'xxx'.

ENDMODULE.                 " STATUS_0100  OUTPUT

Hope this will help you.

Regards,

Kinshuk Saxena

PS reward points if you find the post helpful