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

Clear Function Code for a Push Button on custom Dynpro

0 Likes
1,410

Hello,

I'm working with a sub screen for the equipment transaction IE02.

I have added a push button that call an external report and the code is explained below:

SCREEN 1002

PROCESS BEFORE OUTPUT.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_1002.

---------------------------------------------------------------

MODULE user_command_1002 INPUT.

  ok_code = sy-ucomm.

  IF ok_code = 'REP'.


       SUBMIT rsscd100 WITH objekt   = 'ZIHPA'

                   WITH objektid = zitob-equnr

                   WITH datum    = sy-datum

          AND RETURN.


  ENDIF.

ENDMODULE.                 " USER_COMMAND_1002  INPUT

It works correctly but the problem come out when i come back from the submitted program, even if i press enter, the sy-ucomm is still 'REP' and the external report is called again.

I think i need to clear the sy-ucomm but i don't know how?

I have tried with clear sy-ucomm before the submit but doesn't work.

Any suggestion?

1 ACCEPTED SOLUTION
Read only

0 Likes
978

I have found the solution.

The subscreen inherit the ok field from the main screen and is not editable in subscreen Element List.

I have used the field symbol to access to that information and now the below code works correctly.

TOP INCLUDE

DATA: ok_code(21) VALUE '(SAPMIEQ0)RM63E-FCODE'.

DATA: zrm63e TYPE rm63e.

FIELD-SYMBOLS <ok> TYPE any.

------------------------------------------------------

MODULE user_command_1002 INPUT.

  ASSIGN (ok_code) TO <ok>.

  zrm63e = <ok>.

  IF zrm63e = 'REP'.

      SUBMIT rsscd100 WITH objekt   = 'ZIHPA'

                   WITH objektid = zitob-equnr

                   WITH datum    = sy-datum

                   AND RETURN.

  ENDIF.

ENDMODULE.                 " USER_COMMAND_1002  INPUT

4 REPLIES 4
Read only

Former Member
0 Likes
978

Have you putting your clear after the submit?

Neal

Read only

0 Likes
978

I think i had to fill the General attribute for the field OK and not use the command ok_code = sy-ucomm but the field is not editable as shown in attached file.

How can i do?

Read only

Former Member
0 Likes
978

Instead of Submit, did you tried "Call transaction"  ?

e.g.

MODULE user_command_1002 INPUT.

CASE sy-ucomm.

    WHEN 'REP'..

      CALL TRANSACTION 'TCODE for the report to be called' . 

     endcase.

ENDMODULE.                 " USER_COMMAND_1002  INPUT

Read only

0 Likes
979

I have found the solution.

The subscreen inherit the ok field from the main screen and is not editable in subscreen Element List.

I have used the field symbol to access to that information and now the below code works correctly.

TOP INCLUDE

DATA: ok_code(21) VALUE '(SAPMIEQ0)RM63E-FCODE'.

DATA: zrm63e TYPE rm63e.

FIELD-SYMBOLS <ok> TYPE any.

------------------------------------------------------

MODULE user_command_1002 INPUT.

  ASSIGN (ok_code) TO <ok>.

  zrm63e = <ok>.

  IF zrm63e = 'REP'.

      SUBMIT rsscd100 WITH objekt   = 'ZIHPA'

                   WITH objektid = zitob-equnr

                   WITH datum    = sy-datum

                   AND RETURN.

  ENDIF.

ENDMODULE.                 " USER_COMMAND_1002  INPUT