Skip to Content
0
Jan 29, 2008 at 05:21 AM

not able to save text more than 132 chars, : URGENT

1262 Views

Hi All,

I want to add text to the mateiral through Purchase Order text view in MM01, for that I have used function module create text . In this program user will give material number and text in the file and it will get updated in material master.

But my problem is that I am not able to save text more than 132 characters.

Kindly give solution for this problem its urgent, Below is the code I have written.

REPORT zmm_po_text.

*Internal table to hold long text...

DATA:

BEGIN OF t_upload OCCURS 0,

matnr LIKE mara-matnr, " Material number

ltext LIKE tline-tdline, " Long text

END OF t_upload.

*Internal table to hold long text....

DATA : t_line LIKE tline OCCURS 0 WITH HEADER LINE.

DATA : fname TYPE string,

lv_matnr(70).

SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE tit1.

PARAMETER : file LIKE ibipparms-path OBLIGATORY.

SELECTION-SCREEN: END OF BLOCK blk1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

field_name = 'FILE'

IMPORTING

file_name = file.

START-OF-SELECTION.

  • This perform is used to upload the file

PERFORM upload_file.

  • This perform is used to place the text in MM02 transaction

PERFORM place_longtext.

&----


*& Form upload_file

&----


  • This routine is used to upload file

----


  • No interface parameters are passed

----


FORM upload_file .

fname = file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = fname

filetype = 'ASC'

has_field_separator = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = t_upload

EXCEPTIONS

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

OTHERS = 17 .

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

SORT t_upload BY matnr.

ENDFORM. " upload_file

&----


*& Form place_longtext

&----


  • This routine places the text in MM02 transaction

----


  • No interface parameters are passed

----


FORM place_longtext .

LOOP AT t_upload.

t_line-tdformat = 'ST'.

t_line-tdline = t_upload-ltext.

APPEND t_line.

lv_matnr = t_upload-matnr.

CALL FUNCTION 'AIPC_CONVERT_TO_UPPERCASE'

EXPORTING

i_input = lv_matnr

i_langu = sy-langu

IMPORTING

e_output = lv_matnr.

CALL FUNCTION 'CREATE_TEXT'

EXPORTING

fid = 'BEST'

flanguage = sy-langu

fname = lv_matnr

fobject = 'MATERIAL'

  • SAVE_DIRECT = 'X'

  • FFORMAT = '*'

TABLES

flines = t_line

EXCEPTIONS

no_init = 1

no_save = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDLOOP.

MESSAGE 'Record Updated sucessfully' TYPE 'I'.

ENDFORM. " place_longtext

Thanks & Regards,

Bharat.

  • Helpful answers will be awarded.