ABAP DOC1

一:左侧补零

自己的笨办法
ee = '0000000000000000000' b = strlen(aa). c = 18 - b.  dd+0(c) = ee+0(c) . dd+c(b) = aa.

调用系统的,对数字操作

PERFORM alphaformat(sapfs000) USING: A01-IN,A01-OUT.
可以对同一个字段操作
比如 using itab-aa, itab-aa.那么aa就是左侧补零了

FORM ALPHAFORMAT USING A01-IN A01-OUT.
  STRING = A01-IN.
  SHIFT STRING UP TO ' '.
  IF  A01-IN CO KON_NUMER
  AND STRING EQ SPACE
  AND A01-IN NE SPACE.
    UNPACK A01-IN TO A01-OUT.
  ELSE.
    MOVE A01-IN TO A01-OUT.
  ENDIF.
ENDFORM.

二:自动刷新的程序

自动刷新的程序REPORT zauto_refresh NO STANDARD PAGE HEADING.
DATA: g_num TYPE i.
START-OF-SELECTION.
  CALL FUNCTION 'Z_SLEEP'
    STARTING NEW TASK 'WAIT'
    PERFORMING when_finished ON END OF TASK.
  WRITE:/ sy-uzeit, g_num. "Time
  WRITE:/ 'wait for 5 sec....'.
AT USER-COMMAND.
  CASE sy-ucomm.
    WHEN 'REFRESH'.
      DATA l_time TYPE char8.
      WRITE sy-uzeit TO l_time.
      MODIFY LINE 1 OF CURRENT PAGE FIELD VALUE sy-uzeit FROM l_time
                                                   g_num FROM g_num.
      g_num = g_num + 1.
      CALL FUNCTION 'Z_SLEEP'
        STARTING NEW TASK 'WAIT'
        PERFORMING when_finished ON END OF TASK.
  ENDCASE.
*---------------------------------------------------------------------*
*       FORM WHEN_FINISHED                                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  TASKNAME                                                      *
*---------------------------------------------------------------------*
FORM when_finished USING taskname.
  RECEIVE RESULTS FROM FUNCTION 'Z_SLEEP'.
  SET USER-COMMAND 'REFRESH'.
ENDFORM.                    " WHEN_FINISHED
 
 
 'Z_SLEEP'  里很简单,就写个 wait up to 5 seconds. 就行了。最关键的是要选上 Remote-enable module
 
 
可惜的是,我想用这个方法来实现alv的自动刷新的时候就不行了,debug看代码是被执行的,就是没反应,搞不懂了,哪位大侠知道的,还请告知。

三:如何找到长文本的ID等

如何找到长文本的ID,OBJECT, NAME(所有对象适用)长文本创建后会在STXH表中添加一条记录,而STXH表有ID, OBJECT , NAME字段,和READ_TEXT对应

那么哪一条是你刚刚创建的呢,很简单

根据TDFUSER Created by

TDFDATE Date created

TDFTIME Time Created

限制一下STXH的记录就OK了


*****************************
求助,如何用ABAP实现PS模块WBS元素长文本的激活和保存.

我用SAVE_TEXT保存了WBS元素的长文本,用READ_TEXT可以读出来,但是发现没保存进数据库,事务CJ02 ,双击进入WBS元素长文本,没见到保存的文本.代码如下.

Data I_THEAD type Thead occurs 10 with header line.
Data I_TLINE type TLINE occurs 10 with header line.

  I_THEAD-TDOBJECT = 'PMS'.
  I_THEAD-TDNAME = 'E00009058'.
  I_THEAD-TDID = 'LTXT'.
  I_THEAD-TDSPRAS = '1'.
*  I_THEAD-TDLINESIZE = '40'.
  APPEND I_THEAD.

  I_TLINE-TDFORMAT = '*'.
  I_TLINE-TDLINE = 'aaa'.
  Append I_TLINE.
  I_TLINE-TDFORMAT = '*'.
  I_TLINE-TDLINE = 'FF'.
  Append I_TLINE.

CALL FUNCTION 'SAVE_TEXT'
       EXPORTING
            CLIENT          = sy-mandt
            HEADER          = I_THEAD
*            INSERT          = 'X'
            SAVEMODE_DIRECT = 'X'
*       IMPORTING  FUNCTION  = EDITOR_FUNCTION
*                 NEWHEADER = I_THEAD
       TABLES
            LINES           = I_TLINE.
  call function 'COMMIT_TEXT'
       exporting
            object          = 'PMS'.

  commit work.

原因感觉是因为WBS长文本的第一行是WBS元素的描述,而默认情况下,长文本没有生成,SAVE_TEXT的时候并没有保存进去.不知道怎么激活长文本,请大家帮帮忙

如果WBS的长文本已经回车到第二行,或者第二行有文字,并保存后,用上面的代码能实现修改.但是没激活的情况下保存后不可见.


答案:
RCWBS-XLGTX字段是控制长文本是否存在的, 把这个字段设置成'X', 应该就可以了.

谢谢版主,可以了,更新了这个字段PRPS-TXTSP就可以了,多谢

********************************

为什么我的save_text不成功阿?代码如下:请高手指点。。。t-code:c201。

data: l_plnnr like mkal-plnnr,
      l_alnal like mkal-alnal,
      l_ktext like plko-ktext,
      LN_PLKO LIKE THEAD-TDNAME.
      REFRESH TBL_DESC_TEXT.
      CLEAR: TBL_DESC_TEXT,
             G_PLKO_TEXT1,
             G_PLKO_TEXT2,        
             G_PLKO_TEXT3,
             G_PLKO_TEXT4,
             G_PLKO_TEXT5,
             G_PLKO_LINE,
             LN_PLKO.

      select single plnnr alnal into (l_plnnr,l_alnal)
                         from mkal
                           where verid = g_verid
                             and matnr = tbl_operations-matnr
                             and werks = tbl_operations-werks.

      CONCATENATE sy-mandt '2' l_plnnr l_alnal
      '00000001'
      INTO LN_PLKO.

      select single ktext into l_ktext from plko
                          where plnnr = l_plnnr
                            and PLNAL = l_alnal
                            and werks = tbl_operations-werks.

      SPLIT tbl_operations-G_plko_LINE001 AT DELIMITER INTO
                          G_PLKO_TEXT2
                          G_PLKO_TEXT3
                          G_PLKO_TEXT4
                          G_PLKO_TEXT5
                          G_PLKO_TEXT6.
      move  l_ktext  to   G_PLKO_TEXT1.
*>>>fill tdline
      PERFORM fill_tdline using G_PLKO_TEXT1.
      PERFORM fill_tdline using G_PLKO_TEXT2.
      PERFORM fill_tdline using G_PLKO_TEXT3.
      PERFORM fill_tdline using G_PLKO_TEXT4.
      PERFORM fill_tdline using G_PLKO_TEXT5.

      move 'ROUTING' to TBL_THEAD-TDOBJECT.
      move  LN_PLKO  to TBL_THEAD-TDNAME.
      move  'PLKO'   to TBL_THEAD-TDID.
      move  '1'      to TBL_THEAD-TDSPRAS.
      APPEND TBL_THEAD.


CALL FUNCTION 'SAVE_TEXT'
       EXPORTING
            CLIENT          = sy-mandt
            HEADER          = TBL_THEAD
            INSERT          = ' '
            SAVEMODE_DIRECT = 'X'
*           OWNER_SPECIFIED       = ' '
*           LOCAL_CAT             = ' '
*     IMPORTING
*           FUNCTION              =
*           NEWHEADER             =
       TABLES
            LINES           = TBL_DESC_TEXT
       EXCEPTIONS
            ID                    = 1
            LANGUAGE              = 2
            NAME                  = 3
            OBJECT                = 4
            OTHERS                = 5.
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


  call function 'COMMIT_TEXT'
       exporting
            object          = 'ROUTING'
            NAME            = LN_PLKO
            ID              = 'PLKO'
            LANGUAGE        = '1'.
       commit work.


*&---------------------------------------------------------------------*
*&      Form  fill_tdline
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM fill_tdline using l_text.
data:  l_length(3) TYPE n.
       l_length = strlen( l_text ).
       if  l_length <= 40.
        TBL_DESC_TEXT-TDFORMAT = '*'.
        TBL_DESC_TEXT-TDLINE   = l_text.
        append TBL_DESC_TEXT.
        elseif l_length > 40.
        TBL_DESC_TEXT-TDFORMAT = '*'.
        TBL_DESC_TEXT-TDLINE   = l_text+0(40).
        append TBL_DESC_TEXT.
        TBL_DESC_TEXT-TDFORMAT = '='.
        TBL_DESC_TEXT-TDLINE   = l_text+40(24).
        append TBL_DESC_TEXT.
        endif.


ENDFORM.                    " fill_tdline

解决办法
I am facing problem in displaying the Long text in Open Maintenance orders IW31 Sscreen.
i am uploading the long text using SAVE_TEXT function module.
i can see the data in STXL table but i am not able to see the data on the transaction screen display or change mode.
I am using correct object name ,id and etc..in header table objectid: AUFK, TEXTID: AVOT ,tdname:clintid+routingnumber(afvc table aufpl field+ sequence(like 0001.. ), language: EN.
Text line also i am passing and i am enering the direct saving mpde.

i am getting sy-subrc eq = 0.
and i am able to get the data by READ_TEXT table.

my problem is why the Long text data is not diaplying on the scrreen(TEXT editor).
same thing happening in COmponents LONG TEXT in the same TCODE
Please Help me.


Rich Heilman    

Posts: 13,460
Questions: 35
Registered: 4/27/04
Forum points: 31,292 
 
   Re: problem in SAVE_TEXT usage  
Posted: Nov 28, 2005 4:11 PM    in response to: ramesh alla       Reply      E-mail this post 
 

Can you please post the relevant code?

Regards,
Rich Heilman

 
 

Nekenti Vera Ve...  

Posts: 327
Questions: 0
Registered: 4/26/05
Forum points: 592 
 
   Re: problem in SAVE_TEXT usage  
Posted: Nov 28, 2005 4:12 PM    in response to: ramesh alla       Reply      E-mail this post 
 

for displaying long text you have to use EDIT_TEXT FM.

 
 

Srinivas Adavi  

Posts: 4,777
Questions: 7
Registered: 6/3/04
Forum points: 8,322 
 
   Re: problem in SAVE_TEXT usage   
Posted: Nov 28, 2005 4:13 PM    in response to: ramesh alla       Reply      E-mail this post 
 

This is a known problem with some of the transactions that have long text. In those transactions, an online entry of long text, will not only save the long texts like you did, but also update a specific field on the table that indicates whether long text exists.

In your case, AUFK has a field LTEXT which needs to be set to 'X'. If not, then the long texts will not be shown on the transaction screens, even if they exist in the database.

The only solution for such situations is to directly update the database table and set this field.

Regards,

Srinivas

 
 

zhenglin gu  

Posts: 534
Questions: 32
Registered: 12/10/04
Forum points: 796 
 
   Re: problem in SAVE_TEXT usage  
Posted: Nov 28, 2005 4:14 PM    in response to: ramesh alla       Reply      E-mail this post 
 

hi, sorry, I can't login server to test.
But have a suggestion to your problem.

Thinking of it reverse.
If the long text you store through SAVE_TEXT can' display in screen, why not do a change in screen and save a long text.
Then you can try to find out this long text in the related table, then you can make clear why to call SAVE_TEXT correctly.

Hope it will be helpful
thanks

 
 

Vijay Babu Dudla  

Posts: 9,155
Questions: 14
Registered: 3/29/05
Forum points: 11,350 
 
   Re: problem in SAVE_TEXT usage  
Posted: Nov 28, 2005 4:14 PM    in response to: ramesh alla       Reply      E-mail this post 
 

Hi Check all the Comunication tables to store texts are filled .

regards
vijay

 
 

ramesh alla  

Posts: 93
Questions: 50
Registered: 10/18/05
Forum points: 0 
 
   Re: problem in SAVE_TEXT usage  
Posted: Nov 28, 2005 4:23 PM    in response to: Srinivas Adavi       Reply      E-mail this post 
 

Hi srinvas,

update a specific field on the table that indicates whether long text exists.

first time i am using the long text uploading.
please i am not able to see the long text indiactor field in the transaction screen.
please tell me which field i need to set.
which are the tables i need to do direct update please tell me.
if i update table directly is it required to use SAVE_TEXT?
Please help me

 
 

Srinivas Adavi  

Posts: 4,777
Questions: 7
Registered: 6/3/04
Forum points: 8,322 
 
   Re: problem in SAVE_TEXT usage  
Posted: Nov 28, 2005 4:26 PM    in response to: ramesh alla       Reply      E-mail this post 
 

I think in your case it is the AUFK-LTEXT field. Give the same order number that you are creating long texts for, and update this field to 'X'.

To verify, you can manually enter long texts to an order and check this field.

Srinivas

 
 

Srinivas Adavi  

Posts: 4,777
Questions: 7
Registered: 6/3/04
Forum points: 8,322 
 
   Re: problem in SAVE_TEXT usage  
Posted: Nov 28, 2005 4:29 PM    in response to: Srinivas Adavi       Reply      E-mail this post 
 

Here are the steps.

First save the long texts using SAVE_TEXT.
If that is successful, then update AUFK and set this field value to 'X' using the following syntax.

UPDATE aufk SET ltext = 'X' WHERE aufnr = <your order number>


Hope this helps,

Srinivas

 
 

ramesh alla  

Posts: 93
Questions: 50
Registered: 10/18/05
Forum points: 0 
 
这个帖是讲的我碰到的问题。关键我的是T-code:C201的。我找不到那个字段在那个数据库表里。。。还真头疼阿。。。   Re: problem in SAVE_TEXT usage  
Posted: Nov 28, 2005 4:39 PM    in response to: Srinivas Adavi       Reply      E-mail this post 
 

thanks srinvias
now i am at home.
i will check tomorrow and get back to you.
 
问题已经成功解决。需要更新数据库表的一个关键字段。。。

*     Set text flag in operation data
      lv_plpo-txtsp = sy-langu.

     MODIFY plpo FROM TABLE lv_plpo.

看到长文本按照自己的格式传上去,N高兴啊。。。

 


阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭