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: 

Module Pool

abdul_hakim
Active Contributor
0 Kudos

Hi,

I am working on some enhancement to existing module pool program.

I need to save the changes the user has made on screen nos 100 and 200.

So when the user has pressed the SAVE button i am calling a subroutine which carries out the

update task.

I am using the same subroutine for both screens since these infos needs to saved together.

I am using sy-datar system variable to check whether the user has made any changes.

For screen 100 it is working fine.

For screen 200 it is not working even though i entered some entries.

I dont know what is the exact problem?

Shall i check my changes with my own flag or is it possible to achive through sy-datar for any number of screens?

Note: I have checked in my own programs with mulitple screens it is working fine!!

Kindly advice,

Regards,

Abdul

1 ACCEPTED SOLUTION

former_member186741
Active Contributor
0 Kudos

Hi Abdul,

this could be any number of things. Please show your flow logic for the two screens and the abap code for the pai modules.

Regards

Neil

9 REPLIES 9

former_member186741
Active Contributor
0 Kudos

Hi Abdul,

this could be any number of things. Please show your flow logic for the two screens and the abap code for the pai modules.

Regards

Neil

0 Kudos

Hi Neil,

Below is the required source code.

&----


*& Module USER_COMMAND_0100 INPUT

&----


MODULE USER_COMMAND_0100 INPUT.

CASE OKCODE100.

WHEN 'SAVE'.

PERFORM SAVE_REC.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module USER_COMMAND_0200 INPUT

&----


  • text

----


MODULE USER_COMMAND_0200 INPUT.

CASE OKCODE200.

WHEN 'SAVE'.

PERFORM SAVE_REC.

ENDCASE.

FORM SAVE_REC.

**invoice details

MOVE: invoice TO wa_temp-invce,

vbrk-fkdat TO wa_temp-fkdat,

vbrk-inco1 TO wa_temp-inco1,

vbrk-inco2 TO wa_temp-inco2,

tvzbt-zterm TO wa_temp-zterm,

akkb-baanr TO wa_temp-baanr,

txt_del_terms TO wa_temp-dlvtr,

vbrk-netwr TO wa_temp-netwr,

vbrk-waerk TO wa_temp-waerk,

vbrp-aubel TO wa_temp-aubel,

vbrp-vgbel TO wa_temp-vgbel,

c_various TO wa_temp-vario,

vbrp-ernam TO wa_temp-ernam,

vbrp-erzet TO wa_temp-erzet,

vbkd-bstkd TO wa_temp-bstkd,

shipto_name1 TO wa_temp-shnm1,

shipto_name2 TO wa_temp-shnm2,

shipto_street TO wa_temp-shstr,

shipto_street4 TO wa_temp-shst4,

shipto-pstlz TO wa_temp-shpst,

shipto-ort01 TO wa_temp-shcty,

shipto-land1 TO wa_temp-shcun,

shipto-regio TO wa_temp-shreg,

billto_name1 TO wa_temp-bpnm1,

billto_name2 TO wa_temp-bpnm2,

billto_street TO wa_temp-bpstr,

billto_street4 TO wa_temp-bpst4,

soldto-pstlz TO wa_temp-bppst,

soldto-ort01 TO wa_temp-bpcty,

soldto-land1 TO wa_temp-bpcun,

soldto-regio TO wa_temp-bpreg,

forwarder_name TO wa_temp-ffnm1,

forwarder_street TO wa_temp-ffstr,

forwarder_street4 TO wa_temp-ffst4,

forwarder-pstlz TO wa_temp-ffpst,

forwarder-ort01 TO wa_temp-ffcty,

forwarder-land1 TO wa_temp-ffcun,

forwarder_phone TO wa_temp-ffphn,

forwarder_fax TO wa_temp-fffax,

despatch_country TO wa_temp-despt,

destination TO wa_temp-destn,

herkl TO wa_temp-orign,

c_mixed TO wa_temp-mixed,

final_destination TO wa_temp-fdest,

prtload TO wa_temp-prtld,

prtdis TO wa_temp-prtds,

vessel TO wa_temp-fltno,

delivery_place TO wa_temp-delvy,

gross_wt TO wa_temp-grswt,

net_wt TO wa_temp-netwt,

volume TO wa_temp-totcb,

sign_company TO wa_temp-compy,

sign_name TO wa_temp-signm,

sign_place TO wa_temp-place.

**charge screen details

MOVE: chrg_text1 TO wa_temp-text1,

chrg_text2 TO wa_temp-text2,

chrg_text3 TO wa_temp-text3,

chrg_text4 TO wa_temp-text4,

chrg_text5 TO wa_temp-text5,

chrg_text6 TO wa_temp-text6,

chrg_total TO wa_temp-totll,

price1 TO wa_temp-prce1,

price2 TO wa_temp-prce2,

price3 TO wa_temp-prce3,

price4 TO wa_temp-prce4,

price5 TO wa_temp-prce5,

price6 TO wa_temp-prce6,

total TO wa_temp-total.

*Updating the table zinvoice_updt

IF SY-DATAR EQ 'X'

MODIFY zinvoice_updt FROM wa_temp.

CLEAR WA_TEMP.

ENDIF.

ENDFORM. " SAVE_REC

0 Kudos

Hi Abdul,

thanks, could you also show the 'flow logic' of the two screens?

0 Kudos

Hi Neil,

Below is the flow logic,

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

*

PROCESS AFTER INPUT.

field invoice.

field vbrk-fkdat.

field vbrk-inco1.

field vbrk-inco2.

field vbrk-netwr.

field vbrk-waerk.

field vbrp-aubel.

field vbrp-vgbel.

field vbrp-ernam.

field vbrp-erzet.

field vbkd-bstkd.

field shipto_name1.

field shipto_name2.

field shipto_street.

field shipto_street4.

field shipto-pstlz.

field shipto-ort01.

field shipto-land1.

field shipto-regio.

field billto_name1.

field billto_name2.

field billto_street.

field billto_street4.

field soldto-pstlz.

field soldto-ort01.

field soldto-land1.

field soldto-regio.

field forwarder_name.

field forwarder_street.

field forwarder_street4.

field forwarder-pstlz.

field forwarder-ort01.

field forwarder-land1.

field forwarder_phone.

field forwarder_fax.

field DESPATCH_COUNTRY.

field HERKL.

field C_MIXED.

field DESTINATION.

field FINAL_DESTINATION.

field PRTLOAD.

field PRTDIS.

field vessel.

field delivery_place.

field gross_wt.

field net_wt.

field volume.

field SIGN_COMPANY.

field SIGN_NAME.

field SIGN_PLACE.

MODULE USER_COMMAND_0100.

PROCESS BEFORE OUTPUT.

MODULE STATUS_0200.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0200.

0 Kudos

Hi Abdul,

try using the 'field' statements from screen 100's PAI in screen 200's PAI too. This moves the field values from the screen to make them available in abap variables. You might not need all the fields ... only the ones that appear on screen 200.

regards

Neil

0 Kudos

Hi Neil,

The sy-datar systm variable will be set when the user has made any changes on the screen regardless of the FIELD statement.Are you sure of your logic?Explain me how?

Regards,

Hakim

0 Kudos

I'm not sure but know that I usually use the field statement to ensure data transfer has occurred before modules are processed. Give it a try. It also might be useful to see the abap code where the screens are called from.

0 Kudos

Hi Neil,

I have solved the problem according to your idea.

Thanks

Abdul

Former Member
0 Kudos

Hi,

I think you can use FIELD XXXX MODULE XXXX ON CHANGE INPUT..

If there is any change made to the field mentioned then this module is triggered.There you can keep a flag (ie)if the module is triggered mark a variable 'X'.Then in the okcode you can check for this variable value.If it is 'X' then u can modify the table.Hope it works .

Regards,

vivek