Application Development 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: 

PBO

Former Member
0 Kudos

Hi,

This is my Flow logic.

<b>

LOOP AT IT_VBAP INTO VBAP CURSOR C1.

ENDLOOP.</b> Why we write this statement in PBO and what does cursror C1 suggets.

Again why we write the same loop in PAI also.

PROCESS BEFORE OUTPUT.

MODULE STATUS_9001.

LOOP AT IT_VBAP INTO VBAP CURSOR C1.

ENDLOOP.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_9001.

LOOP AT IT_VBAP.

ENDLOOP.

3 REPLIES 3

Former Member
0 Kudos

hi,

syntax:

LOOP AT itab CURSOR cur [INTO wa]

[CURSOR top_line] [FROM n1] [TO n2]

WITH CONTROL contrl.

...

ENDLOOP.

Effect

If you specify addition AT itab, during loop processing of the table control the internal table itab of the corresponding ABAP program is processed sequentially in parallel. For each row of the table control, one row of the internal table is processed. The internal table itab must be an index table. You can specify the additions INTO, CURSOR, FROM, TO and WITH CONTROL only at PBO, but not at PAI. At PAI, the internal table is used for reference to the table control.

Use addition INTO to specify a work area wa, to which at PBO at the end of each loop pass the current row of the internal table is assigned. If you do not specify the addition wa, an internal table with header row must be used, which will then be used implicitly instead of wa. The content of wa or of the header row is transported after the assinment to the fields with the same names in the current row of the table control. The work area wa must be a global data object of the ABAP program matching the row type of the internal table. At the event PAI, only the work area wa or the header row of the internal table is filled with the content of the table control rows at the beginning of each loop pass. The content of the internal table is not automatically changed.

The syntax of additions CURSOR, FROM and TO is identical to the processing of step loops. When looping on table controls, you are allowed to use additions, but they are not really necessary, because the table controls are designed to be controlled by the structure of type CXTAB_CONTROL created via CONTROLS in the ABAP program. Here, top_line of component TOP_LINE corresponds to this structure while the number of rows to be displayed can be controlled using component LINES instead of n1 and n2. If n1 is still specified for table controls, the content of component CURRENT_LINE is calculated as follows, differing from the method shown at CONTROLS: sy-stepl+ (TOP_LINE - 1) + (n1 - 1).

Notes

For screen fields of the table control defined with a reference to flat structures in the ABAP Dictionary, the data objects with the same names of the ABAP program must be declared identically to normal screen fields using TABLES, otherwise there will be no data transport.

Between LOOP and ENDLOOP, at PBO no dialog module must be called to read the data from the internal table. At PAI, however, this is necessary provided you want to evaluate the transported data. For example, you can modify the internal table according to the user entries.

In the layout of a dynpro screen, there are two screen fields wa-col1 and wa-col2 belonging to a group of a step loop. The screen (dynpro) flow logic contains the following statements:

PROCESS BEFORE OUTPUT.

...

MODULE tab_init.

LOOP AT itab CURSOR top_line INTO wa.

ENDLOOP.

...

PROCESS AFTER INPUT.

...

MODULE get_first_line.

LOOP AT itab.

MODULE tab_in.

ENDLOOP.

...

Parallel loops are executed through the step loop and the internal itab table. At PBO, no dialog module is called in the loop. Instead, the module tab_init is called beforehand to edit the internal table itab. At PAI, the module tab_in is called in the loop to modify the internal table in accordance with the user specifications in the step loop. Beforehand, the module get_first_line is called in order to store the index of the first displayed table line in the help variable line. This is necessary since the content of top_line will be changed when the user scrolls further. The following program section shows the dialog modules of the corresponding ABAP program.

DATA: BEGIN OF wa,

col1 TYPE i,

col2 TYPE i,

END OF wa,

itab LIKE TABLE OF wa.

DATA: top_line TYPE i,

line TYPE i,

idx TYPE i.

...

MODULE tab_init OUTPUT.

IF itab IS INITIAL.

DO 40 TIMES.

wa-col1 = sy-index.

wa-col2 = sy-index ** 2.

APPEND wa TO itab.

ENDDO.

ENDIF.

ENDMODULE.

...

MODULE get_first_line INPUT.

line = top_line.

ENDMODULE.

MODULE tab_in INPUT.

idx = sy-stepl + line - 1.

MODIFY itab FROM wa INDEX idx.

ENDMODULE.

PBO.

Process Before Output, screen event. Triggered by the ABAP runtime environement before a screen is sent to the presentation layer. After PBO processing, screen fields receive the contents of data objects of the same name of the ABAP program.

so inorder form where the screen fields receive the value, the cursor postion indicates form the item the values is to be taken, so we use

********please reward points if the information is helpful to you*********

Former Member
0 Kudos

pbo work .

1 in screen values set default value pbo used

example : cursor possition,

default values...

pai.

when user clk any button .]

pbo works.

example navigate window.

Former Member
0 Kudos

Hi Ram,

Why to put cursor in PBO??

The commands in the flow logic are:

LOOP AT itab CURSOR c .

...

ENDLOOP.

These statements create a parallel loop pass through the step loop rows displayed on the screen and an internal table itabof the ABAP program. The additions INTO, CURSOR, and FROMare possible at the time of PBO, but not at PAI.

With this form of processing, the step loop display contains scroll bars. The scroll function is automatically defined by the system. The step loop rows, between which you can scroll, is copied over from the internal table in the ABAP program. Scrolling triggers the PAI event.

The CURSOR addition is used to control, at the time of PBO, which internal table row should be the first to appear in the screen display. c is a data object of the ABAP program of type i. Conversely, for every PAI event, c is set to the value of the first table row displayed. This allows you to synchronize the internal table of the ABAP program with the step loop rows displayed. It is recommended that you place c into an auxiliary variable at the start of PBO and do not evaluate it in the loop, because scrolling changes the value of c.

Using the INTO addition, the fields of the internal table itab are written to the work area wa at the time of PBO and the content of wa is transported line-by-line to the identically-named fields of the step loop on the screen. Without the INTO addition, you must use an internal table with a header line. Then the content of the header line is transported line-by-line to the identically-named fields of the step loop on the screen at the time of PBO. A module for filling the step loop rows is therefore not necessary.

Conversely, at the time of PAI, the internal table rows are not automatically filled with the contents of the step loop rows. Instead, you must call a module that fills the table within the loop. However, you must still specify the addition AT itab at the time of PAI, because otherwise scrolling with the scroll bars does not work.

You can use the FROM and TOadditions to limit the display or work area of the internal table in the step loop. n1 and n2are data objects of the ABAP program with type i. If you do not specify these parameters, the system uses the start and/or end of the internal table as the display or processing limit. If c is outside the limits n1 and n2, the latter take precedence.

The additions CURSOR c and FROM n1 TO n2 of the LOOP AT statement, which specify the starting line and number of displayed rows of the internal table for step loops, are possible with Table Controls in the Flow Logic, but not necessary. With TABLE CONTROLS, the display is controlled by using the structure CXTAB_CONTROL in the ABAP program.

· Instead of the CURSOR c, you should always use the component TOP_LINE for table controls. This component always contains the upper-most displayed row.

· If you also specify n1 for table controls, the calculation formula for the component CURRENT_LINE is changed to sy-stepl + (TOP_LINE -1) + (n1 - 1).

Thanks,

Vinay