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: 

Problem with CREATE_TEXT FM

Former Member
0 Kudos

Hi All,

I am facing an issue in CREATE_TEXT FM. When I am creating a text for the Object AUFK. This FM creates the text in the STXH/STXL table. Also, I am able to see the text in the tables and also through the READ_TEXT FM. But when I am seeing the text through standard transaction. It doesn’t reflect the text.

I also tried to set the flag in AUFK-LTEXT flag set, as per the field need to set for the long text exist.

I also tried with the FMs SAVE_TEXT and COMMIT_TEXT. But still its not working…

Can you please provide the pointers for the same to get the text properly seen…

Regards.

Brijesh Patel

6 REPLIES 6

Former Member
0 Kudos

can anybody provide some pointers in this?

0 Kudos

Hi,

check the below code

FORM create_text .

  • Declaration of local variables

DATA : lv_fname TYPE tdobname,

lv_text TYPE tdobname,

lv_ebeln TYPE ebeln,

lv_ebelp TYPE ebelp,

lv_lifnr TYPE lifnr.

  • Declaration of local internal tables

DATA : li_flines TYPE STANDARD TABLE OF tline .

  • Declaration of local workareas

DATA : lwa_text TYPE t_text,

lwa_flines TYPE tline.

  • Declaration of local constants

CONSTANTS : lc_ekko TYPE tdobject VALUE 'EKKO',

lc_ekpo TYPE tdobject VALUE 'EKPO',

lc_f TYPE tdformat VALUE '*'.

SORT i_text BY id.

*split the long text table into header and line items

LOOP AT i_text INTO lwa_text.

CASE lwa_text-rec_type.

  • header

WHEN c_h.

APPEND lwa_text TO i_text_h.

  • line items

WHEN c_l.

APPEND lwa_text TO i_text_i.

ENDCASE. "CASE lwa_text-rec_type.

CLEAR lwa_text.

ENDLOOP.

CLEAR : lwa_text.

  • sort header and line items table

SORT : i_text_h, i_text_i.

  • upload text for a header

LOOP AT i_text_h INTO lwa_text .

AT NEW ekgrp.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = lwa_text-lifnr

IMPORTING

output = lv_lifnr.

CLEAR : lv_ebelp,

li_flines.

  • Fetch the document number

SELECT ebeln

FROM ekko

INTO lv_ebeln

UP TO 1 ROWS

WHERE lifnr = lv_lifnr

AND bsart = lwa_text-evart

AND bedat = lwa_text-vedat

AND ekorg = lwa_text-ekorg

AND ekgrp = lwa_text-ekgrp.

ENDSELECT.

lv_fname = lv_ebeln.

ENDAT.

IF NOT lv_fname IS INITIAL.

MOVE : lwa_text-text TO lwa_flines-tdline.

APPEND lwa_flines TO li_flines.

ELSE.

  • Fill the error internal table for longtexts in header level

MOVE :lv_lifnr TO wa_error_txt-lifnr,

lwa_text-evart TO wa_error_txt-evart,

lwa_text-vedat TO wa_error_txt-vedat,

lwa_text-ekorg TO wa_error_txt-ekorg,

lwa_text-ekgrp TO wa_error_txt-ekgrp.

wa_error_txt-msg = text-003.

APPEND wa_error_txt TO i_error_txt.

ENDIF.

AT END OF ekgrp.

  • Call the function module to create the long texts for header

CALL FUNCTION 'CREATE_TEXT'

EXPORTING

fid = lwa_text-id

flanguage = sy-langu

fname = lv_fname

fobject = lc_ekko

save_direct = c_x

fformat = lc_f

TABLES

flines = li_flines

EXCEPTIONS

no_init = 1

no_save = 2

OTHERS = 3.

IF sy-subrc <> 0.

REFRESH li_flines.

ENDIF.

ENDAT.

CLEAR: lwa_text.

ENDLOOP.

  • upload text for a line item

LOOP AT i_text_i INTO lwa_text .

  • Check if Material number is present

IF NOT lwa_text-matnr IS INITIAL.

AT NEW matnr.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = lwa_text-lifnr

IMPORTING

output = lv_lifnr.

CLEAR : lv_ebelp,

li_flines.

  • Fetch the document and line item number

SELECT ebeln

FROM ekko

INTO lv_ebeln

UP TO 1 ROWS

WHERE lifnr = lv_lifnr

AND bsart = lwa_text-evart

AND bedat = lwa_text-vedat

AND ekorg = lwa_text-ekorg

AND ekgrp = lwa_text-ekgrp.

ENDSELECT.

lv_fname = lv_ebeln.

SELECT ebelp

FROM ekpo UP TO 1 ROWS

INTO lv_ebelp

WHERE ebeln = lv_ebeln

AND matnr = lwa_text-matnr.

ENDSELECT.

CONCATENATE lv_ebeln lv_ebelp INTO lv_text.

ENDAT.

  • Check if Material group is present

ELSEIF NOT lwa_text-matkl IS INITIAL.

AT NEW matkl.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = lwa_text-lifnr

IMPORTING

output = lv_lifnr.

CLEAR : lv_ebelp,

li_flines.

  • Fetch the document and line item number

SELECT ebeln

FROM ekko

INTO lv_ebeln

UP TO 1 ROWS

WHERE lifnr = lv_lifnr

AND bsart = lwa_text-evart

AND bedat = lwa_text-vedat

AND ekorg = lwa_text-ekorg

AND ekgrp = lwa_text-ekgrp.

ENDSELECT.

lv_fname = lv_ebeln.

SELECT ebelp

FROM ekpo UP TO 1 ROWS

INTO lv_ebelp

WHERE ebeln = lv_ebeln

AND matkl = lwa_text-matkl.

ENDSELECT.

CONCATENATE lv_ebeln lv_ebelp INTO lv_text.

ENDAT.

ENDIF.

IF NOT lv_ebeln IS INITIAL AND

NOT lv_ebelp IS INITIAL.

MOVE : lwa_text-text TO lwa_flines-tdline.

APPEND lwa_flines TO li_flines.

ELSE.

  • Fill the error internal table for longtexts in header level

MOVE : lv_lifnr TO wa_error_txt-lifnr,

lwa_text-evart TO wa_error_txt-evart,

lwa_text-vedat TO wa_error_txt-vedat,

lwa_text-ekorg TO wa_error_txt-ekorg,

lwa_text-ekgrp TO wa_error_txt-ekgrp,

lwa_text-matnr TO wa_error_txt-matnr.

wa_error_txt-msg = text-003.

APPEND wa_error_txt TO i_error_txt.

ENDIF.

AT END OF ekgrp.

  • Call the function module to create the long texts for header

CALL FUNCTION 'CREATE_TEXT'

EXPORTING

fid = lwa_text-id

flanguage = sy-langu

fname = lv_text

fobject = lc_ekpo

save_direct = c_x

fformat = lc_f

TABLES

flines = li_flines

EXCEPTIONS

no_init = 1

no_save = 2

OTHERS = 3.

IF sy-subrc <> 0.

REFRESH li_flines.

ENDIF.

ENDAT.

CLEAR: lwa_text.

ENDLOOP. "LOOP AT i_text_i INTO lwa_text

ENDFORM. " create_text

reward if helpful.

Regards,

Nagaraj

Former Member
0 Kudos

Try This

DATA: it_lines LIKE TABLE OF tline WITH HEADER LINE.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = 'LTXT'

language = sy-langu

name = '000001100184'

object ='AUFK'

  • IMPORTING

  • HEADER =

TABLES

lines = it_lines

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

Former Member
0 Kudos

Hi Brijesh

Please check for language options when you are using the standard transaction...

Regards,

Arun

Former Member
0 Kudos

hi,

in input file keep the records in capitals, it takes in capitals only, if u give small letters it will get created but wont get displayed in wen u see in transaction, check the object number it should be in capitals. it should work.

regards

siva

Former Member
0 Kudos

I have given the ID = MATK and object = AUFK correctly. Infact, I have created a text for Purchase requisition correctly. But here in this case its not working correctly? I am able to see the data through READ_TEXT, so data is getting updated correctly in the DB.

Regards,

Brijesh Patel