Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Create long text for notification

Former Member
0 Kudos

Hi All, I have a requirement wherein, PI is passing data to SAP R/3 using a custom RFC developed using ABAP. There is a field in the RFC which is to input the long text. But the long text can be of any large length. Can I know what should the length of this RFC long text field be in order to recieve the long text from the PI as input?

29 REPLIES 29

Private_Member_49934
Contributor
0 Kudos

Does the long text get saved into the database? if yest then you should be able to convert the data in table to use the FM SAVE_TEXT. If it just any field in the database which will get updated then it depends upon the requirement.

I think it should be the target field which is getting updated by RFC which will determine the length.

0 Kudos

Actually I am not fetching any long text from the database to pass it to the RFC. PI is passing a long text to the ABAP RFC. This RFC is custom development. I do not understand how much length I must give to this RFC long text input field so as to accomodate all the contents of the long text that is passed from PI. After I fetch the text from PI, I am passing this text to BAPI_ALM_NOTIF_CREATE to create a notification.

0 Kudos

If you are going to update this text in SAP then make Table paramter in your FM type TLINE

And ask PI to send text in this table so that you can also have multiple line text. One line will have 132 Char.

0 Kudos

Yes I too thought of the same solution. My doubt is, PI is inturn fetching bulk data from a 3rd party database table and this contains the text too. This data is passed in bulk to my RFC. So will PI be able to pass just the long text data in table format? If yes, then how?

0 Kudos

hi,

create  variable as string or xstring.

then u can split the string and store in database as well.

Thnk and regards.

0 Kudos

Hi,

Yes, PI should be able to do the job of splitting the single line data to multiple lines/table format based on the length, PI can have a logic to check the length up to 135 characters and pass it as single line of the table and the new line for the next 135 chars. Standard BAPI uses the struture longtexts

FieldData ElementData TypelengthValue
OBJTYPESWO_OBJTYPCHAR000010Object type related to PM notification
OBJKEYQOBJKEYNUMC000008Notification number
FORMAT_COLTDFORMATCHAR000002
Default "*"
TEXT_LINETDLINECHAR000132Text

Cheers,
Prasanna

0 Kudos

In PI they can write a small User defined function to split the text and send it through internal table as an array by using result.addValue method of Java.

Private_Member_49934
Contributor
0 Kudos

Make it as string .

Then use the FM CONVERT_STREAM_TO_ITF_TEXT to convert it in text table.

Finaly use it to poulate

  LONGTEXTS in the BAPI.

0 Kudos

I just found out that the table from which PI is fetching the data contains the long text in a field of length VARCHAR2(1750 bytes). I thought I can use the same length in RFC also. Can you please tell me what is the length I should use in this case. How do I convert this length to characters?

0 Kudos

You can use STRING

0 Kudos

Hi Smitha,

If you see the keyword help you will find that string is predefined data type in data dictionary. It is capable of handling variable length of character starting 256 characters.

You can use you import parameter in the RFC FM as string and you should be able to get it in the FM properly. NO NEED TO SPECIFY ANY LENGHT.

Now in you RFC FM

You can code something like below

  

TYPES : ty_string_tab TYPE STANDARD TABLE OF char72
                        WITH KEY table_line.

DATA : l_v_len TYPE i,
       l_it_string_tab TYPE ty_string_tab,
       l_it_lng_txt TYPE tline_t,
       l_v_char72 TYPE char72.
l_v_len = STRLEN( l_v_text ).

IF l_v_len <> 0.
  DO .
    IF l_v_len <= 72.
      l_v_char72 = l_v_text(l_v_len).
      APPEND l_v_char72 TO l_it_string_tab.
      CLEAR l_v_char72.
      EXIT.
    ELSE.
      l_v_len = l_v_len - 72.
      l_v_char72 = l_v_text(72).
      APPEND l_v_char72 TO l_it_string_tab.
      SHIFT l_v_text BY 72 PLACES LEFT.
    ENDIF.
    CLEAR l_v_char72.
  ENDDO.
ENDIF.

CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'
  TABLES
    text_stream = l_it_string_tab
    itf_text    = l_it_lng_txt.

Finallly loop at l_it_lng_txt and append the table of you bapi. You will get the format and text line from this table. The first two columns you must be knowing already.

Note : the string in the database is varchar2 . It may contain tabs and new line. That is why the above FM is required to get the correct format.

Let me know if it is not clear still. Rewar POINTS if helpfu.

0 Kudos

I used the string format for the field but unfortunately, I am not able to input any data into this field. When i try executing the RFC, the import table which contains field to enter the text is shown in display mode. PFA the screen where it gives me a message that I can only see the table in display mode.

0 Kudos

can you post the function module interface parameter? I can comment after that only.

0 Kudos

The RFC has the following Import parameter:

IT_NOTIF which is of table type ZMPM_NOTIF_CREATE_TY. This table type is of line type ZMPM_NOTIF_CREATE having the custom structure containing the fields:

Notif_no,

NOTIF_TYPE

NOTIF_DESCRIBE

The field of concern is NOTIF_DESCRIBE which needs to accomodate the long text. If I create a data element of type string and associate this with NOTIF_DESCRIBE field, then while executing the RFC, i am not able to give any input in the IT_NOTIF table. Please help

0 Kudos

Hi,

Create the table type as ZMPM_NOTIF_CREATE_TY.pass this to import parameter,now you havin all the data from PI.

loop the table .

use RKD_WORD_WRAP.pass your line type NOTIF_DESRIBE to this FM.

you can move that into saparate variables,you can store in intarnal table.

endloop.

thank and regards

0 Kudos

Yes but data from PI is getting truncated even if i declare the type as string. It is accepting only a maximum of 255 characters.

0 Kudos

If you are doing everything correctly then it's the problem from PI end and not from abap end.

Please check the attachment with screenshot. I am not getting any problem. Also check the documentation attached. String doesn't has any limit.

But please note that in FM test environment you won't be able to add more than 255 character which is the LIMIT OF FUNCTION MODULE TEST ENVIRONMENT. But you can test it programatically. I am sure it won't get tructed.

Let me know if you find it useful.

0 Kudos

Please check the attached screen shots. I am still not able to enter any data.

0 Kudos

Could you please check the table type Z243_TY. Is it sorted?

0 Kudos

It is a standard table.

0 Kudos

Hi,

I have faced same senario where we are getting as string and field values saparated by comma(,).

that time we declare it as the string field as table type.

but your getting as the table type of some  line type(structure)  ,but your import parameter in FM is not matching.

show your flow logic code  and explain the problem properly ,i have got some confusion regarding your requirment.

thank and regards

0 Kudos

In SPROXY Structure which is auto generated what is the type of text declared ?.

Generally they decalre it type of string.which has limited capacity.

If text is longer you can ask PI to break it into multiple and send it to you, so that you can work on that accordingly.

Regards

Vikash Singh

0 Kudos

There is no problem with the flow logic. The only thing is that I have to create a notification with the long text that is passed from PI. I am using BAPI_ALM_NOTIF_CREATE to create the notification. But the long text that is passed from PI to my RFC is getting truncated if the data type is character (CHAR). Hence I declared it as string. But when i did this, I am not able to enter any data into the table field for long text. Please refer to the screens above.

0 Kudos

I have checked in my programs its working fine for normal Fm,but not for the RFC.

check finally function group active or inactive.

0 Kudos

Hi Smitha Joshi,

I am not able to understand why we are not trying to get PI team to truncate the data for every 135 chars and pass it as a text table to SAP, This is the way it has to be done, even if you get the complete data in a single line you have to re code it to truncate and pass it to notification BAPI. Please talk to PI team and get them to do this. We have the PI tool for the transformation purpose only. you can refer to the following link http://www.erpgreat.com/abap/bapi-alm-notif-create-maintenance-notification.htm to get the object types to be passed to the BAPI text table.


Regards, 

0 Kudos

I have talked to the PI team. But the data that they are passing is not reaching the table that i created. please check if the method that i followed towards the table creation is correct or not.

What I did as of now is, I have IT_NOTIF as the import parameter. This is of table type which inturn is of a line type contaning a structure. This structure has the long text field. Now I have associated this long text field with one more table type which is of a line type containing structure of field LONG_TEXT TYPE TDLINE (132 characters). Check if this is the right method

0 Kudos

Hi Smitha,

In your last post, you have mentioned that you have a different parameter which has 132 char length table parameter for passing the texts? Does this mean, PI team is passing the data to this table parameter instead of the old one? if yes, you should go ahead and modify your abap code and do a initial round of testing whether the data is getting posted or not.

I would suggest you the following ways.

1) Try with a 10 char length text data

2) Increase to 100

3) Two line

4) Check the PI outbound payload to ensure the data has been passed successfully..

Regards,

0 Kudos

PI has tried to pass. But they are yet to check the actual way to map. i checked in debug mode (by placing an external breakpoint), i found that the table for long text is not getting filled with whatever data they passed to the ABAP. The table for long text is found to be empty. That is the reason why i asked if the above method of creating a deep structure (i.e., table for long text within the table IT_NOTIF) is the right way or not.

0 Kudos

Hi Smitha,

The max. length of data while passed via RFC is limited to 256 characters i.e. 0-255 in some cases. I'm sorry for not having any reason or description of the cases.

But, to resolve your point, you need to use the Table parameter of the BAPI instead of the Import parameter. I'm a bit confused about the parameter IT_NOTIF as the BAPI_ALM_NOTIF_CREATE in my system didn't have any such import parameter.

Finally, you can map your table parameter in PI with line type TDLINE and write a function in PI that will automatically create a paragraph of text into multiple lines of 132 characters and pass to the BAPI Table parameters which can then be re-combined in SAP.

Hope this helps.

Regards,

Pranav.