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

From Modulepool screen to ALV List

Former Member
0 Likes
975

Hello All,

I called a module pool screen from ALV using a button in application tool bar. This screen will have OK and CANCEL buttons.

If I press OK button the program has to continue with the logic and come back to ALV. It is working. For this I used SET SCREEN 0.

If I press CANCEL button the further logic should not be processed and the control should go to ALV screen. How can I do this.

Can any one send sample code for this.

Good answers will be appreciated.

Thanks in advance.

Best Regards,

Sasidhar Reddy Matli.

Hello All,

I called a module pool screen from ALV using a button in application tool bar. This screen will have OK and CANCEL buttons.

If I press OK button the program has to continue with the logic and come back to ALV. It is working. For this I used SET SCREEN 0.

If I press CANCEL button the further logic should not be processed and the control should go to ALV screen. How can I do this.

Can any one send sample code for this.

Good answers will be appreciated.

Thanks in advance.

Best Regards,

Sasidhar Reddy Matli.

8 REPLIES 8
Read only

Former Member
0 Likes
945

Check the sy-ucomm value and then use SET SCREEN 0.

LEAVE SCREEN. statements.

case sy-ucomm.

when 'CANC'.

SET SCREEN 0.

LEAVE SCREEN.

Endcase.

Regards,

JOy.

Read only

Former Member
0 Likes
945

or use this..

when 'CANCEL'.

leave to screen 0.

Read only

Former Member
0 Likes
945

Hi,

I too had the same problem long back. If i remember correctly i solved it using RETURN command. I cannot remember the exact format but please check with RETURN command and try some possibility

Cheers

Kothand

Read only

Former Member
0 Likes
945

Hello JOy/venkat/kothand,

I tried all thepossiblities. But still control is not coming to the screen without executing the remaining code.

I tried using LEAVE LIST-PROCESSING & LEAVE TO LIST-PROCESSING also.

And im not getting any F1 help on RETURN. It is saying that there so such key word

Please can any one help me out in this.

Thank you.

Best Regards,

Sasidhar Reddy Matli.

Read only

0 Likes
945

LEAVE LIST-PROCESSING is to get out from ALV processing and not from module to ALV. So it will not work... But you are saying RETURN statement is not there? I am so surprised. Which Version of SAP is that ? Im using 4.X but i guess it will be there in latest version too.

1) goto SE38 t-code

2) press CTRL+F8

3) Give RETURN in keywords.

It may list if its there really

Cheers

Kothand

Read only

0 Likes
945

Hi

There's no difference beetween OK or CANCEL in order to back to the ALV, so I can't understand your problem:

if you press CANC where do you need to go?

Max

Read only

0 Likes
945

Hello Max,

Let me explain the scenario.

My ALV list will have check boxes in front of each record. If i select few records and press UPDATE button, One popup should come. Ofcourse i can get the popup using FM, POPUP_GET_VALUES, I have used one customized screen due to some other reasons. This screen should contain the new values for the fields which are to be updated and also OK & CANCEL buttons. So Im calling this screen in a loop where the records of ALV has been selected.

Once entering the new values in the popup screen, If I press OK, Internal table has to be updated with new values and it is working fine.

If i press CANCEL, the control should not go further to the code where internal table is being updated, for the current record which is in loop pass. But it is going to the updation code. This should not happen, because BAPI for updating MARC table is written at the end of entire logic. and popup screen is coming for the next record.

Thank you.

Best Regards,

Sasidhar Reddy Malti.

______________________________________________________

Hello Kothand,

I did as you suggested. It is giving the message as shown below

No suitable documentation for "RETURN" found

Message no. ED 120

Im using the version 4.6B

Thank you.

Best Regards,

Sasidhar Reddy Malti.

Read only

0 Likes
945

Hi

U need to use the command EXIT in order to leave the form:

FORM user_command.

  CALL FUNCTION 'POPUP_GET_VALUES'
       EXPORTING
            popup_title = 'My popup'
       IMPORTING
            returncode  = returncode
       TABLES
            fields      = t_fields.

  IF returncode = 'A'.
    EXIT.
  ENDIF.

  do something only it RETURNCODE <> 'A'.  

ENDFORM.

In this way the system leaves the form where the exit is called and doesn't run the rest of code.

If the POPUP is into a LOOP u need to call the exit twice:

- The first one to leave the loop;

- The second one to leave the form

FORM user_command.

  LOOP AT itab.
    CALL FUNCTION 'POPUP_GET_VALUES'
         EXPORTING
              popup_title = 'My popup'
         IMPORTING
              returncode  = returncode
         TABLES
              fields      = t_fields.

    IF returncode = 'A'.
      EXIT.
    ENDIF.
  ENDLOOP.
  IF returncode = 'A'.
    EXIT.
  ENDIF.
ENDFORM.

Max