01-11-2012 1:29 PM
Hi all.
I want to create drop down for Document type BSART.for that iam using OOABAP but my program is not triggering PBO module itself.I have seen so many examples but iam unable to fetch data.what are the changes i have to do here.i have reduced some code here.i have written my final internal table select query before this stataement.
loop at it_git_final into wa_git_final.
APPEND wa_git_final TO it_git_final.
ENDLOOP.
*Call to ALV
CALL SCREEN 600.
MODULE status_0600 OUTPUT.
SET PF-STATUS 'DISP'.
SET TITLEBAR 'ALVF4'.
ENDMODULE. " STATUS_0600 OUTPUT
calling the PBO module ALV_GRID.
MODULE pbo OUTPUT.
*Creating objects of the container
* SET field for ALV
if g_custom_container is initial.
perform create_and_init_alv changing it_git_final
gt_fieldcat.
PERFORM alv_build_fieldcat.
endif.
* Set ALV attributes FOR LAYOUT
PERFORM alv_report_layout.
CHECK NOT c_alvgd IS INITIAL.
Call ALV GRID
CALL METHOD c_alvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
i_save = 'A'
CHANGING
it_outtab = it_git_final
it_fieldcatalog = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE. " PBO OUTPUT
---------------------------------------------------------------------
MODULE PAI INPUT *
----
MODULE pai INPUT.
ENDMODULE. "pai INPUT
*subroutine to build fieldcat
FORM alv_build_fieldcat changing pt_fieldcat type lvc_t_fcat..
DATA lx_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'IT_GIT_FINAL'
CHANGING
ct_fieldcat = gt_fieldcat.
* To assign dropdown in the fieldcataogue
LOOP AT gt_fieldcat INTO lx_fcat.
DATA : lx_fcat TYPE lvc_s_fcat.
lx_fcat-row_pos = '1'.
lx_fcat-col_pos = '1'.
lx_fcat-fieldname = 'CHECK1'.
lx_fcat-ref_field = 'CHECK1'
lx_fcat-EDIT = 'X'.
lx_fcat-coltext = 'Check Box'.
lx_fcat-seltext = text-c01.
APPEND lx_fcat TO Gt_fieldcat.
CLEAR lx_fcat.
lx_fcat-row_pos = '1'.
lx_fcat-col_pos = '15'.
lx_fcat-fieldname = 'BSART'.
lx_fcat-ref_field = 'BSART'.
lx_fcat-ref_table = 'T161P'.
lx_fcat-coltext = 'Document Type'.
lx_fcat-drdn_hndl = '1'.
lx_fcat-outputlen = 15.
lx_fcat-edit = 'X'.
append lx_fcat to gt_fieldcat.
CLEAR lx_fcat.
DATA: lt_dropdown TYPE lvc_t_drop,
ls_dropdown TYPE lvc_s_drop.
ls_dropdown-handle = '1'.
ls_dropdown-value = '01 ZFC Vesselchart Contract'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '02 ZQTY QTY Contract(SESA)'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '1'.
*method to display the dropdown in ALV
CALL METHOD g_grid->set_drop_down_table
EXPORTING
it_drop_down = lt_dropdown.
LOOP AT it_fcat INTO lx_fcat.
CASE lx_fcat-fieldname.
To assign dropdown in the fieldcataogue
WHEN 'BSART'.
lx_fcat-drdn_hndl = '1'.
lx_fcat-outputlen = 15.
MODIFY it_fcat FROM lx_fcat.
ENDCASE.
ENDLOOP.
endform.
form ALV_OUTPUT .
*Create object for container
CREATE OBJECT g_custom_container
EXPORTING container_name = 'CCONT'.
*create object for grid
CREATE OBJECT g_grid
EXPORTING i_parent = g_custom_container.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = it_layout
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = it_git_final.
endform. " ALV_OUTPUT
form ALV_REPORT_LAYOUT .
it_layout-cwidth_opt = 'X'.
it_layout-col_opt = 'X'.
it_layout-zebra = 'X'.
endform. " ALV_REPORT_LAYOUT
form CREATE_AND_INIT_ALV changing p_it_git_final
p_gt_fieldcat.
create object g_custom_container
exporting container_name = g_container.
create object g_grid
exporting i_parent = g_custom_container.
endform.
01-11-2012 11:09 PM
Hello Raj
Actually all the code is described in PBO module, so you need to invoke this module in PBO when defining the screen.
For example, access transaction SE51, start in Change mode and inser line
MODULE PBO.
Then activate the object
Best regards
Carlos Machad o
01-11-2012 11:09 PM
Hello Raj
Actually all the code is described in PBO module, so you need to invoke this module in PBO when defining the screen.
For example, access transaction SE51, start in Change mode and inser line
MODULE PBO.
Then activate the object
Best regards
Carlos Machad o
01-12-2012 2:27 AM
module PBO output.
endmodule.
where are you calling this module from? open the screen in SE51 and add the module in the PBO, just like the default module 'MODULE status_0600 OUTPUT.' would be coming in there..
01-12-2012 4:54 AM
Hi ,
not triggering PBO...that means you cant see the ALV Grid Control ?.....if that is the case then you check you codes in PBO event , i mean if-endi and check conditions...
regards
Prabhu
01-19-2012 12:32 PM