‎2010 Feb 04 4:01 AM
i want to create a program. the program will take the sales document date as selection option. then it will show in ALV grid all the sales document number, and net price with in that document date. if i click on any document number, it will show the item detail of that document in a new ALV grid.
can i get any sample code for that?? can anyone please help me??
‎2010 Feb 04 4:18 AM
hi,
for first off you have to make two field catalog ok..
then write the code for the first alv you want to display (ALV grid all the sales document number, and net price with in that document date.) Then the user command of this ALV you have to call the second one(item detail of that document in a new ALV grid.) ok.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
* I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
* I_CALLBACK_USER_COMMAND = 'COMMAND' " this is user command
*
is_layout = wa_layout
it_fieldcat = it_field
IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
TABLES
t_outtab = it_final
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.
ENDFORM. " DISPLAY_ALV
command which you pass in the user command is a form so you have define it.
*&---------------------------------------------------------------------*
*& Form COMMAND
*&---------------------------------------------------------------------*
* SUB-ROUTINE COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
*----------------------------------------------------------------------*
* -->UCOMM used to capture the function
* code of the user-defined push-buttons
* -->SELFIELD text
*----------------------------------------------------------------------*
FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
*CLEAR WA_FINAL.
* CASE ucomm.
*
* WHEN '<usercommand>'.
Perform detail_item. " here in this perform you can write the code for second
* ENDCASE.
ENDFORM. "command
hope this helps
Regards
Ritesh
‎2010 Feb 04 4:18 AM
Hi,
1. Build the first first ALV and populate the docment number and date in this ALV using FM 'REUSE_ALV_GRID_DISPLAY'.
2. write the at user command event on the first ALV and based on the selection of the sales order. populate the item details to the second internal table.
3. Pass this internal table second ALV grid using function module ''REUSE_ALV_GRID_DISPLAY'. call this FM in the USER_COMMAND event of the first ALV.
‎2010 Feb 04 4:18 AM
hi,
for first off you have to make two field catalog ok..
then write the code for the first alv you want to display (ALV grid all the sales document number, and net price with in that document date.) Then the user command of this ALV you have to call the second one(item detail of that document in a new ALV grid.) ok.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
* I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
* I_CALLBACK_USER_COMMAND = 'COMMAND' " this is user command
*
is_layout = wa_layout
it_fieldcat = it_field
IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
TABLES
t_outtab = it_final
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.
ENDFORM. " DISPLAY_ALV
command which you pass in the user command is a form so you have define it.
*&---------------------------------------------------------------------*
*& Form COMMAND
*&---------------------------------------------------------------------*
* SUB-ROUTINE COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
*----------------------------------------------------------------------*
* -->UCOMM used to capture the function
* code of the user-defined push-buttons
* -->SELFIELD text
*----------------------------------------------------------------------*
FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
*CLEAR WA_FINAL.
* CASE ucomm.
*
* WHEN '<usercommand>'.
Perform detail_item. " here in this perform you can write the code for second
* ENDCASE.
ENDFORM. "command
hope this helps
Regards
Ritesh