09-09-2008 12:43 PM
hi
i am attaching my bdc
the problem is that it can't move to next screen .
t.code po10 there is two screen .
&----
REPORT ZPO10 NO STANDARD PAGE HEADING
LINE-SIZE 250
LINE-COUNT 60
MESSAGE-ID zcm.
************************************************************************
TYPES DECLARATION *
************************************************************************
Types declaration for flocation intrenal table
TYPES: BEGIN OF ty_mmroh,
PLVAR type PLVAR ,
SEARK TYPE SEARK ,
TIMR6 type STIMR6 ,
BEGDA TYPE BEGDATUM ,
ENDDA TYPE ENDDATUM ,
MARKFELD type c ,
SHORT type SHORT_D ,
STEXT type STEXT ,
END OF ty_mmroh.
************************************************************************
INTERNAL TABLE DECLARATION *
************************************************************************
Internal table to store flocation information
DATA: it_mmroh TYPE STANDARD TABLE OF ty_mmroh INITIAL SIZE 0.
Internal table to map the data to BDC data structure
DATA: it_bdc LIKE STANDARD TABLE OF bdcdata INITIAL SIZE 0.
Internal table to store the system generated messages
DATA: it_bdcmsgcoll LIKE STANDARD TABLE OF bdcmsgcoll INITIAL SIZE 0.
************************************************************************
WORK AREA DECLARATION *
************************************************************************
Work area for flocation data
DATA: wa_mmroh TYPE ty_mmroh.
Work area for internal table IT_BDC
DATA: wa_bdc LIKE bdcdata.
Work area for internal table IT_BDCMSGCOLL
DATA: wa_bdcmsgcoll LIKE bdcmsgcoll.
************************************************************************
VARIABLE DECLARATION *
************************************************************************
DATA: p_ffile TYPE string,
v_message TYPE string,
v_lines TYPE i.
************************************************************************
CONSTANTS DECLARATION *
************************************************************************
CONSTANTS: c_asc(10) TYPE c VALUE 'ASC',
c_x TYPE c VALUE 'X',
c_PO10 TYPE tstc-tcode VALUE 'PO10',
c_n TYPE c VALUE 'N',
c_s TYPE c VALUE 'S' .
************************************************************************
SELECTION-SCREEN DECLARATION *
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_pcfile LIKE rlgrap-filename.
PARAMETERS: p_sesion LIKE apqi-groupid OBLIGATORY. " Create session
SELECTION-SCREEN END OF BLOCK b1.
************************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST EVENT *
************************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pcfile.
Get the file from the presentation server
PERFORM sub_filepath CHANGING p_pcfile.
************************************************************************
START-OF-SELECTION EVENT *
************************************************************************
START-OF-SELECTION.
Upload data from file
PERFORM sub_upload_data.
perform bdc_open_group.
Update the data in SAP
PERFORM sub_update_data.
&----
*& Form sub_filepath
&----
text
----
<--P_P_PCFILE text
----
FORM sub_filepath CHANGING P_P_PCFILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_p_pcfile.
ENDFORM. " sub_filepath
&----
*& Form sub_upload_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM sub_upload_data .
MOVE p_pcfile TO p_ffile.
CLEAR p_pcfile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_ffile
filetype = c_asc
has_field_separator = c_x
read_by_line = c_x
TABLES
data_tab = it_mmroh
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE i001 WITH p_ffile. " Failed to upload file
ENDIF.
ENDFORM. " sub_upload_data
&----
*& Form sub_update_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM sub_update_data .
loop at it_mmroh into wa_mmroh.
perform bdc_dynpro using 'SAPMH5A0' '5100'.
perform bdc_field using 'BDC_OKCODE'
'=INSE'.
perform bdc_field using 'PPHDR-PLVAR'
wa_mmroh-PLVAR.
perform bdc_field using 'PM0D1-SEARK'
wa_mmroh-SEARK.
perform bdc_field using 'BDC_CURSOR'
'TT_T777T-ITEXT(01)'.
perform bdc_field using 'PM0D1-TIMR6'
'X'.
perform bdc_field using 'PPHDR-BEGDA'
wa_mmroh-BEGDA.
perform bdc_field using 'PPHDR-ENDDA'
wa_mmroh-ENDDA.
perform bdc_field using 'MARKFELD(01)'
'X' . "record-MARKFELD_01_006.
perform bdc_dynpro using 'MP100000' '2000'.
perform bdc_field using 'BDC_CURSOR'
'P1000-STEXT'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P1000-SHORT'
wa_mmroh-SHORT.
perform bdc_field using 'P1000-STEXT'
wa_mmroh-STEXT.
perform bdc_dynpro using 'SAPMH5A0' '5100'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_insert.
REFRESH it_bdc.
CLEAR wa_bdc.
REFRESH it_bdcmsgcoll.
CLEAR wa_bdcmsgcoll.
CLEAR v_message.
CLEAR wa_mmroh.
endloop.
perform bdc_close_group.
ENDFORM. " sub
----
Start new screen *
----
FORM bdc_dynpro USING program dynpro.
CLEAR wa_bdc.
wa_bdc-program = program.
wa_bdc-dynpro = dynpro.
wa_bdc-dynbegin = 'X'.
APPEND wa_bdc TO it_bdc.
ENDFORM. "BDC_DYNPRO
----
Insert field *
----
FORM bdc_field USING fnam fval.
CLEAR wa_bdc.
wa_bdc-fnam = fnam.
wa_bdc-fval = fval.
APPEND wa_bdc TO it_bdc.
ENDFORM. "BDC_FIELD
&----
*& Form BDC_INSERT
&----
text
----
FORM bdc_insert .
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = C_PO10
TABLES
dynprotab = it_bdc
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
ENDFORM. " BDC_INSERT
&----
*& Form bdc_close_group
&----
text
----
FORM bdc_close_group .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE: / 'UNABLE TO CLOSE SESSION'.
ENDIF.
IF sy-subrc EQ 0.
WRITE: / 'Session', p_sesion,'Created'.
ENDIF.
ENDFORM. " bdc_close_group
&----
*& Form bdc_open_group
&----
text
----
FORM bdc_open_group .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = p_sesion
keep = 'X'
user = sy-uname
EXCEPTIONS
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
OTHERS = 11.
IF sy-subrc <> 0.
WRITE: / 'UNABLE TO OPEN SESSION'.
ENDIF.
ENDFORM. " bdc_open_group
tamplate :
01 01032008 31129999 PURCH PURCHASE
Regards
Rakesh singh
09-09-2008 12:59 PM
hi,
in recording ,details may not be captured properly that is why u r not abl to go to next screen.
do recording again and try.
09-09-2008 12:59 PM
hi,
in recording ,details may not be captured properly that is why u r not abl to go to next screen.
do recording again and try.
09-09-2008 1:06 PM
hi
thanks for reply
actully i have used both lsmw and bdc but the problem in both is same .
i have done 5 times recording .