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: 

MUSIC ON SELECTION-SCREEN

0 Kudos
517

Can we put .mp3 or any other format file on selection-screen????

9 REPLIES 9

Former Member
0 Kudos
349

Hello Ritesh,

it's a nice Idea. Can you eloborate on your idea/ Intention?

Thanks

Raghava

0 Kudos
349

I want put .mp3 file (in background music) on selection-screen....so is it possible???

Edited by: ritesh9898 on Dec 4, 2010 6:19 AM

faisal_altaf2
Active Contributor
349

Hi, Ritesh

Test the Sample Code Below hope it will help you regarding your requirements.

DATA: it_filetable        TYPE filetable,
      wa_filetable        LIKE LINE OF it_filetable,
      default_extension   TYPE string,
      rc                  TYPE i.

SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: COMMENT 1(20) cpfilen FOR FIELD pfilen.
PARAMETERS: pfilen TYPE string.
SELECTION-SCREEN PUSHBUTTON 72(15) play USER-COMMAND play VISIBLE LENGTH 3.
SELECTION-SCREEN: END OF LINE.

AT SELECTION-SCREEN.
  IF sy-ucomm = 'PLAY'.
    CALL METHOD cl_gui_frontend_services=>execute
      EXPORTING
        document               = pfilen
        minimized              = 'X'
      EXCEPTIONS
        cntl_error             = 1
        error_no_gui           = 2
        bad_parameter          = 3
        file_not_found         = 4
        path_not_found         = 5
        file_extension_unknown = 6
        error_execute_failed   = 7
        synchronous_failed     = 8
        not_supported_by_gui   = 9
        OTHERS                 = 10.
    IF sy-subrc NE 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

  ENDIF.

INITIALIZATION.
  cpfilen = 'Select Music File'.
  CALL FUNCTION 'ICON_CREATE'
    EXPORTING
      name                  = 'ICON_WORKFLOW_ACTIVITY'
      info                  = 'Play'
      add_stdinf            = 'X'
    IMPORTING
      RESULT                = play
    EXCEPTIONS
      icon_not_found        = 1
      outputfield_too_short = 2
      OTHERS                = 3.
  IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfilen.
  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title            = 'Select File'
    CHANGING
      file_table              = it_filetable
      rc                      = rc
    EXCEPTIONS
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      OTHERS                  = 5.
  IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    READ TABLE it_filetable INTO wa_filetable INDEX 1.
    IF sy-subrc = 0.
      pfilen = wa_filetable-filename.
    ENDIF.
  ENDIF.

Thanks and Best Regards,

Faisal

Edited by: Faisal Altaf on Dec 4, 2010 11:52 AM

0 Kudos
349

Thanks...bt its nt working...

0 Kudos
349

Hi, Ritesh

What Message are you getting ?

Regards,

Faisal

0 Kudos
349

it's show dump...below is description regrading run-time error...

Runtime Errors MESSAGE_TYPE_UNKNOWN

Date and Time 04.12.2010 12:14:46

Short text

Message type " " is unknown.

What happened?

Error in the ABAP Application Program

The current ABAP program "ZRSCREENMUSIC" had to be terminated because i

come across a statement that unfortunately cannot be executed.

Error analysis

Only message types A, E, I, W, S, and X are allowed.

Trigger Location of Runtime Error

Program ZRSCREENMUSIC

Include ZRSCREENMUSIC

Row 60

Module Name INITIALIZATION

0 Kudos
349

Hi,

Place a Break-Point and Check on which FM or Method this Dump is coming because it is working very fine for me.

Regards,

Faisal

0 Kudos
349

Hey...its working .....bt it open windows media player den it vl play......so I need in back-ground music on selection-screen only.....it shouldnt open new window media player....

0 Kudos
349

Hi

The code of Faisal is a little trick to run a program in presentation sever, in your case media player or something else to play a mp3

But I think there is not another solution, SAP can't play some music, just only a bip

Max