Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV

Former Member
0 Likes
850

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
828

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

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.

5 REPLIES 5
Read only

former_member181966
Active Contributor
0 Likes
828

Yes there’s 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

Read only

0 Likes
828

Hi all,

Yes there’s 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.

Read only

0 Likes
828

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.

Read only

Former Member
0 Likes
829

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

Read only

0 Likes
828

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.