Application Development 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: 

dialog programming problem.

Former Member
0 Kudos
107

hi ,

i am facing a strange problem. this happend first time .

well i m working on FI dialog programme.

i have several single input/output entry.

well my problem is when i m using to show the entry by select key fields and by pressing enter , it is working nicely but when i m going for refresh and again for show by f4 entry help in key field it is not showing the details.

my second problem is when i m creating or changing a new entry then if i m using mouce only it is working nicely but if i use enter that entry and all other entry washed.

please help me , i m waiting for good suggestion.

process before output.

module status_9000.

module disable_screen.

module display_data.

process after input.

module user_command_9000.

  • chain.

module user_action.

  • endchain.

process on value-request.

field zfit_projmst-status module value_help_status.

&----


*& Module pool SAPMZA_ZFI_PRMST

*&

&----


*&

*&

&----


PROGRAM SAPMZA_ZFI_PRMST.

TABLES: ZFIT_PROJMST.

TYPE-POOLS : VRM.

DATA: W_PROJMST LIKE ZFIT_PROJMST.

DATA: W_PROJMST1 LIKE ZFIT_PROJMST.

DATA: OK_CODE LIKE SY-UCOMM OCCURS 0 WITH HEADER LINE.

DATA: SAVE_OK LIKE OK_CODE OCCURS 0 WITH HEADER LINE.

DATA: W_LEN TYPE I.

*DATA DEFINE GLOBALY

DATA: W_A(1),

W_B(1),

W_C(1),

W_P(1).

*END

DATA: RESULT1(15) TYPE C,

RESULT2(15) TYPE C,

RESULT3(15) TYPE C,

RESULT4(15) TYPE C,

RESULT5(15) TYPE C,

RESULT6(15) TYPE C,

RESULT7(15) TYPE C,

SUM(15) TYPE C.

DATA: NAME2 TYPE VRM_ID,

LIST1 TYPE VRM_VALUES,

VALUE1 LIKE LINE OF LIST1.

DATA: PROJECT_CD1(5) TYPE C.

DATA: Begin of t_status occurs 0,

status like zfit_projmst-status,

end of t_status.

&----


*& Module STATUS_9000 OUTPUT

&----


  • text

----


MODULE STATUS_9000 OUTPUT.

SET PF-STATUS 'PUSH'.

SET TITLEBAR 'TITLE'.

REFRESH LIST1.

CLEAR LIST1.

NAME2 = 'ZFIT_PROJMST-PR_SUCCESS'

.

value1-key = '01'.

value1-text = 'Y'.

append value1 to list1.

value1-key = '02'.

value1-text = 'N'.

append value1 to list1.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME2

VALUES = LIST1.

ENDMODULE. " STATUS_9000 OUTPUT

&----


*& Module USER_COMMAND_9000 INPUT

&----


  • text

----


MODULE USER_COMMAND_9000 INPUT.

IF SY-UCOMM = 'NEW'.

loop at screen.

if screen-group1 = '001'.

screen-ACTIVE = '1'.

modify screen.

endif.

IF SCREEN-GROUP2 = '002'.

SCREEN-ACTIVE = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

W_A = 1.

ENDIF.

CASE OK_CODE.

WHEN 'BACK' .

LEAVE PROGRAM.

  • WHEN 'REFRESH'.

  • CLEAR ZFIT_PROJMST.

ENDCASE.

ENDMODULE. " USER_COMMAND_9000 INPUT

&----


*& Module DISABLE_SCREEN OUTPUT

&----


  • text

----


MODULE DISABLE_SCREEN OUTPUT.

if sy-ucomm = 'CHANGE'.

loop at screen.

screen-active = '1'.

screen-input = '1'.

modify screen.

endloop.

  • endif.

elseif sy-ucomm eq 'NEW'.

*if sy-ucomm eq 'NEW'.

loop at screen.

if screen-group1 = '001'.

screen-input = '1'.

modify screen.

endif.

endloop.

else.

IF W_B <> 1.

loop at screen.

if screen-group2 = '002'.

screen-input = '0'.

modify screen.

endif.

endloop.

W_B = 1.

endif.

ENDIF.

IF W_P <> 1.

LOOP AT SCREEN.

check SCREEN-GROUP3 = '003'.

SCREEN-INPUT = '0'.

MODIFY SCREEN.

  • endif.

ENDLOOP.

W_P = 0.

ENDIF.

ENDMODULE. " DISABLE_SCREEN OUTPUT

&----


*& Module DISPLAY_DATA OUTPUT

&----


  • text

----


MODULE DISPLAY_DATA OUTPUT.

if W_A <> 1.

if W_B <> 1.

  • if w_c <> 1.

  • if w_p <> 1.

loop at screen.

if screen-group2 = '002'.

screen-input = '1'.

modify screen.

endif.

endloop.

endif.

  • endif.

endif.

if not ZFIT_PROJMST-PROJECT_CD is initial.

select single * from ZFIT_PROJMST

where PROJECT_CD = ZFIT_PROJMST-PROJECT_CD.

if W_B <> 1.

select single * from ZFIT_PROJMST into W_PROJMST

where PROJECT_CD = ZFIT_PROJMST-PROJECT_CD.

if sy-subrc = 0.

move W_PROJMST-PROJECT_CD TO ZFIT_PROJMST-PROJECT_CD.

move W_PROJMST-plant TO ZFIT_PROJMST-plant.

move W_PROJMST-PROJECT TO ZFIT_PROJMST-PROJECT.

move W_PROJMST-STATUS TO ZFIT_PROJMST-STATUS.

move W_PROJMST-SECTOR TO ZFIT_PROJMST-SECTOR.

move W_PROJMST-PR_VALUE TO ZFIT_PROJMST-PR_VALUE.

move W_PROJMST-PR_ST_DATE TO ZFIT_PROJMST-PR_ST_DATE.

move W_PROJMST-PR_COP_DATE TO ZFIT_PROJMST-PR_COP_DATE.

move W_PROJMST-PR_EMD TO ZFIT_PROJMST-PR_EMD.

move W_PROJMST-PR_PERFORM TO ZFIT_PROJMST-PR_PERFORM.

move W_PROJMST-PR_ADV_MOBI TO ZFIT_PROJMST-PR_ADV_MOBI.

move W_PROJMST-PR_ADV_EQP TO ZFIT_PROJMST-PR_ADV_EQP.

move W_PROJMST-PR_ADV_SUP TO ZFIT_PROJMST-PR_ADV_SUP.

move W_PROJMST-PR_RETEN TO ZFIT_PROJMST-PR_RETEN.

move W_PROJMST-PR_OTHER TO ZFIT_PROJMST-PR_OTHER.

move W_PROJMST-PR_SUCCESS TO ZFIT_PROJMST-PR_SUCCESS.

RESULT1 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_EMD ) / 100.

RESULT2 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_PERFORM ) / 100.

RESULT3 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_ADV_MOBI ) / 100.

RESULT4 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_ADV_EQP ) / 100.

RESULT5 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_ADV_SUP ) / 100.

RESULT6 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_RETEN ) / 100.

RESULT7 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_OTHER ) / 100.

ENDIF.

ENDIF.

ENDIF.

IF ZFIT_PROJMST-PR_SUCCESS = '01'.

loop at screen.

if screen-group3 = '003'.

screen-active = '1'.

screen-input = '1'.

modify screen.

endif.

endloop.

ENDIF.

if zfit_projmst-plant is not initial.

loop at screen.

if screen-group4 = '004'.

screen-active = '0'.

screen-input = '0'.

modify screen.

endif.

endloop.

endif.

ENDMODULE. " DISPLAY_DATA OUTPUT

&----


*& Module USER_ACTION INPUT

&----


  • text

----


MODULE USER_ACTION INPUT.

IF OK_CODE = 'NEW'.

clear:ZFIT_PROJMST,W_B,RESULT1,RESULT2,RESULT3,RESULT4,RESULT5,

RESULT6,RESULT7,SUM.

loop at screen.

if screen-group2 = '002'.

screen-input = '1'.

modify screen.

endif.

endloop.

W_A = 1.

ENDIF.

if ok_code = 'SAVE'.

if w_B <> 1.

if ZFIT_PROJMST-PROJECT_CD is not initial.

SELECT SINGLE * FROM ZFIT_PROJMST INTO W_PROJMST

WHERE PROJECT_CD = ZFIT_PROJMST-PROJECT_CD.

if sy-subrc = 0.

MESSAGE 'Entry already maintained' TYPE 'W'.

endif.

if sy-subrc <> 0.

move ZFIT_PROJMST-PROJECT_CD TO W_PROJMST-PROJECT_CD.

move ZFIT_PROJMST-plant TO W_PROJMST-Plant .

move ZFIT_PROJMST-PROJECT TO W_PROJMST-PROJECT .

move ZFIT_PROJMST-STATUS TO W_PROJMST-STATUS.

move ZFIT_PROJMST-SECTOR TO W_PROJMST-SECTOR .

move ZFIT_PROJMST-PR_VALUE TO W_PROJMST-PR_VALUE.

move ZFIT_PROJMST-PR_ST_DATE TO W_PROJMST-PR_ST_DATE .

move ZFIT_PROJMST-PR_COP_DATE TO W_PROJMST-PR_COP_DATE .

move ZFIT_PROJMST-PR_EMD TO W_PROJMST-PR_EMD .

move ZFIT_PROJMST-PR_PERFORM TO W_PROJMST-PR_PERFORM .

move ZFIT_PROJMST-PR_ADV_MOBI TO W_PROJMST-PR_ADV_MOBI .

move ZFIT_PROJMST-PR_ADV_EQP TO W_PROJMST-PR_ADV_EQP .

move ZFIT_PROJMST-PR_ADV_SUP TO W_PROJMST-PR_ADV_SUP .

move ZFIT_PROJMST-PR_RETEN TO W_PROJMST-PR_RETEN.

move ZFIT_PROJMST-PR_OTHER TO W_PROJMST-PR_OTHER.

move ZFIT_PROJMST-PR_SUCCESS TO W_PROJMST-PR_SUCCESS.

RESULT1 = ( W_PROJMST-PR_EMD * W_PROJMST-PR_VALUE ) / 100.

RESULT2 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_PERFORM ) / 100.

RESULT3 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_ADV_MOBI ) / 100.

RESULT4 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_ADV_EQP ) / 100.

RESULT5 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_ADV_SUP ) / 100.

RESULT6 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_RETEN ) / 100.

RESULT7 = ( W_PROJMST-PR_VALUE * W_PROJMST-PR_OTHER ) / 100.

SUM = RESULT1 + RESULT2 + RESULT3 + RESULT4 + RESULT5 + RESULT6 +

RESULT7.

PROJECT_CD1 = W_PROJMST-PROJECT_CD.

w_len = STRLEN( PROJECT_CD1 ).

w_len = STRLEN( PROJECT_CD1 ).

If w_len < 5.

MESSAGE 'Project Code must be 5 characters' TYPE 'E'.

Endif.

if W_PROJMST-PROJECT eq ''.

message 'Enter the Project Description' type 'E'.

endif.

if w_projmst-PR_VALUE eq ''.

message 'Enter Project Value' type 'E'.

endif.

IF SUM GE ZFIT_PROJMST-PR_VALUE.

MESSAGE 'Value exceeding project value' TYPE 'E'.

ENDIF.

IF W_PROJMST-PR_COP_DATE LT W_PROJMST-PR_ST_DATE.

MESSAGE 'Completion Date is less than start date'

TYPE 'E'.

ENDIF.

*FIRST

insert into ZFIT_PROJMST values W_PROJMST.

if sy-subrc = 0.

commit work.

MESSAGE 'Entry is saved' TYPE 'S'.

endif.

else.

PROJECT_CD1 = zfit_PROJMST-PROJECT_CD.

w_len = STRLEN( PROJECT_CD1 ).

w_len = STRLEN( PROJECT_CD1 ).

If w_len < 5.

MESSAGE 'Project Code must be 5 characters' TYPE 'E'.

Endif.

if zfit_PROJMST-PROJECT eq ''.

message 'Enter the Project Description' type 'E'.

endif.

if zfit_projmst-PR_VALUE eq ''.

message 'Enter Project Value' type 'E'.

endif.

IF SUM GE ZFIT_PROJMST-PR_VALUE.

MESSAGE 'Value exceeding project value' TYPE 'E'.

ENDIF.

IF W_PROJMST-PR_COP_DATE LT W_PROJMST-PR_ST_DATE.

MESSAGE 'Completion Date is less than start date'

TYPE 'E'.

ENDIF.

IF ZFIT_PROJMST-PR_SUCCESS = '01'.

loop at screen.

if screen-group3 = '003'.

screen-active = '1'.

screen-input = '1'.

modify screen.

endif.

endloop.

ENDIF.

if zfit_projmst-plant is not initial.

loop at screen.

if screen-group4 = '004'.

screen-active = '0'.

modify screen.

endif.

endloop.

endif.

update ZFIT_PROJMST

set PROJECT_CD = ZFIT_PROJMST-PROJECT_CD

plant = zfit_projmst-plant

PROJECT = ZFIT_PROJMST-PROJECT

STATUS = ZFIT_PROJMST-STATUS

SECTOR = ZFIT_PROJMST-SECTOR

PR_VALUE = ZFIT_PROJMST-PR_VALUE

PR_ST_DATE = ZFIT_PROJMST-PR_ST_DATE

PR_COP_DATE = ZFIT_PROJMST-PR_COP_DATE

PR_EMD = ZFIT_PROJMST-PR_EMD

PR_PERFORM = ZFIT_PROJMST-PR_PERFORM

PR_ADV_MOBI = ZFIT_PROJMST-PR_ADV_MOBI

PR_ADV_EQP = ZFIT_PROJMST-PR_ADV_EQP

PR_ADV_SUP = ZFIT_PROJMST-PR_ADV_SUP

PR_RETEN = ZFIT_PROJMST-PR_RETEN

PR_OTHER = ZFIT_PROJMST-PR_OTHER

PR_SUCCESS = ZFIT_PROJMST-PR_SUCCESS

where PROJECT_CD = ZFIT_PROJMST-PROJECT_CD.

RESULT1 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_EMD ) / 100.

RESULT2 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_PERFORM ) / 100.

RESULT3 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_ADV_MOBI ) / 100

.

RESULT4 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_ADV_EQP ) / 100.

RESULT5 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_ADV_SUP ) / 100.

RESULT6 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_RETEN ) / 100.

RESULT7 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_OTHER ) / 100.

SUM = RESULT1 + RESULT2 + RESULT3 + RESULT4 + RESULT5 + RESULT6 +

RESULT7.

**SECOND

if sy-subrc = 0.

message 'Update complete' type 'S'.

endif.

endif.

endif.

else.

PROJECT_CD1 = zfit_PROJMST-PROJECT_CD.

w_len = STRLEN( PROJECT_CD1 ).

w_len = STRLEN( PROJECT_CD1 ).

If w_len < 5.

MESSAGE 'Project Code must be 5 characters' TYPE 'E'.

Endif.

if zfit_PROJMST-PROJECT eq ''.

message 'Enter the Project Description' type 'E'.

endif.

if zfit_projmst-PR_VALUE eq ''.

message 'Enter Project Value' type 'E'.

endif.

IF SUM GE ZFIT_PROJMST-PR_VALUE.

MESSAGE 'Value exceeding project value' TYPE 'E'.

ENDIF.

IF ZFIT_PROJMST-PR_COP_DATE LT ZFIT_PROJMST-PR_ST_DATE.

MESSAGE 'Completion Date is less than start date'

TYPE 'E'.

ENDIF.

IF ZFIT_PROJMST-PR_SUCCESS = '01'.

loop at screen.

if screen-group3 = '003'.

screen-active = '1'.

screen-input = '1'.

modify screen.

endif.

endloop.

ENDIF.

if zfit_projmst-plant is not initial.

loop at screen.

if screen-group4 = '004'.

screen-active = '0'.

modify screen.

endif.

endloop.

endif.

update ZFIT_PROJMST

set PROJECT_CD = ZFIT_PROJMST-PROJECT_CD

plant = zfit_projmst-plant

PROJECT = ZFIT_PROJMST-PROJECT

STATUS = ZFIT_PROJMST-STATUS

SECTOR = ZFIT_PROJMST-SECTOR

PR_VALUE = ZFIT_PROJMST-PR_VALUE

PR_ST_DATE = ZFIT_PROJMST-PR_ST_DATE

PR_COP_DATE = ZFIT_PROJMST-PR_COP_DATE

PR_EMD = ZFIT_PROJMST-PR_EMD

PR_PERFORM = ZFIT_PROJMST-PR_PERFORM

PR_ADV_MOBI = ZFIT_PROJMST-PR_ADV_MOBI

PR_ADV_EQP = ZFIT_PROJMST-PR_ADV_EQP

PR_ADV_SUP = ZFIT_PROJMST-PR_ADV_SUP

PR_RETEN = ZFIT_PROJMST-PR_RETEN

PR_OTHER = ZFIT_PROJMST-PR_OTHER

PR_SUCCESS = ZFIT_PROJMST-PR_SUCCESS

where PROJECT_CD = ZFIT_PROJMST-PROJECT_CD.

RESULT1 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_EMD ) / 100.

RESULT2 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_PERFORM ) / 100.

RESULT3 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_ADV_MOBI ) / 100.

RESULT4 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_ADV_EQP ) / 100.

RESULT5 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_ADV_SUP ) / 100.

RESULT6 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_RETEN ) / 100.

RESULT7 = ( ZFIT_PROJMST-PR_VALUE * ZFIT_PROJMST-PR_OTHER ) / 100.

SUM = RESULT1 + RESULT2 + RESULT3 + RESULT4 + RESULT5 + RESULT6 +

RESULT7.

*THIRD

if sy-subrc = 0.

message 'Update complete' type 'S'.

endif.

endif.

W_C = 1.

ENDIF.

IF OK_CODE = 'CHANGE'.

loop at screen.

if screen-group2 = '002'.

screen-input = '1'.

modify screen.

endif.

endloop.

W_B = '1'.

ENDIF.

IF OK_CODE = 'REFRESH'.

CLEAR: ZFIT_PROJMST,W_A,W_B,W_C,w_p,RESULT1,RESULT2,RESULT3,RESULT4

,

RESULT5,RESULT6,RESULT7,SUM.

loop at screen.

if screen-group1 = '001'.

screen-input = '0'.

modify screen.

endif.

endloop.

ENDIF.

*

  • if ok_code = ''.

*loop at screen.

  • if screen-group2 = '002'.

  • screen-input = '1'.

*

  • modify screen.

  • endif.

  • endloop.

*

*endif.

*

*

*

ENDMODULE. " USER_ACTION INPUT

&----


*& Module value_help_status INPUT

&----


  • text

----


MODULE value_help_status INPUT.

clear t_status.

t_status-status = 'Tendered'.

append t_status.

t_status-status = 'Running'.

append t_status.

t_status-status = 'Closed'.

append t_status.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'STATUS'

DYNPPROG = 'SAPMZA_ZFI_PRMST'

DYNPNR = '9000'

DYNPROFIELD = 'STATUS'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = t_status

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.

ENDMODULE. " value_help_status INPUT

thanks in advance.

all helpfull answer will b awarded*

4 REPLIES 4

former_member196299
Active Contributor
0 Kudos
77

hi Vijay ,

for the 1st problem, i guess anywhere in your program you are doing a refresh and thats effecting the PBO as well i mean esp. the f4 help you are not getting . chack on that part of code ..

for the 2nd problem, capture the values filled in the fields , and pass on those values to the fields again in the PBO . this definately should solve your problem .

Vijay , take out this part of code < REFRESH LIST1.

CLEAR LIST1. >

from the STATUS_9000 area and put it at the end of the module value_help_status , i.e. at the end of the PAI modules .

This should work ..

Revert if further help needed !

Regards,

Ranjita

0 Kudos
77

hi ranjitha,

thanks a lot ranjihta my first problem has been solved but i m still stuck over my second problem.

my table is ZFIT_PROJMST

and key field is PROJECT_CD

through project code i m capturing the values but when i m pressing enter entry washed please could u help me more by looking into code.

once again thanks a lot and please try for my 2nd problem.

thanks and regards

vijay dwivedi

0 Kudos
77

Vijay ,

For your second problem, you said its working when you click on mouse , means definately u might be clicking on a screen element and for whcih you have handled the code .

For getting the same result when you click on enter , in your status bar maintain a key for ENTER and handle the same Fn Code in your PAI part of code . This should work !

Revert back if not solved !

Regards,

Ranjita

0 Kudos
77

HI Ranjitha,

i tried to use that function code for enter but it is creating a big problem to me because i m using a flow like this.

in user_action PAI.

if i will press new.

it will activate most of the input values.

then i m using save function code and giving condition if table-field is initial, then entry already maintained

if sy-subrc <> 0

insert.

else.

update.

else.

update.

but as u told me to use enter code then , after new i m using .

if sy-ucomm = 'enter'.

then i m trying to capture the value.

and then going for save but entry is not saving it is going in update case not in insert so i tried to use insert inside the enter but this is more problamatic because i m using lots of checking conditon so each time it is making problem so

please could u suggest me any other idea to solve this.

thanks and regards

vijay dwivedi