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

Reg Module pool screen field f4 functionality

Former Member
0 Likes
1,554

Hi All,

How to give F4 functionality to field that we have added to a screen? My requirement is like I have added new field to the screen 8459 program sapmv45a(sales order transactions program) for this new field which I have added is the custom field how I will give f4 functionality? and also to validate the field value that has been entered for this. In which event we have to write the code PBO or PAI?

and what code we have to write,I am new to module pool program it will be gr8 if some body give piece of code.

Thanks&Regards

Mahesh

12 REPLIES 12
Read only

former_member508729
Active Participant
0 Likes
1,092

Hi Mahesh,

You hace to write code for f4 functionality in PAI of scree,

like

process on value request for field field1.

module f4_field.

Regards

Ashutosh

Reward points if helpful

Message was edited by:

ashutosh ambekar

Read only

Former Member
0 Likes
1,092

1) to validate a screen field u have to write code in PAi as follows -

PROCESS AFTER INPUT.

field itab-pernr MODULE CHECK_PERNR. "itab-pernr is screen field

module CHECK_PERNR input.

IF ( ( ITAB-PERNR EQ SPACE ) and ( itab-pernr co '0123456789' ) ).

MESSAGE E000(000) WITH 'MANDATORY FIELD'.

ENDIF.

endmodule.

2) to add F4 help on a screen field ,u have to use event "value-request" as follows -

PROCESS ON VALUE-REQUEST.

FIELD ITAB-PERNR MODULE F4_HELP.

module F4_HELP input.

data: begin of lt_all occurs 0.

include structure DYNPREAD.

data end of lt_all.

data: begin of lt_selected occurs 0.

include structure DDSHRETVAL.

data: end of lt_selected.

DATA: BEGIN OF lt_code OCCURS 0,

code LIKE zgill_main-PERNR,

END OF lt_code.

data no_dyn like sy-dynnr.

no_dyn = sy-dynnr. "give the scren no directly or sy-dynnr in case of report.

*At selection-screen on value-request for ECODE.

select PERNR into table lt_code from zgill_main.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'ITAB-PERNR'

dynpprog = sy-repid

dynpnr = no_dyn

dynprofield = 'ITAB-PERNR'

window_title = 'Employee Details'

value_org = 'S'

DISPLAY = 'F'

TABLES

value_tab = lt_code

RETURN_TAB = lt_selected.

  • EXCEPTIONS

  • PARAMETER_ERROR = 1

  • NO_VALUES_FOUND = 2

  • OTHERS = 3

*if sy-subrc eq '0' .

  • write: 'success'.

*endif.

read table lt_selected index sy-tabix.

move lt_selected-fieldval to ITAB-PERNR.

endmodule. " F4_HELP INPUT

reward points if helpfull

amit

Read only

Former Member
0 Likes
1,092

you have to use PROCESS ON VALUE-REQUEST

here you have to use Module name.

regards

shiba dutta

Read only

0 Likes
1,092

Dear Sir,

process before output.

   module status_1002.

process after input.

      PROCESS ON VALUE-REQUEST.

     FIELD ZBUD-KUNNR  MODULE f4_help.

module f4_help input.

  module user_command_1002.

as reference from your code i did my program : but i have get error like this..

Program SAPMZBUDGET_INFO,Screen 1002

Module specification possible only with FIELD.

plz help me : akshath.lt@gmail.com

Read only

Former Member
0 Likes
1,092

Mahesh,

There is an event called <b>Process on Value Request</b>, which satisfied ur f4 functionality.

U should code:

<b>Process on value request.

field table-fieldname module val.</b>

double click on val.

u can write the code as per ur requirement in module pool pgm.

u can use function modules -<b> 'popup_with_table_display' or 'f4if_int_table valuerequest'.</b> u have to pass the fieldname that needs that f4 functionality in the fm.

Regards...

Arun.

Read only

0 Likes
1,092

Hi All,

Thanks a lot for your reposne can you also please clarify how I have to populate the data into this field? I have addedn the new custom field market segment(zzsegnam) and this field I also added into the table VBAP using append structure

Now how I will assign the value to this screen field whehther we have to do this in PBO or PAI? I want to fetch data for this from other custom table and I have to populate this? How to achieve this?

Thanks&Regards

Mahesh

Read only

0 Likes
1,092

where ur program is fetching data for the original table?

there only u can fetch this data..

otherwise u need to write code in PBO or PAI as per ur requiremtn.

u can use any of events it depends only on ur need where actually u need tht data..

dont forget to reward points to helpfull answers.

amit

Read only

Former Member
0 Likes
1,092

sorry icannot get your actual requirement.

if you want to populate your field after giving input to vbeln or other fields and when you press enter then write the code in pai .

regards

shiba dutta

Read only

0 Likes
1,092

Hi,

My doubt is how to assign the data to field which we have added to the screen by default.when we go this screen in va01 it should have data placed in that by default

for this in the module of PBO how I have to reference to the screen field is it like

scree-field = <value>?

Thanks&Regards

mahesh

Read only

0 Likes
1,092

just fetch data at PBO event as per ur requiremnt -

PROCESS BEFORE OUTPUT.

MODULE CHECK_RECORD.

module CHECK_RECORD output.

SELECT SINGLE * FROM ZGILL_MAIN

WHERE PERNR = ITAB-PERNR.

ITAB-PERNR = ZGILL_MAIN-PERNR. "itab-pernr is my field name on screen

ITAB-NAME = ZGILL_MAIN-NAME.

ITAB-DOB = ZGILL_MAIN-DOB.

ITAB-ORG = ZGILL_MAIN-ORG.

endmodule. " CHECK_RECORD OUTPUT

u can check ur screen field names and fetch data in them..

Read only

Former Member
0 Likes
1,092

PROCESS ON VALUE-REQUEST.

FIELD NAME1 MODULE F4HELP.

NAME1 is screen field for which f4 is to be done.

declare internal table of type DDSHRETVAL

data:TP_DIRTY LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE.

MODULE F4HELP INPUT.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'NAME'

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNNR

DYNPROFIELD = 'NAME1'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = ITAB

RETURN_TAB = TP_DIRTY.

ENDMODULE. " F4HELP INPUT

note : NAME is the field of table itab, the value of which is used as a dropdown when f4 is clicked on screen field NAME1.

Read only

Former Member
0 Likes
1,092

Suppose u have added ZFIELD to the standard program screen. If u want to display values from any standard SAP table then assign search help to ZFIELD using SE11 transaction . If u want to display values which are not from standard table then define one internal table e.g. ITAB populate this internal table and use following function module in PROCESS ON VALUE-REQUEST event.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = l_retfield "returning field

dynpprog = l_program "Program name

dynpnr = l_sydynnr "Screen number

dynprofield = l_dynprofield "Screen field

value_org = c_s "Sturctured

TABLES

value_tab = i_TAB

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

As far as validation is concerned if the value is standard SAP table value , validate using select command and if it is not standard SAP table value validate using READ command on ITAB table populated above....