Showing posts with label BDC. Show all posts
Showing posts with label BDC. Show all posts

Monday, September 21, 2020

How you can maintain Logs (or) Error records in Session method in SAP ABAP.

 

How you can maintain Logs (or) Error records in Session method?



Answer:

In Session method SAP is providing a Log file by default

No need to create a Log file for handling error records

You can find Log file by using SM35

Ø Go to SM35

Ø Select your session

Ø Select Log option (F7)

Ø Select your session

Ø Select Display button

Friday, September 11, 2020

Disadvantage Of Using Batch Input Session Method in SAP ABAP.

What Is The Biggest Disadvantage Of Using Batch Input Session Method?



Session Method Disadvantage in SAP ABAP.

When dealing with batch input sessions, there is a timing issue involving the creation of a batch input session and the processing of a batch input session. The creation and processing of batch input sessions are distinct or two different actions; therefore, they occur at different times.

Between the time a batch input session is created and the time it is processed, changes might have been made to the SAP database. These changes may result in errors when processing the batch input session.

For example, a BDC program creates a batch input session to insert 10000 materials into the SAP database. Before the session is processed, a SAP user inserts 20 of these materials into the SAP system. When the batch input session is finally processed, these 20 materials will result in errors because they cannot be inserted into the SAP database more than once. Also Batch Input Sessions cannot be run in parallel and hence are not fast.

Thursday, September 10, 2020

Differences between Session Method and Call Transaction Method in SAP ABAP.

What are the differences between Session Method and Call Transaction Method?.


Session Method and Call Transaction Method in SAP ABAP.

Ans :-

Session

Call Transaction

1. The standard Function modules 'BDC_OPEN_GROUP’, 'BDC_INSERT' and 'BDC_CLOSE_GROUP' are used to work with the session method.

1. The ABAP statement CALL TRANSACTION ….is used.

2. The data is updated in Synchronously mode (Record by Record).

2. The data is updated in both synchronous and Asynchronous modes.

3. An Error LOG File is generated by the system to handle the errors.

3. The messages/errors are manually handled explicitly using the structure BDCMSGCOLL & the function modules 'FORMAT_MESSAGE’ or 'WRITE_MESSAGE’ or the table T100.

4. Session method can process any no of transactions at a time.

4. Call Transaction can process only one transaction at a time.

5. After processing the session through SM35 only, the database is updated.

5. Immediate database updation.

6. Session method is slower.

6. Call transaction method is faster

7. We can schedule the session method in background.

7. We can’t schedule the call transaction in background.

Differences between LSMW and BDC in SAP ABAP.

What are the differences between LSMW and BDC?.


Differences between LSMW and BDC in SAP ABAP.

Ans :-

LSMW

BDC

1. It is the system provided tool.

1. It is the Utility to develop a program.

2. Doesn’t require any programming knowledge.

2. It requires programming knowledge..

3. The data can be imported in different import methods such are Batch Input Recording, BAPI and IDOC.

3. The data is processed or migrated in Batch Input Method only

4. The Field mapping is done automatically by the System.

4. The Field mapping should be done manually by passing the Flat data.

5. The T-Code LSMW is used.

5. The T-Code SM35 is used to develop BDC program

6. Mostly used for both Huge & small amount (Master) of data.

6. BDC can be used for Small amount of data only.

7. LSMW is possible for custom screens/standard with custom fields of applications.

7. BDC can be used custom screens/custom fields of application also.

What are the differences between BAPI and normal BDC IN SAP ABAP

What are the differences between BAPI and normal BDC IN SAP ABAP.



Differences between BAPI and normal BDC IN SAP ABAP.

BAPI BDC BAPI is faster than BDC. BDC is relatively slower than BAPI.

BAPI’s are used to upload the data from the flat file to SAP system directly.

BDC’s are used to upload the data from file to SAP system via screens hence it is slower. No such processing options are available in BAPI. Background and Foreground processing options are available for BDC.

BAPI would generally used for small data uploads.

BDCs would be preferred for large volumes of data upload since background processing option is available. 

BAPI never cause to terminate the program. Whenever an error occurred in the BAPI, it returns those errors through Return parameter. This parameter returns exception messages or success messages to the calling program. Errors can be processed in SM35 for session method and in the batch input program for Call Transaction method.

In BAPI recording is not required

In BDC, recording is required

Thursday, July 23, 2020

Send Mail Excel attachment program in SAP ABAP

Send Mail Excel attachment program in SAP ABAP.




DATA: lt_mailrecipients  TYPE STANDARD TABLE OF somlrec90 WITH HEADER LINE,

      lt_mailtxt         TYPE STANDARD TABLE OF soli      WITH HEADER LINE,

      lt_attachment      TYPE STANDARD TABLE OF solisti1  WITH HEADER LINE,

      lt_mailsubject     TYPE sodocchgi1,

      lt_packing_list    TYPE STANDARD TABLE OF sopcklsti1 WITH HEADER LINE,

      gv_cnt             TYPE i.


Add Recipients


lt_mailrecipients-rec_type  = 'U'.

lt_mailrecipients-com_type  = 'INT'.

lt_mailrecipients-RECEIVER  = 'someone@erpdb.info'.

APPEND lt_mailrecipients .

CLEAR lt_mailrecipients .


Put in the Mail Contents


lt_mailtxt = 'Hi How are you'.      APPEND lt_mailtxt. CLEAR lt_mailtxt.

lt_mailtxt = 'Here is a test mail'. APPEND lt_mailtxt. CLEAR lt_mailtxt.

lt_mailtxt = 'Thanks'.              APPEND lt_mailtxt. CLEAR lt_mailtxt.


Create the attachment


  DATA: BEGIN OF lt_po_data_cons OCCURS 0,

         ebeln LIKE ekpo-ebeln,

         ebelp LIKE ekpo-ebelp,

        END OF lt_po_data_cons.


  SELECT ebeln ebelp INTO TABLE lt_po_data_cons

  UP TO 10 ROWS

  FROM ekpo. 


  CLASS cl_abap_char_utilities DEFINITION LOAD.

  CONCATENATE 'PO' 'PO Line'

              INTO lt_attachment SEPARATED BY

              cl_abap_char_utilities=>horizontal_tab.

  APPEND lt_attachment. CLEAR lt_attachment.


  LOOP AT lt_po_data_cons.

  CONCATENATE lt_po_data_cons-ebeln lt_po_data_cons-ebelp

              INTO lt_attachment SEPARATED BY

              cl_abap_char_utilities=>horizontal_tab.


  CONCATENATE cl_abap_char_utilities=>newline lt_attachment

              INTO lt_attachment.


  APPEND lt_attachment. CLEAR lt_attachment.

 ENDLOOP.

Pack the mail contents and attachment

 lt_packing_list-transf_bin  = SPACE.

  lt_packing_list-head_start  = 1.

  lt_packing_list-head_num    = 0.

  lt_packing_list-body_start  = 1.

  lt_packing_list-body_num    = LINES( lt_mailtxt ).

  lt_packing_list-doc_type    = 'RAW'.

  APPEND lt_packing_list. CLEAR lt_packing_list.


  lt_packing_list-transf_bin  = 'X'.

  lt_packing_list-head_start  = 1.

  lt_packing_list-head_num    = 1.

  lt_packing_list-body_start  = 1.

  lt_packing_list-body_num    = LINES( lt_attachment ).

  lt_packing_list-doc_type    = 'XLS'. " You can give RAW incase if you want just a txt file.

  lt_packing_list-obj_name    = 'data.xls'.

  lt_packing_list-obj_descr   = 'data.xls'.

  lt_packing_list-doc_size    = lt_packing_list-body_num * 255.

  APPEND lt_packing_list. CLEAR lt_packing_list.


  lt_mailsubject-obj_name     = 'MAILATTCH'.

  lt_mailsubject-obj_langu    = sy-langu.

  lt_mailsubject-obj_descr    = 'You have got mail'.

  lt_mailsubject-sensitivty   = 'F'.

  gv_cnt = LINES( lt_attachment ).

  lt_mailsubject-doc_size     = ( gv_cnt - 1 ) * 255 + STRLEN(

  lt_attachment ).

Finally, send the mail out.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

      document_data              = lt_mailsubject

    TABLES

      packing_list               = lt_packing_list

      contents_bin               = lt_attachment

      contents_txt               = lt_mailtxt

      receivers                  = lt_mailrecipients

    EXCEPTIONS

      too_many_receivers         = 1

      document_not_sent          = 2

      document_type_not_exist    = 3

      operation_no_authorization = 4

      parameter_error            = 5

      x_error                    = 6

      enqueue_error              = 7

      OTHERS                     = 8.

  IF sy-subrc EQ 0.

    COMMIT WORK.

    SUBMIT rsconn01 WITH MODE = 'INT' AND RETURN.

  ENDIF.

Friday, February 21, 2020

C201 BDC UPLOAD Program in SAP ABAP.


C201 BDC UPLOAD Program in SAP ABAP.


C201 BDC Program in SAP ABAP.

*&---------------------------------------------------------------------*
*& Report ZPP01_UPLOAD
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
report zpp01_upload.

*report zpp01_upload
*       no standard page heading line-size 255.

* Include bdcrecx1_s:
* The call transaction using is called WITH AUTHORITY-CHECK!
* If you have own auth.-checks you can use include bdcrecx1 instead.
*include bdcrecx1_s.

tablessscrfields.
include <icon>.
types begin of ty_data,
          matnr     
type matnr,
          werks     
type werks_d,
          profident 
type char4,
          sttag     
type char10,
          statu     
type char1,
          verwe     
type char1,
          losvn     
type char1,
          losbs     
type char8,
          plnme     
type plnme,
          bmsch     
type string,
          meinh     
type vorme,
          vornr     
type vornr,
          phflg     
type phflg,
          pvznr     
type pvznr,
          phseq     
type phseq,
          arbpl     
type arbpl,
          ktsch     
type char4,
          ltxa1     
type char40,
          vgw01     
type string,
          vge01     
type string,
          lar01     
type string,
          vgw02     
type string,
          vge02     
type string,
          lar02     
type string,
          vgw03     
type string,
          vge03     
type string,
          lar03     
type string,
          vgw04     
type string,
          vge04     
type string,
          lar04     
type string,
          vgw05     
type string,
          vge05     
type string,
          lar05     
type string,
          vgw06     
type string,
          vge06     
type string,
          lar06     
type string,
          BMSCHN     
TYPE STRING" added
          mic       
type string,
          char      
type string,
          flag
(3)   type n,
        
end of ty_data.


field-symbols :<fsdata> type any.

types begin of ty_data1,
          matnr     
type matnr,
          werks     
type werks_d,
          profident 
type char4,
          sttag     
type char10,
          statu     
type char1,
          verwe     
type char1,
          losvn     
type char1,
          losbs     
type char8,
          plnme     
type plnme,
          bmsch     
type bmsch,
          meinh     
type vorme,
          vornr     
type vornr,
          flag
(3)   type n,
        
end of ty_data1.

types begin of ty_data2,
          phflg   
type phflg,
          pvznr   
type pvznr,
          phseq   
type phseq,
          arbpl   
type arbpl,
          ktsch   
type char4,
          ltxa1   
type char40,
          vgw01   
type string,
          vge01   
type string,
          lar01   
type string,
          vgw02   
type string,
          vge02   
type string,
          lar02   
type string,
          vgw03   
type string,
          vge03   
type string,
          lar03   
type string,
          vgw04   
type string,
          vge04   
type string,
          lar04   
type string,
          vgw05   
type string,
          vge05   
type string,
          lar05   
type string,
          vgw06   
type string,
          vge06   
type string,
          lar06   
type string,
          BMSCH    
TYPE STRING,
          mic     
type string,
          char    
type string,
          flag
(3type n,
        
end of ty_data2.


data wa_data  type ty_data,
       lt_data  
type table of ty_data,
       lt_data1 
type table of ty_data1,
       wa_data1 
type ty_data1,
       wa_data2 
type ty_data2,
       lt_data2 
type table of ty_data2.
data it_data type ty_data occurs with header line.

data  ind(2type c.
data  flag(3)  type n.
data var1(15type c.
data var2(15type c.
data var3(15type c.
data var4(15type c.
data var5(15type c.
data var6(15type c.
data var7(15type c.
data var8(15type c.
data var9(15type c.
data var10(15type c.
data var11(15type c.
data var12(15type c.
data var13(15type c.
data var14(15type c.
data var15(15type c.
data var16(15type c.
data var17(15type c.
data var18(15type c.
data var19(15type c.
data var20(15type c.


datait_bdcdata type standard table of bdcdata,
      wa_bdcdata 
type bdcdata,
      it_mess    
type standard table of bdcmsgcoll,
      wa_mess    
type bdcmsgcoll.

datait_upload type standard table of alsmex_tabline,
      wa_upload 
type alsmex_tabline.

data w_update type ctu_params-updmode,
       w_index  
type i,
       w_line   
type i,
       w_row    
type i value 1,
       v_s      
type char15.

datalv_lines type sy-tabix.
data  cont(3)  type n.
data:lv_filename type string,
     lv_fullpath 
type string,
     lv_path     
type string,
     lv_action   
type i,
     lv_file     
type string.


typesbegin of ty_final,
** data element: SPRAS
*        SPRAS_001(016),
** data element: ASNUM
*        ASNUM_002(018),
* data element: ASKTX
         asktx_003
(040),
* data element: ASTYP
         astyp_004
(004),
* data element: MEINS
         meins_005              
type meins,
* data element: MATKL_SRV
         matkl_006
(009),
* data element: BWKLL
         bklas_007
(009),
* data element: J_1B_TAX_TARIFF_CODE
         taxtariffcode_008
(016),
** data element: SPRAS
         tline
(132),
         ean11
(18),
*     new TYPE c,
       
end of ty_final.

datait_final type standard table of ty_final,
      wa_final 
type ty_final.
types:begin of excel_heading,
        
text(20type c,
      
end of excel_heading.

data:it_heading type standard table of excel_heading initial size 0,
     wa_heading 
type excel_heading.

field-symbols <fs> type any .
selection-screen begin of block b1 with frame title text-001.
parameters p_mode  type ctu_params-dismode default 'A' obligatory,
             p_fname 
type ibipparms-path.
selection-screen end of block b1.
selection-screen function key 1.
datals_sel_button type smp_dyntxt.

initialization.
  ls_sel_button
-icon_id icon_export.
  ls_sel_button
-quickinfo 'Download Production Version Template'.
  ls_sel_button
-icon_text 'Download Template'.
  sscrfields
-functxt_01 ls_sel_button.

at selection-screen.
  
case sscrfields-ucomm.
    
when 'FC01'.
      
perform export using 'ZPD'.
  
endcase.


at selection-screen on value-request for p_fname.
  
perform f4_filename.


start-of-selection.

  
perform upload_exceldata_itab.

  
if lt_data is not initial.

    
select from makt into table @data(lt_maktfor all entries in @lt_data where matnr @lt_data-matnr.

  
endif.

*  IT_DATA[] = LT_DATA[].

  
loop at lt_data into wa_data.

    it_data
-bmsch wa_data-bmsch.
    it_data
-matnr  wa_data-matnr.
    it_data
-werks  wa_data-werks.
    it_data
-profident wa_data-profident.
    it_data
-sttag wa_data-sttag.
    it_data
-statu wa_data-statu.
    it_data
-verwe wa_data-verwe.
    it_data
-losvn wa_data-losvn.
    it_data
-losbs wa_data-losbs.
    it_data
-plnme wa_data-plnme.
    it_data
-meinh wa_data-meinh.
    it_data
-vornr wa_data-vornr.
    wa_data2
-pvznr wa_data-pvznr.
    wa_data2
-phflg wa_data-phflg.
    wa_data2
-phseq wa_data-phseq.
    wa_data2
-arbpl wa_data-arbpl.
    wa_data2
-ktsch wa_data-ktsch.
    wa_data2
-ltxa1 wa_data-ltxa1.
    wa_data2
-vgw01 wa_data-vgw01.
    wa_data2
-vge01 wa_data-vge01.
    wa_data2
-lar01 wa_data-lar01.
    wa_data2
-vgw02 wa_data-vgw02.
    wa_data2
-vge02 wa_data-vge02.
    wa_data2
-lar02 wa_data-lar02.
    wa_data2
-vgw03 wa_data-vgw03.
    wa_data2
-vge03 wa_data-vge03.
    wa_data2
-lar03 wa_data-lar03.
    wa_data2
-vgw04 wa_data-vgw04.
    wa_data2
-vge04 wa_data-vge04.
    wa_data2
-lar04 wa_data-lar04.
    wa_data2
-vgw05 wa_data-vgw05.
    wa_data2
-vge05 wa_data-vge05.
    wa_data2
-lar05 wa_data-lar05.
    wa_data2
-vgw06 wa_data-vgw06.
    wa_data2
-vge06 wa_data-vge06.
    wa_data2
-lar06 wa_data-lar06.
    wa_data2
-bmsch wa_data-bmschn.
    wa_data2
-mic wa_data-mic.
    wa_data2
-char wa_data-char.

    
at new matnr.
      
add to flag.
    
endat.

    it_data
-flag flag.
    wa_data2
-flag flag.
    
append wa_data2 to lt_data2.
    
on change of it_data-matnr.
      
collect it_data.
    
endon.



  
endloop.


  
loop at it_data  .

    
read table lt_makt into data(ls_maktwith key matnr it_data-matnr.

*
*                               WA_DATA2-arbpl.
*pe
    
perform bdc_dynpro      using 'SAPLCPDI' '4000'.
    
perform bdc_field       using 'BDC_CURSOR'
                                  
'RC27M-MATNR'.
    
perform bdc_field       using 'BDC_OKCODE'
                                  
'/00'.
    
perform bdc_field       using 'RC271-PLNNR'
                                  
' '.
    
perform bdc_field       using 'RC27M-MATNR'
                                it_data
-matnr .
    
perform bdc_field       using 'RC27M-WERKS'
                                  it_data
-werks.
    
perform bdc_field       using 'RC271-PROFIDNETZ'
                                  it_data
-profident.
    
perform bdc_field       using 'RC271-STTAG'
                                  it_data
-sttag.
    
perform bdc_dynpro      using 'SAPLCPDA' '4210'.
    
perform bdc_field       using 'BDC_CURSOR'
                                  
'PLKOD-MEINH'.
    
perform bdc_field       using 'BDC_OKCODE'
                                  
'/00'.
    
perform bdc_field       using 'PLKOD-WERKS'
                                  it_data
-werks.
    
perform bdc_field       using 'PLKOD-PLNAL'
                                  
'1'.
    
perform bdc_field       using 'PLKOD-KTEXT'
                                  ls_makt
-maktx.
    
perform bdc_field       using 'PLKOD-VERWE'
                                  it_data
-verwe.
    
perform bdc_field       using 'PLKOD-STATU'
                                  it_data
-statu.
    
perform bdc_field       using 'PLKOD-VAGRP'
                                  
'1'.
    
perform bdc_field       using 'PLKOD-BMSCH'
                                  it_data
-bmsch.
    
perform bdc_field       using 'PLKOD-MEINH'
                                  it_data
-meinh.
    
perform bdc_field       using 'PLKOD-LOSBS'
                                  it_data
-losbs.
    
perform bdc_field       using 'PLKOD-PLNME'
                                 it_data
-plnme.
    
perform bdc_dynpro      using 'SAPLCPDA' '4210'.
    
perform bdc_field       using 'BDC_CURSOR'
                                  
'PLKOD-WERKS'.
    
perform bdc_field       using 'BDC_OKCODE'
                                  
'=VOUE'.
    
perform bdc_field       using 'PLKOD-WERKS'
                                  it_data
-werks.
    
perform bdc_field       using 'PLKOD-PLNAL'
                                  
'1'.
    
perform bdc_field       using 'PLKOD-KTEXT'
                                 ls_makt
-maktx.
    
perform bdc_field       using 'PLKOD-VERWE'
                                  it_data
-verwe.
    
perform bdc_field       using 'PLKOD-STATU'
                                  it_data
-statu.
    
perform bdc_field       using 'PLKOD-VAGRP'
                                  
'1'.
    
perform bdc_field       using 'PLKOD-BMSCH'
                                  it_data
-bmsch.
    
perform bdc_field       using 'PLKOD-MEINH'
                                 it_data
-meinh.
    
perform bdc_field       using 'PLKOD-LOSBS'
                                  it_data
-losbs.
    
perform bdc_field       using 'PLKOD-PLNME'
                                  it_data
-plnme.
    
perform bdc_dynpro      using 'SAPLCPDI' '4400'.
    
perform bdc_field       using 'BDC_CURSOR'
                                  
'PLPOD-STEUS(02)'.
    
perform bdc_field       using 'BDC_OKCODE'
                                  
'=ENT1'.

    
loop at lt_data2 into wa_data2 where flag it_data-flag.

      ind 
ind + 1.
      
concatenate 'PLPOD-PHFLG(' ind ') ' into var1.
      
condense var1.
      
concatenate 'PLPOD-PVZNR(' ind') ' into var2.
      
concatenate 'PLPOD-PHSEQ(' ind ') ' into var3.
      
concatenate 'PLPOD-ARBPL(' ind ') ' into var4.
*      concatenate 'PLPOD-KTSCH(' ind ') ' into var14.
      
concatenate 'PLPOD-STEUS(' ind ') ' into var5.
      
concatenate 'PLPOD-LTXA1(' ind ') ' into var6.
*      concatenate 'PLPOD-LTXA2(' ind ') ' into var7.
      
concatenate 'PLPOD-VGW01(' ind ') ' into var8.
      
concatenate 'PLPOD-VGW02(' ind ') ' into var9.
      
concatenate 'PLPOD-VGW03(' ind ') ' into var10.
      
concatenate 'PLPOD-VGW04(' ind ') ' into var11.
      
concatenate 'PLPOD-VGW05(' ind ') ' into var12.
      
concatenate 'PLPOD-VGW06(' ind ') ' into var13.
      
concatenate 'PLPOD-VGE01(' ind ') ' into var14.
      
concatenate 'PLPOD-VGE02(' ind ') ' into var15.
      
concatenate 'PLPOD-VGE03(' ind ') ' into var16.
      
concatenate 'PLPOD-VGE04(' ind ') ' into var17.
      
concatenate 'PLPOD-VGE05(' ind ') ' into var18.
      
concatenate 'PLPOD-VGE06(' ind ') ' into var19.
      
concatenate 'PLPOD-BMSCH(' ind ') ' into var20.

      
condensevar1,var2,var3,var4,var5,var6,var7,var8,var9,var10,var11,var12,var13,var14,var15,var16,var17,var18,var19VAR20.

      
perform bdc_field       using var1
                                    wa_data2
-phflg.
      
condense wa_data-pvznr.


      
perform bdc_field       using var2
                                    wa_data2
-pvznr.


      
perform bdc_field       using   var3
                                    wa_data2
-phseq.



      
perform bdc_field       using var4
                                    wa_data2
-arbpl.
*       perform bdc_field       using var14
*                                    wa_data2-ktsch.

      
perform bdc_field       using var5
                                     wa_data2
-ktsch.
*
*
      
perform bdc_field       using var6
                                    wa_data2
-ltxa1.

*      *************ADDED BY PK18/07
      
perform bdc_field       using var20
                                    wa_data2
-bmsch.

*      ****************************ADDED
      
perform bdc_field       using 'BDC_OKCODE'
                                         
'=ENT1'.


*      *****************ADDED
*      perform bdc_field       using var7
*                                    wa_data2-ltxa1.
      
if wa_data2-phflg eq 'X'.

        
perform bdc_field       using 'BDC_OKCODE'
                                         
'=ENT1'.
        
perform bdc_field       using 'RC27X-ENTRY_ACT'
                                            
'1'.

        
perform bdc_dynpro      using 'SAPLCPDI' '4400'.
        
perform bdc_field       using 'BDC_CURSOR'
                                       var8
.

*        perform bdc_field       using 'BDC_CURSOR'
*                                   var8.

        
condense wa_data2-vgw01.
        
perform bdc_field       using  var8
                                      wa_data2
-vgw01.

*      CONDENSE wa_data2-vgw02.
        
if wa_data2-vgw02 is not initial.
          
perform bdc_field       using  var9
                                        wa_data2
-vgw02.
        
endif.

        
if wa_data2-vgw03 is not initial.
          
perform bdc_field       using var10
                                       wa_data2
-vgw03.

        
endif.

        
if  wa_data2-vgw04 is not initial.
          
perform bdc_field       using var11
                                        wa_data2
-vgw04.
        
endif.

        
if wa_data2-vgw05 is not initial.
          
perform bdc_field       using var12    wa_data2-vgw05.
        
endif.
        
if wa_data2-vgw06 is not initial.
          
perform bdc_field       using var13
                                        wa_data2
-vgw06.
        
endif.
*        *********
        
if   wa_data2-vge01 is not initial.
          
perform bdc_field       using var14
                                      wa_data2
-vge01.
        
endif.
        
if wa_data2-vge02 is not initial.
          
perform bdc_field       using var15
                                      wa_data2
-vge02.
        
endif.
        
if wa_data2-vge03 is not initial.
          
perform bdc_field       using var16
                                    wa_data2
-vge03.
        
endif.
        
if wa_data2-vge04 is not initial.
          
perform bdc_field       using var17
                                  wa_data2
-vge04.
        
endif.
        
if wa_data2-vge05 is not initial.
          
perform bdc_field       using var18
                                wa_data2
-vge05.
        
endif.
        
if wa_data2-vge06 is not initial .
          
perform bdc_field       using var19
                                      wa_data2
-vge06.
        
endif.

      
endif.

****************mc1 changes

      
if  var8 'PLPOD-VGW01(2)'.


        
perform bdc_field       using 'BDC_CURSOR'
                                      
'PLPOD-VORNR(02)'.
        
perform bdc_field       using 'BDC_OKCODE'
                                      
'=QMUE'.
        
perform bdc_field       using 'RC27X-ENTRY_ACT'
                                      
'1'.
        
perform bdc_field       using 'RC27X-FLG_SEL(02)'
                                      
'X'.
        
perform bdc_field       using 'PLPOD-VGW01(02)'
                                      
'1.2'.
        
perform bdc_field       using 'PLPOD-VGE01(02)'
                                      
'ZII'.
        
perform bdc_field       using 'PLPOD-VGW02(02)'
                                      
'1'.
        
perform bdc_field       using 'PLPOD-VGE02(02)'
                                      
'ZII'.
        
perform bdc_field       using 'PLPOD-VGW03(02)'
                                      
'1'.
        
perform bdc_field       using 'PLPOD-VGE03(02)'
                                      
'ZII'.
        
perform bdc_field       using 'PLPOD-VGW04(02)'
                                      
'8.99'.
        
perform bdc_field       using 'PLPOD-VGE04(02)'
                                      
'ZII'.
        
perform bdc_field       using 'PLPOD-VGW05(02)'
                                      
'5.57'.
        
perform bdc_field       using 'PLPOD-VGE05(02)'
                                      
'ZII'.
        
perform bdc_field       using 'PLPOD-VGW06(02)'
                                      
'1.01'.
        
perform bdc_field       using 'PLPOD-VGE06(02)'
                                      
'ZII'.
        
perform bdc_dynpro      using 'SAPLQPAA' '0150'.
        
perform bdc_field       using 'BDC_CURSOR'
                                      
'PLMKB-VERWMERKM(01)'.

        
perform bdc_field       using 'BDC_OKCODE'
                                      
'/00'.
        
perform bdc_field       using 'PLMKB-VERWMERKM(01)'
                                      wa_data2
-mic.
        
perform bdc_field       using 'PLMKB-MKVERSION(01)'
                                      
'1'.
        
perform bdc_field       using 'PLMKB-QMTB_WERKS(01)'
                                      
''.
        
perform bdc_dynpro      using 'SAPLQPAA' '1501'.
        
perform bdc_field       using 'BDC_OKCODE'
                                      
'=ENT1'.
        
perform bdc_field       using 'BDC_CURSOR'
                                      
'PLMKB-VERWMERKM'.
        
perform bdc_field       using 'PLMKB-VERWMERKM'
                                       wa_data2
-mic..
        
perform bdc_field       using 'PLMKB-QPMK_WERKS'
                                      it_data
-werks.
        
perform bdc_field       using 'PLMKB-MKVERSION'
                                      
'1'.
        
perform bdc_dynpro      using 'SAPLQPAA' '0150'.
        
perform bdc_field       using 'BDC_CURSOR'
                                      
'PLMKB-STICHPRVER(01)'.
        
perform bdc_field       using 'BDC_OKCODE'
                                      
'/00'.
        
perform bdc_field       using 'RQPAS-ENTRY_ACT'
                                      
'1'.
        
perform bdc_field       using 'PLMKB-STICHPRVER(01)'
                                      wa_data2
-char.
        
perform bdc_dynpro      using 'SAPLQPAA' '0150'.
        
perform bdc_field       using 'BDC_CURSOR'
                                      
'PLMKB-STICHPRVER(01)'.
        
perform bdc_field       using 'BDC_OKCODE'
                                      
'=QMBW'.
        
perform bdc_field       using 'RQPAS-ENTRY_ACT'
                                      
'1'.
        
perform bdc_dynpro      using 'SAPLCPDI' '4400'.
        
perform bdc_field       using 'BDC_CURSOR'
                                      
'PLPOD-LTXA1(04)'.
        
perform bdc_field       using 'BDC_OKCODE'
                                      
'=ENT1'.
        
perform bdc_field       using 'RC27X-ENTRY_ACT'
                                      
'1'.
      
endif.

*        *****
*      endif.
      
perform bdc_dynpro      using 'SAPLCPDI' '4400'.
      
perform bdc_field       using 'BDC_CURSOR'
                                    
'PLPOD-VORNR(01)'.
      
perform bdc_field       using 'BDC_OKCODE'
                                    
'=BU'.
      
perform bdc_field       using 'RC27X-ENTRY_ACT'
                                     
'1'.
    
endloop.
**at END OF matnr.
    
call transaction 'C201' using it_bdcdata
                          
mode  p_mode messages
                          
into it_mess.
*endat.
    
clear ind.
    
refresh :it_bdcdata.
  
endloop.

  
loop at  it_mess into wa_mess.
    
data lv_text type string.
    
call function 'MASS_MESSAGE_GET'
      
exporting
        sprsl             
sy-langu
        arbgb             
wa_mess-msgid
        msgnr             
wa_mess-msgnr
        msgv1             
wa_mess-msgv1
        msgv2             
wa_mess-msgv1
        msgv3             
wa_mess-msgv1
        msgv4             
wa_mess-msgv1
      
importing
        msgtext           
lv_text
      
exceptions
        message_not_found 
1
        
others            2.
    
if sy-subrc <> 0.
* Implement suitable error handling here
    
endif.
    
write :/ lv_text.

*    write : / wa_mess-msgnr,
*              wa_mess-msgtyp,
*              wa_mess-msgv1,
*              wa_mess-msgv2,
*              wa_mess-msgv3,
*              wa_mess-msgv4,
*               wa_mess-msg

  
endloop.

*perform bdc_transaction using 'C201'.

*perform close_group.
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*&      --> P_
*&      --> P_
*&---------------------------------------------------------------------*
form bdc_dynpro  using    value(p_901)
                          
value(p_902).
  
clear wa_bdcdata.
  wa_bdcdata
-program  p_901.
  wa_bdcdata
-dynpro   p_902.
  wa_bdcdata
-dynbegin 'X'.
  
append wa_bdcdata to it_bdcdata.


endform.
*&---------------------------------------------------------------------*
*& Form BDC_FIELD
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*&      --> P_
*&      --> P_
*&---------------------------------------------------------------------*
form bdc_field  using    value(p_123)
                         
value(p_124).
  
clear wa_bdcdata.
  wa_bdcdata
-fnam p_123.
  wa_bdcdata
-fval p_124.
  
append wa_bdcdata to it_bdcdata.
endform.
*&---------------------------------------------------------------------*
*& Form F4_FILENAME
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
form f4_filename .
  
call function 'F4_FILENAME'
    
exporting
      program_name  
syst-cprog
      dynpro_number 
syst-dynnr
      field_name    
'P_FNAME'
    
importing
      file_name     
p_fname.



endform.
*&---------------------------------------------------------------------*
*& Form UPLOAD_EXCELDATA_ITAB
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
form upload_exceldata_itab .

  
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    
exporting
      filename                
p_fname
      i_begin_col             
'1'
      i_begin_row             
'6'
      i_end_col               
'38'
      i_end_row               
'60000'
    
tables
      intern                  
it_upload
    
exceptions
      inconsistent_parameters 
1
      upload_ole              
2
      
others                  3.
  
if sy-subrc is not initial.
    
write 'File Error'(001).
    
exit.
  
endif.
  
if it_upload[] is initial.
    
write 'No Data Uploaded'(002).
    
exit.
  
else.
    
loop at it_upload into wa_upload .

      
if wa_upload-row eq w_row.
        
move wa_upload-col to w_index.
        
assign component w_index of structure wa_data to <fs>.
        
if wa_upload-value is initial.
          
exit.
        
else.
          <fs> 
wa_upload-value.
        
endif.
        
at end of row.
          
append wa_data to lt_data.
          
clear wa_data.
          w_row 
wa_upload-row + .
        
endat.
      
else.
        
exit.
      
endif.
    
endloop.
  
endif.

endform.
*&---------------------------------------------------------------------*
*& Form EXPORT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*&      --> P_
*&---------------------------------------------------------------------*
form export  using  p_template_name.

  
call method cl_gui_frontend_services=>file_save_dialog
    
exporting
      window_title      
'Please Select The Location'
      default_extension 
'XLS'
      default_file_name 
lv_file
*FILE_FILTER = '*.XLS'
    
changing
      filename          
lv_filename
      path              
lv_path
      fullpath          
lv_fullpath
      user_action       
lv_action
    
exceptions
      cntl_error        
1
      error_no_gui      
2
      
others            3.

*   types:begin of excel_heading,
*           text(20) type c,
*         end of excel_heading.
*   data:it_heading type standard table of excel_heading initial size 0,
*        wa_heading type excel_heading.

*--Generate the heading for excel data

  wa_heading
-text 'operation unit'.
  
append wa_heading to it_heading.
  
clear wa_heading.
  wa_heading
-text 'operation'.
  
append wa_heading to it_heading.
  
clear wa_heading.
  wa_heading
-text 'phase op flag'.
  
append wa_heading to it_heading.
  
clear wa_heading.
  wa_heading
-text 'superior Operation'.
  
append wa_heading to it_heading.
  
clear wa_heading.
  wa_heading
-text 'Control Recipe Destination'.
  
append wa_heading to it_heading.
  
clear wa_heading.
  wa_heading
-text 'Resources'.
  
append wa_heading to it_heading.

  
clear wa_heading.
  wa_heading
-text 'Control Key'.
  
append wa_heading to it_heading.

  
clear wa_heading.
  wa_heading
-text 'Operation Text'.
  
append wa_heading to it_heading.


  
clear wa_heading.
  wa_heading
-text 'Value'.
  
append wa_heading to it_heading.


  
clear wa_heading.
  wa_heading
-text 'Resources'.
  
append wa_heading to it_heading.


  
clear wa_heading.
  wa_heading
-text 'Base Unit of measure'.
  
append wa_heading to it_heading.
  
clear wa_heading.
  wa_heading
-text 'Activity'.
  
append wa_heading to it_heading.
  
clear wa_heading.
  wa_heading
-text 'Value'.
  
append wa_heading to it_heading.

  
clear wa_heading.
  wa_heading
-text 'Base unit of measure'.
  
append wa_heading to it_heading.

  
clear wa_heading.
  wa_heading
-text 'Activity'.
  
append wa_heading to it_heading.

  
clear wa_heading.
  wa_heading
-text 'Value'.
  
append wa_heading to it_heading.

  
clear wa_heading.
  wa_heading
-text 'Base unit of measure'.
  
append wa_heading to it_heading.

  
clear wa_heading.
  wa_heading
-text 'Activity'.
  
append wa_heading to it_heading.
  
clear wa_heading.
  wa_heading
-text 'Value'.
  
append wa_heading to it_heading.
  
clear wa_heading.
  wa_heading
-text 'Base unit of measure'.
  
append wa_heading to it_heading.



  
clear wa_heading.
  wa_heading
-text 'Activity'.
  
append wa_heading to it_heading.

  
clear wa_heading.
  wa_heading
-text 'Value'.
  
append wa_heading to it_heading.

  
clear wa_heading.
  wa_heading
-text 'Base unit of measure'.
  
append wa_heading to it_heading.

  
clear wa_heading.
  wa_heading
-text 'Activity'.
  
append wa_heading to it_heading.

  
clear wa_heading.
  wa_heading
-text 'Value'.
  
append wa_heading to it_heading.

  
call function 'GUI_DOWNLOAD'
    
exporting
*     BIN_FILESIZE          =
      filename              
lv_fullpath
      filetype              
'DAT'
*     APPEND                = ' '
      write_field_separator 
'X'
    
tables
      data_tab              
it_final[]
      fieldnames            
it_heading[].

  
if sy-subrc <> 0.
* Implement suitable error handling here
  
endif.


endform.