‎2011 Jan 05 5:58 AM
Hello experts,
I have created a BAPI and use FM as a part of it. However, when I use the structure for the export parameter as a string field and get error message "String not allowed in structure".
Then I tried to use data type BAPITLINE and it's work fine, but it can only use for CHAR132 (my data is about 270 - 300 characters long)
Any solution for creating BAPI and use string as an import parameter ???
‎2011 Jan 05 6:29 AM
Hi,
use SRMHLSTRNG type, it is string type and your function will be ok.
FUNCTION ZHHTEST01.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(ILINE) TYPE SRMHLSTRNG
*" EXPORTING
*" REFERENCE(ELINE) TYPE SRMHLSTRNG
*"----------------------------------------------------------------------
ENDFUNCTION.thank you
Jan
‎2011 Jan 05 6:37 AM
Hi,
Try type CHAR339.
ParameterName Type Associated Type Short Text
MY_String TYPE CHAR339 Character 339Regards,
Jovito.
‎2011 Jan 05 7:26 AM
Thank you for your reply,
I have tried to use data type SRMHLSTRNG but it's having an error "Data type SRMHLSTRNG cannot be used for methods" in SWO1
and then I tried to change data type to char339 but it's having an error "Data type CHAR339 cannot be used for methods".
Any solution for this, please help !!
‎2011 Jan 05 8:54 AM
Hi Verdam,
Try creating your own data element in SE11 and using it.
I was able to use CHAR339 as both input and output parameters of an RFC enabled FM. So not sure why you are receiving that error.
Regards,
Jovito
‎2011 Jan 05 9:28 AM
There are less restrictions on RFC enabled FM than on BAPI.
Check [Actions in the ABAP Dictionary |http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/43/b46c3953c111d395fa00a0c94260a5/frameset.htm] in [BAPI Programming Guide (CA-BFA)|http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm]
Conventions for BAPI Data Structures
Each parameter must refer to a data structure in the ABAP Dictionary. In the case of structured parameters this is always to the whole BAPI data structure. But if the parameter consists of only one field, it must refer to a field in a BAPI structure.
Conventions for BAPI/ALE Integration
So that an IDoc for asynchronous communication can be generated from a BAPI, the following conditions must be satisfied:
BAPI structure names must not be longer than 27 characters, otherwise the automatically generated name for the associated segment will be too long and will have to be changed manually later.
Reason : The segment is generated following the convention <BAPI structure name> + <three digit number>.
This graphic is explained in the accompanying text
Single fields in a data structure can only be a maximum of 250 bytes.
So the length of any single parameter (not structure) of the BAPI can not exceed 250.
Regards,
Raymond
‎2011 Jan 05 8:18 AM