2010 May 25 7:35 AM
Hi,
I have a module pool requirement wherein i need to display one field as input field from user Lets say MATNR
and based on material number selected by user , there is one additional field on module pool lets say material description
which is purely display field. Now the requirement is that when user enter material number on screen then its corresponding
material description should automatically get displayed on screen.
Thanks
Parga
2010 May 25 7:53 AM
Hi
Check the below Code Snippet
DATA : from_f4.
" Just copy this and Execute this is Tested Code
PARAMETERS : matnr TYPE matnr,
maktx TYPE maktx.
DATA : BEGIN OF itab OCCURS 0,
matnr type matnr,
maktx type maktx,
END OF itab.
DATA : fmap TYPE TABLE OF dselc WITH HEADER LINE.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'MAKTX'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR MATNR." If it is a selection
*Screen
*else in PROCESS ON VALUE REQUEST
SELECT A~MATNR B~MAKTX FROM MARA AS A INNER JOIN MAKT AS B
ON A~MATNR = B~MATNR
INTO TABLE ITAB UP TO 200 ROWS.
fmap-fldname = 'MATNR'.
fmap-dyfldname = 'MATNR'.
APPEND fmap.
fmap-fldname = 'MAKTX'.
fmap-dyfldname = 'MAKTX'.
APPEND fmap.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
ddic_structure = 'ZMATNR11' " Create your Own Structure in SE11
" with only 2 fields (MATNR and MAKTX)
" We can use MAKT(so that we can avoid structure
"creation in SE11)
" table but for unkonw reasons it is returning Junk
"Chars at the end of Material description
retfield = 'MATNR'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'MATNR'
value_org = 'S'
display = 'F' " This forces the F4 help for
TABLES
value_tab = itab
dynpfld_mapping = fmap.
Cheerz
Ram
Edited by: Rob Burbank on May 25, 2010 11:05 AM
2010 May 25 3:52 PM
Write a PBO Module:
IF g_matnr IS NOT INITIAL.
SELECT SINGLE maktx
FROM makt
INTO g_maktx
WHERE matnr EQ g_matnr
AND spras EQ syst-langu.
ENDIF.
Regards,
John.
2010 May 25 4:07 PM
Moderator message - Please do not ask or answer basic questions - thread locked Rob