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

problem in selection screen

Former Member
0 Likes
510

hi

Iam not getting the output when I click the DISPLAY button.

I have given the user command as OK1.

TABLES MARA.

DATA:BEGIN OF WA,

MATNR LIKE MARA-MATNR,

ERNAM LIKE MARA-ERNAM,

END OF WA.

DATA ITAB LIKE TABLE OF WA.

SELECTION-SCREEN : BEGIN OF SCREEN 900 AS WINDOW.

SELECTION-SCREEN BEGIN OF BLOCK BL1.

SELECT-OPTIONS MAT FOR MARA-MATNR MATCHCODE OBJECT z451mat OBLIGATORY..

SELECTION-SCREEN END OF BLOCK BL1.

SELECTION-SCREEN PUSHBUTTON /24(9) MAT2 USER-COMMAND OK1.

SELECTION-SCREEN : END OF SCREEN 900.

INITIALIZATION.

MAT2 = 'DISPLAY'.

START-OF-SELECTION.

CALL SELECTION-SCREEN '900'.

AT SELECTION-SCREEN.

case sy-ucomm.

when 'OK1'.

select matnr ernam from mara INTO CORRESPONDING FIELDS OF TABLE itab

where Matnr in mat.

endcase.

loop at itab into wa.

WRITE : / wa-matnr,wa-ernam.

ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
475

Hello,

Try using the folliwowing code.

REPORT ZTESTHIM_TEST1.

TABLES MARA.

DATA:BEGIN OF WA,

MATNR LIKE MARA-MATNR,

ERNAM LIKE MARA-ERNAM,

END OF WA.

DATA ITAB LIKE TABLE OF WA.

SELECTION-SCREEN : BEGIN OF SCREEN 900 AS WINDOW.

SELECTION-SCREEN BEGIN OF BLOCK BL1.

SELECT-OPTIONS MAT FOR MARA-MATNR MATCHCODE OBJECT z451mat OBLIGATORY..

SELECTION-SCREEN END OF BLOCK BL1.

SELECTION-SCREEN PUSHBUTTON /24(9) MAT2 USER-COMMAND OK1.

SELECTION-SCREEN : END OF SCREEN 900.

INITIALIZATION.

MAT2 = 'DISPLAY'.

START-OF-SELECTION.

CALL SELECTION-SCREEN '900'.

AT SELECTION-SCREEN.

case sy-ucomm.

when 'OK1'.

select matnr ernam from mara INTO CORRESPONDING FIELDS OF TABLE itab

where Matnr in mat.

endcase.

leave to SCREEN 0.

END-OF-SELECTION.

loop at itab into wa.

WRITE : / wa-matnr,wa-ernam.

ENDLOOP.

What i have done is only added END-OF-SELECTION before the loop...endloop and added a statement LEAVE TO SCREEN 0 after the data is fetched using select.

Hope this helps.

Regards,

Himanshu

3 REPLIES 3
Read only

Former Member
0 Likes
475

what about if you debug it? You program is very tiny so debugging is really not only AN but even THE alternative.

Read only

Former Member
0 Likes
476

Hello,

Try using the folliwowing code.

REPORT ZTESTHIM_TEST1.

TABLES MARA.

DATA:BEGIN OF WA,

MATNR LIKE MARA-MATNR,

ERNAM LIKE MARA-ERNAM,

END OF WA.

DATA ITAB LIKE TABLE OF WA.

SELECTION-SCREEN : BEGIN OF SCREEN 900 AS WINDOW.

SELECTION-SCREEN BEGIN OF BLOCK BL1.

SELECT-OPTIONS MAT FOR MARA-MATNR MATCHCODE OBJECT z451mat OBLIGATORY..

SELECTION-SCREEN END OF BLOCK BL1.

SELECTION-SCREEN PUSHBUTTON /24(9) MAT2 USER-COMMAND OK1.

SELECTION-SCREEN : END OF SCREEN 900.

INITIALIZATION.

MAT2 = 'DISPLAY'.

START-OF-SELECTION.

CALL SELECTION-SCREEN '900'.

AT SELECTION-SCREEN.

case sy-ucomm.

when 'OK1'.

select matnr ernam from mara INTO CORRESPONDING FIELDS OF TABLE itab

where Matnr in mat.

endcase.

leave to SCREEN 0.

END-OF-SELECTION.

loop at itab into wa.

WRITE : / wa-matnr,wa-ernam.

ENDLOOP.

What i have done is only added END-OF-SELECTION before the loop...endloop and added a statement LEAVE TO SCREEN 0 after the data is fetched using select.

Hope this helps.

Regards,

Himanshu

Read only

0 Likes
475

Thanks Himanshu. its working now