Skip to Content
0

Dynamic position of windows in smartforms/SAP Script

Sep 25, 2017 at 06:22 AM

145

avatar image

Hi,

Is there any way where I can pass position(example topmargin and leftmargin) of window object to smartforms/SAP script and able to print the window into the position. The value of topmargin and leftmargin may vary depending on user input.

regards,

Syed Tayab Shah

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Bertrand DELVALLEE Sep 25, 2017 at 09:16 AM
1

Hello,

It's probably not a big deal to do that with SFP with 1 line of javascript to change position. So if you are not obliged to use Smartforms or... Sap Script (really?) just enjoy SFP powers.

You can have some overviews there :

https://blogs.sap.com/2016/08/01/accessing-master-page-field-on-body-page/

https://blogs.sap.com/2013/04/03/using-java-script-in-sap-adobe-forms-to-dynamically-select-logo-image-on-the-basis-of-a-field-value/

In smartforms I guess it can be done using field-symbols in an added flow code. You have to find the (dynamic) name of your block.

(EDIT)

Here is an example in order to change window '%WINDOW1' position. It have to be pasted into Initialization tab :

FIELD-SYMBOLS <docstruc> TYPE tsfdocstrc.
FIELD-SYMBOLS <docstruc_line> TYPE ssfdocstrc.
CONSTANTS c_docstruc_name(40) VALUE '%DOCSTRUC'.
ASSIGN (c_docstruc_name) TO <docstruc>.
LOOP AT <docstruc> ASSIGNING <docstruc_line>
                   WHERE tdwindow = '%WINDOW1'.
  <docstruc_line>-wleft = 15.
  <docstruc_line>-wtop = 15.
ENDLOOP.

Best regards

Bertrand

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Dear Bertrand,

Thanks for your response, above links are showing how to call different logo according to company code or user input.

I am exploring my question more, in below image can I set variable as user input in highlighted area? Obviously no, so how to handle it?

capture1.jpg (79.2 kB)
0

Dear Bertrand,

Thanks I got your point now and issue has resolved from your response.

Thanks again.

0

Hello,

Paste this code into your Global definition/ INITIALIZATION tab :

FIELD-SYMBOLS <docstruc> TYPE tsfdocstrc.
FIELD-SYMBOLS <docstruc_line> TYPE ssfdocstrc.
CONSTANTS c_docstruc_name(40) VALUE '%DOCSTRUC'.
ASSIGN (c_docstruc_name) TO <docstruc>.
LOOP AT <docstruc> ASSIGNING <docstruc_line>
                   WHERE tdwindow = '%WINDOW1'.
  <docstruc_line>-wleft = 15.
  <docstruc_line>-wtop = 15.
ENDLOOP.

I tried, it works. But if you want to do this into a page (not in initialization phase) it's more tricky.

Best regards

Bertrand

1
Sandra Rossi Sep 25, 2017 at 09:59 AM
0

The best you can do is creating many paragraph formats with predefined margin values, and as a text can be dynamic with any paragraph format, you may select the closest paragraph format corresponding to the margin values you need.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Dear Rossi,

Thanks for your response, above links are showing how to call different logo according to company code or user input.

I am exploring my question more, in below image can I set variable as user input in highlighted area? Obviously no, so how to handle it?

0

I understood your question, and I answered "the best you can do is ..." Again, as a workaround, as I said, you can use paragraph formats (in your screen capture, that would correspond to do it inside the text %TEXT3)

0

Again Thanks Rossi for your reply.

This may closest solution that you provided. It can not be print the object at exact user provided location. It can not handle by smartforms function module even copy it to z....function. I just want to clear my doubt of posiblities.

regards,

0