Skip to Content
0
Former Member
Mar 01, 2011 at 01:25 PM

Checking Input field in table control

600 Views

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