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: 

Upload Graphics Using Function Module

Former Member
0 Kudos

Hello,

I am trying to use SAPSCRIPT_IMPORT_GRAPHIC_BDS function module to upload graphics. The problem is that I am always getting dump. Could some one help me with sample code.

Regards,

Vimal

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate

Yes, here is a sample program. This program actually uses the subroutine in SE78 to upload the graphics. Works pretty good. Also, doing it this way, there is no user interaction required after giving the name and filename.



report zrich_0004 .

parameters: p_file type localfile default 'C:file.bmp'.
parameters: p_image type stxbitmaps-tdname.

data: imagename type stxbitmaps-tdname.

at selection-screen on value-request for p_file.
  call function 'KD_GET_FILENAME_ON_F4'
       exporting
            static    = 'X'
       changing
            file_name = p_file.

start-of-selection.

  imagename = p_image.


  perform show_status using 'Importing Image from Front End'.
  perform import_bitmap using p_file
                              imagename
                              'Test Image'.


************************************************************************
*       FORM import_Bitmap                                             *
************************************************************************
form import_bitmap using filename
                         name
                         title.

  data: l_resolution  type stxbitmaps-resolution.
  data: l_docid     type stxbitmaps-docid.

  perform import_bitmap_bds
                  in program saplstxbitmaps
                            using    filename
                                     name
                                     'GRAPHICS'     "Object
                                     'BMAP'         "ID
                                     'BMON'         "B/W
                                     'BMP'          "Extension
                                     title
                                     space
                                     'X'
                            changing l_docid
                                     l_resolution.



endform.


Regards,

Rich Heilman

3 REPLIES 3

RichHeilman
Developer Advocate
Developer Advocate

Yes, here is a sample program. This program actually uses the subroutine in SE78 to upload the graphics. Works pretty good. Also, doing it this way, there is no user interaction required after giving the name and filename.



report zrich_0004 .

parameters: p_file type localfile default 'C:file.bmp'.
parameters: p_image type stxbitmaps-tdname.

data: imagename type stxbitmaps-tdname.

at selection-screen on value-request for p_file.
  call function 'KD_GET_FILENAME_ON_F4'
       exporting
            static    = 'X'
       changing
            file_name = p_file.

start-of-selection.

  imagename = p_image.


  perform show_status using 'Importing Image from Front End'.
  perform import_bitmap using p_file
                              imagename
                              'Test Image'.


************************************************************************
*       FORM import_Bitmap                                             *
************************************************************************
form import_bitmap using filename
                         name
                         title.

  data: l_resolution  type stxbitmaps-resolution.
  data: l_docid     type stxbitmaps-docid.

  perform import_bitmap_bds
                  in program saplstxbitmaps
                            using    filename
                                     name
                                     'GRAPHICS'     "Object
                                     'BMAP'         "ID
                                     'BMON'         "B/W
                                     'BMP'          "Extension
                                     title
                                     space
                                     'X'
                            changing l_docid
                                     l_resolution.



endform.


Regards,

Rich Heilman

Former Member
0 Kudos

What does the dump say? Have you checked the where-used list of this function module? It gives two programs where it is used. May be you can find some clues there. Why are uploading graphics yourself? Don't you have standard transaction SE78 to do that?

Srinivas

Former Member
0 Kudos

Thanks...Rich Heilman & Srinivas..

Problem is Soved.