‎2010 Aug 10 10:02 AM
hi friends i have designed a screen displaying few fields from table MARA.
the code for it in PBO is :
MODULE STATUS_0100 OUTPUT.
" SET PF-STATUS 'ZMENU'.
" SET TITLEBAR 'ZMENU_PAINTER'.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'DISPLAY'.
BREAK-POINT.
SELECT SINGLE MATNR MBRSH MATKL ERNAM FROM MARA
INTO (MARA-MATNR,MARA-MBRSH,MARA-MATKL,MARA-ERNAM)
WHERE MATNR = MARA-MATNR.
WHEN 'CLEAR'.
CLEAR MARA.
ENDCASE.
ENDMODULE. " STATUS_0100 OUTPUTbut after executing entering the material no and clicking "display" doesn't display the data in other fields like MBRSH,MATKL,ERNAM
Moderator message: please use more descriptive subject lines from now on.
Edited by: Thomas Zloch on Aug 11, 2010 11:35 AM
‎2010 Aug 10 11:01 AM
hi,
as you have mentioned that, after entering the matnr no it must display the details but it is not. it is due to the code is in PBO , it must be in PAI because we are giving some action i.e. display after entering the material no. try writing the code in PAI. it must work.
Regards,
sirisha
‎2010 Aug 10 10:59 AM
‎2010 Aug 10 11:02 AM
@keshav: i have already tried.As u can see break-point before "display " in code.But it is not even entering into that block.Please help i m new to it
‎2010 Aug 10 11:14 AM
i have used debugging and found SY-UCOMM is blank and contains nothing in PBO.
‎2010 Aug 10 11:17 AM
Hi,
Have you assigned function code to your button of 'DIsplay'?
Or your sy-ucommis getting cleared somehow. Check what is the case with your code.
Thanks,
Archana
‎2010 Aug 10 11:01 AM
hi,
as you have mentioned that, after entering the matnr no it must display the details but it is not. it is due to the code is in PBO , it must be in PAI because we are giving some action i.e. display after entering the material no. try writing the code in PAI. it must work.
Regards,
sirisha
‎2010 Aug 10 11:08 AM
@ srisa : hi friend i have also tried that but still getting the same thing.
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'DISPLAY'.
BREAK-POINT.
SELECT SINGLE MATNR MBRSH MATKL ERNAM FROM MARA
INTO (MARA-MATNR,MARA-MBRSH,MARA-MATKL,MARA-ERNAM)
WHERE MATNR = MARA-MATNR.
WHEN 'CLEAR'.
CLEAR MARA.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
‎2010 Aug 10 11:14 AM
Hi,
SELECT SINGLE MATNR MBRSH MATKL ERNAM FROM MARA
INTO (MARA-MATNR,MARA-MBRSH,MARA-MATKL,MARA-ERNAM)
WHERE MATNR = MARA-MATNR.In your select query, does variable MARA-MATNR contain any value???
If it contains, did you try and check to put the same in MARA table via SE11 and check if there exists MBRSH, MATKL, ERNAM for that MATNR?
Thanks,
Archana
‎2010 Aug 10 11:17 AM
@Archana : yes it contains value enterd by me on the screen.But even after that the SY-UCOMM contains nothing
‎2010 Aug 10 11:32 AM
Hi,
do you maintianed the PF-status / GUI status in se 41
is there a Application tool added for Display and does the Function code is Display.
Next go to attributes in screen se51 and OK_code at last feild.
and write your code in PAI .
The try it will work.
and check there is no where the the MARA table is intialized in PBO or PAI, if so remove other wise it will clear the screen
Regards,
Prabhudas
‎2010 Aug 10 11:41 AM
there is nothing in Function code of " display " in screen painter.what should i write there.
i am using case ok_code now.
‎2010 Aug 10 11:59 AM
Hi,
Give function code for 'Display' button as 'Display' in screen painter.
It will work.
Thanks,
Archana
‎2010 Aug 10 12:19 PM
@arachna : yeah thanx now it is entering the cse for display and values are store in MARA-ERNAM etc.but on the output screen still no value is displyed in the fields.
‎2010 Aug 10 12:23 PM
Hi,
You need to put these values in the fields in PBO of next screen in which you are displaying these values.
It will display your values.
Thanks,
Archana
‎2010 Aug 11 5:30 AM
@arachna : should i create another screen to dislplay values.
actually while creating first screen :
1) i selected the four fields from the dictionary table MARA : ERNAM,MATNR,MBRSH,MATKL
2) now what i m doing is that on entering the material no in the screen and then clicking on "display" the other fields should be field automatically.
Actually one thing i want to confirm from u that : how do we recognize the inputs fields designed in screen painter in the ABAP program.like for push button we have function code but for input fields what should be used.
Also for displaying the data Do I need to create one more screen same as of earlier one and then display the values in it.
‎2010 Aug 11 10:21 AM
Hi,
Yes you will have to create new screen. and then add code in the PBO of that screen.
It will display your values.
And like pushbuttons, we don't need to give any function code for input/output fields.
Thanks,
Archana
‎2010 Aug 11 11:28 AM
@arachna : i have created similar second screen.now according to the following code in the PAI of screen_100 :
SELECT SINGLE MATNR MBRSH MATKL ERNAM FROM MARA
INTO (MARA-MATNR,MARA-MBRSH,MARA-MATKL,MARA-ERNAM)
WHERE MATNR = MARA-MATNR.
values are in MARA-MATNR,MARA-MBRSH,MARA-MATKL,MARA-ERNAM
no what should be the code in PBO of screen_200.like what should be wriiten ther to display values in the coressponding fields of scrien_200. On screen painter I have choosen "select from dictionary" this time also.
‎2010 Aug 11 11:36 AM
Hi,
In second screen, you need to put these values into your output fields in the second screen.
If output fields for MBRSH is P_MBRSH, then your code in PBO will be
P_MBRSH = MARA-MBRSH.You don't need to refer data dictionary for these fields.
Thanks,
Archana
‎2010 Aug 11 12:46 PM
@arachna : i think i m missing a basic small step.even now i m not getting the screen_200(in that screen i have not used "display" button)now my code is like this :
MODULE USER_COMMAND_0100 INPUT.
ok_code = sy-ucomm.
CASE OK_CODE.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'DISPLAY'.
SELECT SINGLE MATNR MBRSH MATKL ERNAM FROM MARA
INTO (MARA-MATNR,MARA-MBRSH,MARA-MATKL,MARA-ERNAM)
WHERE MATNR = MARA-MATNR.
WHEN 'CLEAR'.
CLEAR MARA.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&--------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&--------------------------------------------------------------*
* text
*--------------------------------------------------------------*
MODULE STATUS_0200 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
break-point.
mbrsh1 = mara-mbrsh.
matkl1 = mara-matkl.
p_ernam = mara-ernam.
ENDMODULE. " STATUS_0200 OUTPUTEdited by: achalmehra on Aug 11, 2010 1:46 PM
‎2010 Aug 11 1:05 PM
Hi,
You need to call screen 200 in PAI of the screen 100.
Just a small mistake from my side. You need to put your below code in PAI of screen 100 and then call screen 200.
mbrsh1 = mara-mbrsh.
matkl1 = mara-matkl.
p_ernam = mara-ernam.It must work.
Thanks,
Archana
‎2010 Aug 10 11:21 AM
hi,
try using ok_code type sy-ucomm and mention in the element list and write the case statement using
case ok_code.
it must capture the sy-ucomm value.
Hope it will help you.
Regards,
sirisha
‎2010 Aug 10 12:16 PM
Try a coding like
PROCESS BEFORE OUTPUT.
MODULE status_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100 AT EXIT_COMMAND.
FIELD MARA-MATNR MODULE MARA_MATNR_0100.
MODULE user_command_0100.
MODULE status_0210 OUTPUT.
SET PF-STATUS '0100' EXCLUDING tab.
* Create STATUS 0100 with your codes EXIT, BACK, CLEAR and DISPLAY
* give a type "E" exit for EXIT and BACK, keep space for the other 2
SET TITLEBAR '0100'.
ENDMODULE.
MODULE user_command_0100 INPUT.
CASE ok_code. " SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'DISPLAY'.
SELECT SINGLE matnr mbrsh matkl ernam
FROM mara
INTO (mara-matnr,mara-mbrsh,mara-matkl,mara-ernam)
WHERE matnr = mara-matnr.
WHEN 'CLEAR'.
CLEAR mara.
ENDCASE.
ENDMODULE.
MODULE mara_matnr_0100 INPUT.
SELECT SINGLE matnr
FROM mara
INTO mara-matnr
WHERE matnr = mara-matnr.
IF sy-subrc NE 0.
MESSAGE e305(m3) WITH mara-matnr.
ENDIF.
ENDMODULE.Regards,
Raymond
‎2010 Aug 11 11:28 AM
Hi Achal,
Stick to basics i.e., In screen programs if the variable name in program(Perticulary in TOP Include) and the
Field names in Screen are same AUTOMATIC DATA TRANSFER takes place.
in TOP include
tables : mara. " and also get the Screen fields from mara table
" And you dont need any other screens to display the Values from MARA table you can use the Same screen
in Flow logic
module status_100.
in program
module status_100.
select single * from mara into mara " This works as work area since tables declaration is there in TOP include
where matnr = mara-matnr. " this is the screen field you declared on the Screen
" Take the help of Raymonds Answer that is more helpful since it uses the Field statement in PAI
endmodule.Cheerz
Ram