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

screen painter

Former Member
0 Likes
2,270

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  OUTPUT

but 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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,163

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

22 REPLIES 22
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,163

Debug and find the solution.

Read only

0 Likes
2,163

@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

Read only

0 Likes
2,163

i have used debugging and found SY-UCOMM is blank and contains nothing in PBO.

Read only

0 Likes
2,163

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

Read only

Former Member
0 Likes
2,164

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

Read only

0 Likes
2,163

@ 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

Read only

0 Likes
2,163

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

Read only

0 Likes
2,163

@Archana : yes it contains value enterd by me on the screen.But even after that the SY-UCOMM contains nothing

Read only

0 Likes
2,163

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

Read only

0 Likes
2,163

there is nothing in Function code of " display " in screen painter.what should i write there.

i am using case ok_code now.

Read only

0 Likes
2,163

Hi,

Give function code for 'Display' button as 'Display' in screen painter.

It will work.

Thanks,

Archana

Read only

0 Likes
2,163

@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.

Read only

0 Likes
2,163

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

Read only

0 Likes
2,163

@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.

Read only

0 Likes
2,163

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

Read only

0 Likes
2,163

@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.

Read only

0 Likes
2,163

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

Read only

0 Likes
2,163

@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  OUTPUT

Edited by: achalmehra on Aug 11, 2010 1:46 PM

Read only

0 Likes
2,163

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

Read only

Former Member
0 Likes
2,163

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

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,163

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

Read only

Former Member
0 Likes
2,163

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