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: 

Checking Input field in table control

former_member925838
Participant
0 Kudos

Hello Experts,

I am writing a module pool program, where i want to check an input field in table control with respect to specific table entry.

my flow logic is:

for screen 800:(initial screen)

PROCESS BEFORE OUTPUT.

MODULE STATUS_0800.

PROCESS AFTER INPUT.

CHAIN.

FIELD RESB-RSNUM MODULE CHECK.

ENDCHAIN.

MODULE USER_COMMAND_0800.

for screen 801( where table control is present)

PROCESS BEFORE OUTPUT.

MODULE STATUS_0801.

MODULE GETDATA.

LOOP AT ITAB2 WITH CONTROL TAB1.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT ITAB2.

CHAIN.

FIELD RESB-MATNR. "MODULE CHECKMATNR.

ENDCHAIN.

MODULE USER_COMMAND_0801.

ENDLOOP.

module pool program is:

PROGRAM ZDEMO.

TABLES: RESB, makt.

DATA: ITAB LIKE STANDARD TABLE OF RESB WITH HEADER LINE,

itab2 LIKE STANDARD TABLE OF itab WITH HEADER LINE,

itab3 like STANDARD TABLE OF makt WITH HEADER LINE,

cnt type i VALUE 0.

DATA: WA LIKE LINE OF ITAB.

CONTROLS TAB1 TYPE TABLEVIEW USING SCREEN '0801'.

MODULE STATUS_0800 OUTPUT.

SET PF-STATUS 'ZSTAT'.

SET TITLEBAR 'ZTITLE'.

ENDMODULE. " STATUS_0800 OUTPUT

MODULE USER_COMMAND_0800 INPUT.

CASE SY-UCOMM.

WHEN 'ENTER'.

CALL SCREEN '0801'.

WHEN 'BACK'.

LEAVE PROGRAM .

WHEN 'CANCEL'.

EXIT..

ENDCASE.

ENDMODULE. " USER_COMMAND_0800 INPUT

MODULE STATUS_0801 OUTPUT.

SET PF-STATUS 'ZSTAT'.

SET TITLEBAR 'ZTITLE'.

ENDMODULE. " STATUS_0801 OUTPUT

MODULE USER_COMMAND_0801 INPUT.

CASE SY-UCOMM.

WHEN 'ENTER'.

perform checkmatnr.

PERFORM getmaktx.

WHEN 'BACK'.

CALL SCREEN '0800'.

WHEN 'CANCEL'.

LEAVE TO SCREEN '000'.

ENDCASE.

ENDMODULE. " USER_COMMAND_0801 INPUT

MODULE CHECK INPUT.

SELECT RSNUM MATNR WERKS FROM RESB INTO CORRESPONDING FIELDS OF TABLE itab

WHERE RSNUM = RESB-RSNUM.

IF SY-SUBRC <> 0.

MESSAGE E001(ZAM).

ENDIF.

ENDMODULE. " CHECK INPUT

MODULE GETDATA OUTPUT.

DO 50 TIMES.

SELECT RSNUM WERKS FROM RESB INTO CORRESPONDING FIELDS OF TABLE itab

WHERE RSNUM = RESB-RSNUM.

READ TABLE itab INTO wa WITH key rsnum = resb-rsnum.

APPEND wa to ITAB2.

ENDDO.

ENDMODULE. " GETDATA OUTPUT

form getmaktx.

select matnr maktx from makt INTO CORRESPONDING FIELDS OF TABLE itab3

WHERE matnr = resb-matnr.

ENDFORM.

FORM CHECKMATNR ."INPUT..

if cnt = 0.

SELECT RSnum MATNR FROM RESB INTO CORRESPONDING FIELDS OF TABLE itab3

WHERE rsnum = resb-rsnum and matnr = resb-matnr. "and werks = resb-werks.

IF SY-SUBRC <> 0.

MESSAGE E002(ZAM).

ELSE.

cnt = cnt + 1.

ENDIF.

endif.

ENDFORM. " CHECKMATNR INPUT

In subroutine i.e. in form checkmatnr i want to check material no is present or not. but system autofield check is automatically done. my subroutine never get called........

so, please can anyone tell me what is solution for checking input field in table control.

Edited by: amar_war on Mar 1, 2011 2:26 PM

3 REPLIES 3

brad_bohn
Active Contributor
0 Kudos

my subroutine never get called........

Before or after you commented out the call?

Do you have a development or QA lead that can advise you? You have many other issues with your dialog program code as well.

0 Kudos

Now I can call module, but my problem is that i am giving input in table control.

my input is matnr and i have to check that no is present or not and if present then give its description in table.

so when i give input in table control it checks the value for all rows of table control. because of loop. but if i write field statement outside the loop it is giving me error.

so how can i check or process my value for single row in table control.

I am new to abap and

I am under training....but i am learning all things myself. no proper guidance is there.........

Danish
Explorer
0 Kudos

Hi,

Try this inside your table control loop. wa_tabctrl denotes the field which you are using on the screen

CHAIN.

FIELD:

wa_tabctrl-matnr.

MODULE CHECKMATNR ON CHAIN-REQUEST.

ENDCHAIN.

-Danish