2006 Dec 12 5:18 PM
I'm building a search help exit for MAT0M and i am adding code for the DISP step. I have the following code:
read table shlp-fielddescr into wa_shlp with key fieldname = 'MATNR'.
loop at record_tab.
l_matnr = record_tab-string+wa_shlp-offset(wa_shlp-leng).
endloop.
The problem is i'm getting an offset value of 82 when the material number is really located at offset 59.
I've looked at the other values in the shlp-fielddescr table and I can't figure out how it is coming up with 82 as an offset.
The shlp-fielddescr table looks like this:
M_MAT1M |MAKTG |E |0001 |000000
M_MAT1M |MATNR |E |0002 |000082
M_MAT1M |MATNR_EXT |E |0003 |000118
M_MAT1M |MATNR_VERS |E |0004 |000198
M_MAT1M |SPRAS |E |0005 |000080
This appears to be the layout for the final screen displayed to the user but not the layout in record_tab-string.
record_tab-string looks like this:
Material Description (offset 0) , External Mat Num(offset 40), Mat Num (offset 59)
TOOL | ETOOL-48 | TOOL48
I'm building a search help exit for MAT0M and i am adding code for the DISP step. I have the following code:
read table shlp-fielddescr into wa_shlp with key fieldname = 'MATNR'.
loop at record_tab.
l_matnr = record_tab-string+wa_shlp-offset(wa_shlp-leng).
endloop.
The problem is i'm getting an offset value of 82 when the material number is really located at offset 59.
I've looked at the other values in the shlp-fielddescr table and I can't figure out how it is coming up with 82 as an offset.
The shlp-fielddescr table looks like this:
M_MAT1M |MAKTG |E |0001 |000000
M_MAT1M |MATNR |E |0002 |000082
M_MAT1M |MATNR_EXT |E |0003 |000118
M_MAT1M |MATNR_VERS |E |0004 |000198
M_MAT1M |SPRAS |E |0005 |000080
This appears to be the layout for the final screen displayed to the user but not the layout in record_tab-string.
record_tab-string looks like this:
Material Description (offset 0) , External Mat Num(offset 40), Mat Num (offset 59)
TOOL | ETOOL-48 | TOOL48
2006 Dec 12 5:24 PM
Hi,
Try declaring a internal table with the view name.
where z_test is my z view..
DATA: ITAB LIKE Z_VIEW OCCURS 0 WITH HEADER LINE.
ITAB[] = RECORD_TAB[].
Then in the internal table ITAB you use directly use the field..
Thanks,
Naren
2006 Dec 12 6:15 PM
Unfortunately this technique won't be effective when using the exit code with other MAT* search helps.
I'd like to have one function module that will work with all 27 material search helps on MAT1. Each of these with have a different "view".
There must be a way to get the correct offset number.
2006 Dec 12 7:51 PM
In other posts and note 736293 I understood that I couldn't modify the record_tab table directly. What I wasn't clear on is that you shouldn't READ record_tab directly either.
The solution was to call F4UT_PARAMETER_VALUE_GET and pass in the fieldname and parameter of MATNR. In return the RESULTS_TAB is popuplated with the material numbers I was looking for.
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |