Add optional import parameter to an EXISTING Z function module.
Hi Guys,
I want to add an OPTIONAL IMPORT parameter. What are the things I need to take care to change and activate the FM, so that the changes does not effect the other programs calling this Z function module.
Thanks,
Adding one more point,
While raising exceptions to your ootional parameter make sure that
For example XINT is optioanl paramter then
if NOT xint is initial.
" then raise your exception
endif.
a®
Similar Messages
-
Optional import parameter in abap webservice
I am using ECC 6.40. I have generated a webservice for a function module. In this function module i have an import parameter refering to a structure defined in data dictionary (SE11).
The import parameter is optional. I see this in the virtual interface of the webservice. But i would also like to make each field of the structure optional. Goal is that the WSDL will have nillable fields or minoccurs = 0.
What i would like to have is like the wsdl from the bapi BAPI_CUSTOMER_CREATEFROMDATA1
<xsd:element name="PI_COMPANYDATA" minOccurs="0" type="s0:BAPIKNA106" />
- <xsd:complexType name="BAPIKNA106">
- <xsd:sequence>
- <xsd:element name="TITLE" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="30" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="TITLE_KEY" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="4" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
In my case i get for the my defined structure ZcvClientfilterRec:
<xsd:element name="FilterLow" minOccurs="0" type="tns:ZcvClientfilterRec" />
- <xsd:complexType name="ZcvClientfilterRec">
- <xsd:sequence>
<xsd:element name="Clientno" type="n0:char10" />
<xsd:element name="Clientgroup" type="n0:char2" />
<xsd:element name="Clientstatus" type="n0:char3" />
Can anyone help me with this or tell my how i can generate the wsdl so it looks like the standard bapiHi everyone,
Just faced the same problem, and while it's almost 2013, SAP doesn't have a solution for this problem, as stated in note 1341947.
Cheers, Fred -
Help , if there exists a Function Module
Hello everybody,
I want a help whether SAP has some Function Module which can take an "Internal Table" as an Import Parameter and give us "CSV File" as an export parameter , more-or-less like the "GUI_DOWNLOAD" Function Module , which downloads the file as ".DAT" or ".ASC" .
Please remember that i would need a CSV file , which i can read later through Opening a Dataset and transferring the contents into a file.
Your immediate answers is most needed.
Thanks,
Suddha Laikhi suddha,
try with GUI_DOWNLOAD with filetype as 'ASC' and
give the filename as 'C:\TEST.CSV'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\TEST.CSV'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = itab
FIELDNAMES =
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.
do reward if it helps,
regards,
priya.
Message was edited by: Priya -
Doubt in export, import and table para when creating Function Module
Dear fellow ABAPers,
I have a doubt in defining export, import and table parameter while creating a function module.
I am calling a function module inside a user exit. Now in the user exit the SAP fills an internal table called i_lfa1 with all the data user has eneterd.
Now I want to pass this whole internal table to function module and the perform some checks on the values of internal table.
After that function module fills an error structure with values depending on some check.
1)
How do I pass this internal table to function module ?
When I am creating function module in se37 where do I define this iternal table type ? Is it in Import or Table parameter during function module creation?
2)
Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
Please clear my doubt..
Relevant points will be awarded.
Regards,
Tushar.Hi Tushar,
1. How do I pass this internal table to function module ?
I assume u are creating your own Y/Z FM.
Pass it thru TABLES parameter.
2. When I am creating function module in se37 where do I define this iternal table type
Define this in TABLES interface.
What Type ?
THE SAME TYPE WHICH HAS BEEN DEFINED
WHILE PASSING IN THE USER-EXIT FUNCTION MODULE.
IF U SEE THE FM OF THE USER-EXIT,
U WILL COME TO KNOW.
3.
Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
Define it in TABLES interace. (not in export, import)
(Since what u are going to return is an internal table)
U can take for eg. BDCMSGCOLL.
OR u can create your own Y/Z structure
for the same purpose.
(or u can use the structure type T100)
I hope it helps.
Regards,
Amit M. -
How to create a working Gateway service utilizing an Existing ECC Function Module?
Hello All,
Our ECC (Back end) has a Function module which is to be used by creating a Gateway service .Can you suggest the step by step procedure with which i can continue to expose the service?
Any help on this is much appreciated!
Thanks,
UshaHi Usha,
the flag 'Local app' indicates where the implementation of the service is done because it can be done on the Hub or on the backend. (see my blog about deployment options SAP Gateway deployment options in a nutshell).
If you choose 'Local App' the BEP API will be called on your hub while otherwise it will be called on the backend system to which the RFC destination points to which has been maintained in your system alias definition.
Best Regards,
Andre
This is explanation offered by SAP Help:
Indicates that the System Alias is to be used by BEP
SAP NetWeaver Gateway applications can be developed either on a SAP Business
Suite backend system or on a SAP NetWeaver Gateway hub system. To access the
business logic from an SAP Business Suite backend system the software component
IW_BEP (Backend Enablement and Event Provisioning) has to be deployed in your
system landscape. IW_BEP can be deployed on the backend system or locally on the
SAP NetWeaver Gateway hub system. Communication is handled via system aliases
(RFC destinations).
Use
Set this flag if you use this system alias for an OData Channel application
that has been developed on the BEP add-on which is deployed on the SAP NetWeaver
Gateway hub system.
In this case the system alias information (such as RFC destiation, Web
service group, software version) is not used by SAP NetWeaver Gateway to
call the BEP API (it is called locally). Instead the system alias information is
passed through to the OData Channel application, so that it could then itself
make a call to the corresponding backend system. -
Syntax Error with Table Parameter (type: ANY) when Creating Function Module
Hello experts,
I want to create a function module with a table parameter and table type is ANY. But when I check (Ctrl+F7) this function module, syntax error occurs - "In this statement, the internal table "MSG_TABLE_ITEM" must have the type "STANDARD TABLE"."
Could anyone tell me what the wrong is? And how can I fix it?
Thanks,
ShelwinHi,
For table parameters, you can only pass
MSG_TABLE_ITM TYPE STANDARD TABLE
or
MSG_TABLE_ITM ( don't fill other columns TYPING ASSOCIATED TYPE ).
For reference check FM 'GUI_UPLOAD' - Table parameters
Regards,
DPM -
How to make input parameter with multiple values in function module?
Dear Experts,
I want to add BUKRS as import field to a FM, what is the best way of of making it accept multiple enteries.
Regards,
KiranhI kiran,
The simple way is to create a data element & domain with value range where u provide set of fixed values or provide a check table to it.
Use that data element in a table <ztable>.
Code:
Parameters:
p_burks like <ztable>-dataelement.
Call Function <function_name>
exporting
p_burks = p_burks, -
Export, Import and Table declaration in custom function module
I am creating a custom function module. Parameters needed are export internal table and one data field from the internal table.
What do i need to fill for 'associated type' for these export parameters since size of the internal table and type for the data field from the internal table vary.Hello Albert
If the function module need not be RFC-enabled then you have many ways to define such dynamic parameters, e.g.:
FUNCTION ZUS_SDN_DYNAMIC_PARAMS.
*"*"Local Interface:
*" EXPORTING
*" REFERENCE(ET_ITAB) TYPE TABLE
*" REFERENCE(ET_ITAB_1) TYPE ANY
*" REFERENCE(ET_ITAB_2)
*" REFERENCE(ED_DATA) TYPE CLIKE
*" REFERENCE(ED_DATA_1) TYPE ANY
*" REFERENCE(ED_DATA_2)
ENDFUNCTION.
See also: How to return back a structure of dynamic tables in a Function Module
Regards
Uwe -
How to use select-options in the function module of import parameter ?
Hi ...
I have created a BAPI and tested in SWO1 tcode , by giving the single value for an company code ( BUKRS ) , it executed properly .
Same thing is working after implementing in a program .
so now it is working for fetching a single company code details .
My requirement is : I want to use select-options in program as well as in function module IN IMPORT PARAMETER.
Program :
REPORT ZTEST.
TABLES : T001 , ZBAPI_STR .
TYPES : BEGIN OF TY_ITEM .
INCLUDE STRUCTURE ZBAPI_STR .
TYPES : END OF TY_ITEM .
DATA :WA_ITEM TYPE TY_ITEM ,
ITEM LIKE STANDARD TABLE OF WA_ITEM INITIAL SIZE 0 .
PARAMETER : BUKRS TYPE ZBAPI_STR-BUKRS.
call function 'ZBAPI_FMT001'
exporting
bukrs = BUKRS
IMPORTING
RETURN =
tables
itemtab = ITEM
IF ITEM IS NOT INITIAL .
LOOP AT ITEM INTO WA_ITEM .
WRITE : / WA_ITEM-BUKRS , WA_ITEM-BUTXT , WA_ITEM-ORT01 , WA_ITEM-LAND1 .
ENDLOOP.
ENDIF.
FUNCTION MODULE :
FUNCTION ZBAPI_FMT001.
""Local Interface:
*" IMPORTING
*" VALUE(BUKRS) TYPE EFG_TAB_RANGES
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRET2
*" TABLES
*" ITEMTAB STRUCTURE ZBAPI_STR
SELECT BUKRS BUTXT ORT01 LAND1 FROM T001 INTO TABLE ITEMTAB WHERE BUKRS = BUKRS .
ENDFUNCTION.
Regards
Deepa.I have given a similiar example which i did
Declare a
Table type:Z_TT_PONUM
Short text : Select options PO Number
in SE11 tcode with row type eg: Z_ST_PONUM
create a structure (this will be the row type)
Structure Z_ST_PONUM
Short text Select Options Field PO number
Compenent Compent type
SIGN BAPISIGN Inclusion/exclusion criterion SIGN for range tables
OPTION BAPIOPTION Selection operator OPTION for range tables
LOW EBELN Purchasing Document Number
HIGH EBELN Purchasing Document Number
In the function module import
give as
I_PO_NUM TYPE Z_TT_PONUM opt pass value Select options PO Number
Hope this is exactly what you want to know.
So you create a structure simliar to mine but the low an high whould be your component
then a table type and then include that in the BAPI.
Then pass your select-option value to this BAPI when you call this BAPI in the program -
Function Module: how to setting table import parameter
hi, i'm developing a function module. i create a TABLES where it will allow multiple variables IMPORT from user input to this function module. the tables i set as OPTIONAL and decribed as below.
PSPID PS_PSPID CHAR 24
POSID PS_POSID CHAR 24
AUFNR AUFNR CHAR 12
PSY J_STATUS CHAR 5
PUS J_STATUS CHAR 5
in my source code, i done a select statement to process the IMPORT input . the problems i face,for the PSY and PUS input, if the one or both input is BLANK, NO RESULT will display. What i'm try to do , if input one or both is BLANK, it wil neglect the input and return as ALL RESULT (return result oir all status for input pspis / posid / aufnr) . attached the select statement. thank you
itparm[] = objparm[].
select
a~pspnr a~stspr a~objnr a~pspid
b~psphi b~objnr as wobjnr b~posid
c~aufnr c~objnr as nobjnr c~pspel
d~objnr as jeobjnr d~inact d~stat
e~objnr as jcobjnr e~udate e~usnam e~utime e~stat as jcstat e~inact as jcinact
f~istat as syistat
f~txt04 as sytxt04
f~spras
g~estat as usestat
g~txt04 as ustxt04
into corresponding fields of table itobj
from proj as a
inner join prps as b on a~pspnr = b~psphi
inner join aufk as c on b~pspnr = c~pspel
inner join jest as d on c~objnr = d~objnr
inner join jcds as e on d~objnr = e~objnr
and d~stat = e~stat
inner join tj02t as f on e~stat = f~istat
inner join tj30t as g on a~stspr = g~stsma
for all entries in itparm
where ( a~pspid = itparm-pspid
or b~posid = itparm-posid
or c~aufnr = itparm-aufnr )
and ( f~istat = itparm-PSY and g~estat = itparm-PUS ).Thanks for your quick reply. actually the data will be somehing like this. since i developed a function module, i keep the import parameter in a table.
PSPID PS_PSPID CHAR 24
POSID PS_POSID CHAR 24
AUFNR AUFNR CHAR 12
PSY J_STATUS CHAR 5
PUS J_STATUS CHAR 5
the example data will be in OTPARM internal table
PSPID POSID AUFNR PSY PUS
aa-aa-aa a1 I001
bb-bb-bb b1 E009
cc-cc-cc
i'll store this into an internal table. from the data. it can be seen there a BLANK input. so the blank input should not be included into WHERE connditions. that why in the previous solution, i use SELECT inside LOOP because every line of the IMPORT tables will be generated with different WHERE conditions. i tried to do something like this:
PSPID POSID AUFNR PSY PUS cond_syx
aa-aa-aa a1 I001 if proj~pspid = itparm-pspid and prps~posid = itparm~posid and ....
bb-bb-bb b1 E009 if proj~pspid = itparm-pspid and aufk~aufnr = itparm~paufnr and ....
cc-cc-cc if proj~pspid = itparm-pspid
and implement with FOR ALL ENTERIES, but at the WHERE conditions i failed to put the CONF_SYX. please comment and give opinions. Thanks you very much. -
Select options in function module
hi friends, pls help me reg my query.
I have wERKS select-options
on the selection screen.
(This same thing, i want to pass in FM)
2. So in FM, I have used the
TABLES parameter (Not import, nor export)
3. And the type given is
WERKS_RANG
i defined it like
plant type WERKS_RANG
(This WERKS_RANG has 4 fields,
just like a select option
SIGN
OPTION
LOW
HIGH
4. Then inside fm,
i used SELECT Query,
and use IN WERKS.
below is my code in FM.
select lgort labst
from mard
into table imard1
where PLANT in werks
and material1 = matnr.
but i am getting an error "field plant is unknown". i have defined it under tables parameter..pls help
how shud i get the values i enter in select option for main program in se38 to function module field 'plant'...Hi
You can define your TABLE parameter WERK without reference and define a range in your fm:
FUNCTION Z_PROVA_PROVA.
""Interfaccia locale:
*" IMPORTING
*" REFERENCE(MATNR) TYPE MATNR
*" TABLES
*" SEL_WERKS
RANGES R_WERKS FOR MARD-WERKS.
R_WERKS[] = SEL_WERKS[].
DATA: BEGIN OF IMARD1 OCCURS 0,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
END OF IMARD1.
SELECT LGORT LABST FROM MARD INTO TABLE IMARD1
WHERE WERKS IN R_WERKS
AND MATNR = MATNR.
Max -
Passing parameter in function module
hi friends,
I have created one function module in which i need to pass PO/SO number from standard EKKO/VBAK tables through the select option parameter S_POSONO. Inside the function module I have a select query which fetches the records from a Z-table which has a field called 'REFERENCE' which is 16-char long. Hence the length mismatches with PO/SO no which is 10-char long. the first 10-char from 'REFERENCE' is PO/SO number, next 3-char is line-item num, and the last three char is schedule item num. It is required to match only first 10-char with the parameter passed i.e, S_POSONO and display only those datas.
The function module is as follows.....
Function :
CALL FUNCTION 'YFIIN_RETRIEVE_SOURCE_DATA'
EXPORTING
LT_RANGE_BUKRS = S_BUKRS[]
LT_RANGE_DOCNO = S_POSONO[]
LT_RANGE_DOCDATE = S_DATUM[]
LT_RANGE_CURRENCY = S_FCURR[]
TABLES
IT_TEMEXPOSU = LT_TEMEXPOSU
EXCEPTIONS
INVALID_SELECTION = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Source code inside function module:
SELECT * FROM ZFIGL_TEMEXPOSU INTO TABLE IT_TEMEXPOSU
WHERE COMPANY_CODE IN LT_RANGE_BUKRS
AND currency in LT_RANGE_CURRENCY
and REFERENCE in LT_RANGE_DOCNO
and doc_date in LT_RANGE_docdate.
IF SY-SUBRC = 0.
SELECT COMPANY_CODE ATTRIBUTE_01 REFERENCE CREATION_DATE FOREIGN_CURR
FROM TEMT_RAWEXPOS APPENDING CORRESPONDING FIELDS OF
TABLE IT_TEMEXPOSU WHERE COMPANY_CODE IN LT_RANGE_BUKRS
AND REFERENCE in LT_RANGE_DOCNO
AND CREATION_DATE IN LT_RANGE_DOCDATE
AND FOREIGN_CURR IN LT_RANGE_CURRENCY.
ENDIF.
Import Parameter of Function Modules :
LT_RANGE_BUKRS - type - BUKRS
LT_RANGE_DOCNO - type - EBELN
LT_RANGE_DOCDATE - type - DOKDATS
LT_RANGE_CURRENCY - type - WAERS
please help me to solve this problem..Hi Ram Tej,
Try this.
First Read all the records without Checking REFERENCE field with LT_RANGE_DOCNO into an internal Tbale.
Then looping at that internal table delete records from the same internal table where REFERENCE(10) <> LT_RANGE_DOCNO.
Hope this may help ur requirement.
Award points if useful. -
Select options passed to function module
Hey
I would like to know how r the select-options of a program passed to the function module that is called internally in that program? I want to use this select-options in the function module to fetch frm the database tables?
ShakrHi,
Use ranges in function modules. You can declare in import/export/ changing or tables parameters
Example of ranges:
ERDAT_RAN
ERDAT_RAN
SHP_R_ERZET
RVBELN
ERNAM_RAN
Please see them in se11.
Pass the select options in the report to these ranges or use below coding:
DATA: wa_cmfre LIKE erdat_ran,
wa_erdat LIKE erdat_ran,
wa_erzet LIKE shp_r_erzet,
wa_vbeln LIKE rvbeln,
wa_ernam LIKE ernam_ran.
SELECT-OPTIONS: s_erdat FOR vbak-erdat, s_erzet FOR vbak-erzet NO-EXTENSION,
s_cmfre FOR vbak-cmfre OBLIGATORY ,
s_vbeln FOR vbak-vbeln NO-EXTENSION,
s_auart FOR vbak-auart OBLIGATORY, s_bsark FOR vbak-bsark.
wa_cmfre-sign = s_cmfre-sign.
wa_cmfre-option = s_cmfre-option.
wa_cmfre-low = s_cmfre-low.
wa_cmfre-high = s_cmfre-high.
IF NOT s_erdat[] IS INITIAL.
wa_erdat-sign = s_erdat-sign.
wa_erdat-option = s_erdat-option.
wa_erdat-low = s_erdat-low.
wa_erdat-high = s_erdat-high.
ENDIF.
IF NOT s_erzet[] IS INITIAL.
wa_erzet-sign = s_erzet-sign.
wa_erzet-option = s_erzet-option.
wa_erzet-low = s_erzet-low.
wa_erzet-high = s_erzet-high.
ENDIF.
IF NOT s_vbeln[] IS INITIAL.
wa_vbeln-sign = s_vbeln-sign.
wa_vbeln-option = s_vbeln-option.
wa_vbeln-low = s_vbeln-low.
wa_vbeln-high = s_vbeln-high.
ENDIF.
IF NOT s_ernam[] IS INITIAL.
wa_ernam-sign = s_ernam-sign.
wa_ernam-option = s_ernam-option.
wa_ernam-low = s_ernam-low.
wa_ernam-high = s_ernam-high.
ENDIF.
you can pass these work areas to function module.
Thanks,
Shravan G. -
Types Does not Exist Error in Function Module creation
Hi Guys
I am trying to replicate the functionality of the below program using a function module. However when I enter the following in the changing tab of the fn mod, I get error TYPE IT_VBRP does not exist.
Parameter name p_it_vbrp like it_vbrp
<removed by moderator>
Moderator message: please post only relevant code parts, your posts must contain less than 5000 characters to preserve readable formatting.
Edited by: Thomas Zloch on Sep 11, 2011 3:55 PMHi
The reference type of a parameter of the interace of function module has to be defined in dictionary, if you need to use a particular type, you need to create an your own custom type pool or try to looking for a type defined like yours,
For example if you need a table based on vbrp, you can use the table type TAB_VBRP
Max -
Adding a new field in existing Genric Func Module extractor
Hi,
I have created a generic data source of type 'Transaction' with Function module and it was working fine and loading data into ODS succesffuly . Recently I needed to add one field.
I have enhanced the function module and the extract structure accordingly. However I am not sure what next to do to have that new field visible in the data source.
I went to transaction SBIW --> Maintain Generic data source in change mode. However I am not able to see the newly added field in there.
Need help.
ThanksHi,
Just check the ROOSFIELD table in se11 for your datasource. Possibly the newly added field is hidden. You can execute this code and the field would appear in RSO2.
tables ROOSFIELD.
update ROOSFIELD set SELECTION = 'X' where
Datasource = ' <Data source>'
and field = '<your field>'.
This would make the field appear in RSO2/RSA6.
Bye
Dinesh
Maybe you are looking for
-
Modification in MB5B prg...material stock between a date range
Hi experts I have to modify mb5b tranx prg . presently we are using date as selection criteria..but now onwards user wants G/L account along with date as selection criteria. I created one selec-option for field HKONT type hkont-bseg. Now in select qu
-
Legacy C program - new Java GUI and calling methods
Hello, I am fairly new to these forums. I've been working for a company that has an exsisting program that is a propriotery video-client to a video-server. It is written in C and has DirectX components for the standalone C application and ActiveX com
-
I don't understand what to do. The required file was not found or has a permissions error. Correct this permissions problem and try again, or deauthorize this computer if the permissions cannot be changed.
-
Trouble connecting to MS Exchange server with IMAP
I've been trying to setup Apple mail to talk with the Exchange server at work. I've had no luck after many attempts. Mac Mini, Intel Core Duo OS X 10.4.5 Mail 2.0.6 I can connect to the mail server using Safari via Outlook Web Access fine, so my acco
-
Multi threading under single file channel
Hi, We have File-Proxy scenario . We are using fCC sender channel and using recordset sequence as varaibale recordsets per message was 250. When large size file like 2GB was processed, PI is taking 45-50 min to process the file and from proxy end i