‎2006 Dec 26 7:04 PM
it is displaying screen asking for mandatory fields to enter
document no
company code
fiscal year
WHEN I'M ENTERING MANUALLY IT IS DISPLAYIN
it is taking document no when I d.clicked but its not taking fiscal year and company code
can anyone give me an idea.
Thanks
HEMA.
‎2006 Dec 26 9:27 PM
Hi,
I am not sure why are calling the ALV again in the user command..Check the changes marked in bold..
DATA: BEGIN OF wa_bseg,
ebeln like bseg-ebeln,
belnr like bseg-belnr,
END OF wa_bseg.
DATA: v_repid TYPE syrepid.
v_repid = sy-repid.
DATA it_bseg LIKE STANDARD TABLE OF I_bseg with header line.
SELECT ebeln belnr
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'I_bseg'
i_inclname = v_repid
CHANGING
ct_fieldcat = i_fldcat.
Pass the program.
v_repid = sy-repid.
I_BSEG[] = IT_BSEG[].
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = i_fldcat
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = it_bseg.
&----
*& Form user_command
&----
text
----
-->UCOMM text
-->SELFIELD text
----
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm = '&IC1' and selfield-fieldname = 'EBELN'.
READ TABLE i_bseg INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BES' FIELD i_bseg-ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDFORM. "user_command
DATA: BEGIN OF wa_BSIS,
belnR like BSIS-belnR,
END OF wa_BSIS.
DATA: X_repid TYPE syrepid.
X_repid = sy-repid.
DATA it_bsIS LIKE STANDARD TABLE OF i_bsIS
WITH HEADER LINE.
SELECT BELNR GJAHR BUKRS
FROM bsIS
INTO CORRESPONDING FIELDS OF TABLE it_bsIS.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = X_repid
i_internal_tabname = 'i_bsIS'
i_inclname = X_repid
CHANGING
ct_fieldcat = i_fldcat.
X_repid = sy-repid.
I_BSIS[] = IT_BSIS[].
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = X_repid
it_fieldcat = i_fldcat
i_callback_user_command = 'USER_COMMAND2'
TABLES
t_outtab = it_bsIS.
&----
*& Form user_command2
&----
text
----
-->UCOMM1 text
-->SELFIELD text
----
FORM user_command2 USING ucomm2 LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm2 = '&IC1' and selfield-fieldname = 'BELNR'.
READ TABLE i_bsIS INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BLN' FIELD i_bsIS-belnR.
SET PARAMETER ID 'GJR' FIELD i_bsIS-GJAHR.
SET PARAMETER ID 'BUK' FIELD I_BSIS-bukrs.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDFORM. "user_command2
********************************************************************************
form call_list_viewer.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = x_layout
it_fieldcat = i_fldcat[]
i_default = c_x
it_sort = i_sort[]
I_CALLBACK_USER_COMMAND = 'USER_COMMAND1'
i_save = g_save
is_variant = g_variant
it_events = g_events[]
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = g_exit_caused_by_user
TABLES
t_outtab = i_final
EXCEPTIONS
program_error = 1
others = 2.
if sy-subrc <> 0.
write: / 'Problem in calling the ALV report'(042).
endif.
endform. " call_list_viewer
&----
*& Form USER_COMMAND1
&----
text
----
-->UCOMM text
-->SELFIELD text
----
FORM USER_COMMAND1
USING ucomm1 LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm1 = '&IC1' and selfield-fieldname = 'EBELN'.
READ TABLE i_final INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BES' FIELD i_final-ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
<b>ELSEIF ucomm3 = '&IC1' and selfield-fieldname = 'BELNR'.
READ TABLE i_final INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BLN' FIELD i_final-belnR.
SET PARAMETER ID 'GJR' FIELD i_final-GJAHR.
SET PARAMETER ID 'BUK' FIELD P_bUKRS.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.</b>
ENDIF.
<b>*I commented this code..
*call function 'REUSE_ALV_GRID_DISPLAY'
*EXPORTING
*i_callback_program = g_repid
*is_layout = x_layout
**it_fieldcat = i_fldcat[]
*i_default = c_x
*it_sort = i_sort[]
*I_CALLBACK_USER_COMMAND = 'USER_COMMAND3'
*i_save = g_save
*is_variant = g_variant
*it_events = g_events[]
*IMPORTING
*e_exit_caused_by_caller = g_exit_caused_by_caller
*es_exit_caused_by_user = g_exit_caused_by_user
*TABLES
*t_outtab = i_final
*EXCEPTIONS
*program_error = 1
*others = 2.
*if sy-subrc <> 0.
*write: / 'Problem in calling the ALV report'(042).
*endif.</b>
endform. " call_list_viewer
&----
*& Form USER_COMMAND3
&----
text
----
-->UCOMM text
-->SELFIELD text
----
FORM USER_COMMAND3
USING ucomm3 LIKE sy-ucomm
selfield TYPE slis_selfield.
ENDFORM. "USER_COMMAND3
Thanks,
Naren
‎2006 Dec 26 7:07 PM
Hi,
Check this example..You have to set the parameter id..
Accounting document
SET PARAMETER ID 'BLN' FIELD '7300000066'.
Company code
SET PARAMETER ID 'BUK' FIELD '0001'.
Fiscal year
SET PARAMETER ID 'GJR' FIELD '2006'.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
Thanks,
Naren
‎2006 Dec 26 7:21 PM
HI NAREN HEMA HERE
This is the same program which we were discussing yesterday
for purchase it was st forward
but
coming to account document when i d.clicked on acc doc no it is displaying sel screen (fb03)asking to enter manually bukrs company code andfiscal year gjahr
if i entered them manually i'm getting the result
now what i need is when I d.click on acc documnent it must it must directly display acc document details fb03(
I tried the above mentioned but it is not working.
‎2006 Dec 26 7:33 PM
Hi,
Check this sample program..it works fine for me..
TYPE-POOLS: slis.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: BEGIN OF wa_bkpf,
belnr LIKE bkpf-belnr,
bukrs LIKE bkpf-bukrs,
gjahr LIKE bkpf-gjahr,
END OF wa_bkpf.
DATA: v_repid TYPE syrepid.
v_repid = sy-repid.
DATA it_bkpf LIKE STANDARD TABLE OF wa_bkpf WITH HEADER LINE.
SELECT * UP TO 100 ROWS
FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE it_bkpf.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'WA_BKPF'
i_inclname = v_repid
CHANGING
ct_fieldcat = gt_fieldcat.
Pass the program.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = gt_fieldcat
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = it_bkpf.
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm = '&IC1' AND selfield-fieldname = 'BELNR'.
READ TABLE it_bkpf INDEX selfield-tabindex.
IF sy-subrc = 0.
<b>* Accounting document
SET PARAMETER ID 'BLN' FIELD it_bkpf-belnr.
Company code
SET PARAMETER ID 'BUK' FIELD it_bkpf-bukrs.
Fiscal year
SET PARAMETER ID 'GJR' FIELD it_bkpf-gjahr.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.</b>
ENDIF.
ENDIF.
ENDFORM.
Please let me know if it works for you..
Thanks,
Naren
‎2006 Dec 26 7:55 PM
‎2006 Dec 26 7:43 PM
Hi,
Or paste your code..I will let you know what changes are required..
Thanks,
Naren
‎2006 Dec 26 7:57 PM
‎2006 Dec 26 9:05 PM
NAREN u r suggestions
set parameter worked
I made some changes (some dec r not done)
now it is fine
one more problem
for the first d.click PO DETAILS (ME23N) are displayed and for second D .click ACC DOCUMENTATION (FB03)IS DISPLAYED
WHEN i TRIED TO D.CLICK FIRST ON ACC DOCUMENTATION IT IS NOT WORKING(ONLY WHEN i DID IT TWICE D.CLICK IT IS )
CAN U SUGGEST ME ANY IDEA.
THANKS
‎2006 Dec 26 9:12 PM
Hi,
Please post your user command code..I will check it..
Thanks,
Naren
‎2006 Dec 26 9:16 PM
‎2006 Dec 26 9:17 PM
‎2006 Dec 26 9:27 PM
Hi,
I am not sure why are calling the ALV again in the user command..Check the changes marked in bold..
DATA: BEGIN OF wa_bseg,
ebeln like bseg-ebeln,
belnr like bseg-belnr,
END OF wa_bseg.
DATA: v_repid TYPE syrepid.
v_repid = sy-repid.
DATA it_bseg LIKE STANDARD TABLE OF I_bseg with header line.
SELECT ebeln belnr
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'I_bseg'
i_inclname = v_repid
CHANGING
ct_fieldcat = i_fldcat.
Pass the program.
v_repid = sy-repid.
I_BSEG[] = IT_BSEG[].
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = i_fldcat
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = it_bseg.
&----
*& Form user_command
&----
text
----
-->UCOMM text
-->SELFIELD text
----
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm = '&IC1' and selfield-fieldname = 'EBELN'.
READ TABLE i_bseg INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BES' FIELD i_bseg-ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDFORM. "user_command
DATA: BEGIN OF wa_BSIS,
belnR like BSIS-belnR,
END OF wa_BSIS.
DATA: X_repid TYPE syrepid.
X_repid = sy-repid.
DATA it_bsIS LIKE STANDARD TABLE OF i_bsIS
WITH HEADER LINE.
SELECT BELNR GJAHR BUKRS
FROM bsIS
INTO CORRESPONDING FIELDS OF TABLE it_bsIS.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = X_repid
i_internal_tabname = 'i_bsIS'
i_inclname = X_repid
CHANGING
ct_fieldcat = i_fldcat.
X_repid = sy-repid.
I_BSIS[] = IT_BSIS[].
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = X_repid
it_fieldcat = i_fldcat
i_callback_user_command = 'USER_COMMAND2'
TABLES
t_outtab = it_bsIS.
&----
*& Form user_command2
&----
text
----
-->UCOMM1 text
-->SELFIELD text
----
FORM user_command2 USING ucomm2 LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm2 = '&IC1' and selfield-fieldname = 'BELNR'.
READ TABLE i_bsIS INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BLN' FIELD i_bsIS-belnR.
SET PARAMETER ID 'GJR' FIELD i_bsIS-GJAHR.
SET PARAMETER ID 'BUK' FIELD I_BSIS-bukrs.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDFORM. "user_command2
********************************************************************************
form call_list_viewer.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = x_layout
it_fieldcat = i_fldcat[]
i_default = c_x
it_sort = i_sort[]
I_CALLBACK_USER_COMMAND = 'USER_COMMAND1'
i_save = g_save
is_variant = g_variant
it_events = g_events[]
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = g_exit_caused_by_user
TABLES
t_outtab = i_final
EXCEPTIONS
program_error = 1
others = 2.
if sy-subrc <> 0.
write: / 'Problem in calling the ALV report'(042).
endif.
endform. " call_list_viewer
&----
*& Form USER_COMMAND1
&----
text
----
-->UCOMM text
-->SELFIELD text
----
FORM USER_COMMAND1
USING ucomm1 LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm1 = '&IC1' and selfield-fieldname = 'EBELN'.
READ TABLE i_final INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BES' FIELD i_final-ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
<b>ELSEIF ucomm3 = '&IC1' and selfield-fieldname = 'BELNR'.
READ TABLE i_final INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BLN' FIELD i_final-belnR.
SET PARAMETER ID 'GJR' FIELD i_final-GJAHR.
SET PARAMETER ID 'BUK' FIELD P_bUKRS.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.</b>
ENDIF.
<b>*I commented this code..
*call function 'REUSE_ALV_GRID_DISPLAY'
*EXPORTING
*i_callback_program = g_repid
*is_layout = x_layout
**it_fieldcat = i_fldcat[]
*i_default = c_x
*it_sort = i_sort[]
*I_CALLBACK_USER_COMMAND = 'USER_COMMAND3'
*i_save = g_save
*is_variant = g_variant
*it_events = g_events[]
*IMPORTING
*e_exit_caused_by_caller = g_exit_caused_by_caller
*es_exit_caused_by_user = g_exit_caused_by_user
*TABLES
*t_outtab = i_final
*EXCEPTIONS
*program_error = 1
*others = 2.
*if sy-subrc <> 0.
*write: / 'Problem in calling the ALV report'(042).
*endif.</b>
endform. " call_list_viewer
&----
*& Form USER_COMMAND3
&----
text
----
-->UCOMM text
-->SELFIELD text
----
FORM USER_COMMAND3
USING ucomm3 LIKE sy-ucomm
selfield TYPE slis_selfield.
ENDFORM. "USER_COMMAND3
Thanks,
Naren
‎2006 Dec 27 1:30 AM