cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Updating the ShortText of an Inspection Lot

Jose3
Explorer
0 Kudos
1,417

Hallo,

I am trying to update the short text of an inspection lot using SAVE_TEXT. But I can not get it to work. Is there any other way to update the short text of the Inspection Lot. Or How can I fix this approach.

Any help is appreciated.

Thanks

DATA lt_lines          TYPE TABLE OF tline.
DATA ls_line           TYPE tline.
DATA ls_header         TYPE thead.

" Prepare header
        ls_header-tdobject = 'QPRUEFLOS'.
        ls_header-tdname   = ls_usagedec-insplot. " Inspection Lot Number
        ls_header-tdid     = 'QAVE'.
        ls_header-tdspras  = sy-langu.
" Prepare text line
        ls_line-tdformat = '*'.
        ls_line-tdline   = lv_shorttext. " Text to be filled in the ShortText

CALL FUNCTION 'SAVE_TEXT'
          EXPORTING  CLIENT           = SY-MANDT
                     header           = ls_header
                     insert           = 'X'
                     savemode_direct  = 'X'
          TABLES     lines           = lt_lines
          EXCEPTIONS id              = 1
                     language        = 2
                     name            = 3
                     object          = 4
                     OTHERS          = 5.
IF sy-subrc <> 0.
          " Handle error in setting text
          APPEND VALUE #( msgty      = 'E'
                          msgid      = 'ZQ'
                          msgno      = '001'
                          msgv1      = 'Error setting text for inspection lot'
                          msgv2      = ls_usagedec-insplot
                          prot_zeile = 'Error setting text for inspection lot' ) TO e_protocol.
          e_subrc = 4.
ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

 

Accepted Solutions (0)

Answers (3)

Answers (3)

RaymondGiuseppi
Active Contributor
  • SAVE_TEXT will save the long (multiple lines) text (it wont update the main data tables the way transaction, IDOC or BAPI do)
  • AFAIK no BAPI to change inspection lot (check it)

What is the exact table/dynpro field(s) that you are willing to change?

Jose3
Explorer
0 Kudos

Hi @RaymondGiuseppi 
It is QALS-KTEXTLOS.

@RemiKaimal 

RaymondGiuseppi
Active Contributor
0 Kudos

Did you consider a small BDC (executed after save_text commited with wait option?)

During standard maintenance you could use BAdI QST02_STABILOT_WA to change short text, you could look for some BAPI_INSPLOT_* which triggers this BAdI.

(Else look for unreleased FM  at your own risk but first analyse their use by standard code and then test carefully your own code, changing the short text should not get you into trouble, but insure you don't change anything else)

janbuchmann
Contributor
0 Kudos

Hello there

It seems you've got a few things mixed up: the inspection lot short text has TDID = 'QALS'. 'QAVE' on the other hand is for the Usage Decision long text. Also, as @RaymondGiuseppi correctly pointed out, SAVE_TEXT will save the long text. But you should still be able to use it, since the first 40 (?) characters of the long text are automatically saved into QALS-KTEXTLOS. Lastly, only concatenate MANDT and PRUELFOS into TDNAME (i.e. without 'L').

Hope this helps.

RaymondGiuseppi
Active Contributor
0 Kudos
Keep in mind that SAVE_TEXT will only change the long text, it will not update the short text saved on the inspection lot.
juan_suros
Contributor
0 Kudos

It looks like the TDNAME for this text is more complicated than your example code.  Check table STXH in your own system to confirm.

I see a requirement for the client number, then PRUEFLOS, then "L".

juan_suros_0-1736179430387.png

 

Jose3
Explorer
0 Kudos

Hi @juan_suros 

I have tried

 

CONCATENATE sy-mandt ls_usagedec-insplot 'L' INTO ls_header-tdname.

 

Still does not work

juan_suros
Contributor
0 Kudos
Looking at the comments above, I suggest you use QA03 to view the long text you are interested in then use the menu to show the "Header" of thi long text. This will settle the question from janbuchman of which keys you should be using.