2011 Aug 22 4:44 AM
Dear Expert
We have case going to develop tool to create and update production order long text. There we are going to use the function module CREATE_TEXT to create text for production order. But after we test this function we found that the text header table STXH was updates with certain record. And we used the test the function module READ_TEXT got the expected result. But when we display production order with the transaction CO03, we can not see the long text in in production order. Any advise how can we get the resule in the dispaly order CO03.
Thanks
Hailiang
2011 Aug 22 5:14 AM
Update AUFK-LTEXT field manually or in some user-exit possible whereever you are creating the Long texts and this will allow you to see Texts in transactions.
I am not sure but must be some SAP Note explaining this as well.
BR,
Diwakar
2011 Aug 22 5:14 AM
Update AUFK-LTEXT field manually or in some user-exit possible whereever you are creating the Long texts and this will allow you to see Texts in transactions.
I am not sure but must be some SAP Note explaining this as well.
BR,
Diwakar
2011 Aug 22 6:43 AM
Dear Diwakar
I did test update the AUFK-LTEXT directly in the data base with 'X', but still can not see the long text in CO03. If we writhe long test in production order change transaction CO02 the AUFK-LTEXT will show 'E', but if we change directly debug in SE16, the 'X' can just be assigned.
Best Regards
Hailiang
2011 Aug 22 6:52 AM
Hi,
You need to use BDC for achieveing the result. Please record the long text. Sample code for your reference.
PERFORM open_group.
LOOP AT t_text INTO wa_text.
PERFORM bdc_dynpro USING 'SAPLCOKO1' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'CAUFVD-AUFNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'CAUFVD-AUFNR'
'60003608'.
PERFORM bdc_field USING 'R62CLORD-FLG_OVIEW'
'X'.
PERFORM bdc_dynpro USING 'SAPLCOKO1' '0115'.
PERFORM bdc_field USING 'BDC_CURSOR'
'CAUFVD-GSTRP'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=LATX'.
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
textline = wa_text-text
outputlen = 72
TABLES
out_lines = t_ltext
EXCEPTIONS
outputlen_too_large = 1
OTHERS = 2.
IF sy-subrc = 0.
READ TABLE t_ltext INTO wa_ltext INDEX 1.
READ TABLE t_ltext INTO wa_ltext1 INDEX 2.
ENDIF.
PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
IF NOT wa_ltext IS INITIAL.
PERFORM bdc_field USING 'RSTXT-TXLINE(02)'
wa_ltext.
PERFORM bdc_field USING 'RSTXT-TXPARGRAPH(02)'
'='.
ENDIF.
IF NOT wa_ltext1 IS INITIAL.
PERFORM bdc_field USING 'RSTXT-TXLINE(03)'
wa_ltext1.
ENDIF.
PERFORM bdc_field USING 'BDC_OKCODE'
'=TXBA'.
PERFORM bdc_dynpro USING 'SAPLCOKO1' '0115'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_transaction USING 'CO02'.
ENDLOOP.
PERFORM close_group.
Regards,
Nagaraj
2011 Aug 22 7:52 AM
HAILIANG,
Yes, same behaviour for me also, by default it comes as E for (EN language) though actually it should be X as per valid values.
But, updating the blank ones with 'X' itself works for me, the texts start appearing in the transactions.
You can try once more, if doesn't work, update as 'E' with a program and check.
Btw, which text id are you using, I suppose 'KOPF', right ?
BR,
Diwakar
2013 Nov 11 1:52 PM
Actually, the AUFK-LTEXT field should be set to sy-langu the language that you have used to create the long text, otherwise the long text would not be displayed in CO02/CO03. I have checked some production orders created in EN environment and some in ZH, and found that the AUFK-LTEXT fields have been set to 'E' in EN, and '1' in ZH.
My code to update the long text for production order goes like this. It worked for me.
*&---------------------------------------------------------------------*
*& Form CREATE_TEXT_PRODORD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_DATA text
*----------------------------------------------------------------------*
FORM create_text_prodord USING pw_data LIKE LINE OF gt_data.
DATA: lt_result_tab TYPE TABLE OF string,
lw_result_tab TYPE string,
lt_lines TYPE TABLE OF tline,
lw_lines TYPE tline,
lv_len TYPE i,
lw_header TYPE thead,
lv_message TYPE string,
lw_aufk TYPE aufk.
lv_len = strlen( pw_data-note_pp008 ).
CHECK lv_len > 0.
CALL FUNCTION 'SPLIT_LINE'
EXPORTING
text = pw_data-note_pp008
len = lv_len
maxlen = 132
* SEPARATOR = ' '
sep_before = ''
sep_behind = ''
* COMMENT = '*'
* IMPORTING
* RC =
* FORCED_SPLITLINE =
TABLES
result_tab = lt_result_tab.
LOOP AT lt_result_tab INTO lw_result_tab.
CLEAR lw_lines.
lw_lines-tdformat = '*'.
lw_lines-tdline = lw_result_tab.
APPEND lw_lines TO lt_lines.
ENDLOOP.
CHECK lt_lines[] IS NOT INITIAL.
lw_header-tdobject = 'AUFK'.
CONCATENATE sy-mandt pw_data-aufnr INTO lw_header-tdname.
CONDENSE lw_header-tdname NO-GAPS.
lw_header-tdid = 'KOPF'.
* Here I used sy-langu to create the long text,
* so later on I set the value of field AUFK-LTEXT
* to sy-langu.
lw_header-tdspras = sy-langu.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
* CLIENT = SY-MANDT
header = lw_header
* INSERT = ' '
savemode_direct = 'X'
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
TABLES
lines = lt_lines
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5
.
IF sy-subrc <> 0.
CONCATENATE '生产订单 ' pw_data-aufnr '写入长文本失败'
INTO lv_message SEPARATED BY space.
MESSAGE ID 'ZBC_MC' TYPE 'S' NUMBER 000 WITH lv_message DISPLAY LIKE 'E'.
pw_data-light = '2'. "yellow
EXIT.
ENDIF.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
object = lw_header-tdobject
name = lw_header-tdname
id = lw_header-tdid
language = lw_header-tdspras
savemode_direct = 'X'.
SELECT SINGLE * FROM aufk INTO lw_aufk WHERE aufnr = pw_data-aufnr.
CHECK sy-subrc = 0.
lw_aufk-ltext = sy-langu. "<<< Here it is very important.
DO 5 TIMES.
MODIFY aufk FROM lw_aufk.
IF sy-subrc = 0.
EXIT.
ENDIF.
WAIT UP TO 1 SECONDS.
ENDDO.
ENDFORM. " CREATE_TEXT_PRODORD
2011 Aug 22 8:01 AM
Hi,
Plz check this link...
http://abaplovers.blogspot.com/2008/02/function-modules-create-text-and-read.html
Regards,
Joseph.S