on 01-08-2007 3:50 PM
I apologize if this is elementary but this is my first time working with SAPScript. I am trying to modify a SAPScript form. I am attempting to add our Material Document Number to printed checks form. This number is stored in the AWKEY field (BKPF-AWKEY). Do I need to declare the table BKPF anywhere in the form before I use it? To display this number I added &BKPF-AWKEY& but it is the first time table BKPF is being used in the form. Any help is appreciated. I do not have a test case to test my change yet so I was hoping if anybody on here could tell me if it would/should work or not.
Thanks,
Aaron
HI Aaron,
All the code work u have to do it in Print program not in Sapscript.
in Sapscript u have to give only the variable name.
fetch ur field value into a itab along with other values to represent.
pass the field BKPF-AWKEY to the main window to write_form F.M. from ur print program from itab or standard table.
and u can represent the field in sapscript like &BKPF-AWKEY& or &ITAB-AWKEY&
Regards
CNU
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Srinu and Sudheer, thanks for your reply but I am still confused.
Is there an example that you can point me to? BKPF is not being used at all but REGUP is. The program is RFFOUS_C but I can't figure out what i need to add where to pass BKPF-AWKEY. Is there any way that you can point me towards the right direction? I am VERY NEW to SAP/ABAP/SAPScript. If it would help I can post the code for the report RFFOUS_C.
Thanks,
Aaron
hi Aaron,
R u using standard program or Zprogram?
R u using Standard Sapscript or zsapscript?
If u r using z_program then in include RFFORI01 it is printing checks there u can try to add ur fields.
if u r using z_sapscript then use perform command to print new values from the subroutine u write in other program.
Regards
CNU
We are using a standard program (RFFOUS_C) but a zsapscript. I was looking in RFFORI01 but I am not sure where to add my fields. I was looking at the code for quite a while and could not come up with anything.
I apologize if I seem unintelligent but this is very new to me. This is the first time I have seen or worked with any SAPScript.
Thanks,
Aaron
Message was edited by:
Aaron Shover
In RFFOUS_C program in include RFFORI99..
SELECT SINGLE * FROM BKPF WHERE BUKRS EQ REGUP-BUKRS
AND BELNR EQ REGUP-BELNR
AND GJAHR EQ REGUP-GJAHR.
this statement selects the BKPF-AWKEY also from BKPF.
try to print a BKPF-AWKEY value in zsapscript.
for testing purpose..
in Main window in Sapscript
/: ULINE (70)
&BKPF-AWKEY&
/: ULINE (70)
so u know the sapscript retrieving bkpf-awkey value or not.
If sapscript cant retrieve this data then u need to write a subroutine using other values to get BKPF-AWKEY.
Regards
CNU
Thanks for that reply! I was thinking that I needed to put a select like that in the program somewhere but I wasn't sure where. I am waiting to receive a test case so that I can test the zsapscript. Does it matter where in the include (RFFORI99) I put the select?
Thanks again for the reply.
Aaron
Hi Aaron,
In Include RFFORI99, we cant add custom code we dont have permission to modify the standard program.
If the above program in previous reply doesn't work then we can add a subroutine in sapscript and can implement in other zprogram like.
/: PERFORM TEST_ROUTINE IN PROGRAM ZTEST
/: USING ®UP-FIELD&
/: CHANGING &MY_FIELD&
/: ENDPERFORM.
ZTEST is a zprogram where u can implement subroutine TEST_ROUTINE.
here we can write select statement:
EX: select single awkwy from bkpf into lv_awkey where field = ®UP-FIELD&.
Let us know once you get the test case, so we can move forward.
Regards
CNU
HI Aaron,
I think u have to use Subroutine to get the BKPF-AWKEY value in ur sapscript.
In sapscript...
*************************************************************
/: PERFORM TEST_ROUTINE IN PROGRAM ZTEST
/: USING ®UP-BUKRS&
/: USING ®UP-BELNR&
/: USING ®UP-GJAHR&
/: CHANGING &MY_BKPF_AWKEY&
/: ENDPERFORM.
&MY_BKPF_AWKEY&
**************************************************************
Create a report ZTEST ( or ur name specific must match with perform program name in sapscript).
*****************************************************************
TABLES: BKPF.
DATA: L_BUKRS LIKE REGUP-BUKRS,
L_BELNR LIKE REGUP-BELNR,
L_GJAHR LIKE REGUP-GJAHR,
L_AWKEY LIKE BKPF-AWKEY.
FORM TEST_ROUTINE TABLES IN_PAR STRUCTURE
ITSCY
OUT_PAR STRUCTURE ITCSY.ITCSY
OUT_PAR STRUCTURE ITCSY.READ TABLE IN_PAR WITH KEY 'REGUP-BUKRS'.
IF SY-SUBRC = 0.
L_BUKRS = IN_PAR-VALUE.
ENDIF.
READ TABLE IN_PAR WITH KEY 'REGUP-BELNR'.
IF SY-SUBRC = 0.
L_BELNR = IN_PAR-VALUE.
ENDIF.
READ TABLE IN_PAR WITH KEY 'REGUP-GJAHR'.
IF SY-SUBRC = 0.
L_GJAHR = IN_PAR-VALUE.
ENDIF.
SELECT SINGLE AWKEY FROM BKPF INTO L_AWKEY WHERE BUKRS = L_BUKRS BELNR = L_BELNR GJAHR = L_GJAHR.
READ TABLE OUT_PAR WITH KEY 'MY_BKPF_AWKEY'.
IF SY-SUBRC = 0.
MY_BKPF_AWKEY = L_AWKEY.
ENDIF.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.
*********************************************************************
i am assuming that table REGUP values are passing to the form. If not code is same just change the table name and variables for relation with BKPF table.
hope it solves the problem...
let me know if u need some more information
Regards
CNU
Hi Aaron,
In SAPscript layout editor... to the window it consists... i assume Main Window.
Righ click on main window... EDIT Text.
Goto Edit --> Change Editor.
there u can write this code
If u have any Text Elements then u must know under which text element u have to display this BKPF-AWKEY. under the texr element provide the code.
*************************************************************
/: PERFORM TEST_ROUTINE IN PROGRAM ZTEST
/: USING ®UP-BUKRS&
/: USING ®UP-BELNR&
/: USING ®UP-GJAHR&
/: CHANGING &MY_BKPF_AWKEY&
/: ENDPERFORM.
/: ULINE(75)
&MY_BKPF_AWKEY&
/: ULINE(75)
**************************************************************
i am giving ULINE(75) just to know that variable is executing ...( testing purpose)
Regards
CNU
Hello Sirnu,
I am beginning to try out the code you posted but I ran into a slight problem. In the ztest program there is a line:
FORM TEST_ROUTINE TABLES IN_PAR STRUCTURE ITSCY OUT_PAR STRUCTURE ITCSY.
What is ITCSY? It gives me an error saying that ITSCY is unknown.
Thanks for all of your help!
Aaron
HI Aaron,
in my above code by mistake i wrote it as itscy... pls change to ITCSY.. make sure the Subroutine name and ZTEST program name is same as u given in Sapscript form.
I am not sure what is the problem that it cant see the structure in ur program
FORM TEST_ROUTINE TABLES IN_PAR STRUCTURE ITCSY OUT_PAR STRUCTURE ITCSY.
READ TABLE IN_PAR WITH KEY 'REGUP-BUKRS'.
IF SY-SUBRC = 0.
L_BUKRS = IN_PAR-VALUE.
ENDIF.
READ TABLE IN_PAR WITH KEY 'REGUP-BELNR'.
IF SY-SUBRC = 0.
L_BELNR = IN_PAR-VALUE.
ENDIF.
READ TABLE IN_PAR WITH KEY 'REGUP-GJAHR'.
IF SY-SUBRC = 0.
L_GJAHR = IN_PAR-VALUE.
ENDIF.
SELECT SINGLE AWKEY FROM BKPF INTO L_AWKEY WHERE BUKRS = L_BUKRS BELNR = L_BELNR GJAHR = L_GJAHR.
READ TABLE OUT_PAR WITH KEY 'MY_BKPF_AWKEY'.
IF SY-SUBRC = 0.
MY_BKPF_AWKEY = L_AWKEY.
ENDIF.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.
for further help u can double clcik on any field or table name .....
and on commands place the cursor and press F1 for help.
Regards
CNU
Hi Srinu,
The link below is a screenshot of my zSAPScript. I have included the code you provided me with and I created a program called ZTest. However, nothing is happening. I'm not sure if I have the code in the wrong spot or if I messed the code up in some way. If you wouldn't mind looking at it and letting me know what I did wrong I would appreciate it. Thanks again for all of your help!
http://img81.imageshack.us/img81/6758/20070112140616gv8.jpg
Regards,
Aaron
hi Aaron,
I think the place of the perform is wrong.... it comes under different text element.
U need to place where the REGUP table items r displaying.
525
--
/: PROTECT
®UP-BELNR* ®UP-
-
HERE PLACE THE PERFORM----
/: PERFORM TEST_ROUTINE IN PROGRAM ZTEST
/: USING ®UP-BUKRS&
/: USING ®UP-BELNR&
/: USING ®UP-GJAHR&
/: CHANGING &MY_BKPF_AWKEY&
/: ENDPERFORM.
/: ULINE(70)
&MY_BKPF_AWKEY&
/: ULINE(70)
/: ENDPROTECT
if doesn't work try to place in other text element... in ur code in form...
If it also doesn't work then try to print the
®UP-BUKRS&
®UP-BELNR&
®UP-GJAHR&
these values so we might know that these values r actually fetching from print program.
Regards
CNU
Hello Srinu,
I have found, in the main program (RFFOUS_C) where it calls the form (Write_form). I also discovered that the main program does indeed reference the table I need (BKPF). How do I pass the value to the form in the write_form command? I can't find much documentation on write_form. As always, any help is more than appreciated!
Regards,
Aaron
Hi Aaron,
Your Perform is
/: PERFORM TEST_ROUTINE IN PROGRAM ZTEST.
/: USING ®UP-BUKRS&
/: USING ®UP-BELNR&
/: USING ®UP-GJAHR&
/: CHANGING &MY_BKPF_AWKEY&
/: ENDPERFORM
In the ZTEST Program.
FORM TEST_ROUTINE TABLES IN_PAR STRUCTURE ITCSY OUT_PAR STRUCTURE ITCSY.
DATA: L_BUKRS type BUKRS.
L_BELNR type BELNR.
L_GJAHR type ZJAHR.
L_AWKEY type AWKEY.
READ TABLE IN_PAR WITH KEY 'REGUP-BUKRS'.
IF SY-SUBRC = 0.
L_BUKRS = IN_PAR-VALUE.
ENDIF.
READ TABLE IN_PAR WITH KEY 'REGUP-BELNR'.
IF SY-SUBRC = 0.
L_BELNR = IN_PAR-VALUE.
ENDIF.
READ TABLE IN_PAR WITH KEY 'REGUP-GJAHR'.
IF SY-SUBRC = 0.
L_GJAHR = IN_PAR-VALUE.
ENDIF.
SELECT SINGLE AWKEY FROM BKPF INTO L_AWKEY WHERE BUKRS = L_BUKRS BELNR = L_BELNR GJAHR = L_GJAHR.
READ TABLE OUT_PAR WITH KEY 'MY_BKPF_AWKEY'.
IF SY-SUBRC = 0.
MY_BKPF_AWKEY = L_AWKEY.
ENDIF.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.
This Should work, just put a Break point in the ZTEST Program, and see the Values of L_BUKRS L_BELNR L_GJAHR .
Regards
Sudheer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The from values will be stored in Structure while running the SAPSCRIPT, so i think the field &BKPF-AWKEY& won't give you the correct one, if it is giving then there is no need to declare the TABLES statment anywhere, if you are not gettting the correct one with this field &BKPF-AWKEY&, then you need to write the External perform and get the value then use it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.