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

03-06-2019

Thx for answer...

In my example is GRAPHIC_MULTI an ImageField, and in context I have 2 fields ( GRAPHIC_GREEN, GRAPHIC_RED) type Graphic node (by content).

Field GRAPHIC_MULTI is default bind to GRAPHIC_RED.

Now I want dynamic change binding do GRAPHIC_GREEN.

I try in my example in events initialize and form:ready this code:

data.stranka_01.Subform2.GRAPHIC_MULTI::initialize - (JavaScript, client)

this.rawValue  = $record.GRAPHIC_GREEN.rawValue;

data.stranka_01.Subform2.GRAPHIC_MULTI::ready:form - (JavaScript, client)

this.rawValue  = $record.GRAPHIC_GREEN.rawValue;

But still I see in preview red (default) picture instead green picture...

If my JavaScript code and events correct ?

Regards, MD