2011 Oct 04 5:28 PM
Hi everybody,
I have checked some threads that I think could help me with my problem but I have no luck. My be somebody can help me...
I need to check a specific header text at ME32K transaction before saving. If the user complete it everything is ok, if not an error message appears. I solved this with an exit, but the problem is that the text is not saved at this point, I need to get it from memory and I'm not solving this point.
Do you have any ide to solve this?
Kind regards!
Hi
If the text is deleted, the READ_TEXT doesn't return the text?
Are you sure?
Max
2011 Oct 04 5:33 PM
Hi
You can use the fm READ_TEXT, it always returns the current text, that means:
- If the text is not saved yet, it returns the text from buffer
- if the text is saved, it return the text from DB
Max
2011 Oct 04 5:35 PM
Thanks Max but READ_TEXT is not useful for me. If the existing text was deleted READ_TEXT brings the old one.
I need to read which the user does: if the text was deleted I need to know it.
Thx a lot!
2011 Oct 04 5:47 PM
Hi
If the text is deleted, the READ_TEXT doesn't return the text?
Are you sure?
Max
2011 Oct 04 5:50 PM
2011 Oct 04 5:58 PM
Uhm
I've inserted the following code in the exit for the checking of Purchase Order:
DATA: L_HEADER TYPE MEPOHEADER.
DATA: L_NAME TYPE THEAD-TDNAME.
L_HEADER = IM_HEADER->GET_DATA( ).
DATA: LINES TYPE STANDARD TABLE OF TLINE.
MOVE L_HEADER-EBELN TO L_NAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = 'F91'
LANGUAGE = 'I'
NAME = L_NAME
OBJECT = 'EKKO'
TABLES
LINES = LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
ENDIF.In the lines I can see the modification I've done in the text before saving the document, I mean I see the current text
Max
2011 Oct 04 6:40 PM
Thanks Max!!
Can you tell me which is IM_HEADER?
I'm just going to copy exactly which you said, I did it before but not with im_header->get_data( )
Thanks again!
2011 Oct 04 6:47 PM
Max, with your suggested code, al ME32K user-exit the text is the old one
2011 Oct 04 6:52 PM
Hi
That is the BADI for PO (ME22N), but the contract should be very similar, I'm trying to ckeck for the contract, but I don't know if there's an exit developed
Max
2011 Oct 04 6:56 PM
2011 Oct 04 6:59 PM
2011 Oct 04 7:12 PM
Uhm ok
That exit is developed for PO, so I've inserted my code in that exit:
DATA: L_NAME TYPE THEAD-TDNAME.
DATA: TLINES TYPE STANDARD TABLE OF TLINE.
MOVE I_EKKO-EBELN TO L_NAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = 'K01'
LANGUAGE = 'I'
NAME = L_NAME
OBJECT = 'EKKO'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = TLINES
* EXCEPTIONS
* ID = 1
* LANGUAGE = 2
* NAME = 3
* NOT_FOUND = 4
* OBJECT = 5
* REFERENCE_CHECK = 6
* WRONG_ACCESS_TO_ARCHIVE = 7
* OTHERS = 8
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.Now I'm go to the header text, do a modification to the text ID K01 and press the CHECKING in order to trigger the exit.
If I run the process above in debug way, in table TLINES I can see the current text (so all modifications I've done)
Max
2011 Oct 05 7:05 PM
Thanks Maxi for hour help, it was very helpful.
I solve it by another way:
I get if the text was modified or not with an ASSIGN. I put down a piece of code.
FIELD-SYMBOLS: <fs_control> TYPE ANY TABLE,
<wa_control> TYPE ANY,
<fs_aux> TYPE ANY TABLE,
<fs_aux2> TYPE ANY.
...
...
...
ASSIGN ('(SAPMM06E)theadtab[]') TO <fs_control>.
IF sy-subrc EQ 0.
LOOP AT <fs_control> ASSIGNING <wa_control>.
wal_thead = <wa_control>.
IF wal_thead-tdobject EQ cl_ekko AND wal_thead-tdid EQ cl_k24.
IF wal_thead-tdtxtlines EQ 0.
vl_fill = cl_x.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
Thanks & regards!
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |