Skip to Content
0
Former Member
Mar 06, 2006 at 04:40 PM

Material listing Display in VA01

14 Views

I put this code in FORM USEREXIT_MOVE_FIELD_TO_KOMKD

***EXAMPLE for DYNAMIC PART LOOKUP

DATA : Z_PLANT type WERKS_D.

DATA COUNT type I value '0'.

DATA L_LINES TYPE I.

DATA: T_RETVAL LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF L_PARTS OCCURS 0,

MATNR LIKE MARA-MATNR,

MAKTX LIKE MAKT-MAKTX,

MFRPN LIKE MARA-MFRPN,

NAME1 LIKE LFA1-NAME1,

STOCK(10) TYPE C,

END OF L_PARTS.

DATA: BEGIN OF L_MATNRS OCCURS 0.

INCLUDE STRUCTURE ZWCSM_MARATAB.

DATA: END OF L_MATNRS.

CALL FUNCTION 'ZWCSM_DYNAMIC_PART_LOOKUP'

EXPORTING

I_MATERIAL = VBAP-MATNR

I_PLANT = 'ALB1'

I_SALES_ORG = 'S001'

I_DIST_CHANNEL = '01'

I_KUNNR = ' '

TABLES

MATNRS_OUT = L_MATNRS

EXCEPTIONS

NOTHING_FOUND = 1

NO_KEYS = 2

INVALID_PLANT = 3

OTHERS = 4.

Count = count + 1.

LOOP AT L_MATNRS.

L_PARTS-MATNR = L_MATNRS-MATNR.

L_PARTS-MAKTX = L_MATNRS-MAKTX.

L_PARTS-MFRPN = L_MATNRS-MFRPN.

L_PARTS-NAME1 = L_MATNRS-NAME1.

  • IF L_MATNRS-MTART = G_NS_2

  • OR L_MATNRS-DISPR = G_NS_1.

  • L_PARTS-STOCK = TEXT-055.

  • ELSE.

  • L_PARTS-STOCK = TEXT-054.

  • ENDIF.

APPEND L_PARTS.

CLEAR L_PARTS.

ENDLOOP.

DESCRIBE TABLE L_PARTS LINES L_LINES.

*IF L_LINES = 1 .

  • MESSAGE I002(ZEXAMPLE).

*ELSEIF L_LINES = 0.

  • MESSAGE I003(ZEXAMPLE3).

*ENDIF.

If count = 1.

<b>IF L_LINES > 1.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'VBAP-MATNR'

VALUE_ORG = 'S'

TABLES</b> VALUE_TAB = L_PARTS

RETURN_TAB = T_RETVAL

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

VBAP-MATNR = L_MATNRS-matnr.

  • IF NOT T_RETVAL[] IS INITIAL.

  • READ TABLE T_RETVAL INDEX 1.

  • P_ITEM = T_RETVAL-FIELDVAL.

ELSE.

VBAP-MATNR = L_MATNRS-matnr.

  • ENDIF.

ENDIF.

ENDIF.

*END OF DYNAMIC PART LOOKUP.

But when just i enter material number works fine. Next it will ask for Enter qauntity, if enter quantity it will display the material search list again. Blocked part is running again, But i don't want to display this POPUP when i enter qauntity. So i tried Count variable setting, that too not working, b'cos it not storeing count value..

Thanks