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

table control

Former Member
0 Likes
433

hi all

write the syntax for table controlin flow logic and se38

4 REPLIES 4
Read only

Former Member
0 Likes
415

Hi Rohit,

In SE 38

First Create a internal table in your program

Data:
  begin of itab occurs 0,
    cbox type c,
    carrid type spfli-carrid,
    connid type spfli-connid,
  end of itab.

In SE51

Frist create table control by using the Table control wizard and write a module in PAI of Flow logic

In PAI.

Module operations.

double click on that module it will create a module in your program .

In your program

module operations input.

write what you want code........

endmodule.

Regards,

Mahi.

Read only

Former Member
0 Likes
415

Table controls indirectly relate to an internal table.

It is only form an internal table in a program that you access the table control.

And when displaying values in a table control, it will be done through an internal table from the program.

Even in the table control,the field names are given in the format <internal_table_name>-<field_name>.

If the value is being retrieved form a standard program,then the values need to be passed into the internal table and thus thye would be displayed on the table control.

The format that you need to follow in the PBO and PAI of the screen of the table control is :

PROCESS BEFORE OUTPUT.

LOOP WITH <table_control_name>.

MODULE user_command_0100.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP WITH CONTROL <table_control_name>.

module read_table_control.

ENDLOOP.

To handle table controls in ABAP programs, you must declare a control in the declaration part of the program for each table control using the following statement:

CONTROLS <ctrl> TYPE TABLEVIEW USING SCREEN <scr>.

where <ctrl> is the name of the table control on a screen in the ABAP program. The control allows the ABAP program to read the attributes of the table control and to influence the control. <scr> is the screen number where the initial values of the table are loaded.

Regards,

Read only

Former Member
0 Likes
415

Hi..

You can go thru this.

Top_Include :

----


  • Table Control Declarations

----


CONTROLS : tbc1 TYPE TABLEVIEW USING SCREEN '200',

PAI :

&----


*& Module MODIFY_ITAB INPUT

&----


MODULE modify_itab INPUT.

MODIFY it_vbak INDEX tbc1-current_line.

ENDMODULE. " MODIFY_ITAB INPUT

PBO :

&----


*& Module POPULATE_TBC1 OUTPUT

&----


MODULE populate_tbc1 OUTPUT.

vbak-vbeln = it_vbak-vbeln.

vbak-erdat = it_vbak-erdat.

vbak-ernam = it_vbak-ernam.

vbak-vbtyp = it_vbak-vbtyp.

vbak-auart = it_vbak-auart.

vbak-kunnr = it_vbak-kunnr.

ENDMODULE. " POPULATE_TBC1 OUTPUT

vbak-vbeln ,vbak-erdat , vbak-ernam , vbak-vbtyp, vbak-auart , vbak-kunnr are fields of Table Control. I am populating the values in to table Control in PBO.

SE 38 :

You Jus write Include statements of you PAI and PBO modules like below.

INCLUDE mz50871_sd_tablecontroltop. " Global Data

INCLUDE mz50871_sd_tablecontrol_usei01. " PAI Modules

INCLUDE mz50871_sd_tablecontrol_popo01. " PBO Modules

Regards

Sandeep reddy

Read only

Former Member
0 Likes
415

Hi,

Try this Code for Table Control

&----


*& Module pool SAPMZSD_MODP_TABCNTRL

&----


PROGRAM SAPMZSD_MODP_TABCNTRL MESSAGE-ID ZFAR.

************************************************************************

                                  • MODIFICATION LOG ******************&

************************************************************************

  • Date : 10/24/2007 *

  • Title : Customer Information *

  • Program Type : Modulepool Program *

  • Author : XXXXXXXXXx. *

  • Purpose : To display the Sales order and item details *

----


*---- Table declaration.

TABLES: KNA1.

CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 200.

CONTROLS TC2 TYPE TABLEVIEW USING SCREEN 300.

*---- Data declaration.

DATA:OKCODE LIKE SY-UCOMM.

DATA:V_KNA1 LIKE KNA1.

*DATA:ERROR TYPE C.

*---- Internal Table declaration.

DATA:BEGIN OF IT_TAB OCCURS 0,

CHK,

VBELN TYPE VBELN_VA,

KUNNR TYPE KUNAG,

ERDAT TYPE ERDAT,

AUDAT TYPE AUDAT,

VBTYP TYPE VBTYP,

END OF IT_TAB.

DATA:BEGIN OF IT_TAB1 OCCURS 0,

VBELN TYPE VBELN_VA,

POSNR TYPE POSNR_VA,

MATNR TYPE MATNR,

MATWA TYPE MATWA,

PMATN TYPE PMATN,

END OF IT_TAB1.

&----


*& Module USER_COMMAND_0100 INPUT

&----


MODULE USER_COMMAND_0100 INPUT.

OKCODE = SY-UCOMM.

CASE OKCODE.

WHEN 'DISP' OR SPACE.

SELECT *

FROM VBAK

INTO CORRESPONDING FIELDS OF TABLE IT_TAB

WHERE KUNNR = KNA1-KUNNR.

IF SY-SUBRC <> 0.

MESSAGE 'No sales document exists'(001) TYPE 'I'.

ENDIF.

LEAVE TO SCREEN 200.

CLEAR OKCODE.

*--- To leave Transaction

WHEN 'BACK' .

LEAVE PROGRAM.

CLEAR OKCODE.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module validate_kunnr INPUT

&----


MODULE VALIDATE_KUNNR INPUT.

V_KNA1 = KNA1.

SELECT SINGLE *

FROM KNA1

WHERE KUNNR = KNA1-KUNNR.

*-----Process error condition

IF SY-SUBRC <> 0.

CLEAR KNA1.

KNA1-KUNNR = V_KNA1-KUNNR.

CASE OKCODE..

WHEN 'BACK' OR 'EXIT' .

LEAVE PROGRAM.

ENDCASE.

MESSAGE 'Customer Does Not Exist'(002) TYPE 'I'.

LEAVE TO SCREEN 100.

ENDIF.

ENDMODULE. " validate_kunnr INPUT

&----


*& Module STATUS_0100 OUTPUT

&----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'PF'.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0200 INPUT

&----


MODULE USER_COMMAND_0200 INPUT.

CASE OKCODE.

WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.

LEAVE TO SCREEN 100.

CLEAR OKCODE.

CLEAR IT_TAB1.

WHEN 'DISP' .

CLEAR OKCODE.

READ TABLE IT_TAB WITH KEY CHK = 'X'.

IF SY-SUBRC = 0.

SELECT VBELN POSNR MATNR MATWA PMATN

FROM VBAP

INTO TABLE IT_TAB1

WHERE VBELN = IT_TAB-VBELN.

IF SY-SUBRC = 0.

SORT IT_TAB.

DESCRIBE TABLE IT_TAB LINES TC1-LINES.

LEAVE TO SCREEN 300.

ELSE.

MESSAGE E016(YBHV).

ENDIF.

ELSE.

MESSAGE 'Please select one record' TYPE 'I'.

ENDIF.

ENDCASE.

ENDMODULE. " USER_COMMAND_0200 INPUT

&----


*& Module STATUS_0200 OUTPUT

&----


MODULE STATUS_0200 OUTPUT.

SET PF-STATUS 'PF3'.

ENDMODULE. " STATUS_0200 OUTPUT

&----


*& Module USER_C.OMMAND_0300 INPUT

&----


  • text

----


MODULE USER_COMMAND_0300 INPUT.

SET PF-STATUS 'PF3'.

CASE OKCODE.

WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.

CLEAR OKCODE.

LEAVE TO SCREEN 200.

ENDCASE.

ENDMODULE. " USER_COMMAND_0300 INPUT

&----


*& Module modify INPUT

&----


MODULE MODIFY INPUT.

MODIFY IT_TAB INDEX TC1-CURRENT_LINE.

ENDMODULE. " modify INPUT

&----


*& Module okcode OUTPUT

&----


  • text

----


MODULE OKCODE OUTPUT.

CLEAR OKCODE.

ENDMODULE. " okcode OUTPUT

Hope this use for u, reward point

Regards

Fareedas

Edited by: sft on Feb 21, 2008 11:24 AM