0% found this document useful (0 votes)
447 views

ZBP Vendor Creation

The document describes the data types and structures used to create a vendor record in SAP. It includes details like the vendor's name, address, contact information, tax numbers, and bank account details. A loop will iterate through a table of vendor data and use BDC functionality to populate the fields and save each new vendor record to the SAP system. Any error messages returned during the process will be collected in message tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
447 views

ZBP Vendor Creation

The document describes the data types and structures used to create a vendor record in SAP. It includes details like the vendor's name, address, contact information, tax numbers, and bank account details. A loop will iterate through a table of vendor data and use BDC functionality to populate the fields and save each new vendor record to the SAP system. Any error messages returned during the process will be collected in message tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 16

report zbp_vendor_creation

no standard page heading line-size 255.

type-pools : truxs, slis, lfbw.

types : begin of ty_data,

creation_group type bus_joel_main-creation_group, " VENDOR GROUP


name1 type but000-name_org1, " NAME
bu_sort1_txt type bus000flds-bu_sort1_txt, " SEARCH TERMS
street type addr1_data-street, " STREET
street2 type addr1_data-str_suppl1,
street3 type addr1_data-str_suppl2,
street4 type addr1_data-str_suppl3,
post_code1 type addr1_data-post_code1,
city1 type addr1_data-city1,
country type addr1_data-country,
region type addr1_data-region,
langu type addr1_data-langu,
tel_number type sza1_d0100-tel_number,
mob_number type sza1_d0100-mob_number,
fax_number type sza1_d0100-fax_number,
smtp_addr type sza1_d0100-smtp_addr, " E-Mail
* taxtype type dfkkbptaxnum-taxtype, " tax cat
taxnumxl type dfkkbptaxnum-taxnumxl, " tax number
taxnumxl2 type dfkkbptaxnum-taxnumxl, " tax number
banks type but0bk-banks, " CONTRY
bankl type but0bk-bankl, " BANK KEY
bankn type but0bk-bankn, " BANK ACCT
koinh type but0bk-koinh , " BANK ACCOUNT HOLDER
accname type but0bk-accname, " ACCOUUNT NAME
bpkind type bus000flds-bpkind, " BP Type
group_feature type bp001-group_feature, " Grouping Charact
j_1ipanno type lfa1-j_1ipanno, " Pan Number
burks type bs001-bukrs, " Compay Code
akont type lfb1-akont,
zuawa type lfb1-zuawa,
zterm type lfb1-zterm,
witht type cvis_lfbw-witht,
wt_withcd type cvis_lfbw-wt_withcd,
wt_subjct type cvis_lfbw-wt_subjct,
qsrec type cvis_lfbw-qsrec,
ekorg type ekko-ekorg,
waers type lfm1-waers,
zterm1 type lfm1-zterm,
kalsk type lfm1-kalsk,
end of ty_data.

types: begin of yv_messages,


mtype type bapi_mtype,
id type symsgid,
number type symsgno,
message type bapi_msg,
message_v1 type symsgv,
message_v2 type symsgv,
message_v3 type symsgv,
message_v4 type symsgv,
fldname type fnam_____4,
end of yv_messages.
data: begin of bdcdata occurs 0.
include structure bdcdata.
data: end of bdcdata.

data: lx_auth_check type ref to cx_root.


data: messtab like bdcmsgcoll occurs 0 with header line.
data : gs_messages type bdcmsgcoll,
gt_messages type standard table of bdcmsgcoll,
gt_messages1 type standard table of bdcmsgcoll,
gs_messages1 type bdcmsgcoll.

data: gs_return type yv_messages,


gt_return type standard table of yv_messages.

data : it_fieldcatalog type slis_t_fieldcat_alv,


wa_fieldcatalog type slis_fieldcat_alv,
gwa_layout type slis_layout_alv,
t_sort type slis_t_sortinfo_alv,
wa_sort type slis_sortinfo_alv,
gd_repid like sy-repid,
gi_events type slis_t_event,
gi_events2 type slis_t_event,
gi_top_of_page type slis_t_listheader,
gi_top_of_page2 type slis_t_listheader.

data: gv_mtext type string.


data : it_data type table of ty_data,
wa_data type ty_data.

data : v_file type rlgrap-filename.


data : v_file1 type string.
data: it_raw type truxs_t_text_data.
data tot_count type i.

selection-screen begin of block b1 with frame title text-001.


parameters : pa_file like rlgrap-filename obligatory,
v_mode type ctu_params-dismode default 'A'.

parameters ctumode like ctu_params-dismode default 'A'.


parameters cupdate like ctu_params-updmode default 'L'.

selection-screen end of block b1.

at selection-screen on value-request for pa_file.


perform get_f4_for_file.

*include bdcrecx1.
start-of-selection.

v_file = pa_file.
v_file1 = pa_file.
perform upload_file using v_file.
*BREAK-POINT.
* perform open_group.
loop at it_data into wa_data.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1000_CRE_ORGA'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BDC_CURSOR'
'BUS_JOEL_MAIN-CHANGE_NUMBER'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1110_CHG_ROLE'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
wa_data-creation_group." 'ZV01'.
perform bdc_field using 'BDC_CURSOR'
'BUS_JOEL_MAIN-PARTNER_ROLE'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'SZA11_0100-TEL_COUNTR'
'IN'.
perform bdc_field using 'SZA11_0100-MOB_COUNTR'
'IN'.
perform bdc_field using 'SZA11_0100-FAX_COUNTR'
'IN'.

perform bdc_dynpro using 'SAPLSPO1' '0600'.


perform bdc_field using 'BDC_OKCODE'
'=OPT1'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1100_TAB_03'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BUS000FLDS-TITLE_MEDI'
'0003'.
perform bdc_field using 'BUT000-NAME_ORG1'
wa_data-name1." 'SAVIC2'.
perform bdc_field using 'BUS000FLDS-BU_SORT1_TXT'
wa_data-bu_sort1_txt ." 'SAV'.
perform bdc_field using 'BDC_CURSOR'
'SZA1_D0100-SMTP_ADDR'.
perform bdc_field using 'ADDR1_DATA-STR_SUPPL1'
wa_data-street2." 'STREET2'.
perform bdc_field using 'ADDR1_DATA-STR_SUPPL2'
wa_data-street3." 'STREET3'.
perform bdc_field using 'ADDR1_DATA-STREET'
wa_data-street." 'STREET1'.
perform bdc_field using 'ADDR1_DATA-STR_SUPPL3'
wa_data-street4." 'STREET4'.
perform bdc_field using 'ADDR1_DATA-POST_CODE1'
wa_data-post_code1." '624616'.
perform bdc_field using 'ADDR1_DATA-CITY1'
wa_data-city1." 'CHENNAI'.
perform bdc_field using 'ADDR1_DATA-COUNTRY'
wa_data-country." 'IN'.
perform bdc_field using 'ADDR1_DATA-REGION'
wa_data-region." '22'.
perform bdc_field using 'ADDR1_DATA-LANGU'
wa_data-langu."'EN'.
perform bdc_field using 'SZA1_D0100-TEL_NUMBER'
wa_data-tel_number." '24442444'.
perform bdc_field using 'SZA1_D0100-MOB_NUMBER'
wa_data-mob_number." '9535648245'.
perform bdc_field using 'SZA1_D0100-FAX_NUMBER'
wa_data-fax_number."
perform bdc_field using 'SZA1_D0100-SMTP_ADDR'
wa_data-smtp_addr." '[email protected]'.
perform bdc_field using 'SZA11_0100-TEL_COUNTR'
'IN'.
perform bdc_field using 'SZA11_0100-MOB_COUNTR'
'IN'.
perform bdc_field using 'SZA11_0100-FAX_COUNTR'
'IN'.
*

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1100_TAB_03'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BDC_CURSOR'
'BUS_JOEL_MAIN-CREATION_NUMBER'.
* perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
*
* perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.
* perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1100_TAB_04'.
* perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
* perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
* perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
wa_data-creation_group." 'ZV01'.
* perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
* perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
* perform bdc_field using 'BUS000FLDS-LOCATION_3'
'0'.

if wa_data-taxnumxl is not initial .


perform bdc_field using 'BDC_CURSOR'
'DFKKBPTAXNUM-TAXNUMXL(01)'.
perform bdc_field using 'DFKKBPTAXNUM-TAXTYPE(01)'
'in3'. "wa_data-taxtype."
perform bdc_field using 'DFKKBPTAXNUM-TAXNUMXL(01)'
wa_data-taxnumxl." '12312221544885'.
endif.
if wa_data-taxnumxl2 is not initial.

perform bdc_field using 'BDC_CURSOR'


'DFKKBPTAXNUM-TAXNUMXL(02)'.
perform bdc_field using 'DFKKBPTAXNUM-TAXTYPE(02)'
'in2'. "wa_data-taxtype."
perform bdc_field using 'DFKKBPTAXNUM-TAXNUMXL(02)'
wa_data-taxnumxl2." '12312221544885'.
endif.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1100_TAB_04'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
wa_data-creation_group." 'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BUS000FLDS-LOCATION_3'
'0'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_ENTER'.
* perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
* perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
* perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
'ZV01'.
* perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
* perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BDC_CURSOR'
'BUS000FLDS-BPKIND'.
perform bdc_field using 'BUS000FLDS-BPKIND'
wa_data-bpkind." '001'.
* perform bdc_field using 'BDC_CURSOR'
'BUT000-AUGRP'.
perform bdc_field using 'GS_BP001-GROUP_FEATURE'
wa_data-group_feature. " '0001'.
if wa_data-bankl is not initial. "'12345'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1100_TAB_05'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
* perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
* perform bdc_field using 'BUS000FLDS-BPKIND'
'001'.
* perform bdc_field using 'BDC_CURSOR'
'BUT000-AUGRP'.
* perform bdc_field using 'BUT000-AUGRP'
'0001'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_ENTER'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
* perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.

perform bdc_field using 'BDC_CURSOR'


'GT_BUT0BK-ACCNAME(01)'.
perform bdc_field using 'GT_BUT0BK-BANKS(01)'
wa_data-banks ."'in'.
perform bdc_field using 'GT_BUT0BK-BANKL(01)'
wa_data-bankl."'KVBL0001128'.
perform bdc_field using 'GT_BUT0BK-BANKN(01)'
wa_data-bankn."'1128155000071214'.
perform bdc_field using 'GT_BUT0BK-KOINH(01)'
wa_data-koinh."'savic'.
perform bdc_field using 'GT_BUT0BK-ACCNAME(01)'
wa_data-accname." 'savic'.

endif.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1100_TAB_09'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
wa_data-creation_group." 'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1100_TAB_08'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP' wa_data-
creation_group." 'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BDC_CURSOR'
'CVIS_LFAT-TEXT30(10)'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_ENTER'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP' wa_data-
creation_group." 'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BDC_CURSOR'
'GS_LFA1-STGDL'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1000_MAIN_P02'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
wa_data-creation_group." 'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BDC_CURSOR'
'GS_LFA1-STGDL'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_ENTER'.
* perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
* perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
* perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
wa_data-creation_group." 'ZV01'.
* perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
* perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BDC_CURSOR' 'BS001-
BUKRS'.
perform bdc_field using 'BS001-BUKRS'
wa_data-burks. " '1000'.
perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_ENTER'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1100_TAB_02'.
perform bdc_field using 'BDC_CURSOR'
'BUS_LOCA_SRCH01-SEARCH_ID'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP' wa_data-
creation_group." 'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'GS_LFB1-AKONT'
wa_data-akont." '21800091'.
perform bdc_field using 'GS_LFB1-ZUAWA'
wa_data-zuawa." '012'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1100_TAB_05'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
wa_data-creation_group." 'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BDC_CURSOR'
'GS_LFB1-ZTERM'.
perform bdc_field using 'GS_LFB1-ZTERM'
wa_data-zterm. " '0001'.
if wa_data-witht is not initial.
perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.
perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_ENTER'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
wa_data-creation_group." 'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BDC_CURSOR'
'CVIS_LFBW-QSREC(01)'.
perform bdc_field using 'CVIS_LFBW-WITHT(01)'
wa_data-witht." 't2'.
perform bdc_field using 'CVIS_LFBW-WT_WITHCD(01)'
wa_data-wt_withcd." 'T2'.
perform bdc_field using 'CVIS_LFBW-WT_SUBJCT(01)'
wa_data-wt_subjct." 'X'.
perform bdc_field using 'CVIS_LFBW-QSREC(01)'
wa_data-qsrec." 'CO'.
endif.
perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.
perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1100_TAB_07'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
wa_data-creation_group." 'ZV01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BDC_CURSOR'
'CVIS_LFBW-QSREC(01)'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1110_CHG_ROLE'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-CREATION_GROUP'
wa_data-creation_group." 'ZV01'.
perform bdc_field using 'BDC_CURSOR'
'BUS_JOEL_MAIN-PARTNER_ROLE'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.

perform bdc_dynpro using 'SAPLSPO1' '0600'.


perform bdc_field using 'BDC_OKCODE'
'=OPT2'.
perform bdc_transaction using 'BP'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_ENTER'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BDC_CURSOR'
'BUS_JOEL_MAIN-PARTNER_ROLE'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_ENTER'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BDC_CURSOR'
'BUS_JOEL_MAIN-PARTNER_ROLE'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_ENTER'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BDC_CURSOR'
'BUS_JOEL_MAIN-PARTNER_ROLE'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1000_ACTIVITY'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BDC_CURSOR'
'BUS_JOEL_MAIN-PARTNER_ROLE'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN00'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1110_CHG_ROLE'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BDC_CURSOR'
'BUS_JOEL_MAIN-PARTNER_ROLE'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'GS_LFB1-AKONT'
wa_data-akont." '21800091'.
perform bdc_field using 'GS_LFB1-ZUAWA'
wa_data-zuawa." '012'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1100_TAB_10'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BDC_CURSOR'
'BUS000FLDS-TITLE_MEDI'.
* perform bdc_field using 'BUS000FLDS-TITLE_MEDI'
'0003'.
* perform bdc_field using 'BUT000-NAME_ORG1'
'SAVIC2'.
* perform bdc_field using 'BUS000FLDS-BU_SORT1_TXT'
'SAV'.
* perform bdc_field using 'ADDR1_DATA-STR_SUPPL1'
'STREET2'.
* perform bdc_field using 'ADDR1_DATA-STR_SUPPL2'
'STREET3'.
* perform bdc_field using 'ADDR1_DATA-STREET'
'STREET1'.
* perform bdc_field using 'ADDR1_DATA-STR_SUPPL3'
'STREET4'.
* perform bdc_field using 'ADDR1_DATA-POST_CODE1'
'624616'.
* perform bdc_field using 'ADDR1_DATA-CITY1'
'CHENNAI'.
* perform bdc_field using 'ADDR1_DATA-COUNTRY'
'IN'.
* perform bdc_field using 'ADDR1_DATA-REGION'
'22'.
* perform bdc_field using 'ADDR1_DATA-TIME_ZONE'
'INDIA'.
* perform bdc_field using 'ADDR1_DATA-LANGU'
'EN'.
* perform bdc_field using 'SZA1_D0100-TEL_NUMBER'
'24442444'.
* perform bdc_field using 'SZA1_D0100-MOB_NUMBER'
'9535648245'.
* perform bdc_field using 'SZA1_D0100-SMTP_ADDR'
'[email protected]'.
* perform bdc_field using 'BUS000FLDS-ADDR_VALID_FROM'
'05.10.2017'.
* perform bdc_field using 'BUS000FLDS-ADDR_VALID_TO'
'31.12.9999'.
* perform bdc_field using 'SZA11_0100-TEL_COUNTR'
'IN'.
* perform bdc_field using 'SZA11_0100-MOB_COUNTR'
'IN'.
* perform bdc_field using 'SZA11_0100-FAX_COUNTR'
'IN'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=SCREEN_1000_MAIN_P02'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BDC_CURSOR'
'GS_LFA1-J_1IPANNO'.
perform bdc_field using 'GS_LFA1-J_1IPANNO'
wa_data-j_1ipanno ." '656894231563'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_ENTER'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
* perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_RO LE'
'FLVN01'.
* perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'BDC_CURSOR'
'GV_PURCHASING_ORG'.
perform bdc_field using 'GV_PURCHASING_ORG'
wa_data-ekorg." '1010'.

perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.


perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_ENTER'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN01'.
perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
perform bdc_field using 'GS_LFM1-WAERS'
wa_data-waers." 'INR'.
perform bdc_field using 'GS_LFM1-ZTERM'
wa_data-zterm1." ''.
perform bdc_field using 'BDC_CURSOR'
'GS_LFM1-KALSK'.
perform bdc_field using 'GS_LFM1-KALSK'
wa_data-kalsk." 'F1'.

perform bdc_field using 'BDC_OKCODE'


'=BUS_MAIN_SAVE'.
* perform bdc_dynpro using 'SAPLBUS_LOCATOR' '3000'.
* perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_SAVE'.
*********
*
* perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_TYPE'
'1'.
* perform bdc_field using 'BUS_LOCA_SRCH01-SEARCH_ID'
'7'.
* perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_ROLE'
'FLVN01'.
* perform bdc_field using 'BUS_JOEL_MAIN-PARTNER_TIMEDEP'
'000001'.
* perform bdc_field using 'GS_LFM1-WAERS'
'INR'.
* perform bdc_field using 'BDC_CURSOR'
'GS_LFM1-KALSK'.
* perform bdc_field using 'GS_LFM1-KALSK'
'F1'.
* perform bdc_transaction using 'BP'.

perform bdc_field using 'BDC_OKCODE'


'=BUS_MAIN_ENTER'.
perform bdc_field using 'BDC_OKCODE'
'=BUS_MAIN_SAVE'.

* perform close_group.

call transaction 'BP' using bdcdata mode v_mode update 'S' messages into
gt_messages.

clear bdcdata[].
if not gt_messages[] is initial.

delete gt_messages where msgtyp = 'I' or msgtyp = 'W' . " Warning and Info
message type removed

loop at gt_messages into gs_messages.


"To get the Message Text
call function 'MASS_MESSAGE_GET'
exporting
arbgb = gs_messages-msgid
msgnr = gs_messages-msgnr
msgv1 = gs_messages-msgv1
msgv2 = gs_messages-msgv2
msgv3 = gs_messages-msgv3
msgv4 = gs_messages-msgv4
importing
msgtext = gv_mtext
exceptions
message_not_found = 1
others = 2.
if sy-subrc = 0.
gs_return-mtype = gs_messages-msgtyp.
gs_return-id = gs_messages-msgid.
gs_return-number = gs_messages-msgnr.
gs_return-message = gv_mtext.
gs_return-message_v1 = gs_messages-msgv1.
gs_return-message_v2 = gs_messages-msgv2.
gs_return-message_v3 = gs_messages-msgv3.
gs_return-message_v4 = gs_messages-msgv4.
gs_return-fldname = gs_messages-fldname.
append gs_return to gt_return.
endif.
endloop.
refresh gt_messages.
clear gs_messages.
endif.
endloop.
**----------------------------------------------------------------------*
** dynpro *
**----------------------------------------------------------------------*
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.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
condense bdcdata-fval.
append bdcdata.
endform. "bdc_field
form bdc_transaction using tcode.

data: l_mstring(480).
data: l_subrc like sy-subrc.
* data: lx_auth_check type ref to cx_root.
data: l_auth_check_text type string.

refresh messtab.
try.
call transaction tcode with authority-check using bdcdata
mode ctumode
update cupdate
messages into messtab.
catch cx_sy_authorization_error into lx_auth_check.
* Authorization missing for user when executing transaction
l_auth_check_text = lx_auth_check->get_text( ).
sy-subrc = 99.
endtry.
l_subrc = sy-subrc.

* if smalllog <> 'X'.


write: / 'CALL_TRANSACTION',
tcode,
'returncode:'(I05),
l_subrc,
'RECORD:',
sy-index.
if l_subrc <> 99.
loop at messtab.
message id messtab-msgid
type messtab-msgtyp
number messtab-msgnr
into l_mstring
with messtab-msgv1
messtab-msgv2
messtab-msgv3
messtab-msgv4.
write: / messtab-msgtyp, l_mstring(250).
endloop.
else.
write: / l_auth_check_text.
endif.
skip.
* endif.
refresh bdcdata.
endform.
*&---------------------------------------------------------------------*
*& Form GET_F4_FOR_FILE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
form get_f4_for_file .

call function 'F4_FILENAME'


exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'PA_FILE'
importing
file_name = pa_file.
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 UPLOAD_FILE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
* -->P_V_FILE text
*&---------------------------------------------------------------------*
form upload_file using p_v_file.

call function 'TEXT_CONVERT_XLS_TO_SAP'


exporting
* i_field_seperator = ' '
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = v_file
tables
i_tab_converted_data = it_data
exceptions
conversion_failed = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
clear v_file.

endform.

You might also like