2012 Oct 22 1:08 PM
Hi all,
I have used the following code to successfully update email IDs for vendors using flat file. Now I want an EXIT button on my final screen where I kept a message "Data Inserted". Please let me know how to do that.
*Source internal table
data : begin of itab occurs 1,
f1 type RF02K-lifnr,
f2 type LFA1-lfurl,
end of itab.
*target internal table
data : bdcdata type bdcdata occurs 1 with header line.
*Fields for Selection screen F4 input
DATA : V_FILE TYPE STRING.
*Selection screen
SELECTION-SCREEN BEGIN OF BLOCK blck WITH FRAME TITLE text-011.
PARAMETERS : p_file TYPE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK blck.
*Code for F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
* field_name = p_file
IMPORTING
file_name = p_file.
start-of-selection.
v_file = p_file.
*Upload data from text file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = v_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = itab.
loop at itab.
refresh bdcdata.
*----------------------------------------------------------------------------
perform bdc_dynpro using 'SAPMF02K' '0101'.
perform bdc_field using 'BDC_CURSOR'
'USE_ZAV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
itab-f1.
perform bdc_field using 'RF02K-BUKRS'
'seml'.
perform bdc_field using 'RF02K-EKORG'
'sepo'.
perform bdc_field using 'RF02K-D0110'
'X'.
perform bdc_field using 'USE_ZAV'
'X'.
perform bdc_dynpro using 'SAPMF02K' '0111'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'BDC_CURSOR'
'SZA1_D0100-SMTP_ADDR'.
perform bdc_field using 'SZA1_D0100-SMTP_ADDR'
itab-f2.
*----------------------------------------------------------------------------
************************************************************************
***PUSH DATA
CALL TRANSACTION 'XK02' USING BDCDATA MODE 'A'.
************************************************************************
endloop.
IF sy-subrc <> 0.
* Error Found
WRITE : / 'DATA Not INSERTED'.
ELSE.
WRITE : / 'DATA INSERTED'.
exit.
ENDIF .
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. "BDC_DYNPRO
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
Hi all,
I have used the following code to successfully update email IDs for vendors using flat file. Now I want an EXIT button on my final screen where I kept a message "Data Inserted". Please let me know how to do that.
*Source internal table
data : begin of itab occurs 1,
f1 type RF02K-lifnr,
f2 type LFA1-lfurl,
end of itab.
*target internal table
data : bdcdata type bdcdata occurs 1 with header line.
*Fields for Selection screen F4 input
DATA : V_FILE TYPE STRING.
*Selection screen
SELECTION-SCREEN BEGIN OF BLOCK blck WITH FRAME TITLE text-011.
PARAMETERS : p_file TYPE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK blck.
*Code for F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
* field_name = p_file
IMPORTING
file_name = p_file.
start-of-selection.
v_file = p_file.
*Upload data from text file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = v_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = itab.
loop at itab.
refresh bdcdata.
*----------------------------------------------------------------------------
perform bdc_dynpro using 'SAPMF02K' '0101'.
perform bdc_field using 'BDC_CURSOR'
'USE_ZAV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
itab-f1.
perform bdc_field using 'RF02K-BUKRS'
'seml'.
perform bdc_field using 'RF02K-EKORG'
'sepo'.
perform bdc_field using 'RF02K-D0110'
'X'.
perform bdc_field using 'USE_ZAV'
'X'.
perform bdc_dynpro using 'SAPMF02K' '0111'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'BDC_CURSOR'
'SZA1_D0100-SMTP_ADDR'.
perform bdc_field using 'SZA1_D0100-SMTP_ADDR'
itab-f2.
*----------------------------------------------------------------------------
************************************************************************
***PUSH DATA
CALL TRANSACTION 'XK02' USING BDCDATA MODE 'A'.
************************************************************************
endloop.
IF sy-subrc <> 0.
* Error Found
WRITE : / 'DATA Not INSERTED'.
ELSE.
WRITE : / 'DATA INSERTED'.
exit.
ENDIF .
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. "BDC_DYNPRO
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
2012 Oct 22 1:17 PM
2012 Oct 23 6:05 AM
I am sorry. I am new to the community and dint knew. Thanks for updating me.
2012 Oct 22 5:19 PM
Satya Prakash,
If you are looking for the EXIT button at the end of XK02 transaction, then this cannot be possible since the XK02 functionality does not have the screen to tell that the data was inserted. Even after the processing of all the records, this is not possible since this is not the part of the transaction.
From what I understand that you want some sort of confirmation if the data was inserted using Batch Input. For the same, you need to go to Transaction SM35, where you will get the details of your batch input sessions, detailing for each screen. You will come to know from the sessions log about the data been inserted correctly or not. You will also come to know for any errors.
Regards,
Hardik Mehta
2012 Oct 23 6:08 AM
Hello Hardik,
I am actually not looking to keep an EXIT button on xk02 final screen. If you observe my program and executed it, after successfully inserting all email IDs, we will get a message "DATA INSERTED" as sy-subrc = 0. Now, I want to have an EXIT button on this 'DATA INSERTED' screen which I've given and not on the xk02 functionality final screen.
2016 Mar 14 3:13 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |