I'm new in ABAP. I want my code to create a selection where I can enter a number and it shows me the list of my previously created customers.
this is the code:
REPORT ZBSP_CODING.
DATA: ls_ZBSPCUSTOMERS TYPE ZBSPCUSTOMERS,
lt_ZBSPCUSTOMERS TYPE TABLE OF ZBSPCUSTOMERS,
lv_KUNNR TYPE KUNNR.
SELECT-OPTIONS p_KUNNR FOR lv_KUNNR NO INTERVALS.
SELECT * FROM ZBSPCUSTOMERS INTO ls_ZBSPCUSTOMERS WHERE KUNNR IN p_KUNNR.
WRITE: / ls_ZBSPCUSTOMERS-KUNNR,
/ ls_ZBSPCUSTOMERS-NAME_FIRST, ls_ZBSPCUSTOMERS-NAME_LAST,
/ ls_ZBSPCUSTOMERS-STREET, ls_ZBSPCUSTOMERS-HOUSE_NUM1,
/ ls_ZBSPCUSTOMERS-POST_CODE1, ls_ZBSPCUSTOMERS-CITY1.
ENDSELECT.
the problem is, it won't show me any customers. What am I doing wrong?
There will be two cases.-
Either ZBSPCUSTOMERS
table doesn't contains any data.
or might be data mismatch for leading 0's
in data value for KUNNR
field. So, Add these line-
SELECT-OPTIONS p_KUNNR FOR lv_KUNNR NO INTERVALS. "-------add below lines----- LOOP AT p_KUNNR. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = p_KUNNR-low IMPORTING output = p_KUNNR-low. MODIFY p_KUNNR. ENDLOOP. "-------End of addition------------- SELECT * FROM ZBSPCUSTOMERS INTO ls_ZBSPCUSTOMERS WHERE KUNNR IN p_KUNNR. WRITE: / ls_ZBSPCUSTOMERS-KUNNR, / ls_ZBSPCUSTOMERS-NAME_FIRST, ls_ZBSPCUSTOMERS-NAME_LAST, / ls_ZBSPCUSTOMERS-STREET, ls_ZBSPCUSTOMERS-HOUSE_NUM1, / ls_ZBSPCUSTOMERS-POST_CODE1, ls_ZBSPCUSTOMERS-CITY1. ENDSELECT.
CONVERSION_EXIT_ALPHA_INPUT Function module adds leading 0's in value. for ex- if DE size is 10 digit than if you enter 102, then it'll convert fron 102 to 0000000102.
谢谢大家,就像@divScorp提到的那样,它是F8按钮而不是Enter-Key
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.