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

Refreshing problem

Former Member
0 Likes
2,011

Here I have 2 radio buttons.

first it will check with a ztable against entered supplying plant(s_werks)

and receiving plant(r_werks).

when i select first radio button,

it adds one plant(zplants-plant) to the r_werks.

when i select second radio button it adds same plant(zplants-plant) to

the s_werks.

when i run the report first time with selecting either first or second

radio button, it is displaying perfectly.

when i comes back and selects another radio button,

the zplant-plant field is displaying in both the columns, but it has to

display in only one column.

It is not refreshing the selection values....

AT SELECTION-SCREEN ON RADIOBUTTON GROUP R6.

Select * from zplants

where reswk in s_werks

and werks in r_werks.

if sy-subrc eq 0.

if l1_dat = 'X'. " l1 radio button

r_werks-sign = 'I'.

r_werks-option = 'EQ'.

r_werks-low = zplants-plant.

append r_werks.

select single * from zritem where

l1_dvry in xblnr.

if sy-subrc eq 0.

select single * from zrhdr where

l1_sto = zritem-l1_sto

and receiv_plant in r_werks.

endif.

elseif l2_dat = 'X'. " l2 radio button

s_werks-sign = 'I'.

s_werks-option = 'EQ'.

s_werks-low = zplants-plant.

append s_werks.

select single * from zritem where

l2_dvry in xblnr.

if sy-subrc = 0.

select single * from zrhdr where

l1_sto = zritem-l1_sto

and spply_plant in s_werks.

endif.

endif.

endif.

endselect.

anybody has solution...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,808

Hi Yad,

I assume that you enter the values in the selection screen, then select the corresponding radio-button and execute the report.

I this case, instead of writing this code in this event you can write this in START-OF-SELECTION. And refresh the values in both r_werks and s_werks before processing the logic.

I hope this solves your problem.

Thanks

vamsi

15 REPLIES 15
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,808

Can you clear/refresh it each time?




at selection-screen on radiobutton group r6.
  
<b>  clear r_werks. refresh r_werks.</b>
<b>  clear s_werks. refresh s_werks.</b>

...


Regards,

Rich Heilman

Read only

0 Likes
1,808

1.I tried like this

if l1_dat = 'X'. " l1 radio button

clear s_werks. refresh s_werks.

....

..

elseif l2_dat = 'X'. " l2 radio button

clear s_werks. refresh s_werks.

I am getting runtime error "compute_bcd_overflow"

2.I tried this way also

at selection-screen on radiobutton group r6. clear r_werks. refresh r_werks.

clear s_werks. refresh s_werks.

...

only zplants-plant is displaying in the corresponding column.entered values in the selection screen are not displaying in the final report.

thanks,

Yad

Read only

0 Likes
1,808

1.I tried like this

if l1_dat = 'X'. " l1 radio button

clear s_werks. refresh s_werks.

....

..

elseif l2_dat = 'X'. " l2 radio button

clear r_werks. refresh r_werks.

I am getting runtime error "compute_bcd_overflow"

2.I tried this way also

at selection-screen on radiobutton group r6. clear r_werks. refresh r_werks.

clear s_werks. refresh s_werks.

...

only zplants-plant is displaying in the corresponding column.entered values in the selection screen are not displaying in the final report.

thanks,

Yad

Read only

0 Likes
1,808

What is the compute_bcd_overflow error saying?

I'm not getting that error.

Can you post your complete code?

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,808

As I look at the code, it appears as if you want to use R_WERKS when the user selects L1_DAT radiobutton and use S_WERKS when the user select L2_DAT radiobutton. If I am correct so far, the I would like to split your logic into two sections.

Section 1.

Do not show s_werks. To achieve this you need to define your radiobuttons as follows:


PARAMETERS: l1_dat RADIOBUTTON GROUP r6 DEFAULT 'X' USER-COMMAND werk,
            l2_dat RADIOBUTTON GROUP r6.

You need to define S_WERKS and R_WERKS as follows:


SELECT-OPTIONS: s_werks FOR zplants-werks MODIF ID swrk,
                r_werks FOR zplants-werks MODIF ID rwrk.

Now you need the following code.


AT SELECTION-SCREEN OUTPUT.

  IF l1_dat = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'SWRK'.
        screen-active = 0.
      ELSE.
        screen-active = 1.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ELSEIF l2_dat = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'RWRK'.
        screen-active = 0.
      ELSE.
        screen-active = 1.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

Section 2.

I will move your ON RADIOBUTTON GROUP code into the start-of-selection.

Please let me know if I am on the wrong track here.

Srinivas

Read only

0 Likes
1,808

Srini,

I have to show s_werks and r_werks in selection screen.

I tried with ur idea, but the result is negative.

thanks,

Yad

Read only

Former Member
0 Likes
1,808

Sorry to hear that. I am looking at your code. You have a SELECT, ENDSELECT loop. In that loop you have a IF SY-SUBRC = 0 statement. This is not required as you enter the loop only if there is a record for that criteria.

Next, with each record you obtain from the above select loop, you are either appending it to R_WERKS or S_WERKS as the case may be and the doing the select from zrhdr where supplying or receiving plant in r_werks or s_werks. Have you realized that you are doing this wrong. Let us say there are two records in zplants and let us l1_dat = 'X'.

In my first pass, I will have one record in r_werks with which I will do the select from zrhdr. Then in my second pass, I will have two records, including the first one. So my select from zrhdr is going to bring me the previous values as well as the current ones. Isn't it doing the same thing.

Why don't you post your code and we will see how we can resolve your issue?

Regards,

Srinivas

Read only

0 Likes
1,808

you are correct.I removed sy-subrc = 0 statement in between select, endselect.Here In zplants-plant field has only one value(P476) but it contains number of records.I have to read zrhdr table and have to compare with supplying or receiving plant with original supplying or receiving plant entered.after that the report will continue with noraml report selections of data from database.

It is already developed report.I am doing modifications in it.the report is quite big.If you want i can post it.

Read only

Former Member
0 Likes
1,809

Hi Yad,

I assume that you enter the values in the selection screen, then select the corresponding radio-button and execute the report.

I this case, instead of writing this code in this event you can write this in START-OF-SELECTION. And refresh the values in both r_werks and s_werks before processing the logic.

I hope this solves your problem.

Thanks

vamsi

Read only

0 Likes
1,808

START-OF-SELECTION.

refresh r_werks. clear r_werks.

refresh s_werks. clear s_werks.

if l1_dat = 'X'. " l1 radio button

Select * from zplants where reswk in s_werks and

werks in r_werks.

r_werks-sign = 'I'.

r_werks-option = 'EQ'.

r_werks-low = zplants-plant.

append r_werks.

endselect.

select single * from zritem where l1_dvry in xblnr.

if sy-subrc eq 0.

select single * from zrhdr where l1_sto = zritem-l1_sto

and receiv_plant in r_werks.

endif.

elseif l2_dat = 'X'. " l2 radio button

Select * from zsto_via_plants where reswk in s_werks

and werks in r_werks.

s_werks-sign = 'I'.

s_werks-option = 'EQ'.

s_werks-low = zplants-plant.

append s_werks.

endselect.

select single * from zritem where l2_dvry in xblnr.

if sy-subrc = 0.

select single * from zrhdr where l1_sto = zritem-l1_sto

and spply_plant in s_werks.

endif.

endif.

Read only

0 Likes
1,808

I changed like above...still same problem.

Thanks,

Yad

Read only

0 Likes
1,808

In this part of the code below, you seem to be selecting from <b><u>zsto_via_plants</u></b>, but you are moving <b><u>zplants-plant</u></b>.

Could that be the problem?


elseif l2_dat = 'X'. " l2 radio button
  Select * from zsto_via_plants <------ selecting this
          where reswk in s_werks
            and werks in r_werks.
  s_werks-sign = 'I'.
  s_werks-option = 'EQ'.
  s_werks-low = zplants-plant. <------ moving this
  append s_werks.
endselect.

select single * from zritem where l2_dvry in xblnr.

if sy-subrc = 0.
select single * from zrhdr where l1_sto = zritem-l1_sto
and spply_plant in s_werks.
endif.
endif.

Read only

0 Likes
1,808

I have been thinking.

Why can't you have just one select option called 'Plants' and if the user selects the first radio button, use your logic for first radio-button and if the user the second radio button, use the second logic?

That way you have only one select option to deal with. If you have to do it the current way, then apply my previous code for at selection-screen output and do a refresh and clear of s_werks or r_werks depending on the user choice of the radio-button, instead of hiding one or the other.

Srinivas

Read only

0 Likes
1,808

I am sorry I have written wrong.

this is the correct one.

elseif l2_dat = 'X'. " l2 radio button

Select * from zplants <---- selecting this

where reswk in s_werks and werks in r_werks.

s_werks-sign = 'I'.

s_werks-option = 'EQ'.

s_werks-low = zplants-plant. <------ moving this

append s_werks.

endselect.

select single * from zritem where l2_dvry in xblnr.

if sy-subrc = 0.

select single * from zrhdr where l1_sto = zritem-l1_sto

and spply_plant in s_werks.

endif.

endif.

Read only

0 Likes
1,808

So your new code will look probably like this if you have keep both S_WERKS and R_WERKS.


PARAMETERS: l1_dat RADIOBUTTON GROUP r6 DEFAULT 'X' USER-COMMAND werk,
            l2_dat RADIOBUTTON GROUP r6.

SELECT-OPTIONS: s_werks FOR zplants-werks MODIF ID swrk,
                r_werks FOR zplants-werks MODIF ID rwrk.


AT SELECTION-SCREEN OUTPUT.

  IF l1_dat = 'X'.
*-- use R_WERKS, so clear S_WERKS
    REFRESH s_werks. CLEAR s_werks.
  ELSEIF l2_dat = 'X'.
*-- use S_WERKS, so clear R_WERKS
    REFRESH r_werks. CLEAR r_werks.
  ENDIF.

START-OF-SELECTION.

  IF l1_dat = 'X'.
*-- user selected l1 radio button
    SELECT * FROM zplants
            WHERE reswk IN s_werks
              AND werks IN r_werks.
      r_werks-sign   = 'I'.
      r_werks-option = 'EQ'.
      r_werks-low    = zplants-plant.
      APPEND r_werks.
    ENDSELECT.

    SELECT SINGLE * FROM zritem
                   WHERE l1_dvry IN xblnr.
    IF sy-subrc EQ 0.
      SELECT SINGLE * FROM zrhdr
                     WHERE l1_sto = zritem-l1_sto
                       AND receiv_plant IN r_werks.
    ENDIF.
  ELSEIF l2_dat = 'X'.
*-- user selected l2 radio button
    SELECT * FROM zsto_via_plants
            WHERE reswk IN s_werks
              AND werks IN r_werks.
      s_werks-sign = 'I'.
      s_werks-option = 'EQ'.
      s_werks-low = zsto_via_plants-reswk."<--- or is it werks
      APPEND s_werks.
    ENDSELECT.

    SELECT SINGLE * FROM zritem
                   WHERE l2_dvry IN xblnr.
    IF sy-subrc = 0.
      SELECT SINGLE * FROM zrhdr
                     WHERE l1_sto = zritem-l1_sto
                       AND spply_plant IN s_werks.
    ENDIF.
  ENDIF.

Regards,

Srinivas