cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Module Pool Programming

Former Member
0 Kudos

Hi,

I have a issue realted to Module pool programming.

The issue is:

AT first I am running a Report through selection screen from that depending upon <b>row/record</b> selected it will take me to Module Pool Screen. From there i will manipulate details and press <b>SAVE</b> button then it will run BDC Code If it successful i have to come back to selection-screen because i need to refresh the data in report.

How can i do it.

WHen i used <b>LEAVE TO SCREEN 0</b>.

It is taking me back to Report output but data i updated is not getting refreshed - so another option is to goto Selection-Screen and run Report once again. Then data will get refreshed.

Can any body have solution for the same.

Thanks in advance.

Thanks & Regards,

Prasad.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Prasad,

Are you using a ALV Report or a Classical Report?

How are you calling the Module Pool program - Call transaction?

If its and ALV, in the report after the statement that call the Module Pool, refetch the data in to your internal table and call the REFRESH_TABLE_DISPLAY (If you are using OO ALV), or call REUSE function again.

If its classical report, after the call to the Module pool, code again a LEAVE to SCREEN 0.

Regards,

Ravi

Note : Please mark all the helpful answers

Former Member
0 Kudos

Hi,

It's normal Report only.

But here we are making use of TREE like Report like - Orders under it items with (-).

We will select item and goto module pool screen there after running BDC item data need to be refreshed with new data.

Thanks,

Prasad.

Former Member
0 Kudos

Prasad,

Can you post the code which is calling the model pool program and also what you have written after that?

Regards,

Ravi

Former Member
0 Kudos

Hi,



<b>    WHEN 'SAVE'.

      IF v_clicked = c_a.

        PERFORM f_bdc_prcoess_vx22_assign.

        READ TABLE i_messtab WITH KEY
                               msgtyp = c_e.

* If There is any Error in the Record(s)
* Then send the Created Error Log to User Group Through Mail
        IF sy-subrc EQ 0 OR
           v_subrc  NE 0.

* Send error log to User Group
          PERFORM f_send_message.

        ELSE.

* Some Update Statements

        ENDIF.

        LEAVE TO SCREEN 0.

      ENDIF.

      IF v_clicked = c_d.

        IF v_zzexgen IS INITIAL.

          PERFORM f_bdc_prcoess_vx22_de_assign.

          READ TABLE i_messtab WITH KEY
                                 msgtyp = c_e.

* If There is any Error in the Record(s)
* Then send the Created Error Log to User Group Through Mail
          IF sy-subrc EQ 0 OR
             v_subrc  NE 0.

          ELSE.

* Some update statements
          ENDIF.

        ELSE.

          MESSAGE i100 WITH text-041.

        ENDIF.

        LEAVE TO SCREEN 0.

      ENDIF.</b>

Thanks,

Prasad.

Former Member
0 Kudos

Alright, I am assuming that currently once the BDC is executed it throws you back into the SELECTION SCREEN, right?

The problem with a classical report, you cannot refresh the screen with new data, so you have to go back to the selection screen.

Can you move the LEAVE to SCREEN 0 statment into ELSE part.

Regards,

Ravi

Former Member
0 Kudos

Hi,

No it will takes me to Report Screen - There my data need to be refreshed witout going back to Selection-Screen and execute again.

I don't think there is any need to move <b>LEAVE TO SCREEN 0</b> to ELSE Part as If BDC is successful/not it should be the same.

As if it is success ful i have to go back to REport screen and refresh data.

If unsuccessful then Group will be informed by mail adn i have to again come back to report screen[Data wont change].

Am i right!

Thanks,

Prasad.

Former Member
0 Kudos

Prasad,

In a classical ALV Report, you cannot refresh the data.

Work Around : Submit the same report again with the same selection criteria. Take a a look at SUBMIT Report.

Regards,

Ravi

Former Member
0 Kudos

Hi,

It's normal Report only.

But here we are making use of TREE like Report like - Orders under it items with (-).

See the same code below which make it Tree-Like Report.

<b> LOOP AT i_data.

AT NEW vbeln.

FORMAT COLOR COL_HEADING INTENSIFIED OFF.

WRITE: /1 syst-vline NO-GAP,

'[' NO-GAP,

i_data-exp NO-GAP HOTSPOT ON,

']'.

v_mark = 'X'.

ENDAT.

IF v_mark = 'X'.

FORMAT COLOR COL_NORMAL INTENSIFIED ON.

WRITE: i_data-vbeln,

i_data-maktx,

i_data-vkorg,

i_data-vtweg,

i_data-vdatu,

i_data-erdat,

i_data-ernam,

i_data-bstnk,

AT syst-linsz syst-vline.

page-pagno = syst-pagno.

HIDE: i_data-vbeln, page-pagno.

v_mark = space.

ENDIF.

IF i_data-exp = '-'.

v_sno = v_sno + 1.

i_data-sno = v_sno.

MODIFY i_data TRANSPORTING sno.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

WRITE: /1 syst-vline,

8 i_data-posnr,

i_data-matnr,

i_data-maktx,

i_data-gegru,

i_data-alnum,

i_data-embgr,

i_data-secgk,

i_data-netwr,

i_data-land1,

i_data-line,

i_data-exgen,

AT syst-linsz syst-vline.

HIDE: i_data, page-pagno.

ENDIF.

ENDLOOP.

ULINE.</b>

Now can u suggest something!

Thanks & Regards,

Prasad.

Former Member
0 Kudos

Prasad,

I did NOT mean ALV report, I mean CLASSICAL reports developed using WRITE statements.

You CANNOT refresh the data on the screen unless you SUBMIT the same report again or go back to the SELECTION SCREEN and execute again.

Regards,

Ravi

Former Member
0 Kudos

Hi,

Instead of LEAVE TO SCREEN 0.

If i make use of CALL SELECTION-SCREEN 1000. and from there if i re-execute it is taking me to Dialog Screen from selection screen instead of Report screen.

Thanks & Regards,

Prasad.

Former Member
0 Kudos

Prasad,

I think the best option is to SUBMIT the report again. You will know what are the current values entered on the SELECTION SCREEN, so just SUBMIT the report again.

SUBMIT... [VIA SELECTION-SCREEN]

[USING SELECTION-SET <var>]

[WITH <sel> <criterion>]

[WITH FREE SELECTIONS <freesel>]

[WITH SELECTION-TABLE <rspar>].

regards,

Ravi

Message was edited by: Ravikumar Allampallam

Former Member
0 Kudos

Hi,

I have written following code:

<b> SUBMIT z_asmt_deasmt_to_ord

VIA SELECTION-SCREEN

USING SELECTION-SET syst-slset.</b>

It is taking me to Selection-screen with current variant[SYST-SLSET]. If i execute it again from there it is taking me to report screen with correct data.

i have 2 issues over here.

1. Can i goto Report screen skipping selection screen directly.

2. If user does not chooses any variant and [gives/inputs] data directly into selection screen then above code will fail so is there anyway by which i can get the entered data by the user and use in <b>SUBMIT</b>!

Thanks for your time.

Thanks & Regards,

Prasad.

Former Member
0 Kudos

Prasad,

1. Yes you can skip the selection screen. (Don't use the VIA SELECTION SCREEN option)

2. Don't go by the variants. Get the values and pass them along with the SUBMIT statement.

Take a look at this example and do exactly like that.

Use the case of <b> When 4 </b>

REPORT demo_program_submit_rep1.

DATA number TYPE i.

PARAMETERS paramet(14) TYPE c.

SELECT-OPTIONS selecto FOR number.

The program DEMO_PROGRAM_SUBMIT_REP1 is called by the following program using various parameters:

REPORT demo_program_submit_sel_screen NO STANDARD PAGE HEADING.

DATA: int TYPE i,

rspar TYPE TABLE OF rsparams,

wa_rspar LIKE LINE OF rspar.

RANGES seltab FOR int.

WRITE: 'Select a Selection!',

/ '----


'.

SKIP.

FORMAT HOTSPOT COLOR 5 INVERSE ON.

WRITE: 'Selection 1',

/ 'Selection 2'.

AT LINE-SELECTION.

CASE sy-lilli.

WHEN 4.

seltab-sign = 'I'. seltab-option = 'BT'.

seltab-low = 1. seltab-high = 5.

APPEND seltab.

SUBMIT demo_program_submit_rep1 VIA SELECTION-SCREEN

WITH paramet eq 'Selection 1'

WITH selecto IN seltab

WITH selecto ne 3

AND RETURN.

WHEN 5.

wa_rspar-selname = 'SELECTO'. wa_rspar-kind = 'S'.

wa_rspar-sign = 'E'. wa_rspar-option = 'BT'.

wa_rspar-low = 14. wa_rspar-high = 17.

APPEND wa_rspar TO rspar.

wa_rspar-selname = 'PARAMET'. wa_rspar-kind = 'P'.

wa_rspar-low = 'Selection 2'.

APPEND wa_rspar TO rspar.

wa_rspar-selname = 'SELECTO'. wa_rspar-kind = 'S'.

wa_rspar-sign = 'I'. wa_rspar-option = 'GT'.

wa_rspar-low = 10.

APPEND wa_rspar TO rspar.

SUBMIT demo_program_submit_rep1 VIA SELECTION-SCREEN

WITH SELECTION-TABLE rspar

AND RETURN.

ENDCASE.

Regards,

Ravi

Message was edited by: Ravikumar Allampallam

Former Member
0 Kudos

Hi,

Hi i had written following code.

In my program initially i had written:

<b> IF syst-slset EQ space.

v_us_var = 'TESTING8'.

i_jvari_desc-report = sy-repid.

i_jvari_desc-variant = v_us_var.

i_jvari_desc-ename = 'EXAMPLES'.

i_jvt-report = sy-repid.

i_jvt-variant = v_us_var.

i_jvt-langu = sy-langu.

i_jvt-vtext = 'FUNCTION EXAMPLES'.

APPEND i_jvt.

CLEAR i_selpa.

i_selpa-sign = 'I'.

i_selpa-option = 'EQ'.

i_selpa-kind = 'P'.

i_selpa-selname = 'v_us_var'.

i_selpa-low = v_us_var.

APPEND i_selpa.

CALL FUNCTION 'RS_CREATE_VARIANT'

EXPORTING

curr_report = sy-repid

curr_variant = v_us_var

vari_desc = i_jvari_desc

TABLES

vari_contents = i_selpa

vari_text = i_jvt.

IF sy-subrc EQ 0.

ENDIF.

ENDIF.</b>

With this if user does not select any Variants from available new variant will be create by name of <b>TESTING8</b>.

Then in my main logic i had written SUBMIT as follows:

IF syst-slset NE space.

SUBMIT zasdcft002_lic_asmt_to_ord

USING SELECTION-SET syst-slset.

ELSE.

SUBMIT zasdcft002_lic_asmt_to_ord

USING SELECTION-SET v_us_var.

ENDIF.

NOw it is working exactly what i require.

skipping selection-screen and going to report screen after refreshing data.

BUt after those submit's i had written following code:

to delete that variant i created:

<b> CALL FUNCTION 'RS_VARIANT_EXISTS'

EXPORTING

report = sy-repid

variant = v_us_var

IMPORTING

r_c = v_retcode.

IF v_retcode = 0 AND sy-subrc = 0.

CALL FUNCTION 'RS_VARIANT_DELETE'

EXPORTING

report = sy-repid

variant = v_us_var

FLAG_CONFIRMSCREEN = 'X'

IMPORTING

variant = v_us_var.

v_retcode = sy-subrc.

ENDIF.</b>

It is not working when i am going through back groung mode.

When i am running through Foreground mode [Debugging] it is working correctly.

That is one issue out here, another is when i am running in debug mode it is promting dialog box's like delete all client varriants & then do you want to delete variant TESTING8.

What i can do here for above 2 issues.

Thanks & Regards,

Prasad.

Former Member
0 Kudos

Prasad,

I think you want to delete the variants for once right.

In that case go to SE38 and delete the variants manually and then remove the code for creating the variants.

regards,

Ravi

Former Member
0 Kudos

Hi,

I had Moved the Variant DELETE code to Just before CREATE Variant part.

Now it is working fine.

Before creating variant it will check wether that variant exists/not if yes it will delete it and recreate it again.

Now the code is

<b> IF syst-slset EQ space.

v_us_var = 'TEST_SEL_SCR'.

CALL FUNCTION 'RS_VARIANT_EXISTS'

EXPORTING

report = sy-repid

variant = v_us_var

IMPORTING

r_c = v_retcode.

IF v_retcode = 0 AND sy-subrc = 0.

CALL FUNCTION 'RS_VARIANT_DELETE'

EXPORTING

report = sy-repid

variant = v_us_var

flag_confirmscreen = c_n

flag_delallclient = c_n

IMPORTING

variant = v_us_var.

v_retcode = sy-subrc.

IF v_retcode EQ 0.

ENDIF.

ENDIF.

i_jvari_desc-report = sy-repid.

i_jvari_desc-variant = v_us_var.

i_jvari_desc-ename = 'EXAMPLES'.

i_jvt-report = sy-repid.

i_jvt-variant = v_us_var.

i_jvt-langu = sy-langu.

i_jvt-vtext = 'FUNCTION EXAMPLES'.

APPEND i_jvt.

CLEAR i_selpa.

i_selpa-sign = 'I'.

i_selpa-option = 'EQ'.

i_selpa-kind = 'P'.

i_selpa-selname = 'v_us_var'.

i_selpa-low = v_us_var.

APPEND i_selpa.

CALL FUNCTION 'RS_CREATE_VARIANT'

EXPORTING

curr_report = sy-repid

curr_variant = v_us_var

vari_desc = i_jvari_desc

TABLES

vari_contents = i_selpa

vari_text = i_jvt.

IF sy-subrc EQ 0.

ENDIF.

ENDIF.</b>

Then in main part the code is as:

<b> IF syst-slset NE space.

SUBMIT zasdcft002_lic_asmt_to_ord

USING SELECTION-SET syst-slset.

ELSE.

SUBMIT zasdcft002_lic_asmt_to_ord

USING SELECTION-SET v_us_var.

ENDIF.</b>

Now it is working fine except for one small issue.

When It is taking me to Report Screen [Data is Refreshed ], Then when i am trying to go back to selection-screen it coming entirely out of program.

That is the only issue remains.

It is workinng in normal screen to screen process.

After above changes in code it is going out.

Thanks for your efforts.

Thanks & Regards,

Prasad.

Former Member
0 Kudos

Prasad,

1. I am not sure why you creating the VARIANTS in the first place in your code.

2. Yes, that is a problem that once you hit SUBMIT and back out, it will come out and will NOT STOP at the SELECTION SCREEN.

Try this ..

SUBMIT .... AND RETURN.

Leave to SCREEN 0.

Try this and let me know.

Regards,

Ravi

Note : Please mark all the helpful answers

Former Member
0 Kudos

Hi,

1. Because at first i will execute report from variant.

if variant is not choosen then if user gives some input i will make run time variant with that - which i will use in SUBMIT statement.

2. If we use AND RETURN it will take us back to Selection-screen from Report layout - but issue here is when u press Execute[F8] again from there it will take me to Dialog screen which i previously run and back to report & then to sel-screen.

So i think AND RETURN option can be discarded.

Please suggest.

Thanks & Regards,

Prasad.

Former Member
0 Kudos

Prasad,

Whether the user enters the data or uses the variant, ultimately the values are there on the parameters right? So, you don't have to create a variant, just take the parameters / select-options and pass them as it is to the SUBMIT. It will work.

If RETURN is not working, I don't think we have a work around. So, to refresh the data.

1. Either show the SELECTION SCREEN again.

2. When backing out of the program, it will SKIP the SELECTION SCREEN.

You will have to choose one of these options.

Regards,

Ravi

Note : Please mark all the helpful answers

Former Member
0 Kudos

Hi,

I had done in your way.

<b> SUBMIT z_asmt_deasmt_to_ord

VIA SELECTION-SCREEN

WITH s_vkorg IN r_seltab

WITH s_vtweg IN r_seltab

WITH s_spart IN r_seltab

WITH s_vbeln IN r_seltab

WITH s_erdat IN r_seltab

WITH s_ernam IN r_seltab

WITH boy EQ r_seltab

WITH emb EQ r_seltab

WITH lic EQ r_seltab.</b>

Then it had taken me to Slection-Screen by blanking out the same.

Is there any way by which i can make sele-screen fields reamin as it is and execute the screen without my intervention.

In my Create & delete variant case after saving BDC it is submitting the sel-screen again and showing Report again with refreshed data. only issue here is when i press EXit button there it takes me out of program.

Thanks for your time & effort.

Thanks & Regards,

Prasad.

Former Member
0 Kudos

Prasad,

Even here if you don't use VIA SELECTION SCREEN option it will skip the SELECTION SCREEN.

Variants are no way in picture.

Remove the variants code and do NOT the VIA SELECTION SCREEN. This will still throw you when press back after REFRESH, but we don't have a choice.

Please mark all the helpful answers.

regards,

Ravi

Former Member
0 Kudos

Hi,

It is making Selection-screen blank immediately after SUBMIT so because there are some validations it is giving error as make entry in all req fields.

Can we anyway make the sel-screen data remain as is.

Thanks,

Prasad.

Answers (2)

Answers (2)

former_member182371
Active Contributor
0 Kudos

Hi,

have you tried with the following?:

<b>SET SCREEN 0.

LEAVE SCREEN.</b>

Best regards.

vinod_gunaware2
Active Contributor
0 Kudos

U have to use below code and also u have to handle refresh in PBO or PAI depending upon codition i.e. sy-ucomm is save.

and return to orignal screen is also conditional.

Set flag for same codition.

<b>if w_flag = 'X'.

Leave to screen sy-dynnr.

endif.</b>

regards

vinod