cancel
Showing results for 
Search instead for 
Did you mean: 

another image question - using Regular ABAP not web dynpro

Former Member
0 Kudos

Following Otto's awesome instructions:


1) create image field in your form (not only image!! it must be the image field)
2) load your picture in the backend
3) convert the image into XSTRING
4) create the XSTRING variable in the interface/ context, fill it with the picture data
5) bind the image field to this variable
6) enjoy
Regards, Otto

We can easily get an image to appear on a form produced from Web Dynpro ABAP using an XML interface.

However, we are having an issue doing the same using a regular ABAP report and Data Dictionary interface.

We added a new field to our DDIC structure called signature TYPE RAWSTRING (we can't define a new domain with type X since SAP doesn't allow that, but they are both Variable Length Byte Strings).

We use the exact same code to upload the same image from UNIX, we see the byte string in our variable, but no image appears on our form (using the ImageField object).

We then created a Global variable with type Xstring in our interface. We pass our binary image to the function module. Through debugging, I see that an error occurs because the gloabl variable states it's max characters is only 255.

any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

OttoGold
Active Contributor
0 Kudos

Hello, I must admit I didn´t try that in regular ABAP (not WD). But looks like you have. That means you have both solutions, right? So you can start with the image extraction out of SAP and passing to the variable the same way in both solutions, right? Then debug out if the value passed to the image field is the same for both. To make that fast, use the trace and check the values in the attached files. If there will be a difference, move the check to the ABAP, what is the value BEFORE passing to the form.

Mostly I would try to create a demo myself, but I am too busy these days, Otto

Answers (2)

Answers (2)

OttoGold
Active Contributor
0 Kudos

I thank you. The solution you provided has all the details so anybody can recreate this!! Glad your app works, Otto

OttoGold
Active Contributor
0 Kudos

I asked a colleague who I helped with a regular ABAP personal card printing. There is a photo of the employee on the form. It is not WD, it is true regular ABAP. And the proposed approach worked for him.

If you can check the variable values, it can help us move forward. Are you sure, the forms are designed the same way? I hope you didn´t forget to set "embed image data"? What picture type do you use? The same type for both applications? Which one is that?

Otto

Former Member
0 Kudos

Otto,

thanks for the replies.

I did make sure to embed the image. We tried both jpg and bmp, but neither worked.

for testing, I hardcoded this in the WD and it worked. I copied it over to our ABAP method


  DATA: lv_ds TYPE string VALUE '/sapmnt/DEV/interface/renewables/pbch-1/archive/352.bmp',
             lv_xstring TYPE xstring.

  OPEN DATASET lv_ds FOR INPUT IN BINARY MODE .

  CHECK sy-subrc = 0.

  DO 1 times.
    READ DATASET lv_ds INTO lv_xstring.
    IF sy-subrc <> 0.
      EXIT.
    ENDIF.
  ENDDO.

This gets me an Xstring field that's 1272 long.

I pass the lv_xstring field directly to the FM IMAGE field, which is defined as an Xstring in the PDF Interface


  CALL FUNCTION ls_function
    EXPORTING
      /1bcdwb/docparams  = fp_docparams
      is_scale_stng      = ls_scale_stng
      it_scale_tkti      = it_scale_tkti
      it_scale_seal      = it_scale_seal
      is_scale_tkt       = ls_scale_tkt_print
      image              = lv_xstring          " <---- pass the xstring image
    IMPORTING
      /1bcdwb/formoutput = ls_form_output
    EXCEPTIONS
      usage_error        = 1
      system_error       = 2
      internal_error     = 3
      OTHERS             = 4.

Stepping into the FM, I see that IMAGE now has the same size of 1272

In my PDF Form layout, I dragged/dropped the ImageField object on my form.

I found the IMAGE field in my Data View tab and dragged/dropped that onto the ImageField to Bind it.

I checked 'embed image data'.

I checked the form properties and the layout was set to 'Standard'. I changed it to ZCI, as well.

I know the data is coming across because I can drag/drop the image field from the Data View directly on the form as a Text Field and see the hex data come through.

Former Member
0 Kudos

otto, what type of interface is your colleague using? XML/ABAP Data Dictionary?

thanks alot.

rp.

Edited by: robert phelan on Jan 13, 2010 7:43 PM

Former Member

Otto - i finally figured it out.

check this thread -

it specifically mentions having to use FM to convert the binary to a string.


CALL FUNCTION 'SSFC_BASE64_ENCODE'
  EXPORTING
    bindata = image_xstring
  IMPORTING
    b64data = image_string.

to convert the Xstring into a String - all this time, i've been trying to make sure I was passing an Xstring!

Once I did this, the signature field came as planned.

thanks for your help.

rp.