ABAP Program to Display OAER pictures on Screen

2
791
There is another way to upload the image and display on screen in our custom application. We can also add the Images using the Transaction OAER, then calling the relevant functions to do rest of the work at PBO.
Image display (using OAER)
Image display (using OAER)

 

Steps to follow:

Step 1: Upload the image using T-Code OAER. Follow as per given below to upload the image.

On Initial screen, enter the Class Name (‘PICTURES’), Class Type (‘OT’) and Object Key (enter project name / your name; I used my name to group all the images uploaded by me).

Enter Details on initial screen of OAER
Enter Details on initial screen of OAER

Execute by pressing F8. On next screen you have to create a Screen (thats actually an image). Goto create tab and double click the Screen. A window pops-up for the file name specification. Browse to the file you want to upload, and press open.Upload image to OAER.

Select the file to upload
Select the file to upload

 

On next screen press ok to save the image.

Press ok to save the Image
Press ok to save the Image

The details of the screen is now visible to you.

Image Details - now visible
Image Details - now visible

 

Step 2: Create a Module Pool program with a Screen and place a custom container(name it PICT190) on the screen(say 0100).

step 3: Place the following code in the program in PBO module.

*&———————————————————————*
*&      Module  STATUS_0100  OUTPUT
*&———————————————————————*
*       text
*———————————————————————-*
module status_0100 output.
*– Main Status
  set pf-status ‘0100’.
  set titlebar ‘0100’.

  v_objkey = ‘NAVEENVISHAL’.
  v_class = ‘PICTURES’.
  v_type = ‘OT’.
  v_client = ‘090’.

  call function ‘BDS_BUSINESSDOCUMENT_GET_URL’
    EXPORTING
      classname  = v_class
      classtype  = v_type
      client     = v_client
      OBJECT_KEY = V_OBJKEY
    TABLES
      uris       = uris.

* Find image
  loop at uris.
    search uris-uri for ‘winter.jpg’.
    if sy-subrc = 0.
      url = uris-uri.
      exit.
    endif.
  endloop.
*  create container and place picture in it
  if pict190 is initial.
    create object picture_container
      EXPORTING
        container_name = ‘PICT190’.

    create object pict190
      EXPORTING
        parent = picture_container.

    call method:
    pict190->load_picture_from_url
    exporting url = url,
    pict190->set_display_mode
    exporting display_mode = pict190->display_mode_normal_center.
  endif.

endmodule.                 ” STATUS_0100  OUTPUT

 

Thats it..Image will be shown in the defined container.

 

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here