XK99 lsmw or BDC program to copy vendors doesn´t update db records
Hello people
I am facing a requirement to copy a list of existing vendors into about 10 new company codes. Vendors all exist in the "main" company code, so I figured it would be a good idea to use the XK99 transaction as a basis for a mass upload via lsmw or bdc program.
So
So I performed a recording and applied my logic in lsmw, ran the batch input folder in SM35, seemingly without errors. But to my srprise I saw that no database records had been created in the LFB1 table.
So I tried to incorporate the recording into a bdc program that uses call transaction, but the same thing happens. The batch input seems to be running OK, but no changes are actually made to db....
So I was wondering what could I be doing wrong? I notice one strange thing though. After carrying out the selections in XK99 manually, one needs to mark columns to be transfered and then push the ´Perform mass update´ button and THEN click save. However, when in recording mode, one may click save directly, and no error is given and the recording ends.
However, the select columns operation, if I try to do it during recording, doesnt seem to get captured....
Any ideas of what I might be doing wrong here?
Regards, Jorgen
T XK99
SAPMMSDL 0200 X
BDC_OKCODE =NEXT
BDC_SUBSCR SAPMMSDL 1000SUBTAB
BDC_CURSOR MASSTABS-TABTXT(02)
MASSTABS-MARK(02) X
SAPLMASS_SEL_DIALOG 0100 X
BDC_OKCODE =NEW
BDC_SUBSCR SAPLMASS_SEL_DIALOG 0200SUB_ALL
BDC_SUBSCR SAPLMASSFREESELECTIONS 1000SUB_SEL
BDC_CURSOR MASSFREESEL-LOW(01)
MASSFREESEL-LOW(01) 300011
SAPLMASS_SEL_DIALOG 0100 X
BDC_OKCODE /00
BDC_SUBSCR SAPLMASS_SEL_DIALOG 0400SUB_ALL
BDC_SUBSCR SAPLMASSFREESELECTIONS 1000SUB_SEL
MASSFREESEL-LOW(01) 300011
MASSFREESEL-LOW(02) 7010
BDC_SUBSCR SAPLMASSFREESELECTIONS 2000SUB_PARA
BDC_CURSOR MASSFREESEL_P-LOW(02)
MASSFREESEL_P-LOW(01) 300011
MASSFREESEL_P-LOW(02) 7000
SAPLMASS_SEL_DIALOG 0100 X
BDC_OKCODE =CRET
BDC_SUBSCR SAPLMASS_SEL_DIALOG 0400SUB_ALL
BDC_SUBSCR SAPLMASSFREESELECTIONS 1000SUB_SEL
BDC_CURSOR MASSFREESEL-LOW(01)
BDC_SUBSCR SAPLMASSFREESELECTIONS 2000SUB_PARA
SAPLMASSINTERFACE 0200 X
BDC_OKCODE =SAVE
BDC_SUBSCR SAPLMASSINTERFACE 0202FIELDS
BDC_SUBSCR SAPLMASSINTERFACE 0210SUB_HEAD
BDC_CURSOR HEADER_STRUC-FIELD2-VALUE-LEFT(01)
BDC_SUBSCR SAPLMASSINTERFACE 0212SUB_DATA
Hello,
first of all Transaction XK99 is more helpful in case of vendor change, not really creation.
It was also intended to cover mass maintenance so it is used instead of LSMW or any other BDC custom program.
I would say that you can go either with LSMW or CALL TRANSACTION custom program, but you should base your recording on XK/FK01 transactions.
Regards,
Grzegorz
Similar Messages
-
Error in BDC program for Block vendor in SAP R/3
Hello friends,
I wrote a BDC program to block vendor using FK02.
When I debug the program in <b>No screen</b> mode
the program gives a error 'No batch input data for screen SAPMSSY3 0131.
But the screen name and screen number is not available in the program.
When I execute without debugging in No screen mode, the program works correctly.
When I run in ALL screen mode, the program works correctly and the program does not prompt for SAPMSSY3 0131 screen.
Is there any solution for this problem.check this
... MODE mode
Effect
The processing mode can take the following values:
'A' Display screen
'E' Display only if an error occurs
'N' Do not display
<b>'P' Do not display; debugging possible</b>
If the MODE addition is omitted, then the processing mode is 'A'.
If a screen is displayed in processing mode 'E' because the system reached the end of the BDC data, the system automatically switches to processing mode 'A'.
If breakpoints are set in a transaction tcod called using the CALL TRANSACTION tcod USING itab variant, these are not actually reached in 'N' mode. The system tries to insert data in the Debugger screen; the call ends with SY-SUBRC = 1001 and the message "Batch input data is not available for screen SAPMSSY3 0131" (S 00 344).
Conversely, in 'P' mode, transaction screens are processed in the background (as in 'N' mode) and debugging is possible.
Regards
Prabhu -
Budget Document Entry Upload via LSMW or BDC Program not working!
Hi All,
I tried creating a LSMW and a BDC program for upload of budgets by recording Tcode FMBB. Unfortunately, I didn't succeed because some fields in Tcode FMBB are not input ready. I therefore seek an alternative solution to upload the budgets. I have the following questions:-
1. Is there a standard program that can be used to upload the budgets? If so, please give a the name or Tcode for the program.
2. I have checked in this site and confirmed I can use BAPI BAPI_0050_CREATE to upload the budgets. Unfortunately, I have never used BAPIs before. How do I the BAPI to upload my data in Excel? Do I call the BAPI as a function in a program? How do I format the data in Excel for Upload. Kindly provide a step by step procedure on how this can be done and also explain how the data is formatted in Excel.
Thank you.
RobethHi Alok,
May be ur recording a table control in the transaction FB01 for accounting line items..
When recording line items.. u need to record the page "page down" button...
If it is so..
You can control the line item table control , by recording the line item in the second row, then recording the 'page down' button..
This will move your line item to first row and the next line item will be recorded in the second row....and it continues on...
But i am unaware that BDC is tuff for enjoy transactions... If it is so, please go for the bapi specified by Kishan..
Awrd and close the thread if answered...
Thanks
Rajiv -
Hi,
To post the data for RG23C with multiple Line Items in the <b>J1IEX</b> T-code is it advisable to use LSMW or BDC Program. B'cas through LSMW recording method the Multiple Line Items seems to be impossible to upload, and in BDC some of the screen fields are not being caputured.
Suggsestions and Help will be much appreciated.
Regards.
Ramesh.Hello,
I guess such complex scenarios shall be handled theu BDC, as it gives a better control and flexibility.
If there are some fields in the table that are not getting captured during recording, verify that you are doing the required scrolling within the screen.
If still there is something not getting captured thru BDC, search for some OSS note.
Also try if there is a BAPI or Function to do the required posting, then you can avoid the BDC as well..simple and sweet
Regards,
Vishal -
Problem in creating a BDC program for transaction cj20n(project sytem)
Hi all,
I am trying to create project,WBS element ,network and activity using a BDC program,
I am able to create to a recording for the transaction cj20n using tcode shdb but when i run the recording it doesnt run properly i am not able to create any thing.
I get error saying that a particular field doesnt exist on the screen.
Is possible to create a BDC program for transaction CJ20N ?
Also is there any other alternative apart from using a BAPI or a function module.
Thanks,
NishantHi,
Check below link for BAPIs of transaction cj20n.
[BAPI for cj20n|BAPI for CJ20N transaction]
Thanks,
Asit Purbey. -
Problem in BDC program when executed using scheduled job
I have developed a BDC program for J1I5 T-code whcih updates RG1 Register. This is working as expected when run in foreground as well as in background. But it is not giving expected results when scheduled in Job. It is not giving any error message, job is executed without error.
What can be the problem? pls. help.
Thanks!
PrakashHi,
Thanks for reply.
I have checked log using SM37, it is not showing any error.
Log details are as follows...
Date Time Message text Message class Message no. Messag
08.05.2010 11:47:10 Job started 00 516 S
08.05.2010 11:47:10 Step 001 started (program ZSDB_J1I5_REG_UPDATE_BDC, variant 1101_1_RMA, user ID STK) 00 550 S
08.05.2010 11:47:20 Job finished 00 517 S -
BDC PROGRAM WITH OUT USING A FM?
Hi Experts,
I need wirte a BDC program for tcode PA30.
i did the screen recording part using tcode-shdb.
i need to use field i recorded as input fields.
Now the main part is how to write code? with out using a class/method?
class/method which i earlier used is class : CL_GUI_FRONTEND_SERVICES.
method: gui_upload.
am not using ny flat file/xml file to upload?
are there any function modules which i can use?
and how to write code with out using FM?
if any can solve my issue would be very helpful...plz provide code...which would be more helpful.
Thanks in Adv.
Krrish.Hi,
If you are migrating employee data, I would suggest you to do it through PA40 transaction rather PA30. systematic screen validations it will go through. If you dont want to use any FM and wanted to do using recording pls find the below code which will update the employee data through PA40 with call transaction method.
SELECTION SCREEN
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_plan TYPE ibipparms-path OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK b1.
TYPES: BEGIN OF ty_error,
pernr TYPE persno, " Personnel number
rel_obj_id(12), " Related Object ID
msg(200) TYPE c, " To store Message
END OF ty_error.
DATA: i_tplan TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE,
i_intern TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE,
i_error TYPE ty_error OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF w_pa000,
pernr TYPE persno,
begda TYPE begda,
END OF w_pa000.
DATA: wa_plan LIKE i_plan,
wa_messtab TYPE bdcmsgcoll, " Messages
wa_error TYPE ty_error. " Errors
DATA: it_pa000 LIKE STANDARD TABLE OF w_pa000 WITH HEADER LINE,
it_pa002 LIKE STANDARD TABLE OF w_pa000 WITH HEADER LINE,
it_pa001 LIKE STANDARD TABLE OF w_pa000 WITH HEADER LINE.
DATA: g_mode LIKE ctu_params-dismode VALUE 'N',
g_file TYPE ibipparms-path.
ALV field catalog
DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
Batchinputdata of single transaction
DATA: i_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
messages of call transaction
DATA: i_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
error session opened (' ' or 'X')
Table to hold the return messages
DATA: BEGIN OF i_errmsg OCCURS 10.
INCLUDE STRUCTURE bapiret2.
DATA: END OF i_errmsg.
ALV List header table
DATA : i_header1 TYPE slis_t_listheader.
ALV List header table
DATA : i_header TYPE slis_listheader.
***ALV Events
DATA: is_layout TYPE slis_layout_alv.
DATA : it_event TYPE slis_alv_event.
DATA : it_event1 TYPE slis_t_event.
To get the F4 help for file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_plan.
PERFORM get_filename.
START OF SELECTION
START-OF-SELECTION.
Initialise data
PERFORM initialise_events.
Retrieve data from Excel file
PERFORM retreive_data.
Populate final data into an internal table
PERFORM populate_data.
Process the excel file data to create a record for IT0007
PERFORM process_data.
END OF SELECTION
END-OF-SELECTION.
PERFORM final_output.
*& Form GET_FILENAME
FORM get_filename .
*Function module used for F4 help
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_plan.
ENDFORM. " GET_FILENAME
*& Form INITIALISE_EVENTS
FORM initialise_events .
i_header-typ = 'H'.
i_header-key = 'R'.
i_header-info = 'BDC Interface for PA Infotypes 0000,0001,0002'.
APPEND i_header TO i_header1.
CLEAR i_header.
i_header-typ = 'S'.
i_header-info = 'Hiring, Org.Assignment, Personnel Data'.
APPEND i_header TO i_header1.
CLEAR i_header.
***Events and form name
it_event-name = 'TOP_OF_PAGE'.
it_event-form = 'TOP_OF_PAGE'.
APPEND it_event TO it_event1.
ENDFORM. " INITIALISE_EVENTS
*& Form RETREIVE_DATA
FORM retreive_data .
PERFORM upload_data.
ENDFORM. " RETREIVE_DATA
*& Form UPLOAD_DATA
FORM upload_data .
FM to upload data from excel sheet to internal table
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_plan
i_begin_col = g_colbeg
i_begin_row = g_rowbeg
i_end_col = g_colend
i_end_row = g_rowend
TABLES
intern = i_tplan
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
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. " UPLOAD_DATA
*& Form POPULATE_DATA
FORM populate_data .
processing the internal table generated from the function module
Passing data from Excel file to internal table
CLEAR: g_cnt_processed,
g_cnt_err_processed,
i_intern,
i_plan.
LOOP AT i_tplan.
AT NEW row.
CLEAR i_plan.
ENDAT.
CASE i_tplan-col.
Begin Date
WHEN '0001'.
i_plan-pernr = i_tplan-value.
End Date
WHEN '0002'.
i_plan-begda = i_tplan-value.
WHEN '0003'.
i_plan-massg = i_tplan-value.
Sign
WHEN '0004'.
i_plan-plans = i_tplan-value.
WHEN '0005'.
i_plan-werks = i_tplan-value.
WHEN '0006'.
i_plan-persg = i_tplan-value.
WHEN '0007'.
i_plan-persk = i_tplan-value.
WHEN '0008'.
i_plan-anrex = i_tplan-value.
WHEN '0009'.
i_plan-nachn = i_tplan-value.
WHEN '0010'.
i_plan-vorna = i_tplan-value.
WHEN '0011'.
i_plan-gesch = i_tplan-value.
WHEN '0012'.
i_plan-gbdat = i_tplan-value.
WHEN '0013'.
i_plan-fatxt = i_tplan-value.
WHEN '0014'.
i_plan-famdt = i_tplan-value.
WHEN '0015'.
i_plan-gblnd = i_tplan-value.
WHEN '0016'.
i_plan-anzkd = i_tplan-value.
WHEN '0017'.
i_plan-natio = i_tplan-value.
WHEN '0018'.
i_plan-btrtl = i_tplan-value.
WHEN '0019'.
i_plan-gsber = i_tplan-value.
WHEN '0020'.
i_plan-abkrs = i_tplan-value.
ENDCASE.
Appending the internal table tb_data, tb_chng
AT END OF row.
APPEND i_plan.
IF i_plan IS INITIAL.
g_cnt_err_processed = g_cnt_err_processed + 1.
ENDIF.
ENDAT.
ENDLOOP.
To get the total number of records processed
DESCRIBE TABLE i_plan LINES g_lines.
g_cnt_processed = g_cnt_err_processed + g_lines.
CLEAR g_lines.
ENDFORM. " POPULATE_DATA
*& Form PROCESS_DATA
FORM process_data .
CLEAR wa_error.
REFRESH i_bdcdata.
Check if the employee numbers from the template has already been hired
SELECT pernr
begda
FROM pa0000
INTO TABLE it_pa000
FOR ALL ENTRIES IN i_plan
WHERE pernr = i_plan-pernr
AND massn = 'ZA'.
IF sy-subrc = 0.
SORT it_pa000 BY pernr.
Check if employee has a corresponding infotype 0001 record
SELECT pernr
begda
FROM pa0001
INTO TABLE it_pa001
FOR ALL ENTRIES IN it_pa000
WHERE pernr = it_pa000-pernr AND
begda = it_pa000-begda.
IF sy-subrc = 0.
SORT it_pa001 BY pernr.
Check if employee has a corresponding infotype 0002 record
SELECT pernr
begda
FROM pa0001
INTO TABLE it_pa002
FOR ALL ENTRIES IN it_pa001
WHERE pernr = it_pa001-pernr AND
begda = it_pa001-begda.
IF sy-subrc = 0.
SORT it_pa002 BY pernr.
ENDIF.
ENDIF.
ENDIF.
LOOP AT i_plan.
REFRESH i_bdcdata.
***your recording to be pasted here***
PERFORM bdc_field USING 'BDC_CURSOR'
'P0006-BEGDA'.
PERFORM call_transaction.
APPEND wa_error TO i_error.
REFRESH: i_bdcdata, i_messtab.
CLEAR: wa_error, i_error.
ENDLOOP.
ENDFORM. " PROCESS_DATA
*& Form BDC_DYNPRO
FORM bdc_dynpro USING program dynpro.
CLEAR i_bdcdata.
i_bdcdata-program = program.
i_bdcdata-dynpro = dynpro.
i_bdcdata-dynbegin = 'X'.
APPEND i_bdcdata.
ENDFORM. "BDC_DYNPRO
*& Form BDC_FIELD
FORM bdc_field USING fnam fval.
IF fval <> nodata.
CLEAR i_bdcdata.
i_bdcdata-fnam = fnam.
i_bdcdata-fval = fval.
APPEND i_bdcdata.
ENDIF.
ENDFORM. "bdc_field
*& Form ERROR_RECORD_DATA
FORM error_record_data .
CLEAR: g_lines,
wa_messtab,
g_msg.
DESCRIBE TABLE i_messtab LINES g_lines.
READ TABLE i_messtab INTO wa_messtab INDEX g_lines.
IF sy-subrc = 0.
CLEAR g_msg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_messtab-msgid
lang = sy-langu
no = wa_messtab-msgnr
v1 = wa_messtab-msgv1
v2 = wa_messtab-msgv2
v3 = wa_messtab-msgv3
v4 = wa_messtab-msgv4
IMPORTING
msg = g_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF wa_messtab-msgtyp = 'E'.
IF wa_messtab-msgtyp = 'S' AND wa_messtab-msgnr = '102' AND wa_messtab-msgid = 'PG'.
wa_error-pernr = i_plan-pernr.
wa_error-rel_obj_id = 'S'.
wa_error-msg = 'Personnel Number Created Successfully'.
ELSE.
wa_error-pernr = i_plan-pernr.
wa_error-rel_obj_id = 'E'.
wa_error-msg = g_msg.
ENDIF.
APPEND wa_error TO i_error.
CLEAR i_error.
ENDIF.
ENDFORM. " ERROR_RECORD_DATA
*& Form FINAL_OUTPUT
FORM final_output .
CLEAR g_lines.
SORT i_error.
*************added*********************************************
loop at i_error into wa_error.
if wa_error-MSG eq 'No batch input data for screen MP000600 2000'.
wa_error-rel_obj_id = 'S'.
wa_error-MSG = 'Record Created Successfully'.
modify i_error from wa_error.
endif.
endloop.
loop at i_error into wa_error.
if wa_error-rel_obj_id = 'S'.
g_cnt_success = g_cnt_success + 1. " Append success count
elseif wa_error-rel_obj_id = 'E'.
g_cnt_failure = g_cnt_failure + 1. " Append error count
endif.
endloop.
***Field catalog
PERFORM field_cat.
***Assigning Program name
g_repid = sy-repid.
SORT i_error.
***Display Output
IF NOT it_final[] IS INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'PF_STATUS_SET'
i_save = 'A'
it_events = it_event1
is_layout = is_layout
it_fieldcat = i_fieldcat[]
TABLES
t_outtab = i_error[].
ELSE.
MESSAGE i015(zv_msg) WITH 'No Data Found for this selection'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " FINAL_OUTPUT
*& Form top_of_page
text
FORM top_of_page.
***FM for Displaying Heading
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header1[]
i_logo = 'ENJOYSAP_LOGO'.
ENDFORM. "top_of_page
*& Form FIELD_CAT
FORM field_cat .
ENDFORM. " FIELD_CAT
*& Form CALL_TRANSACTION
FORM call_transaction .
CALL TRANSACTION 'PA40' USING i_bdcdata
MODE g_mode
UPDATE 'S'
MESSAGES INTO i_messtab.
If call transaction successful
IF sy-subrc = 0.
g_cnt_success = g_cnt_success + 1. " Append success count "changed
PERFORM error_record_data. " Populate all data
If call transaction not successful
ELSE.
PERFORM error_record_data. " Populate all table
g_cnt_failure = g_cnt_failure + 1. " Append error count "changed
ENDIF.
ENDFORM. " CALL_TRANSACTION -
BDC program to change to vendor master
Can anyone give me a sample BDC code to change vendor master MK02
After entering the Vendor number and selecting the checkboxes Address and Control in the first screen if i take enter it should go to the second screen which contains all fields of address to modify but My code is giving the screen 0110 which contains only few fields,even though i prepared BDC table with 0111 screen, but the actual screen to be called is 0111.
Can anyone send the sample code or give me the solution
Thanks,DATA : lv_filename TYPE STRING,
V_TEXTOUT TYPE T100-TEXT,
v_tcode TYPE tcode.
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA: MESSTAB TYPE STANDARD TABLE OF BDCMSGCOLL ,
MESSTAB1 TYPE BDCMSGCOLL.
DATA : ITAB_FILETAB TYPE FILETABLE.
CONSTANTS: C_TCODE(4) TYPE C VALUE 'AS02', " Assets master data Change - Transaction
C_N TYPE C VALUE 'N', " Not to display screens while call transaction
C_E TYPE C VALUE 'E', " Error
C_S TYPE C VALUE 'S'.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETERS : P_FILE TYPE STRING OBLIGATORY,
P_APPL TYPE FILENAME-FILEEXTERN DEFAULT '/usr/sap/tmp/test_asset.txt' OBLIGATORY LOWER CASE,
P_ALV TYPE C AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK B2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
PERFORM GET_FILENAME_UPLOAD_FILE.
AT SELECTION-SCREEN ON P_FILE.
PERFORM CHECK_FILE_EXISTS.
START-OF-SELECTION.
PERFORM READ_FILE .
PERFORM FILL_TAB.
PERFORM GET_FINAL_RECORD.
PERFORM BDC_REC.
FORM CHECK_FILE_EXISTS.
DATA: V_FILENAME TYPE STRING,
V_RET TYPE C.
V_FILENAME = P_FILE .
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST
EXPORTING
FILE = V_FILENAME
RECEIVING
RESULT = V_RET
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5.
IF NOT ( SY-SUBRC = 0 AND V_RET = 'X' ).
MESSAGE E000(100) WITH 'file does not exits '.
ENDIF.
ENDFORM.
*& Form GET_FILENAME_UPLOAD_FILE
select the file on presentation server using F4 option.
FORM GET_FILENAME_UPLOAD_FILE.
DATA: V_TITLE TYPE STRING,
V_RC TYPE I.
V_TITLE = 'WINDOW ' .
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = V_TITLE
DEFAULT_FILENAME = '*.txt'
INITIAL_DIRECTORY = 'C:\'
MULTISELECTION = ' ' "No multiple selection
CHANGING
FILE_TABLE = ITAB_FILETAB
RC = V_RC.
READ TABLE ITAB_FILETAB INTO P_file INDEX 1.
ENDFORM.
FORM READ_FILE .
lv_filename = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = lv_filename
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = ITAB_FILE
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
FORM BDC_REC .
DATA user_date TYPE sy-datum.
DATA : DATE_FORMAT(10) TYPE C,
TEMP(2) TYPE C,
ROW TYPE STRING ,
ROW1 TYPE STRING.
LOOP at ITAB_FINAL INTO WA_FINAL .
CONCATENATE WA_FINAL-afabg6(4) WA_FINAL-afabg0(2) WA_FINAL-afabg+3(2) INTO USER_DATE .
WRITE USER_DATE TO DATE_FORMAT.
PERFORM BDC_DYNPRO USING 'SAPLAIST' '0100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'ANLA-ANLN1'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'ANLA-ANLN1'
WA_FINAL-ANLN1 . "'158'.
PERFORM BDC_FIELD USING 'ANLA-ANLN2'
WA_FINAL-ANLN2 . "'0'.
PERFORM BDC_FIELD USING 'ANLA-BUKRS'
WA_FINAL-BUKRS . "'2600'.
PERFORM BDC_DYNPRO USING 'SAPLAIST' '1000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=TAB08'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'ANLA-TXT50'.
PERFORM BDC_FIELD USING 'ANLA-TXT50'
'PUMP/ATTACK REAGENT METERING'.
PERFORM BDC_FIELD USING 'ANLH-ANLHTXT'
'PUMP/ATTACK REAGENT METERING'.
PERFORM BDC_FIELD USING 'ANLA-INVNR'
'DB1LA607251CNWF'.
PERFORM BDC_FIELD USING 'ANLA-MENGE'
'1'.
PERFORM BDC_FIELD USING 'ANLA-MEINS'
'EA'.
PERFORM BDC_FIELD USING 'ANLA-INKEN'
'X'.
PERFORM BDC_FIELD USING 'ANLA-AKTIV'
'07/01/1984'.
PERFORM BDC_DYNPRO USING 'SAPLAIST' '1000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BUCH'.
CLEAR TEMP.
*TEMP = WA_FINAL-LINENO.
CONCATENATE 'ANLB-WBIND(' WA_FINAL-LINENO ')' INTO ROW1 .
PERFORM BDC_FIELD USING 'BDC_CURSOR'
ROW1 ."'ANLB-WBIND(06)'.
CONCATENATE 'ANLB-AFABG(' WA_FINAL-LINENO ')' INTO row.
PERFORM BDC_FIELD USING row
DATE_FORMAT . "wa_file-afabg . "'12/01/1985'.
CALL TRANSACTION C_TCODE USING BDCDATA
MODE C_N
UPDATE C_S
MESSAGES INTO MESSTAB.
IF SY-SUBRC EQ 0.
READ TABLE MESSTAB INTO MESSTAB1 WITH KEY MSGTYP = C_S.
IF SY-SUBRC EQ 0.
Builds actual message based on info returned from Call transaction
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
MSGID = MESSTAB1-MSGID
MSGNR = MESSTAB1-MSGNR
MSGV1 = MESSTAB1-MSGV1
MSGV2 = MESSTAB1-MSGV2
MSGV3 = MESSTAB1-MSGV3
MSGV4 = MESSTAB1-MSGV4
IMPORTING
MESSAGE_TEXT_OUTPUT = V_TEXTOUT.
Build Success table ready for output
MOVE-CORRESPONDING WA_FINAL TO WA_SUCCESS.
WA_SUCCESS-MESS = V_TEXTOUT.
APPEND WA_SUCCESS TO ITAB_SUCCESS.
CLEAR: WA_SUCCESS .
ENDIF.
ELSE.
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM. -
What is the bdc program for vendor master?
what is the bdc program for vendor master?
Hi,
Find the code here.
And do create your text file data in the order of itab structure.
{report ZBDC_XK01
no standard page heading line-size 255.
data: bdcdata like bdcdata occurs 0 with header line.
data: begin of itab occurs 0,
lifnr like lfa1-lifnr,
bukrs like RF02K-bukrs,
ekorg like RF02K-ekorg,
ktokk like RF02K-ktokk,
anred like lfa1-anred,
name1 like lfa1-name1,
sortl like lfa1-sortl,
land1 like lfa1-land1,
spras like lfa1-spras,
waers like lfm1-waers,
end of itab.
selection-screen begin of block blk1 with frame.
parameters: p_file like rlgrap-filename OBLIGATORY.
selection-screen end of block blk1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
perform f4_help_p_file.
start-of-selection.
perform get_data.
perform upload.
END-OF-SELECTION.
*& Form f4_help_p_file
text
--> p1 text
<-- p2 text
form f4_help_p_file .
data: v_file like p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = v_file.
CHECK sy-subrc EQ 0.
p_file = v_file.
endform. " f4_help_p_file
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
data: s_file type string.
s_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = s_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = 'D'
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = itab
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
stop.
ENDIF.
endform. " get_data
*& Form upload
text
--> p1 text
<-- p2 text
form upload .
loop at itab.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR' itab-lifnr.
perform bdc_field using 'RF02K-BUKRS' '0001'.
perform bdc_field using 'RF02K-EKORG' '1000'.
perform bdc_field using 'RF02K-KTOKK' '0001'.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-SPRAS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-ANRED' itab-anred.
perform bdc_field using 'LFA1-NAME1' itab-name1.
perform bdc_field using 'LFA1-SORTL' itab-sortl.
perform bdc_field using 'LFA1-LAND1' itab-land1.
perform bdc_field using 'LFA1-SPRAS' itab-spras.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-AKONT'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS' itab-waers.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
call transaction 'XK01' using bdcdata mode 'A'.
refresh bdcdata.
clear itab.
endloop.
endform. " upload
*& Form bdc_dynpro
text
-->P_0126 text
-->P_0127 text
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
endform. " bdc_dynpro
*& Form bdc_field
text
-->P_0316 text
-->P_0317 text
form bdc_field using fnam fval.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
endform. " bdc_field}
Reward points if you find it helpful
Thanks,
Prasanna -
BDC programs affected after system copy.
Dear All,
We are facing a problem after system copy with regards to the HR module.
Client have created a BDC programs and it was running fine in the old server.
After the system refresh, one of the BDC is having problem and following is the brief,
1. While running a user transaction in FOREGROUND, the program is running correctly and in BACKGROUND the program is calling some other action which is not recorded in the BDC. One observation was made that, while running in DEBUG mode, with the background option, the program runs correctly.
2. In program we are calling 2 PA40 actions, whose sequence no. are 28 and 61 resp. In background mode the program calling some other PA40 action whose seq no is 22.
Is there anything we are missing in the profile or some settings in the applications to run the BDC program correctly?
Regards
PrasNo, I haven't run that transaction.
I have checked the old server, and the logical system is PRDCABS500 and the same is present in the new system.
But I am amaze that the other BDC's are working fine, just 1-2 bdc are having problems?
I have checked BD54 in new system its still showing the old..
What do you recommend and when should this activity to be done( I information says that no users should be present?).
Edited by: Prashant Dhas on Jun 13, 2008 7:05 AM -
Vendor Conversion (LSMW or BDC)
Hello,
I want to know what is the best way to convert the Vendor Master(around 60000) from the Legacy to SAP.
There will be new fields to be filled up and then some old fields(Porg,CC,etc) from the legacy might need a logic(table) to convert.
Should I use LSMW or BDC and can I process it based on a file.?
How do we do it?
Recommendation would be appreciated.
ThanksHi,
For uploading the data from legacy system to SAP sys preference should be like this...
1) LSMW
2) BAPI
3) BDC
regards,
paras -
Error in bdc programing code-pls help
hi friends,
I was tring to do a bdc program.But it shows me an error. MY bdc program is jus to upload a 2 fields in vendoe master table.
That is LIFNR,NAME1 field for the new vendors.
I worked out an execl sheet for this, and jus copied it to the text file by selecting all and pasting.
Even then i get an error code that BDC_open does not exits.
MY code is this, please help me if iam wrong.
If anyone can help to make it more understandable,I Kindly request you to try out this program with the screen shot and mail to this id [email protected] would be very thankful for your timely help.
report Z_PK_BDC
no standard page heading line-size 255.
include bdcrecx1.
parameters: dataset(132) lower case.
parameters: p_file like rlgrap-filename default
'C:\SAP TESTING\p_file.txt'.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record OCCURS 0,
data element: LIF16
LIFNR_001(016),
data element: BUKRS
BUKRS_002(004),
data element: KTOKK
KTOKK_003(004),
data element: ANRED
ANRED_004(015),
data element: NAME1_GP
NAME1_005(035),
data element: SORTL
SORTL_006(010),
data element: NAME2_GP
NAME2_007(035),
data element: STRAS_GP
STRAS_008(035),
data element: ORT01_GP
ORT01_009(035),
data element: ORT02_GP
ORT02_010(035),
data element: PFORT_GP
PFORT_011(035),
data element: LAND1_GP
LAND1_012(003),
data element: SPRAS
SPRAS_013(002),
end of record.
End generated data section ***
start-of-selection.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = P_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = record
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC <> 0.
WRITE:/ 'SY-SUBRC:', SY-SUBRC.
ENDIF.
LOOP AT RECORD.
*perform open_dataset using dataset.
*perform open_group.
*do.
*read dataset dataset into record.
*if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'SAPMF02K' '0105'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
record-LIFNR_001.
perform bdc_field using 'RF02K-BUKRS'
record-BUKRS_002.
perform bdc_field using 'RF02K-KTOKK'
record-KTOKK_003.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-SPRAS'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'LFA1-ANRED'
record-ANRED_004.
perform bdc_field using 'LFA1-NAME1'
record-NAME1_005.
perform bdc_field using 'LFA1-SORTL'
record-SORTL_006.
perform bdc_field using 'LFA1-NAME2'
record-NAME2_007.
perform bdc_field using 'LFA1-STRAS'
record-STRAS_008.
perform bdc_field using 'LFA1-ORT01'
record-ORT01_009.
perform bdc_field using 'LFA1-ORT02'
record-ORT02_010.
perform bdc_field using 'LFA1-PFORT'
record-PFORT_011.
perform bdc_field using 'LFA1-LAND1'
record-LAND1_012.
perform bdc_field using 'LFA1-SPRAS'
record-SPRAS_013.
perform bdc_transaction using 'FK01'.
**enddo.
**perform close_group.
endloop.
**perform close_dataset using dataset.
Thanks in Advance
Rinky123Hi,
If you are using GUI_UPLOAD in 4.7 then the file path whatever you are using currently it won't work. Replace the file path like this.
P_FILE LIKE RLGRAP-FILENAME.
DATA: V_FILE TYPE STRING.
V_FILE = P_FILE.
Now take this v_file for function module.Then only it will open the file otherwise you won't get unable to open file error message.
I observerd that you are getting so many fields from the file to the internal table. -
pls tell the differnce b'w lsmw and bdc . when we use bdc and when we use lsmw .for uploading master data (ex: cusomer data ) in tosap which method s u prrefer out of thhse 4
method scall transaction
session input
lsmw bapi whic one is the better one
when use session method and when we use call tran sac
which method is better for bacjground processing call tran s or session method . pls tell
the reason
answres as soon as possibleHi,
LSMW IS JUST A TOOL TO GET THE DATA FROM A LEGACY SYSTEM.
IN BDC WE HAVE 2 WRITE THE CODE AND CALL THE REQUIRED METHOD
THATS IT. IN FUNCTIONALITY PERSPECTIVE THERE IS NO
DIFFERENCE.
BDC is Batch Data Communication. It is basically a program
either generated by SAP after a recording or programmed by a
abaper.Its like running the transaction manually but all the
data is populated on the screens automatically.It is a
little complex when the screens contain table controls.
LSMW is legacy system migration workbench is a more user-
friendly tool thru which one can do the same as a BDC. One
just has to follow some 14 steps, click buttons and the data
is set to be uploaded ….LSMW offer you 4 ways to import data
into SAP, they are BDC, Direct Input, BAPI(BO), IDOC.
To spell out the differences in detail:
look at the below threads to know more
Diff between LSmw and Bdc
Diff. between LSMW & BDC
Regards
Sudheer -
Changes in BDC program to upload data from text/excel file
Hi friends i have obtained the BDc program after recording :
start-of-selection.
perform open_group.
perform bdc_dynpro using 'SAPLCOIH' '0100'.
perform bdc_field using 'BDC_CURSOR'
'CAUFVD-GSBER'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'AUFPAR-PM_AUFART'
'PM01'.
perform bdc_field using 'CAUFVD-IWERK'
'460a'.
perform bdc_field using 'CAUFVD-GSBER'
'2460'.
perform bdc_field using 'CAUFVD-EQUNR'
'10000009'.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'CAUFVD-KTEXT'
'abc'.
perform bdc_field using 'CAUFVD-INGPR'
'GM'.
perform bdc_field using 'CAUFVD-VAPLZ'
'RTN_VELR'.
perform bdc_field using 'CAUFVD-VAWRK'
'460A'.
perform bdc_field using 'BDC_CURSOR'
'CAUFVD-GLTRP'.
perform bdc_field using 'CAUFVD-GSTRP'
'1.8.2010'.
perform bdc_field using 'CAUFVD-GLTRP'
'1.8.2010'.
perform bdc_field using 'CAUFVD-TPLNR'
'RTNP-HIG'.
perform bdc_field using 'CAUFVD-EQUNR'
'10000009'.
perform bdc_field using 'AFVGD-INDET'
'1'.
perform bdc_field using 'AFVGD-WERKS'
'460A'.
perform bdc_field using 'AFVGD-STEUS'
'PMIN'.
perform bdc_field using 'AFVGD-ARBEH'
'H'.
perform bdc_field using 'AFVGD-DAUNE'
'H'.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'CAUFVD-KTEXT'.
perform bdc_field using 'CAUFVD-KTEXT'
'abc'.
perform bdc_field using 'CAUFVD-INGPR'
'GM'.
perform bdc_field using 'CAUFVD-VAPLZ'
'RTN_VELR'.
perform bdc_field using 'CAUFVD-VAWRK'
'460A'.
perform bdc_field using 'CAUFVD-GSTRP'
'01.08.2010'.
perform bdc_field using 'CAUFVD-GLTRP'
'01.08.2010'.
perform bdc_field using 'CAUFVD-TPLNR'
'RTNP-HIG'.
perform bdc_field using 'CAUFVD-EQUNR'
'10000009'.
perform bdc_field using 'AFVGD-LTXA1'
'abc'.
perform bdc_field using 'AFVGD-INDET'
'1'.
perform bdc_field using 'AFVGD-ARBPL'
'RTN_VELR'.
perform bdc_field using 'AFVGD-WERKS'
'460A'.
perform bdc_field using 'AFVGD-STEUS'
'PMIN'.
perform bdc_field using 'AFVGD-ARBEH'
'H'.
perform bdc_field using 'AFVGD-DAUNE'
'H'.
perform bdc_transaction using 'IW31'.
perform close_group.
after executing it has two options.one is for call transactioin and other is for with session.Now i want to do the uploading from text file.Please guide me how to achieve that and what should be the order of fields in the text file.I am just a beginner.I know how to do that with LSMW bt trying BDc first time for creating PM ordersYou can use class "cl_gui_frontend_services". First you must select file with "file_open_dialog" method and the you can upload file with "gui_upload" method into internal table. Here is a sample: (I didn't try the code but I'm sure you can get it working, there are lots of sample codes about that. You can also search FM "GUI_UPLOAD").
REPORT zreport.
DATA:
gv_subrc TYPE sysubrc,
gv_result TYPE abap_bool,
gt_data_tab type table of zstruc.
PARAMETERS: p_fname LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
PERFORM file_open_dialog USING space space space space
CHANGING p_fname gv_action gv_subrc.
START-OF-SELECTION.
PERFORM gui_upload TABLES gt_data_tab
USING p_fname CHANGING gv_subrc.
*** FORMS ***
FORM file_open_dialog USING pv_window_title
pv_default_extension
pv_default_filename
pv_initial_directory
CHANGING pv_filename
pv_user_action
pv_subrc.
DATA:
lt_file_table TYPE filetable,
lv_rc TYPE i,
lv_initial_directory TYPE string.
IF pv_initial_directory IS INITIAL.
PERFORM get_desktop_directory CHANGING lv_initial_directory.
ELSE.
lv_initial_directory = pv_initial_directory.
ENDIF.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = pv_window_title
default_extension = pv_default_extension
default_filename = pv_default_filename
* file_filter =
* with_encoding =
initial_directory = lv_initial_directory
* multiselection =
CHANGING
file_table = lt_file_table
rc = lv_rc
user_action = pv_user_action
* file_encoding =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5
pv_subrc = sy-subrc.
IF pv_subrc EQ 0.
READ TABLE lt_file_table INTO pv_filename INDEX 1.
ENDIF.
ENDFORM.
FORM gui_upload TABLES pt_data_tab
USING pv_filename
CHANGING pv_subrc TYPE sysubrc.
DATA:
lt_data_tab TYPE TABLE OF string,
lv_filename TYPE string.
lv_filename = pv_filename.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = lv_filename
filetype = 'ASC'
has_field_separator = 'X'
* header_length = 0
* read_by_line = 'X'
* dat_mode = SPACE
* codepage = SPACE
* ignore_cerr = ABAP_TRUE
* replacement = '#'
* virus_scan_profile =
* show_transfer_status = 'X'
* IMPORTING
* filelength =
* header =
CHANGING
data_tab = lt_data_tab
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19
pv_subrc = sy-subrc.
IF pv_subrc EQ 0.
pt_data_tab[] = lt_data_tab[].
ENDIF.
ENDFORM. -
Can we make a BDC program as a webservice
Hi All,
Can we write a BDC program in RFC Function Module and access it through web service.
We have a requirement to create a Return Order, for that we have recorded the Va01 transaction for return order and included the same recorded code in RFC Function module and also created web service for it. But when we tried to access through webservice, it is showing the following error
"Call to returned http code 500 (Internal Server Error) with unacceptable content type (text/html; charset=utf-8).
><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode> soap:Server </faultcode><faultstring xml:lang="en"> RABAX occurred on server side </faultstring><detail><sap:Rabax xmlns:sap="http://www.sap.com/webas/710/soap/runtime/abap/fault/generic"><MESSAGE>Access via 'NULL' object reference not possible.</MESSAGE><SYMSGID>VX</SYMSGID><SYMSGTY>S</SYMSGTY><SYMSGNO>206</SYMSGNO><SYMSGV1>TextEditControl</SYMSGV1><SYMSGV2></SYMSGV2><SYMSGV3></SYMSGV3><SYMSGV4></SYMSGV4><SYREPID>SAPLV70T</SYREPID><SYTCODE>VA01</SYTCODE><SYDYNNR>2000</SYDYNNR><SYUNAME>DIK</SYUNAME><SYMANDT>100</SYMANDT><SYLANGU>E</SYLANGU><SYECODE>558</SYECODE><SYHOST>sapdvp</SYHOST><SYSYSID>SD1</SYSYSID><SYOPSYS>Windows NT</SYOPSYS><SYDBSYS>MSSQL</SYDBSYS><SYSAPRL>700</SYSAPRL><SYXPROG>SAPCNVE</SYXPROG><SYXFORM>CONVERSION_EXIT</SYXFORM><SYDATUM>20111104</SYDATUM><SYUZEIT>153001</SYUZEIT><SYETEXT>RABAX_STATE</SYETEXT><ERRORCODE>OBJECTS_OBJREF_NOT_ASSIGNED</ERRORCODE><PATHTRANS>/sap/bc/srt/rfc/sap/zcom_create_return_bdc/100/zcom_create_return_bdc/zcom_create_return_bdc</PATHTRANS><MESSAGE>Access via 'NULL' object reference not possible.</MESSAGE><ERRORCODE>OBJECTS_OBJREF_NOT_ASSIGNED</ERRORCODE></sap:Rabax></detail></soap:Fault></soap:Body></soap:Envelope>"
When we execute the same RFC from SAP SE37 T-Code , it is working fine but same not working from web service .
One more thing If anybody knows the standard BAPI or Function Module to create the Sales Return Order please do post .
Thanks in advance ,
ChaitanyaHi Pranav,
Okay. Kindly let me know how to run rfc function module in background because we have call transaction perform in RFC function module and I am posting BDC code that is using inside RFC function module.
TYPES:BEGIN OF t_bdcdata,
program TYPE bdc_prog,
dynpro TYPE bdc_dynr,
dynbegin TYPE bdc_start,
fnam TYPE fnam_____4,
fval TYPE bdc_fval,
END OF t_bdcdata.
DATA:wa_bdcdata TYPE t_bdcdata,
it_bdcdata TYPE TABLE OF t_bdcdata.
DATA:auart_001 TYPE bdc_fval,
vkorg_002 TYPE bdc_fval,
vtweg_003 TYPE bdc_fval,
spart_004 TYPE bdc_fval,
vbeln_005 TYPE bdc_fval,
kunwe_006 TYPE bdc_fval,
bstkd_007 TYPE bdc_fval,
augru_010 TYPE bdc_fval,
bsark_011 TYPE bdc_fval,
augru_019 TYPE bdc_fval,
bsark_020 TYPE bdc_fval.
DATA:v_subrc TYPE sy-subrc.
MOVE auart TO auart_001.
MOVE vkorg TO vkorg_002.
MOVE vtweg TO vtweg_003.
MOVE spart TO spart_004.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = vbeln
IMPORTING
output = vbeln.
MOVE vbeln TO vbeln_005.
MOVE kunwe TO kunwe_006.
MOVE bstkd TO bstkd_007.
MOVE augru TO augru_010.
MOVE bsark TO bsark_011.
MOVE augru TO augru_019.
MOVE bsark TO bsark_020.
wa_bdcdata-program = 'SAPMV45A'.
wa_bdcdata-dynpro = '0101'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_CURSOR'.
wa_bdcdata-fval = 'VBAK-AUART'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=COPY'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'VBAK-AUART'.
wa_bdcdata-fval = auart_001.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'VBAK-VKORG'.
wa_bdcdata-fval = vkorg_002.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'VBAK-VTWEG'.
wa_bdcdata-fval = vtweg_003.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'VBAK-SPART'.
wa_bdcdata-fval = spart_004.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLV45C'.
wa_bdcdata-dynpro = '0100'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=UEBR'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_CURSOR'.
wa_bdcdata-fval = 'LV45C-VBELN'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'LV45C-VBELN'.
wa_bdcdata-fval = vbeln_005.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLJ3AD'.
wa_bdcdata-dynpro = '2010'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=ENT1'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_CURSOR'.
wa_bdcdata-fval = 'J_3ASZFH-BSTKD'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'J_3ASZFH-KUNWE'.
wa_bdcdata-fval = kunwe_006.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'J_3ASZFH-BSTKD'.
wa_bdcdata-fval = bstkd_007.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'J_3ASZFH-AUGRU'.
wa_bdcdata-fval = augru_010.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'J_3ASZFH-BSARK'.
wa_bdcdata-fval = bsark_011.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLJ3AD'.
wa_bdcdata-dynpro = '2010'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=SICH'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_CURSOR'.
wa_bdcdata-fval = 'J_3ASZFH-BSTKD'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'J_3ASZFH-AUGRU'.
wa_bdcdata-fval = augru_019.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'J_3ASZFH-BSARK'.
wa_bdcdata-fval = bsark_020.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
EXPORTING
tcode = 'VA01'
skip_screen = ''
mode_val = 'N'
update_val = 'A'
IMPORTING
subrc = subrc
TABLES
using_tab = it_bdcdata
SPAGPA_TAB =
mess_tab = messtab
EXCEPTIONS
call_transaction_denied = 1
tcode_invalid = 2
OTHERS = 3
IF sy-subrc <> 0.
subrc = sy-subrc.
EXIT.
ENDIF.
so i am using BDC code to create order instead of function module and converted bdccode into rfc function module,
just help how to do with above code.
With Regards,
Krishna Chaitanya
Maybe you are looking for
-
I purchased a song from iTunes store but it will not download. I keep getting an error code
Recently the songs I puchase from Itunes store will not download to my computer. I keep getting an error message... something about check my internet connection. I can download purchased songs on my other Apple devices on the same network. So I think
-
How can I sync my ipod to the i tunes library in my computer? and how can I make sure each Cd I play is automatically saved onto the Ipod? My problem is that if I open I tunes, the Sync ipod option in the menue is grayed out, and so not available. Th
-
Hi SAP Gurus, Is there not a way that we can set POs to e-mail as soon as they are saved? Thanks Anusha
-
I bought the software "Tune Tools for Ipod" a few days ago and used this to transfer my songs/videos etc from my ipod to my new laptop I received as a Christmas gift. I have all the songs/videos now sitting in itunes, but now I can't get them from it
-
It sure would be a lot faster to talk to someone. I bought Il Volo yesterday for my ipod nano and itunes deleted all my previous music. I want all my previous music back on my ipod. Would someone please get it back for me. Thank you