Application Development 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: 

ALV

Former Member
0 Kudos

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

former_member188685
Active Contributor
0 Kudos

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

5 REPLIES 5

former_member181966
Active Contributor
0 Kudos

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

0 Kudos

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.

0 Kudos

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.

former_member188685
Active Contributor
0 Kudos

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

0 Kudos

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.