How to invoke transaction codes by double-clicking events in ABAP

Source: Internet
Author: User

For example, through the ordinary screen, using the custom control, display a ALV table, the information listed in the table includes the item number, the item name and other information

Now you want to double-click the item number and call the transaction code MM03 to display the item information, which function is used?

The creation process is as follows:

One. Draw splash Screen

Use SE80 to enter to create a report

The underlying code includes:

1. Define the inner table (used to store the displayed data)


This inner table needs to be repeatedly assigned in the following code to form the final desired content.

SELECT * * * to corresponding fields of TABLE itab_xxx

LOOP at itab_xxx then assign a value

After the completion of the internal table assignment, it will be used as a data source for the ALV table in the normal screen.

2. Create a normal screen 0100

ABAP's screen is basically divided into two types: selection screen and normal screen

The selection screen is the default, and the system-assigned identifier is 1000, which is the first screen of the entire program to get the initial input and the like.

The normal screen is created by the developer himself and can be named for itself, usually named 0100 0200.

Normal screen creation often to create three things in SE80 GUI State GUI title

Create a process or refer to a previous post.

3. Defining variables

Part of this part of the variable, the more important is that the screen element corresponding to the global variables

Like what:

You create a radio box on a normal screen radiobutton

Then your code to determine whether the two RadioButton is selected or not, you must pass this screen element corresponding to the global variables, to determine

The process is as follows:

You first use the screen maker in SE80 to create a screen element named TESTRB display text for test RB

Then save, exit the screen drawing and return to SE80, for example, double-click "Screen" in 0100 to view its screen elements



For example, in the element list, list all the various elements you created in screen painter

The TESTRB we just created is a radiobutton consisting of two parts, 1. Text 2. RB itself

At this point we double-click on the element list and the TESTRB will pop up the dialog box


Click Yes


Create this global variable, and you'll find that SE80 has automatically created this variable in your code TESTRB


So in SE80, you need to use this global variable to determine whether the RB element in screen painter is selected.


4. Define the variables related to the custom control of the normal screen display


5. Define parameters and Select-option

This part of the variable, used to show that the program starts execution immediately on the default screen 1000 shows a few input boxes, these input boxes are parameters and select-option

The above MATNR is a

select-options : Matnr for MARA-matnr obligatory.


6. Add code for Start-of-selection and End-of-selection as

The process of executing the program is:

1. Display Selection screen

2. Execute the code in the Start-of-selection

3. Execute the code in the End-of-selection


In the above code, in Frm_print, the normal screen was called 100


Second, add code for the normal screen for displaying ALV

Adding code means making the normal screen effective

At the end of the previous step, execute code call screen 100. has already let the system put the code execution, gave the ordinary screen 100

For a normal screen, its execution is divided into three parts

1.PBO

2. Display screen

3.PAI

It's more trivial to write before, or just write the key.

Double-click the data in the ALV, and then call a transaction code.

To create a class, add a method, respond to a double-click event

1. Defining classes

CLASS lcl_event_receiver100 DEFINITION.  Public section.    METHODS:    handle_double_click for        EVENT Double_click of Cl_gui_alv_grid            importing E_row.  PRIVATE section. Endclass.               " lcl_event_receiver100

2. Implementation class

CLASS lcl_event_receiver100 implementation. METHOD Handle_double_click.    Data:wt100 like Itab_show.    READ TABLE itab_show[] INDEX e_row-index into WT100.        IF e_column-fieldname = ' NAME1 ' and wt100-korl = ' Kunnr '.        SET PARAMETER ID ' KUN ' FIELD Wt100-kunnr.        Call TRANSACTION ' XD03 ' and SKIP first screen.    ELSEIF e_column-fieldname = ' NAME1 ' and wt100-korl = ' Lifnr '.        SET PARAMETER ID ' LIF ' FIELD Wt100-kunnr.        Call TRANSACTION ' XK03 ' and SKIP first screen.    ELSE.        EXIT.    ENDIF.  EndMethod. Endclass.

In the above code, the call TRANSACTION method is to invoke other transaction codes that already exist




How to invoke transaction codes by double-clicking events in ABAP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.