Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

SAP Adobe Forms - how to use variables from context in JavaScript/FormCalc

Avatar

Avatar
Validate 1
Level 1
miland72392180
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
miland72392180
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
miland72392180
Level 1

29-05-2019

Hello,

I am beginner in Sap Adobe Forms, I need a little help.

I have to create a Sap Adobe form with a table, which included in some columns images (dynamicly based on data in input table).

What I did now ( in my example form I expect only 2 types of pictures (red a green triangle) 😞

1) In se78 create  2 pictures (red a green triangle)

2) in interface of the form create 3 global variables :

GV_PICT_TRIANGLE_RED - xstring

GV_PICT_TRIANGLE_GREEN - xstring

GV_SWITCH_PICTURE - char1 (value 'G' -> want to display green triangle, 'R' -> want to display red triangle)

3) in init section of interface add a code to load binary pictures from Se78

CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp

EXPORTING

  p_object = 'GRAPHICS'

  p_name   = 'ZGM_PEP_SIPKA_CERVENA'

  p_id     = 'BMAP'

  p_btype  = 'BCOL'

RECEIVING

  p_bmp = GV_PICT_TRIANGLE_RED

EXCEPTIONS

  not_found = 1

  internal_error = 2

  OTHERS = 3.

etc...

4) in my test form in context I created 2 Graphics node (GRAPHICS_1, GRAPHICS_2) , type content graphics and map contend field to global variables GV_PICT_TRIANGLE_RED and GV_PICT_TRIANGLE_GREEN

5) that is all OK, when I on subform put ImageField IMAGE_01 a  bind it to GRAPHICS_1 or GRAPHICS_2, picture will be display corect.

6) Now I need in Image field IMAGE_01 display picture dynamicly (for example depend on value of global variable GV_SWITCH_PICTURE), it means, that in some event ( initialize ) of form should I by javaScript / FormCalc  set dynamic binding to GRAPHICS_1 or GRAPHICS_2.

data.#pageSet[0].Page1.image_01::initialize - (JavaScript, client)

this.bind.ref =  ?????.

Can somebody tell me how to write such a Javascript code, how to access context variable GV_SWITCH_PICTURE and how to bind dynamicly IMAGE_01 to GRAPHICS_1 or GRAPHICS_2 ?

Something like this:

If ( GV_SWITCH_PICTURE = 'R' )

   bind Image_01 to GRAPHICS_1

else.

   bind Image_01 to GRAPHICS_2

endif.

Thx for help....

Best regards, MD

View Entire Topic

Avatar

Avatar
Validate 1
Level 1
miland72392180
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
miland72392180
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
miland72392180
Level 1

04-06-2019

Hello,

thx for answer...

Image data comes from picure load into SE78 tcod in SAP, in initialization section of interface I load this pictures into global variable using

CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp

EXPORTING

  p_object = 'GRAPHICS'

  p_name   = 'ZGM_PEP_SIPKA_CERVENA'

  p_id     = 'BMAP'

  p_btype  = 'BCOL'

RECEIVING

  p_bmp = GV_PICT_TRIANGEL_RED

EXCEPTIONS

  not_found = 1

  internal_error = 2

  OTHERS = 3.

Then in context create a Graphic nodes GRAPHIC_RED a GRAPHIC_GREEN and bind them to global variables GV_PICT_TRIANGEL_RED a GV_PICT_TRIANGEL_GREEN.

Static bind on image field GRAPHIC_MULTI: is working.

In XML source is as property "bind" value "$record.GRAPHIC_GREEN" (in case of static binding). That is way I used in JavaScript this

code: this.rawValue  = $record.GRAPHIC_GREEN.rawValue;

But it doesn't work still.

I add a few pictures of my example form.

Best regards, MD

adobe_form_01.jpgadobe_form_02.jpgadobe_form_03.jpgadobe_form_04.jpgadobe_form_05.jpg