‎2010 Aug 19 10:19 AM
Dear Experts,
In printing of MB23n , I need to print STR_SUPPL1 and STR_SUPPL2 from ARDC table. I already have ADDRNUMBER.
We are using SAP SCRIPT.
Please guide me how to insert the following query in SAP SCRIPT.
tables: lfa1, adrc.
data: begin of it_test occurs 0 ,
str_suppl1 like adrc-str_suppl1,
str_suppl2 like adrc-str_suppl2,
end of it_test.
select str_suppl1 str_suppl2 into corresponding fields of table it_test from adrc addrnumber = lfa1-adrnr.
Please hekp me to solve the issue.
Thanks in advance.
Regards
Ankur
‎2010 Aug 19 10:35 AM
Hi Ankur
May be you can write a short program and include all the desired code/functionality into it and then call the same in the required Page Window of your SAP Script.
Hope this helps.
Harsh
‎2010 Aug 19 10:35 AM
Hi Ankur,
You will need to write this select query in your print program and use these variables in the script.
In the scripts you cannot fetch the data.
If your print program is standard, then you will need to create subroutine in another custome program and call that in the script.
Please let me know if you need more help on this.
Thanks,
Archana
‎2010 Aug 19 10:46 AM
hello archana
thanks for quick response.
can you please guide me the steps to write a subroutine and call the same in SAP Script.
I am new to ABAP, please help.
Regards
Ankur
‎2010 Aug 19 10:35 AM
Hi Ankur
May be you can write a short program and include all the desired code/functionality into it and then call the same in the required Page Window of your SAP Script.
Hope this helps.
Harsh
‎2010 Aug 19 10:48 AM
hello harish,
thanks for the response.
can you please guide me the steps to create an include and call the same in my script.
please help.
regards
Ankur
‎2010 Aug 19 10:50 AM
Hi Ankur,
Please go through below link. It has provided good explanation of creation subroutines in scripts.
[http://wiki.sdn.sap.com/wiki/display/profile/ExternalSubroutinesinSAPScript]
Let me know if you don't understand anything.
Thanks,
Archana
‎2010 Aug 19 10:53 AM
Ankur
You'll be creating this program, just as you do other programs in tcode se38.
Then Write in the Window Editor:
PERFORM Var_1 IN PROGRAM ZTEST USING (some variables as per your requirement)
ENDPERFORM.
Refer to the [link|http://wiki.sdn.sap.com/wiki/display/profile/ExternalSubroutinesinSAPScript] for more details.
Hope this helps.
Harsh
‎2010 Aug 19 10:49 AM
‎2010 Aug 19 11:34 AM
Hi,
In Script - Page Window -
PERFORM <form name> IN PROGRAM <Program Name>
USING &VBDKR-VBELN_VL&
USING &VBDKR-VBELN_VAUF&
CHANGING &ADDR_LINE1&
CHANGING &ADDR_LINE2&
CHANGING &ADDR_LINE3&
CHANGING &ADDR_LINE4&
CHANGING &ADDR_LINE5&
ENDPERFORM
&ADDr_line1&&ADDR_LINE3& &ADDr_line2&
&ADDR_LINE4&
PROTECT
&ADDR_LINE5&
ENDPROTECT
In SE38 - Create Prog as Subroutine pool --> Write a Form with same name
SELECT SINGLE adrnr INTO twlad-adrnr FROM twlad WHERE werks = lips-werks AND
lgort = lips-lgort.
IF sy-subrc = 0.
CALL FUNCTION 'ADDRESS_INTO_PRINTFORM'
EXPORTING
address_type = '1'
address_number = twlad-adrnr
IMPORTING
address_printform_table = lt_address.