Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9242

How to update long text for FI Document and can be displayed in FB03

$
0
0

Dear Experts,

 

 

I met an issue for updating FI Document Long text, the requirement now is uploading one .txt file to Application Server and then the program can read this file and generate a FI Document and then if the bank description is longer than 50 characters, the long text should be updated with other remained character(except 50 previous characters).

 

Technical issue is when the FI Document was generated by COMMIT WORK, I use CREATE_TEXT to create a new long text for the FI Document, but failed, kindly refer to below code:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

              CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

                EXPORTING

                  documentheader    = v_head

                TABLES

                  accountgl         = v_item[]

                  accountreceivable = v_ar_item[]

                  accounttax        = v_tax[]

                  currencyamount    = v_currency[]

                  extension2        = v_extension[]

                  return            = v_return[].

              READ TABLE v_return INDEX 1.

              IF v_return-type = 'S'.

                MESSAGE ID v_return-id TYPE v_return-type NUMBER v_return-number INTO v_message WITH v_return-message_v1 v_return-message_v2 v_return-message_v3 v_return-message_v4.

                WRITE : / v_message.

                COMMIT WORK.

 

                LOOP AT it_l_text INTO wa_l_text.

                  SELECT SINGLE *

                    FROM bseg

                    INTO wa_bseg

                   WHERE bukrs = wa_l_text-bukrs

                     AND belnr = v_return-message_v2+0(10)

                     AND gjahr = wa_l_text-budat+0(4)

                     AND buzei = wa_l_text-posnr.

*                   AND hkont = wa_l_text-hkont.

                  IF sy-subrc EQ 0.

 

 

                    REFRESH v_flines.

                    CLEAR: v_tdname,

                           v_n,

                           v_m,

                           v_i,

                           v_t_length,

                           v_l_length.

 

 

                    CONCATENATE wa_l_text-bukrs v_return-message_v2+0(10)

                                wa_l_text-budat+0(4) wa_l_text-posnr INTO v_tdname.

 

 

                    CLEAR v_length.

                    v_length = strlen( wa_l_text-lntxt ).

 

 

                    v_m = v_length MOD 72.

                    v_n = v_length / 72.

                    v_l_length = v_length - v_n * 72. "0 or not 0

 

 

                    WHILE v_i LE v_n.

                      IF v_i EQ v_n.

                        APPEND wa_l_text-lntxt+v_t_length(v_l_length) TO v_flines.

                      ELSE.

                        APPEND wa_l_text-lntxt+v_t_length(72) TO v_flines.

                        v_i = v_i + 1.

                        v_t_length = v_i * 72.

                      ENDIF.

                    ENDWHILE.

 

 

                    CALL FUNCTION 'CREATE_TEXT'

                      EXPORTING

                        fid         = '0001'

                        flanguage   = sy-langu

                        fname       = v_tdname

                        fobject     = 'DOC_ITEM'

                        save_direct = 'X'

                        fformat     = '*'

                      TABLES

                        flines      = v_flines

                      EXCEPTIONS

                        no_init     = 1

                        no_save     = 2

                        OTHERS      = 3.

                    IF sy-subrc EQ 0.

                       COMMIT WORK.

*                       Implement suitable error handling here

                    ENDIF.

 

 

                  ENDIF.

 

 

                ENDLOOP.


Viewing all articles
Browse latest Browse all 9242

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>