0% found this document useful (0 votes)
458 views6 pages

BDC Session Va01

This document contains code for summarizing sales order data from an Excel file into an internal table and then using BDC functionality to post the order data into an SAP system. The code first reads the Excel file and stores the cell values in an internal table. It then loops through the internal table, assigns the values to structures, and inserts them into BDC tables to populate dialog screens for order creation. Finally it executes the BDC to generate the sales orders in the SAP system.

Uploaded by

srikanth549
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
458 views6 pages

BDC Session Va01

This document contains code for summarizing sales order data from an Excel file into an internal table and then using BDC functionality to post the order data into an SAP system. The code first reads the Excel file and stores the cell values in an internal table. It then loops through the internal table, assigns the values to structures, and inserts them into BDC tables to populate dialog screens for order creation. Finally it executes the BDC to generate the sales orders in the SAP system.

Uploaded by

srikanth549
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

*&---------------------------------------------------------------------* *& Report ZGBS17_76_SESSION_VA01 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZGBS17_76_SESSION_VA01.

types : begin of types_va01, auart type auart, " order type kunnr type kunnr, "customer number BSTKD type BSTKD, "unique number BSTDK type BSTDK, " PO date LIFSK type LIFSK, " delivary block FAKSK type FAKSK, "billing block PRSDT type PRSDT, "pricing date mabnr type MAtNR, "mat .no KWMENG type KWMENG, " quantity end of types_va01, begin of types_itab. include STRUCTURE alsmex_tabline. types : end of types_itab, begin of types_bdc. INCLUDE STRUCTURE bdcdata. types : end of types_bdc. data : itab_va01 type STANDARD TABLE OF types_va01, wa_va01 type types_va01, itab_table type STANDARD TABLE OF types_itab, wa_table type types_itab, itab_bdc type STANDARD TABLE OF types_bdc, wa_bdc type types_bdc. PARAMETERS : path type localfile DEFAULT 'C:\'. AT SELECTION-SCREEN on VALUE-REQUEST FOR path. call function 'F4_FILENAME' exporting field_name = 'PATH' importing file_name = path.

START-OF-SELECTION. call function 'ALSM_EXCEL_TO_INTERNAL_TABLE' EXPORTING filename = path i_begin_col = 1 i_begin_row = 1 i_end_col = 9 i_end_row = 3 TABLES intern = itab_table. if itab_table is not INITIAL. loop at itab_table into wa_table. CASE wa_table-col. WHEN 1. wa_va01-auart = wa_table-value. WHEN 2. wa_va01-kunnr = wa_table-value. WHEN 3. wa_va01-BSTKD = wa_table-value. WHEN 4. wa_va01-BSTDK = wa_table-value. WHEN 5. wa_va01-LIFSK = wa_table-value. WHEN 6. wa_va01-FAKSK = wa_table-value. WHEN 7. wa_va01-PRSDT = wa_table-value. WHEN 8. wa_va01-mabnr = wa_table-value. WHEN 9. wa_va01-KWMENG = wa_table-value. WHEN OTHERS. ENDCASE. at END OF row. append wa_va01 to itab_va01. clear wa_va01. ENDAT. ENDLOOP. endif. IF itab_va01 is not INITIAL. loop at itab_va01 into wa_va01. call function 'BDC_OPEN_GROUP' EXPORTING client = sy-mandt group = 'ZGBS17_76' keep = 'X'

user = sy-uname.

refresh itab_bdc. clear wa_bdc. perform bdc_dynpro perform bdc_field perform bdc_field perform bdc_field *perform bdc_field * *perform bdc_field * *perform bdc_field * perform bdc_dynpro perform bdc_field perform bdc_field perform bdc_field perform bdc_field *perform bdc_field * *perform bdc_field * *perform bdc_field * perform bdc_dynpro perform bdc_field *perform bdc_field * perform bdc_field *perform bdc_field * *perform bdc_field * perform bdc_field *perform bdc_field * using 'SAPMV45A' '0101'. using 'BDC_CURSOR' 'VBAK-AUART'. using 'BDC_OKCODE' '/00'. using 'VBAK-AUART' wa_va01-auart. using 'VBAK-VKORG' record-VKORG_002. using 'VBAK-VTWEG' record-VTWEG_003. using 'VBAK-SPART' record-SPART_004. using 'SAPMV45A' '4001'. using 'BDC_OKCODE' '/00'. using 'BDC_CURSOR' 'VBKD-BSTKD'. using 'VBKD-BSTKD' wa_va01-BSTKD. using 'KUAGV-KUNNR' wa_va01-kunnr. using 'RV45A-KETDAT' record-KETDAT_007. using 'RV45A-KPRGBZ' record-KPRGBZ_008. using 'VBKD-PRSDT' record-PRSDT_009. using 'SAPMV45A' '4001'. using 'BDC_OKCODE' '/00'. using 'VBKD-BSTKD' record-BSTKD_010. using 'VBKD-BSTDK' wa_va01-BSTDK. using 'KUAGV-KUNNR' record-KUNNR_012. using 'KUWEV-KUNNR' record-KUNNR_013. using 'BDC_CURSOR' 'VBAK-LIFSK'. using 'RV45A-KETDAT' record-KETDAT_014.

*perform bdc_field * perform bdc_field perform bdc_field perform bdc_field *perform bdc_field * *perform bdc_field * perform bdc_dynpro perform bdc_field *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * perform bdc_field perform bdc_field perform bdc_dynpro perform bdc_field *perform bdc_field * *perform bdc_field * *perform bdc_field

using 'RV45A-KPRGBZ' record-KPRGBZ_015. using 'VBAK-LIFSK' wa_va01-LIFSK. using 'VBAK-FAKSK' wa_va01-FAKSK. using 'VBKD-PRSDT' wa_va01-PRSDT. using 'VBKD-ZTERM' record-ZTERM_019. using 'VBKD-INCO1' record-INCO1_020. using 'SAPMV45A' '4001'. using 'BDC_OKCODE' '/00'. using 'VBKD-BSTKD' record-BSTKD_021. using 'VBKD-BSTDK' record-BSTDK_022. using 'KUAGV-KUNNR' record-KUNNR_023. using 'KUWEV-KUNNR' record-KUNNR_024. using 'RV45A-KETDAT' record-KETDAT_025. using 'RV45A-KPRGBZ' record-KPRGBZ_026. using 'VBAK-LIFSK' record-LIFSK_027. using 'VBAK-FAKSK' record-FAKSK_028. using 'VBKD-PRSDT' record-PRSDT_029. using 'VBKD-ZTERM' record-ZTERM_030. using 'VBKD-INCO1' record-INCO1_031. using 'BDC_CURSOR' 'RV45A-MABNR(01)'. using 'RV45A-MABNR(01)' wa_va01-mabnr. using 'SAPMV45A' '4001'. using 'BDC_OKCODE' '/00'. using 'VBKD-BSTKD' record-BSTKD_033. using 'VBKD-BSTDK' record-BSTDK_034. using 'KUAGV-KUNNR'

* *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * *perform bdc_field * perform bdc_field perform bdc_field

record-KUNNR_035. using 'KUWEV-KUNNR' record-KUNNR_036. using 'RV45A-KETDAT' record-KETDAT_037. using 'RV45A-KPRGBZ' record-KPRGBZ_038. using 'VBAK-LIFSK' record-LIFSK_039. using 'VBAK-FAKSK' record-FAKSK_040. using 'VBKD-PRSDT' record-PRSDT_041. using 'VBKD-ZTERM' record-ZTERM_042. using 'VBKD-INCO1' record-INCO1_043. using 'BDC_CURSOR' 'RV45A-KWMENG(01)'. using 'RV45A-KWMENG(01)' wa_va01-KWMENG.

call function 'BDC_INSERT' EXPORTING tcode = 'VA01' tables dynprotab = itab_bdc.

CALL FUNCTION 'BDC_CLOSE_GROUP'.

ENDLOOP. ENDIF. form BDC_DYNPRO using program dynpro.

clear wa_bdc. wa_bdc-program = program. wa_bdc-dynbegin = 'X'. wa_bdc-dynpro = dynpro. append wa_bdc to itab_bdc. endform. " BDC_DYNPRO *&---------------------------------------------------------------------* *& Form BDC_FIELD *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------*

* -->P_0176 text * -->P_WA_VA01_VBELN text *----------------------------------------------------------------------* form BDC_FIELD using fieldname fieldval. clear wa_bdc. wa_bdc-fnam = fieldname. wa_bdc-fval = fieldval. append wa_bdc to itab_bdc. endform. " BDC_FIELD

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy