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

Module pool program

Former Member
0 Likes
1,718

Hi Friends,

Requirement is to display a list of fields in module pool screen, some of the textboxes allow me to enter the value. when i hit save or enter button after entering the values on the module pool screen, it will update the other relative fields as well.

How to mark the field as MANDATORY, optional, display?

how to display calculative fields in screen?

Could you please give sample example to save all the entry in Module pool screen?

Thanks and regards,

BABA

1 ACCEPTED SOLUTION
Read only

sridhar_meesala
Active Contributor
0 Likes
1,369

Hi,

In order to make the fields as mandatory, double click on the field in screen painter and select 'required' in the input option.

For optional you need to do nothing.

For making them display only check the 'output only' check box.

To display calculated value in the module pool, you make a field as output only. If you want to add values of two fields and store them in the third one then in flow logic of the screen:

<field3> = <field1> + <field2>.

Hope it's helpful to you.

Thanks,

Sri.

6 REPLIES 6
Read only

sridhar_meesala
Active Contributor
0 Likes
1,370

Hi,

In order to make the fields as mandatory, double click on the field in screen painter and select 'required' in the input option.

For optional you need to do nothing.

For making them display only check the 'output only' check box.

To display calculated value in the module pool, you make a field as output only. If you want to add values of two fields and store them in the third one then in flow logic of the screen:

<field3> = <field1> + <field2>.

Hope it's helpful to you.

Thanks,

Sri.

Read only

0 Likes
1,369

Hi Sri

Thq Sri for quick response !

But the requirement is to display a list of fields in module pool screen, some of the textboxes allow me to enter the value. when i hit save or enter button after entering the values on the module pool screen, it will update the other relative fields as well.

Could you give sample example for this ?

Thxand regds,

BABA

Read only

0 Likes
1,369

Could you please elaborate a little in detail. Do you expect some new fields to appear once you enter some value to a field and press enter...

Read only

0 Likes
1,369

Hi,

Suppose if there are 5 fields in in your screen like emp no, name, dept., date of joining, date of birth.

now emp no is input field and the rest are output only fields.

so when you enter emp no it should display the results in the remaining fields.

If the requirement is like this then you can write like this in PAI.

CASE sy-ucomm.

WHEN 'F_SHOW'. " function code for the button

SELECT SINGLE empno

FROM <ztable>

INTO <local variable>

WHERE empno = ztable-empno.

IF sy-subrc = 0.

ztable-name = name.

ztable-dept = dept.

ztable-doj = doj.

ztable-dob = dob.

ELSE.

MESSAGE 'enter the correct empno' TYPE 'E'.

ENDIF.

ENDCASE.

revert incase of any issues.

Thanks,

Sri.

Read only

Former Member
0 Likes
1,369

Hi,

To make your fields mandatory go to Layout of the Screen -> Go to the Screen Attributes of the field you want make mandatory -> Go to Program Tab -> Make it required.

In order to display your calculative fields, you can have them Output only fields -> In the Screen Attributes -> Program Tab -> Uncheck Input field. The field will be greyed out for input purposes.

To save your data,

If the screen elements are ELE1, ELE2, ELE3

Then declare a workarea or an internal table (depends on your requirement)

data: begin of itab occurs 0,

field1(10) type c,

field2(10) type c,

field3(10) type c,

end of itab.

data: wa_itab like line of itab.

In your PAI of the screen,

Put all your user entered data into the work area from the screen elements

wa_itab-field1 = ele1.

wa_itab-field2 = ele2.

wa_itab-field3 = ele3.

append wa_itab to itab.

clear wa_itab.

"This inserts data into the database table from the internal table.

insert dbtable from itab. "Data is saved in the database

Read only

Former Member
0 Likes
1,369

Hi,

This serves your purpose

To code the sy-ucomm for Enter, one method is

Create a GUI Status -> In the Function Keys -> In any of the icons displayed, give a name (Function Code) like 'ENTER' -> double click on that -> asks for the Function Text and the Function Code is activated. Do not forget to activate your GUI Status

I have two screen elements MARA-MATNR and MAKT-MAKTX. On giving Material No, an Enter would fetch the Description.



module STATUS_0100 output.
  SET PF-STATUS 'STATUS'.
endmodule.                 " STATUS_0100  OUTPUT




module USER_COMMAND_0100 input.

GV_MATNR = MARA-MATNR.

  IF OK_CODE EQ 'ENTER'.
    SELECT SINGLE MAKTX FROM MAKT INTO GV_DESC WHERE MATNR EQ GV_MATNR.
      IF SY-SUBRC EQ 0.
        MAKT-MAKTX = GV_DESC.
      ENDIF.
  ENDIF.

endmodule.                 " USER_COMMAND_0100  INPUT


"TOP Include
TABLES: MARA,
        MAKT.

DATA: BEGIN OF T_MATNR OCCURS 0,
      MATNR TYPE MARA-MATNR,
      END OF T_MATNR.

DATA: GV_DESC TYPE MAKT-MAKTX,
      GV_MATNR TYPE MARA-MATNR,
      OK_CODE TYPE SY-UCOMM.