|
|
This website is not affiliated with, sponsored by, or approved by SAP AG.
Development SAPscript/ Smartforms
Moderators: thx4allthefish, Snowy, Gothmog, YuriT
by ahaks » Sun Jun 14, 2009 7:34 pm
hello guys,
as i know that when we declare a box in SAP Script, the box XPOS and YPOS are fixed. my question are how do we declare a dynamic box?
Thanks in advance.
-
ahaks
-
- Posts: 13
- Joined: Mon Apr 27, 2009 2:34 am
by Rich » Sun Jun 14, 2009 11:04 pm
Not having tried it, but here's a thought. The below is a 'dynamic' document, made up of includes that can vary between different screens that the user is displaying, and as each screen can have different combinations of subscreens, if these were declared statically there would be about 100 different help screens to cover all the combinations. This way there is just one. - Code: Select all
/: DEFINE &BLOCK1& = ' ' /: DEFINE &BLOCK2& = ' ' /: DEFINE &BLOCK3& = ' ' /: PERFORM GET_BLOCKS IN PROGRAM SAPLZ_FSE_P_02 /: CHANGING &BLOCK1& /: CHANGING &BLOCK2& /: CHANGING &BLOCK3& /: ENDPERFORM /: INCLUDE ZFSEP02_0200 OBJECT DOKU ID TX * /: IF &BLOCK1& <> ' ' . /: INCLUDE &BLOCK1& OBJECT DOKU ID TX * /: ENDIF /: IF &BLOCK2& <> ' ' . /: INCLUDE &BLOCK2& OBJECT DOKU ID TX * /: ENDIF /: IF &BLOCK3& <> ' ' . /: INCLUDE &BLOCK3& OBJECT DOKU ID TX /: ENDIF * /: INCLUDE ZFSEP02_0DIAG_MORE_INFO OBJECT DOKU ID TX
. The routine GET_BLOCKS populates the &BLOCKN& variables: - Code: Select all
*eject *&---------------------------------------------------------------------* *& Form Get_Blocks *&---------------------------------------------------------------------* * text The help displayed by the form SHOW_HELP above is * dynamically generated so if the user clicks 'Print', * SAP complains that the document does not exist or is * empty. However, this routine, using document * ZFSEP02_TEMPLATE can generate the document in a * printable form. *----------------------------------------------------------------------* * * Since this form is a callback program essentially for the * performance assistant, the parameters have to be global * variables. * * G_BLOCK1, G_BLOCK2 and g_BLOCK3 define the text blocks that * have been used to generate the above help text. *----------------------------------------------------------------------* Form Get_Blocks TABLES IN_PAR STRUCTURE ITCSY OUT_PAR STRUCTURE ITCSY. Loop at Out_Par. Case Out_Par-Name. When 'BLOCK1'. Out_Par-Value = g_Block1. When 'BLOCK2'. Out_Par-Value = g_Block2. When 'BLOCK3'. Out_Par-Value = g_Block3. EndCase. Modify Out_Par. EndLoop. EndForm.
So, why not try somehting similar, and try populating two variables from a routine in an ABAP and then using them in place of the XPOS and YPOS variables in the sapscript command ?
-
Rich
-
- Posts: 6919
- Joined: Thu Oct 31, 2002 4:47 pm
- Location: Geneva
-
by RosieBrent » Mon Jun 15, 2009 2:11 am
Moved to SAPScript forum from ABAP
Kind Regards
Rosie Brent
Please remember to search the forum and check the FAQ before posting questions, thank you.
Tuly Idiot most of the time, part-time Guru 
-
RosieBrent
-
- Posts: 6197
- Joined: Mon Oct 21, 2002 3:04 am
- Location: Darlington
-
by exactly » Mon Jun 15, 2009 4:39 am
HI! You can create a text element where (for example) YPOS should be incremented by 5 mm. - Code: Select all
POSITION YORIGIN '+5' MM
So call this text element from your program as many times as you need just to move the position.
-
exactly
-
- Posts: 7
- Joined: Mon Jun 09, 2008 5:55 am
- Location: Russia
-
by ahaks » Tue Jun 16, 2009 1:54 am
i tried use yorigin but it only reposition my windows...
what i want is the length of the box that i declare is the same as the data that will be output. By using block, i still doesn't understand on how to do block.
Thanks in advance
-
ahaks
-
- Posts: 13
- Joined: Mon Apr 27, 2009 2:34 am
by Rich » Tue Jun 16, 2009 2:07 am
ahaks wrote:i tried use yorigin but it only reposition my windows...
what i want is the length of the box that i declare is the same as the data that will be output. By using block, i still doesn't understand on how to do block.
Thanks in advance
Hopefully this will point you in the right direction, however, you may need to change the units to characters rather than MM. - Code: Select all
/: DEFINE &MY_XPOS& = ' ' /: DEFINE &MY_YPOS& = ' ' /: DEFINE &MY_HEIGHT& = ' ' /: DEFINE &MY_WIDTH& = ' ' /: PERFORM GET_BOX_SIZE IN PROGRAM Z_MY_PROG /: CHANGING &MY_XPOS& /: CHANGING &MY_YPOS& /: CHANGING &MY_HEIGHT& /: CHANGING &MY_WIDTH& /: BOX XPOS '&MY_XPOS' MM YPOS '&MY_YPOS' MM HEIGHT '&MY_HEIGHT' MM WIDTH '&MY_WIDTH' MM INTENSITY 10 FRAME 0 TW
Form Get_Box_Size TABLES IN_PAR STRUCTURE ITCSY OUT_PAR STRUCTURE ITCSY. Loop at Out_Par. Case Out_Par-Name. When 'MY_XPOS'. Out_Par-Value = 100. When 'MY_YPOS'. Out_Par-Value = 57. When 'MY_HEIGHT'. Out_Par-Value = 300. When 'MY_WIDTH'. Out_Par-Value = 'Does it matter?'.
EndCase. Modify Out_Par. EndLoop. EndForm.
-
Rich
-
- Posts: 6919
- Joined: Thu Oct 31, 2002 4:47 pm
- Location: Geneva
-
by ahaks » Tue Jun 16, 2009 9:27 pm
rich, i code my sapcript and prog like this. - Code: Select all
in sapscript
/: DEFINE &LENY& = ' ' W1 &ws_name& /: PERFORM GET_LENY IN PROGRAM ZRLMPYTF1 /: CHANGING &LENY& /: BOX XPOS 0 MM YPOS &LENY& MM WIDTH 0 MM HEIGHT 4 MM FRAME 20 TW /: BOX XPOS 0 MM YPOS &LENY& MM WIDTH 0 MM HEIGHT 4 MM FRAME 20 TW /: POSITION YORIGIN +4 MM w2 &ilist-zname1&
in program
FORM get_leny TABLES IN_PAR STRUCTURE ITCSY OUT_PAR STRUCTURE ITCSY.
loop at out_par. case out_par-name. when 'leny'. out_par-value = out_par-value + '4.5'. endcase. modify out_par. endloop. endform.
and still the line is start from 0 mm of the window. how do i do if i want it to start from 4.5 MM from window and it will continue as the data goes on?
-
ahaks
-
- Posts: 13
- Joined: Mon Apr 27, 2009 2:34 am
by Rich » Tue Jun 16, 2009 10:56 pm
My Mistake.... I missed out the ENDPERFORM when I was changing the code above. In your Sapscript you need: - Code: Select all
/: PERFORM GET_LENY IN PROGRAM ZRLMPYTF1 /: CHANGING &LENY& /: ENDPERFORM
-
Rich
-
- Posts: 6919
- Joined: Thu Oct 31, 2002 4:47 pm
- Location: Geneva
-
by ahaks » Tue Jun 16, 2009 11:37 pm
i change it and add endperform and also i change the addition statement. - Code: Select all
FORM get_leny TABLES IN_PAR STRUCTURE ITCSY OUT_PAR STRUCTURE ITCSY.
loop at out_par. case out_par-name. when 'LENY'. out_par-value = out_par-value + 4. endcase. modify out_par. endloop. endform.
but it still start from 0 mm. when i hard code it, the starting point change. but it will not follow on the data that will be output. still the value of 'LENY is not pass to the sapscript.
-
ahaks
-
- Posts: 13
- Joined: Mon Apr 27, 2009 2:34 am
by Rich » Tue Jun 16, 2009 11:40 pm
Turn the sapscript debugger on and trace your form. Make sure that LENY is actually being changed.
-
Rich
-
- Posts: 6919
- Joined: Thu Oct 31, 2002 4:47 pm
- Location: Geneva
-
by ahaks » Wed Jun 17, 2009 12:12 am
may i know that the out_par value hold a character or an interger? when i debug, the out_par-value didn't get the value of '4'.
-
ahaks
-
- Posts: 13
- Joined: Mon Apr 27, 2009 2:34 am
Return to SAPscript/Smartforms
Who is online
Users browsing this forum: No registered users and 4 guests
|
|