05-18-2006 8:32 AM
Hi,
I have a field on a screen which has a search help assigned. When the users select an entry I would like to populate a text field on the screen with the desc of the chosen entry.
Can this be done.
Thanks
Martin
05-18-2006 8:35 AM
Hi Martin,
This can be done. Create a field in the screen and mark it as 'output only', i.e, not an input field. Then pass the description value to that field in the module pool program.
Hope this helps.
Cheers,
Rajeev
05-18-2006 8:37 AM
Hi,
To pass the description field I need to do it in the PBO. However when I choose the drop down option of the field, the PBO of the screen is not called again.
Thanks
Martin
05-18-2006 8:41 AM
Martin,
You have to create a module under PAI for this. Inside the module you can use a select query and get the description for that particular code. Then you can pass the description text to the screen field(output only)
CHeers,
Rajeev
05-18-2006 8:46 AM
The drop down does not call any of the events in the screen.
I presume I need to code my own drop down list and use the value-request event.
05-18-2006 8:46 AM
Hi Martin ,
This exactly fits ur requirement .
<b>1.</b> Here i am displaying F4 help using
'POPUP_WITH_TABLE_DISPLAY'
<b>2.</b> Then seelect record from display in the text field
using FM 'DYNP_VALUES_UPDATE'
Have a look at this sample program .
DATA : BEGIN OF POP_ERDAT OCCURS 1,
ERDAT LIKE YB001-ERDAT,
ERNAME LIKE YB001-ERNAME,
END OF POP_ERDAT.
DATA : BEGIN OF POP_ERDAT1 OCCURS 1,
TEXT(25) ,
END OF POP_ERDAT1.
DATA:L_CHOICE LIKE SY-TABIX.
DATA : IT_DYNP TYPE STANDARD TABLE OF DYNPREAD WITH HEADER LINE.
SELECT DISTINCT ERDAT ERNAME INTO TABLE POP_ERDAT
FROM YB001
WHERE ERDAT <= SY-DATUM.
IF SY-SUBRC EQ 0.
DELETE ADJACENT DUPLICATES FROM POP_ERDAT COMPARING ERDAT ERNAME.
SORT POP_ERDAT BY ERDAT ASCENDING.
LOOP AT POP_ERDAT.
CLEAR POP_ERDAT1.
WRITE POP_ERDAT-ERDAT DD/MM/YYYY TO POP_ERDAT1-TEXT.
CONCATENATE POP_ERDAT1-TEXT ' ' POP_ERDAT-ERNAME INTO POP_ERDAT1-TEXT SEPARATED BY SPACE .
APPEND POP_ERDAT1.
ENDLOOP.
ENDIF.
IF NOT POP_ERDAT[] IS INITIAL.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL = 69
ENDPOS_ROW = 20
STARTPOS_COL = 45
STARTPOS_ROW = 10
TITLETEXT = 'Versions'
IMPORTING
CHOISE = L_CHOICE
TABLES
VALUETAB = POP_ERDAT1
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
READ TABLE POP_ERDAT INDEX L_CHOICE.
IF SY-SUBRC = 0.
CLEAR : IT_DYNP,IT_DYNP[].
IT_DYNP-FIELDNAME = P_ERDAT.
WRITE POP_ERDAT-ERDAT DD/MM/YYYY TO IT_DYNP-FIELDVALUE.
APPEND IT_DYNP.
IT_DYNP-FIELDNAME = P_UNAME.
IT_DYNP-FIELDVALUE = POP_ERDAT-ERNAME.
APPEND IT_DYNP.
CLEAR IT_DYNP.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = '1000'
TABLES
DYNPFIELDS = IT_DYNP
EXCEPTIONS
INVALID_ABAPWORKAREA = 1
INVALID_DYNPROFIELD = 2
INVALID_DYNPRONAME = 3
INVALID_DYNPRONUMMER = 4
INVALID_REQUEST = 5
NO_FIELDDESCRIPTION = 6
UNDEFIND_ERROR = 7
OTHERS = 8.
ENDIF.
ENDIF.
ENDIF.
I think that this helps u .
<b>Thanks,
Venkat.O</b>