Passing SO number to driver program !!
hi guys...
i have to create a smartform for printing a sales order which will be attached to a z o/p type in std tcode VA02. i want to know the following.....
1. how do i import the SO number entered by the user in VA02 into my z program or z smartform.
2. i found the following steps in SND to create a PO ...
a. when you create a output it creates an entry in table NAST.
b. the transaction triggers program SAPFM06P which in turn looks into table TNAPR to get the program and smartform.
c. SAPFM06P triggers form ENTRY_NEU of your new Z program and prints the Z-smartform.
d. Please have a quick look at program SAPFM06P for the basic structure. call ur smart form in subroutine ENTRY_NEU.
are there any similar step for creating a SO as well??
i have asked this question earlier as well but could not arrive at a solution....i would be greatful if someone could give more elaborate answers as i am working on smartforms for the first time.
Points will be rewarded !!
Edited by: Poonam Londhe on Jul 19, 2008 12:48 PM
hi Poonam,
In transaction VA02 also it is the same steps followed to create a sales order output.
a. when you create a output it creates an entry in table NAST.
b. From TNAPR table the program will read for smartform and print program and the subroutine from which it has to start the execution of the program
c. It will pass the nast key to the print program in which you will get the sales order number .From which you can get the details of the sales order.
Regards,
Veeresh
Similar Messages
-
Passing Value from a Driver Program
Hi,
How can i send a specific field's value alone to the form from driver program ?
we normally use write_form in Loop & end loop.
if i wanna send a value from one flied alone wat shud i do??
Pls help me...
Thank You.Hi
See the sample code for Subroutines and do accordingly
How to call a subroutine form SAPscripts
The Form :
/:PERFORM CDE_CENT IN PROGRAM ZKRPMM_PERFORM_Z1MEDRUCK
/:USING &EKKO-EBELN&
/:CHANGING &CDECENT&
/:ENDPERFORM
The report :
REPORT zkrpmm_perform_z1medruck .
DATA : BEGIN OF it_input_table OCCURS 10.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_input_table.
déclaration de la table output_table contenant les
variables exportées
DATA : BEGIN OF it_output_table OCCURS 0.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_output_table.
DATA : w_ebeln LIKE ekko-ebeln,
w_vbeln LIKE vbak-vbeln,
w_zcdffa LIKE vbak-zcdffa.
FORM CDE_CENT
FORM cde_cent TABLES input output.
it_input_table[] = input[].
it_output_table[] = output[].
READ TABLE it_input_table INDEX 1.
MOVE it_input_table-value TO w_ebeln.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_ebeln
IMPORTING
output = w_ebeln.
SELECT SINGLE zcdffa FROM ekko
INTO w_zcdffa
WHERE ebeln = w_ebeln.
it_output_table-name = 'CDECENT'.
MOVE w_zcdffa TO it_output_table-value.
MODIFY it_output_table INDEX 1.
output[] = it_output_table[].
ENDFORM.
REPORT ZMPO1 .
form get_freight tables in_par structure itcsy out_par structure itcsy.
tables: ekko,konv,t685t.
data: begin of itab occurs 0,
ebeln like ekko-ebeln,
knumv like ekko-knumv,
end of itab.
data: begin of itab1 occurs 0,
knumv like konv-knumv,
kposn like konv-kposn,
kschl like konv-kschl,
kbetr like konv-kbetr,
waers like konv-waers,
kwert like konv-kwert,
end of itab1.
data: begin of iout occurs 0,
kschl like konv-kschl,
vtext like t685t-vtext,
kbetr like konv-kbetr,
kwert like konv-kwert,
end of iout.
data v_po like ekko-ebeln.
read table in_par with key 'EKKO-EBELN'.
if sy-subrc = 0.
v_po = in_par-value.
select
ebeln
knumv
from ekko
into table itab
where ebeln = v_po.
if sy-subrc = 0.
loop at itab.
select
knumv
kposn
kschl
kbetr
waers
kwert
into table itab1
from konv
where knumv = itab-knumv and
kappl = 'M'.
endloop.
loop at itab1.
if itab1-kposn <> 0.
select single * from t685t
where kschl = itab1-kschl
and kappl = 'M'
and spras = 'EN'.
iout-vtext = t685t-vtext.
iout-kschl = itab1-kschl.
iout-kbetr = itab1-kbetr.
iout-kwert = itab1-kwert.
append iout.
clear iout.
endif.
endloop.
sort itab1 by kposn.
loop at iout.
sort iout by kschl.
if ( iout-kschl eq 'GSDC' OR
iout-kschl eq 'GSFR' OR
iout-kschl eq 'GSIR' ).
at end of kschl.
read table iout index sy-tabix.
sum.
write:/ iout-kschl,iout-vtext,iout-kwert.
out_par-name = 'A1'.
out_par-value = iout-vtext.
append out_par.
out_par-name = 'A2'.
out_par-value = iout-kwert.
append out_par.
endat.
endif.
endloop.
endif.
endif.
endform.
IN THE FORM I AM WRITING THIS CODE.
/:DEFINE &A1& = ' '
/:DEFINE &A2& = ' '
/:PERFORM GET_FREIGHT IN PROGRAM ZMFORM_PO1
/:USING &EKKO-EBELN&
/:CHANGING &A1&
/:CHANGING &A2&
/:ENDPERFORM
&A1&
&A2&
This Code is to be written in the PO form under ADDRESS window.
/:DEFINE &A1& = ' '
/:DEFINE &A2& = ' '
/:DEFINE &A3& = ' '
/:DEFINE &A4& = ' '
/:DEFINE &A5& = ' '
/:DEFINE &A6& = ' '
/:PERFORM GET_VENDOR IN PROGRAM ZMFORM_PO
/:USING &EKKO-EBELN&
/:CHANGING &A1&
/:CHANGING &A2&
/:CHANGING &A3&
/:CHANGING &A4&
/:CHANGING &A5&
/:CHANGING &A6&
/:ENDPERFORM
&A1&
&A2&
&A3&
&A4&
&A5&
&A6&
Reward points for useful Answers
Regards
Anji -
Table from driver program to smartform
Hi All,
I am passing the table from driver program to smartform as below
CALL FUNCTION w_fname
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
output_options = ls_composer_param
user_settings = space
TABLES
t_prod_ords = i_prod_ords
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
now my problem is that i want to access the data into smartform i have already define similar structure under types tab in global setting and then create a table in global data tab but when i go to smartform the table comes up BLANK.
i dont want to create Z structure and dont want to define table in import parameter.
any other way out ?
Thanks ,
Ruchi TiwariHi Ruchi,
The data you wanted to pass from driver program to Smartform should be defined under Global settings in Form Interface not in Global data.
If you want to pass tables data from driver program to smartform, define a table with same structure in Form Interface of Global settings and if you wanted to export/import some values just do the same in Import/export parameters under Form Interface.
The data you declare under Global data can be used globally in the smartform.
eg : GT_VBAK LIKE VBAK.
Hope this helps
Rgds,
Sripal -
Regarding Passing two internal Tables from Driver Program to Smartform
hi all,
I am Passing Two Internal Tables from Driver Program to Smartform it is going to dump and message is showing like this " one of the parameters eded according to the interface description was not specified ".
When i am passing one Internal Table Output is coming Perfectly. Is there any restriction for passing of internal tables.
Regards
RamiHI,
Check the names specified in the smartfrom and FM whcih you are calling in the driver program. Both might be different.... -
Hi,
can u plz send me one realtime sample smartform driver program if possible invoice from and credit form
regards
Sirihi
good
THIS IS A SAMPLE DRIVER PROGRAM
REPORT ZSMARTFORM.
Calling SMARTFORMS from your ABAP program.
Collecting all the table data in your program, and pass once to SMARTFORMS
SMARTFORMS
Declare your table type in :-
Global Settings -> Form Interface
Global Definintions -> Global Data
Main Window -> Table -> DATA
Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
http://sapr3.tripod.com
TABLES: MKPF.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: BEGIN OF INT_MKPF OCCURS 0.
INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.
SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
MOVE-CORRESPONDING MKPF TO INT_MKPF.
APPEND INT_MKPF.
ENDSELECT.
At the end of your program.
Passing data to SMARTFORMS
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSMARTFORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
if sy-subrc <> 0.
WRITE: / 'ERROR 1'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function FM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
GS_MKPF = INT_MKPF
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
AND YOU CAN IMPLEMENT YOUR OWN SMARTFORM DRIVER PROGRAM USING THIS LOGIC
THANKS
MRUTYUN -
Calling standard printer driver program RVADOR01 from ALV report
I have ALV report (Sales order documents) and one of columns in report is icon type with print preview link (hotspot). When user press icon, I would like to call standard print program RVADOR01 (actually we have custom Z_RVADOR01 and custom smartform which are working fine when using Document -> Output in VA03) to display print preview. I don't know how to call (trigger) print driver routine and pass needed parameters to it (ex. SO number).
MarkoActually I did that. But then you are at least three clicks away from print preview screen. For testing purpose I've created custom smartform and run it from my report. It is working like I want. Now, instead of my procedure I want to run standard printer driver program with needed parameters. I believe that all it needs is document number (vbeln) and all the rest is already there, program, smatform... I just don't know how to use it (ex. pass parameters).
I know I maybe complicating too much but I am ABAP beginner and want to learn as much as possible. Thank you anyway! -
Problem with SmartForms driver program
Hello,
I have the following problem:
I have created a Smarform that uses a standard text element. In my program, the text in this element is changed depending on the language the user has selected.
The form is then created and converted to PDF and displayed to the user. The problem I have is that the first time, the PDF is displayed in the correct language. However, when another language is selected the second time, the displayed PDF will still show the first language. After some testing, I found out that the problem most likely lies with the Smartforms function module. It seems that a certain variable is not being reset when it is called the second time, resulting in the same language being shown. Perhaps there's some variable in the control_parameters that I didn't set?
In any case, this is the code of the driver program:
DATA: fm_name TYPE rs38l_fnam.
DATA: output_options TYPE ssfcompop,
control_parameters TYPE ssfctrlop,
job_output_info TYPE ssfcrescl.
* Get function module name for SmartForm
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZHR_ADVERTISEMENT'
IMPORTING
fm_name = fm_name.
* SmartForm settings
control_parameters-getotf = 'X'.
control_parameters-no_dialog = 'X'.
output_options-tdnoprev = 'X'.
* Execute SmartForm
CALL FUNCTION fm_name
EXPORTING
control_parameters = control_parameters
output_options = output_options
IMPORTING
job_output_info = job_output_info
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
* Display PDF
CALL FUNCTION 'HR_EFI_SHOW_PDF_FORM'
TABLES
otf_table = job_output_info-otfdata.
Thanks in advance!
DaveHi,
Check the below code and see if ur missing something
DATA: form_name TYPE rs38l_fnam, " Used to get the function module of Smartform
wa_ctrlop TYPE ssfctrlop, " Smart Forms: Control structure
wa_outopt TYPE ssfcompop, " SAP Smart Forms: Smart Composer (transfer) options
t_otfdata TYPE ssfcrescl. " Smart Forms: Return value at end of form printing
Data: t_pdf_tab type table of tline, " SAPscript: Text Lines
t_otf TYPE table of itcoo. " OTF Structure
Variables used to pass to GUI_DOWNLOAD
DATA: w_filesize TYPE i,
w_bin_filesize TYPE i.
Variables used for Save Dialog Box
DATA : file_name TYPE string,
file_path TYPE string,
full_path TYPE string.
START-OF-SELECTION.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZPDF_G' "p_name
IMPORTING
fm_name = form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_outopt-tdnoprev = 'X'.
CALL FUNCTION form_name
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_outopt
user_settings = 'X'
IMPORTING
job_output_info = t_otfdata
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
END-OF-SELECTION.
t_otf[] = t_otfdata-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = w_bin_filesize
TABLES
otf = t_otf
lines = t_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
----TAKING THE DOWNLOAD FILE PATH AS USER INPUT*
CALL METHOD cl_gui_frontend_services=>file_save_dialog
CHANGING
filename = file_name
path = file_path
fullpath = full_path
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Download the file to the selected path
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = w_bin_filesize
filename = full_path "fname1
filetype = 'BIN'
IMPORTING
filelength = w_filesize
TABLES
data_tab = t_pdf_tab
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE i000(zpdf). "File not downloaded
ELSE.
MESSAGE i001(zpdf). "File downloaded
ENDIF. -
Calling a Smartform through a driver program.
Hi ALL,
I had created a smart-form and executed it without any errors.
Since its create a FM, which can be called by driver Program,when i called the smart-form FM from the driver program I get a Pop-up asking for the OUTPUT DEVICE. When we enter a device name its executed properly and can see the print preview of the form.
My concern is to avoid that pop up, by giving the device value in the program itself. To do so it provided a options though which i can send the device type.
these are the values which i have passed.
outop-TDTITLE = 'testing for title'.
outop-xdfoutdev = 'LP01'. "output device type
cparam-getotf = 'X'.
cparam-no_dialog = 'X'.
cparam-preview = ' '.
CALL FUNCTION fm_name "FM for smart-form.
EXPORTING
control_parameters = cparam
output_options = outop
* user_settings = 'X'
*** IMPORTING
** job_output_info = tab_otf_data
* EXCEPTIONS
* formatting_error = 1
* internal_error = 2
* send_error = 3
* user_canceled = 4
* OTHERS = 5.
Can you tell where am I going wrong, so that can avoid that window.
Thanks,
Lalitkumar.Hi shivendran,
I tried the mentioned code by mentioned by you. but still the issue exists that is the popup for output device.
DATA:fm_name TYPE rs38l_fnam.
DATA: ls_control_pars TYPE ssfctrlop,
ls_output_opt TYPE ssfcompop.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'z_smartform_test'
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
ls_output_opt-tddest = 'LP01'.
ls_output_opt-tdimmed = 'X'.
ls_control_pars-no_dialog = 'X' .
CALL FUNCTION fm_name
EXPORTING
control_parameters = ls_control_pars
output_options = ls_output_opt
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
this is code which i tried to call my amartform from driver program.
I tried assigning the default output device by
open a session:
Clickon the system menu->user profile -> own data
then goto the defaults tab. in the spool control section maintain output device (your printer name where you want to print)
but still the problem exists.
Please help to resolve this issue.
Thanks,
Lalitkumar. -
About smartforms driver program
Hello Experts,
Is there any function module to fetch data from sd module to get data in SMARTFORMS ?
mail me solution on "[email protected]"
Thanx in advance,
Rahul TaleleHi Rahul,
Call function 'SSF_FUNCTION_MODULE_NAME' that will give u smartform function name by passing smartform name. then call that FM to transfer data from driver program to smartform.
Refer this code :
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = P_FORM
IMPORTING
FM_NAME = P_FUNCTION
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION P_FUNCTION
TABLES
D_VBRK = IT_VBRK
D_VBRP = IT_VBRP
D_LIKP = IT_LIKP
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Reward points if helpful.
regards,
Hemant -
Driver program for Pallet label or Handling unit
Hi Friends,
Could any one give me The standard driver program for Pallet label for Handling unitHi Jyotiswaran,
It can be without HU managed. You need to use SU (storage unit) managed storage types.
When you do GR for inbound delivery and create a TO for stock putaway, by using the palletisation data in WM view 2 system generates the storage units. The same can be treated as the pallet number.
Regards,
Sudhir -
Hi experts ,
Can anyone guide me for writing a driver program for ADOBE forms ( created using SFP transaction) . I have created the form but dont know how to run it using a driver program since i m new to SFP.
Plz help me.
Message was edited by:
suchita phulkarSuchita,
You can check this code.. This is purley to run the ADOBE form, above one is to run a smart form.
*& Form print_form
* Subroutine to print the form
FORM print_form .
DATA : l_fmname TYPE funcname,
l_params TYPE sfpoutputparams,
l_docparams TYPE sfpdocparams,
l_formoutput TYPE fpformoutput.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'Z_CERT_CONTINU_FORM'
IMPORTING
e_funcname = l_fmname
* E_INTERFACE_TYPE =
* l_params-getpdf = 'X'.
l_params-nodialog = ''.
l_params-preview = 'X'.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = l_params
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
l_docparams-langu = 'E'.
CALL FUNCTION l_fmname
EXPORTING
/1bcdwb/docparams = l_docparams
g_regis = g_regis
g_date = g_date
g_frmname = g_frmname
g_comp = g_comp
IMPORTING
/1bcdwb/formoutput = l_formoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
* E_RESULT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " print_form
Thanks,
Sreekanth
<i>*-- Please close the post and do not forget to reward if it helps you</i> -
Driver program Configurations for CO03/CO02
Hi All,
Requirement:
We are configure script and driver program in OPK8 With list type LP01.
Issue:
This driver program is not triggered CO03/CO02 transaction level For this we need configure any other transaction.
Can you suggest me how to resolve this issue.
Thanks in Advance,
Rajeshbabuv.Hi,
Check whether you have maintained an entry of the smartform in NACE, and removed any sapscript assigned under FORM in NACE.
Place a break point in Program RSNAST00 at line number 799, and check the values of TNAPR workarea, see what the Driver program and smartform name
TNAPR-PGNAM = ?
TNAPR-SFORM = ?
Regards
Bala Krishna
Edited by: Bala Krishna on Aug 6, 2010 3:12 PM -
Dear all
I want to make a driver program in sapscripts for Delivery note...since i am new to this topic then also i am done with the layout . please help me the program. i want the example code which is easy to read and understand.
thanks in advance...
MohitHi Mohit,
Go through the following code.
START-OF-SELECTION.
PERFORM GET_DATA CHANGING WA_MARC
I_MARC.
PERFORM GET_DATA1 CHANGING I_MARC
I_VBAP.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZPAVSCRIPT1'
LANGUAGE = SY-LANGU .
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT I_VBAP INTO WA_VBAP.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'MAIN'
FUNCTION = 'APPEND'
TYPE = 'BODY'
WINDOW = 'MAIN.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM' .
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
In the script layout,create a MAIN window,in that create a Text element (i named it MAIN in my program).
call these functions using button "Pattern" in toolbar.
In the above forms Get_data & get_data1,write the required code.....
This is the example code to b written in driver program...
Dont forget to reward points if helpful....
Pavan. -
dear experts,
this is my driver program for the sap script.
but when i execute this i am able to display the form. please tell me where i had gone wrong.
TABLES: BSEG,BKPF,SKAT.
DATA : BEGIN OF I_BKPF OCCURS 0,
BSTAT LIKE BKPF-BSTAT,
XREVERSAL LIKE BKPF-XREVERSAL,
BELNR LIKE BKPF-BELNR,
BLDAT LIKE BKPF-BLDAT,
BUDAT LIKE BKPF-BUDAT,
BKTXT LIKE BKPF-BKTXT,
BVORG LIKE BKPF-BVORG,
BLART LIKE BKPF-BLART,
TCODE LIKE BKPF-TCODE,
USNAM LIKE BKPF-USNAM,
PPNAM LIKE BKPF-PPNAM,
END OF I_BKPF.
DATA :BEGIN OF I_BSEG OCCURS 0,
DOCLN LIKE BSEG-DOCLN,
BUKRS LIKE BSEG-BUKRS,
HKONT LIKE BSEG-HKONT,
PRCTR LIKE BSEG-PRCTR,
PROJK LIKE BSEG-PROJK,
KOSTL LIKE BSEG-KOSTL,
WRBTR LIKE BSEG-WRBTR,
DMBTR LIKE BSEG-DMBTR,
BSCHL LIKE BSEG-BSCHL,
MWSKZ LIKE BSEG-MWSKZ,
VBUND LIKE BSEG-VBUND,
PSWSL LIKE BSEG-PSWSL,
END OF I_BSEG.
DATA : BEGIN OF I_FINTAB OCCURS 0,
DOCLN LIKE BSEG-DOCLN,
BUKRS LIKE BSEG-BUKRS,
HKONT LIKE BSEG-HKONT,
PRCTR LIKE BSEG-PRCTR,
PROJK LIKE BSEG-PROJK,
KOSTL LIKE BSEG-KOSTL,
WRBTR LIKE BSEG-WRBTR,
DMBTR LIKE BSEG-DMBTR,
BSCHL LIKE BSEG-BSCHL,
MWSKZ LIKE BSEG-MWSKZ,
VBUND LIKE BSEG-VBUND,
PSWSL LIKE BSEG-PSWSL,
SGTXT LIKE BSEG-SGTXT,
BSTAT LIKE BKPF-BSTAT,
XREVERSAL LIKE BKPF-XREVERSAL,
BELNR LIKE BKPF-BELNR,
BLDAT LIKE BKPF-BLDAT,
BUDAT LIKE BKPF-BUDAT,
BKTXT LIKE BKPF-BKTXT,
BVORG LIKE BKPF-BVORG,
BLART LIKE BKPF-BLART,
TCODE LIKE BKPF-TCODE,
USNAM LIKE BKPF-USNAM,
PPNAM LIKE BKPF-PPNAM,
END OF I_FINTAB.
DATA : V_TOP TYPE C,
V_TEMP TYPE C VALUE 'X'.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_BUKRS LIKE BKPF-BUKRS.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
*PERFORM GET_DATA.
PERFORM OPEN_FORM.
PERFORM WRITE_FORM.
PERFORM CLOSE_FORM.
*& FORM GET_DATA
*FORM GET_DATA.
FORM SUB_FORM1 TABLES INTAB STRUCTURE ITCSY OUTTAB STRUCTURE ITCSY.
*SELECT BUKRS
BELNR
GJAHR
FROM BKPF INTO TABLE I_BKPF WHERE BSTAT =
*SELECT SINGLE BELNR FROM BKPF INTO G_BELNR
WHERE BLART = G_BLART
AND BLDAT = G_BLDAT
AND TCODE = G_TCODE
AND BUDAT = G_BUDAT
AND USNAM = G_USNAM
AND BKTXT = G_BKTXT
AND PPNAM = G_PPNAM
AND BVORG = G_BVORG.
DATA: G_BELNR LIKE BKPF-BELNR,
G_BLDAT LIKE BKPF-BLDAT,
G_BUDAT LIKE BKPF-BUDAT,
G_BLART LIKE BKPF-BLART,
G_BVORG LIKE BKPF-BVORG,
G_BKTXT LIKE BKPF-BKTXT,
G_TCODE LIKE BKPF-TCODE,
G_USNAM LIKE BKPF-USNAM,
G_PPNAM LIKE BKPF-PPNAM.
SELECT BELNR
BLDAT
BUDAT
BKTXT
BVORG
BLART
TCODE
USNAM
PPNAM INTO I_BKPF FROM BKPF WHERE BELNR = G_BELNR.
ENDSELECT.
ENDFORM.
FORM SUB_FORM2 TABLES INTAB STRUCTURE ITCSY OUTTAB STRUCTURE ITCSY.
DATA: G_BELNR LIKE BSEG-BELNR,
G_DOCLN LIKE BSEG-DOCLN,
G_BUKRS LIKE BSEG-BUKRS,
G_HKONT LIKE BSEG-HKONT,
G_PRCTR LIKE BSEG-PRCTR,
G_PROJK LIKE BSEG-PROJK,
G_KOSTL LIKE BSEG-KOSTL,
G_WRBTR LIKE BSEG-WRBTR,
G_DMBTR LIKE BSEG-DMBTR,
G_BSCHL LIKE BSEG-BSCHL,
G_MWSKZ LIKE BSEG-MWSKZ,
G_VBUND LIKE BSEG-VBUND,
G_PSWSL LIKE BSEG-PSWSL.
SELECT DOCLN
BUKRS
HKONT
PRCTR
PROJK
KOSTL
WRBTR
DMBTR
BSCHL
MWSKZ
VBUND
PSWSL INTO I_BSEG FROM BSEG WHERE BELNR = G_BELNR.
ENDSELECT.
ENDFORM.
*ENDFORM. "GET DATA
*& FORM OPEN_FORM
FORM OPEN_FORM.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZZ_FIGL_JOURNAL'
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "OPEN_FORM
*& WRITE_FORM
FORM WRITE_FORM.
LOOP AT I_FINTAB.
V_TOP = 'Y'.
AT NEW BELNR.
V_TOP = 'X'.
ENDAT.
READ TABLE I_FINTAB WITH KEY BELNR = I_FINTAB-BELNR.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
ENDFORM. "WRITE_FORM
*& FORM CLOSE_FORM
FORM CLOSE_FORM.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
*END-OF-SELECTION.
regards,
hridhayanjili.hi sushil this is the code i have written in line edotor.
could u plz check why my program is not displaying the form.
perform sub_form2 in program zsap_driver
using &bkpf-belnr&
changing &g_docln&
changing &g_bukrs&
changing &g_hkont&
changing &g_prctr&
changing &g_progk&
changing &g_kostl&
changing &g_wrbtr&
changing &g_dmbtr&
changing &g_bschl&
changing &g_mwskz&
changing &g_vbund&
changing &g_pswsl&
end perform.
regards,
hridhayanjili. -
Driver Program ------ Very Urgent
How to find the Driver program for the smart forms ?
Hi Manjunath,
Hope it will give clear idea abt trigger of smartform thru driver program.
Try this in IDES , you will get how the smartform will trigger for specific application thru message control.
but if you want to pass application table data like VBRK, VBRP,.... you need to identify the exact location
in PERFORM processing USING us_screen subroutine.
Program name is RVADIN01
Routine Name is ENTRY
SmartForm Name ZSF_RVADIN01 (Your Custom Form)
step1 : copy your RVADIN01 to ZRVADIN01
step2 : goto subroutine
FORM entry USING return_code us_screen.
*CLEAR retcode.
*xscreen = us_screen.
*PERFORM processing USING us_screen.
*CASE retcode.
WHEN 0.
return_code = 0.
WHEN 3.
return_code = 3.
WHEN OTHERS.
return_code = 1.
*ENDCASE.
---> Here call your SSF_FUNTION_MODULE_NAME.
ENDFORM.
step3 : In NACE, Replace the Program name as ZRAVADIN01.
and smartform name is ZF_RVADINO1.
step4 : Run invoice transaction and check the output.
Regards,
Vishvesh
if helpful, rewards it.
Maybe you are looking for
-
Day must be between 1 and last day of month
Hi I have a master detail form for overtime entries. Master Block contain emp_no,name,month etc. Detail block contain a date field ,,from time, to time etc when i enter the date in detail block it defaults the month from Server date and i am getting
-
GR/IR clearing (Urgent)
Hi Guru's PO 659879854 / GR 2365987456 will not clear from the GR/IR for 8695.23. The GR is not appear to have been posted to the GL 369587, or is not showing the clearing document. value points assigned thanks sunitha
-
OLAP Analytic Workspace Manager/Worksheet in Oracle 11g...
Hi, In Oracle Client 10g .v2 the product OLAP Analytic Workspace Manager/Worksheet is included and installed. However , it is not in Oracle 11g - the Oracle client of this version is included - http://www.oracle.com/technology/software/index.html Dow
-
Fail to install printer dirver for HP LJ M125ra on XP
Tried to install printer driver from CD and form official HP site. I got error. So, what may be wrong with my system. Scanner was installed succesfully. How can I recover the situation?
-
I have a wedding project in Final cut express that was just about finish. It was left to render. When I came back the G5 had a system failure so I restarted. When it was back on I got into another project I was working on. Just a few minutes ago I tr