Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic position of windows in smartforms/SAP Script

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

bertrand_delvallee
Active Participant

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-ima...

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

8 REPLIES 8

bertrand_delvallee
Active Participant

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-ima...

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

0 Kudos

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?

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

0 Kudos

Dear Bertrand,

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

Thanks again.

Sandra_Rossi
Active Contributor
0 Kudos

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.

0 Kudos

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 Kudos

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 Kudos

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,