I've made a table with three fields: KUNNR, NAME_1 and Z_CLASS. KUNNR has KUNNR as data element, NAME_1 has NAME1_GP and Z_CLASS has a data element that I made with 3 values (1, 2 or 3). I've made the table maintenance generator and put some data in with SM30.
Now, I need to make the name of the client show automatically (NAME_1) when I enter a client number (KUNNR) and press enter; and need to make sure that the Z_CLASS is filled and not leaved in blank.
I don't really know how to search for the solution because I'm new to SAP. Thank you.
PROCESS BEFORE OUTPUT.
MODULE LISTE_INITIALISIEREN.
LOOP AT EXTRACT WITH CONTROL
TCTRL_Z10FICLASSFICA CURSOR NEXTLINE.
MODULE LISTE_SHOW_LISTE.
ENDLOOP.
*
PROCESS AFTER INPUT.
MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.
MODULE LISTE_BEFORE_LOOP.
LOOP AT EXTRACT.
MODULE LISTE_INIT_WORKAREA.
CHAIN.
FIELD Z10FICLASSFICA-KUNNR .
FIELD Z10FICLASSFICA-NAME1 .
FIELD Z10FICLASSFICA-Z_CLASS .
MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
ENDCHAIN.
FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
CHAIN.
FIELD Z10FICLASSFICA-KUNNR .
MODULE LISTE_UPDATE_LISTE.
ENDCHAIN.
ENDLOOP.
MODULE LISTE_AFTER_LOOP.
I've found the answer for both problems. For automatic filling the name of the client I used a form routine with the event "Filling hidden fields" (no. 21). In the generated include I used this code:
FORM fill_hidden.
DATA: lc_name1 TYPE kna1-name1.
Data: lc_kunnr TYPE kna1-kunnr.
lc_kunnr = z10ficlassfica-kunnr.
SELECT SINGLE name1 INTO lc_name1 FROM kna1 WHERE kunnr = lc_kunnr.
z10ficlassfica-name1 = lc_name1.
endform.
For the mandatory field I went to Maintenance Screens, Element List tab, Special Attributes tab and choose mandatory from the drop down menu in the Entry column. Worked like a charm. Thanks for all your answers :)