2006 Feb 27 5:37 PM
Hi all,
Can we add new records to the already displayed ALV list ?
Friends Can we do this ? If so can you please explain me how it can be done ?
Regards,
Vijay.
2006 Feb 27 6:06 PM
hi,
yep, you can do that..,in user_command you can do this way...
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
<b> I_CALLBACK_PF_STATUS_SET = 'STAT'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'</b>
IS_LAYOUT = X_LAYOUT_DATA
IT_FIELDCAT = IT_FIELDCAT_DATA[]
IT_SORT = IT_SORT_DATA[]
IT_EVENTS = IT_EVENTS_DATA[]
TABLES
T_OUTTAB = IT_DISPLAY
EXCEPTIONS
PROGRAM_ERROR = 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.
ENDIF.
FORM STAT USING P_EXTAB TYPE SLIS_T_EXTAB.
*-Pf status
SET PF-STATUS 'STATUS'.
ENDFORM. " STATUS
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
CASE P_UCOMM.
WHEN 'ADD'.
ITAB-FIELD = 'NEWDATA'.
..
...
APPEND ITAB.
CLEAR ITAB.
P_SELFIELD-REFRESH = 'X'.
ENDCASE.
ENDFORM.
REGARDS
VIJAY
2006 Feb 27 5:56 PM
Yes theres a way I can think of ..If you have create button on your ALV menu.. You can click it and Popup display where you add up your new entries and save it and your ALV list get refreshed and show you the new line.
Thanks
2006 Feb 27 9:04 PM
Hi all,
Yes theres a way I can think of ..If you have create button on your ALV menu.. <b>You can click it and Popup display where you add up your new entries and save it and</b> your ALV list get refreshed and show you the new line.
Can anyone explain me how do I get the pop up for user entries.
Regards,
Vijay.
2006 Feb 28 12:08 AM
Here is a code for fm which you can call to display a pop up -
When user clicks on button, call fm POPUP_TO_gET_ONE_VALUE.
USer will enter the value then populate your final itnernal table again with this new value and display new report.
Take care of BACK button while handling this. You may not want to go back to old version of report when user clicks BACK.
Sample code for the fm
call function 'POPUP_TO_GET_ONE_VALUE'
exporting
textline1 = 'Enter Amount'
titel = 'Amount Entry'
valuelength = 20
importing
answer = l_ans
value1 = l_amt
exceptions
titel_too_long = 1
others = 2.
I guess you have already another similar thread. If your quesry is answered, pls close this thread.
2006 Feb 27 6:06 PM
hi,
yep, you can do that..,in user_command you can do this way...
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
<b> I_CALLBACK_PF_STATUS_SET = 'STAT'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'</b>
IS_LAYOUT = X_LAYOUT_DATA
IT_FIELDCAT = IT_FIELDCAT_DATA[]
IT_SORT = IT_SORT_DATA[]
IT_EVENTS = IT_EVENTS_DATA[]
TABLES
T_OUTTAB = IT_DISPLAY
EXCEPTIONS
PROGRAM_ERROR = 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.
ENDIF.
FORM STAT USING P_EXTAB TYPE SLIS_T_EXTAB.
*-Pf status
SET PF-STATUS 'STATUS'.
ENDFORM. " STATUS
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
CASE P_UCOMM.
WHEN 'ADD'.
ITAB-FIELD = 'NEWDATA'.
..
...
APPEND ITAB.
CLEAR ITAB.
P_SELFIELD-REFRESH = 'X'.
ENDCASE.
ENDFORM.
REGARDS
VIJAY
2006 Feb 27 6:24 PM
Hi Vijay,
Your reply has answered my problem. Thanks a lot. Can you please explain me what is the significance of specifying <b>P_SELFIELD-REFRESH = 'X'</b> in the code.
Regards,
Vijay.