scenario: uploading the customer master through bdc ... · scenario: uploading the customer master...

52
Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs to be maintained in the screen table control. Step1. Go to Tcode- SHDB for recording. Step2. Click on New Recording button.

Upload: dotuyen

Post on 07-Sep-2018

235 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs to be maintained in the screen table control. Step1. Go to Tcode- SHDB for recording.

Step2. Click on New Recording button.

Page 2: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step3. Provide a Recording name and the transaction 'XD01' and click on continue button.

Page 3: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step4. Provide the company code, sales org, distribution channel, division and account group and hit ENTER key from keyboard.

Page 4: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step5. Provide title, country and language and hit ENTER key from keyboard.

Page 7: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step8. The screen appears where we have to provide multiple bank account details as a table control.

Page 8: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step9. Provide the bank country, bank key and the bank account number and hit ENTER key from keyboard.

Page 11: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step12. The BANK key in the sap system can be cretaed in tcode- FI01/FI02/FI03. In teh recording we have used bank key- 5001, 5002 and 5003. These bank keys are defined in the system before creating the customer.

Page 12: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step13. Now go to tcode- SE38 to create the BDC program for table control for the customer master.

Step14. Provide a program name and click on create button and provide the below code.

Page 13: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

REPORT zbdc_table_control_cust_master. DATA : p_banks TYPE char15, p_bankl TYPE char15, p_bankn TYPE char15, idx TYPE num2 . TYPES : BEGIN OF ty_cust, slno TYPE char2, cust_id TYPE char2, com_code TYPE bukrs, sales_org TYPE vkorg, dist_ch TYPE vtweg, division TYPE spart, acct_gr TYPE ktokd, title TYPE anred, land TYPE land1, lang TYPE spras, END OF ty_cust, BEGIN OF ty_bank, slno TYPE char2, cust_id TYPE char2, land TYPE banks, bank_key TYPE bankl, acct TYPE bankn, END OF ty_bank. PARAMETERS : cust_fil TYPE ibipparms-path OBLIGATORY DEFAULT 'C:\Users\Desktop\bdc with table contorl\CUST DATA.xlsx', bank_fil TYPE ibipparms-path OBLIGATORY DEFAULT 'C:\Users\Desktop\bdc with table contorl\BANK DATA.xlsx'. DATA : lt_cust_ex TYPE TABLE OF alsmex_tabline,

Page 14: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

lt_bank_ex TYPE TABLE OF alsmex_tabline, ls_excel TYPE alsmex_tabline . DATA : lt_cust TYPE TABLE OF ty_cust, ls_cust TYPE ty_cust, lt_bank TYPE TABLE OF ty_bank, ls_bank TYPE ty_bank, lt_bdc TYPE TABLE OF bdcdata, ls_bdc TYPE bdcdata. AT SELECTION-SCREEN ON VALUE-REQUEST FOR cust_fil . CALL FUNCTION 'F4_FILENAME' EXPORTING program_name = syst-cprog dynpro_number = syst-dynnr field_name = space IMPORTING file_name = cust_fil. AT SELECTION-SCREEN ON VALUE-REQUEST FOR bank_fil . CALL FUNCTION 'F4_FILENAME' EXPORTING program_name = syst-cprog dynpro_number = syst-dynnr field_name = space IMPORTING file_name = bank_fil. START-OF-SELECTION . CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' EXPORTING filename = cust_fil i_begin_col = 1 i_begin_row = 2 i_end_col = 100 i_end_row = 100 TABLES

Page 15: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

intern = lt_cust_ex 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. CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' EXPORTING filename = bank_fil i_begin_col = 1 i_begin_row = 2 i_end_col = 100 i_end_row = 100 TABLES intern = lt_bank_ex 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. LOOP AT lt_cust_ex INTO ls_excel. CASE ls_excel-col. WHEN '0001'. ls_cust-slno = ls_excel-value. WHEN '0002'. ls_cust-cust_id = ls_excel-value. WHEN '0003'. ls_cust-com_code = ls_excel-value. WHEN '0004'. ls_cust-sales_org = ls_excel-value. WHEN '0005'.

Page 16: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

ls_cust-dist_ch = ls_excel-value. WHEN '0006'. ls_cust-division = ls_excel-value. WHEN '0007'. ls_cust-acct_gr = ls_excel-value. WHEN '0008'. ls_cust-title = ls_excel-value. WHEN '0009'. ls_cust-land = ls_excel-value. WHEN '0010'. ls_cust-lang = ls_excel-value. ENDCASE. CLEAR ls_excel. AT END OF row. APPEND ls_cust TO lt_cust. CLEAR : ls_cust. ENDAT. ENDLOOP. CLEAR : ls_excel. LOOP AT lt_bank_ex INTO ls_excel. CASE ls_excel-col. WHEN '0001'. ls_bank-slno = ls_excel-value. WHEN '0002'. ls_bank-cust_id = ls_excel-value. WHEN '0003'. ls_bank-land = ls_excel-value. WHEN '0004'. ls_bank-bank_key = ls_excel-value. WHEN '0005'. ls_bank-acct = ls_excel-value. ENDCASE. CLEAR ls_excel. AT END OF row. APPEND ls_bank TO lt_bank. CLEAR ls_bank. ENDAT. ENDLOOP.

Page 17: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

LOOP AT lt_cust INTO ls_cust. PERFORM call_screen USING 'SAPMF02D' '0100' 'X'. PERFORM : fill_screen USING 'BDC_CURSOR' 'RF02D-KTOKD', fill_screen USING 'BDC_OKCODE' '/00', fill_screen USING 'RF02D-BUKRS' ls_cust-com_code, fill_screen USING 'RF02D-VKORG' ls_cust-sales_org, fill_screen USING 'RF02D-VTWEG' ls_cust-dist_ch, fill_screen USING 'RF02D-SPART' ls_cust-division, fill_screen USING 'RF02D-KTOKD' ls_cust-acct_gr. PERFORM call_screen USING 'SAPMF02D' '0110' 'X'. PERFORM : fill_screen USING 'BDC_CURSOR' 'KNA1-SPRAS', fill_screen USING 'BDC_OKCODE' '/00', fill_screen USING 'KNA1-ANRED' ls_cust-title, fill_screen USING 'KNA1-LAND1' ls_cust-land, fill_screen USING 'KNA1-SPRAS' ls_cust-lang. PERFORM call_screen USING 'SAPMF02D' '0120' 'X'. PERFORM : fill_screen USING 'BDC_CURSOR' 'KNA1-LIFNR', fill_screen USING 'BDC_OKCODE' '/00'. PERFORM call_screen USING 'SAPMF02D' '0125' 'X'. PERFORM : fill_screen USING 'BDC_CURSOR' 'KNA1-NIELS', fill_screen USING 'BDC_OKCODE' '/00'. *** FILL TABLE FOR TABLE CONTROL ************ PERFORM call_screen USING 'SAPMF02D' '0130' 'X'. PERFORM fill_screen USING 'BDC_CURSOR' 'KNBK-KOINH(01)'. PERFORM fill_screen USING 'BDC_OKCODE' '=ENTR'. CLEAR idx. LOOP AT lt_bank INTO ls_bank WHERE cust_id = ls_cust-cust_id. idx = idx + 1. CLEAR : p_banks, p_bankl, p_bankn. CONCATENATE 'KNBK-BANKS(' idx ')' INTO p_banks. CONCATENATE 'KNBK-BANKL(' idx ')' INTO p_bankl. CONCATENATE 'KNBK-BANKN(' idx ')' INTO p_bankn. PERFORM fill_screen USING p_banks ls_bank-land.

Page 18: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

PERFORM fill_screen USING p_bankl ls_bank-bank_key. PERFORM fill_screen USING p_bankn ls_bank-acct. ENDLOOP. PERFORM call_screen USING 'SAPMF02D' '0130' 'X'. PERFORM : fill_screen USING 'BDC_CURSOR' 'KNBK-BANKS(01)', fill_screen USING 'BDC_OKCODE' '=UPDA'. CALL TRANSACTION 'XD01' USING lt_bdc MODE 'A' UPDATE 'A'. REFRESH lt_bdc[]. ENDLOOP. *&---------------------------------------------------------------------* *& Form CALL_SCREEN *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_0391 text * -->P_0392 text * -->P_0393 text *----------------------------------------------------------------------* FORM call_screen USING pgm dyn dyn_bgn. ls_bdc-program = pgm. ls_bdc-dynpro = dyn. ls_bdc-dynbegin = dyn_bgn. APPEND ls_bdc TO lt_bdc. CLEAR ls_bdc. ENDFORM. " CALL_SCREEN *&---------------------------------------------------------------------* *& Form FILL_SCREEN *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------*

Page 19: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

* -->P_0510 text * -->P_0511 text *----------------------------------------------------------------------* FORM fill_screen USING fnam fval . ls_bdc-fnam = fnam. ls_bdc-fval = fval. APPEND ls_bdc TO lt_bdc. CLEAR ls_bdc. ENDFORM. " FILL_SCREEN _______________________________________________________________________________ Step15. The excel file1 contains the customer header data.

Page 20: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step16. The excel file2 contains the customer bank details information.

Page 21: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step17. Run the program and select the two excel files to upload.

Step18. The XD01 screen is called. Hit the ENTER key from keyboard to continue.

Page 22: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step19. Hit the ENTER key from keyboard to continue.

Page 23: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step20. Hit the ENTER key from keyboard to continue.

Page 24: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step21. Hit the ENTER key from keyboard to continue.

Page 25: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step22. The customer bank information is filled in the table control. Hit the ENTER key from keyboard to continue.

Page 26: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step23. Hit the ENTER key from keyboard to continue.

Page 27: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step24. Hit the ENTER key from keyboard to continue.

Page 28: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step25. Hit the ENTER key from keyboard to continue.

Page 29: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step26. Hit the ENTER key from keyboard to continue.

Page 30: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step27. Hit the ENTER key from keyboard to continue.

Page 31: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step28. The customer bank information is filled in the table control. Hit the ENTER key from keyboard to continue.

Page 32: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step29. Hit the ENTER key from keyboard to continue.

Page 33: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step30. Hit the ENTER key from keyboard to continue.

Page 34: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step31. Hit the ENTER key from keyboard to continue.

Page 35: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step32. Hit the ENTER key from keyboard to continue.

Page 36: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step33. Hit the ENTER key from keyboard to continue.

Page 37: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step34. The customer bank information is filled in the table control. Hit the ENTER key from keyboard to continue.

Page 38: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step35. Hit the ENTER key from keyboard to continue.

Page 39: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step36. Hit the ENTER key from keyboard to continue.

Page 40: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step37. Hit the ENTER key from keyboard to continue.

Page 41: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step38. Hit the ENTER key from keyboard to continue.

Page 42: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step39. Hit the ENTER key from keyboard to continue.

Page 43: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step40. The customer bank information is filled in the table control area. Hit the ENTER key from keyboard to continue.

Page 44: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step41. Hit the ENTER key from keyboard to continue.

Page 45: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step42. Hit the ENTER key from keyboard to continue.

Page 46: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step43. Hit the ENTER key from keyboard to continue.

Page 47: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step44. Hit the ENTER key from keyboard to continue.

Page 48: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step45. Hit the ENTER key from keyboard to continue.

Page 49: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step46. The customer bank information is filled in the table control. Hit the ENTER key from keyboard to continue.

Page 50: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step47. Hit the ENTER key from keyboard to continue.

Page 51: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

Step48. The program terminates with successfully uploading the customer master details with the use of table control.

Page 52: Scenario: Uploading the customer master through BDC ... · Scenario: Uploading the customer master through BDC technique where multiple bank information of a particular customer needs

_____________________________________________________________________