Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 9057

Hi i want to display error message in my bdc program, that when i give a wrong entry (like kb instead og KG ) , an error msg has to be displayed,

$
0
0

*&---------------------------------------------------------------------*
*& Report  ZBDCREC6
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*


report ZBDCLAK
        no standard page heading line-size 255.

data : begin of ltab occurs 0 ,
   tab1(10),
   tab2(10),
   tab3(10),
   tab4(10),
   tab5(10),
   end of ltab.

   DATA : bdcdata TYPE TABLE OF bdcdata WITh HEADER LINE .
DATA : it TYPE TABLE OF itab WITH HEADER LINE .

DATA : BDCMSG TYPE TABLE OF BDCMSGCOLL.



START-OF-SELECTION.
data : bdctab like bdcdata occurs 0 with header line.




CALL FUNCTION 'GUI_UPLOAD'


     EXPORTING
       filename                      = 'd:\LocalData\z011777\Desktop\rec.txt'

    FILETYPE                      = 'ASC'
      has_field_separator           = 'X'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            =
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =



     TABLES
       data_tab                      = ltab.



loop at ltab.

   refresh bdctab.

perform bdc_dynpro      using 'SAPLMGMM' '0060'.

perform bdc_field       using 'BDC_CURSOR'
                               'RMMG1-MBRSH'.
perform bdc_field       using 'BDC_OKCODE'
                               '=ENTR'.
perform bdc_field       using 'RMMG1-MATNR'
                               ltab-tab1.
perform bdc_field       using 'RMMG1-MBRSH'
                               ltab-tab2.
perform bdc_field       using 'RMMG1-MTART'
                               ltab-tab3.
perform bdc_dynpro      using 'SAPLMGMM' '0070'.
perform bdc_field       using 'BDC_CURSOR'
                               'MSICHTAUSW-DYTXT(01)'.
perform bdc_field       using 'BDC_OKCODE'
                               '=ENTR'.
perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                               'X'.
perform bdc_dynpro      using 'SAPLMGMM' '4004'.
perform bdc_field       using 'BDC_OKCODE'
                               '/00'.
perform bdc_field       using 'MAKT-MAKTX'
                               ltab-tab4.
perform bdc_field       using 'BDC_CURSOR'
                               'MARA-MEINS'.
perform bdc_field       using 'MARA-MEINS'
                               ltab-tab5.
perform bdc_field       using 'MARA-MTPOS_MARA'
                               'NORM'.
perform bdc_dynpro      using 'SAPLSPO1' '0300'.
perform bdc_field       using 'BDC_OKCODE'
                               '=YES'.

   call transaction 'MM01' using bdctab mode 'e' MESSAGES INTO  BDCMSG.
endloop.
*
*  DATA : WA_BDCMSG LIKE LINE OF BDCMSG.
*  IF BDCMSG IS NOT INITIAL.
*    LOOP AT BDCMSG INTO WA_BDCMSG.
*      WRITE:/ WA_BDCMSG-TCODE, WA_BDCMSG-MSGTYP, WA_BDCMSG-MSGV1, WA_BDCMSG-FLDNAME .
*      CLEAR WA_BDCMSG.
*    ENDLOOP.
*  ENDIF.



*perform close_group.

*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
   CLEAR BDCtab.
   BDCtab-PROGRAM  = PROGRAM.
   BDCtab-DYNPRO   = DYNPRO.
   BDCtab-DYNBEGIN = 'X'.
   APPEND BDCtab.
ENDFORM.

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
   CLEAR BDCtab.
   BDCtab-FNAM = FNAM.
   BDCtab-FVAL = FVAL.
   APPEND BDCtab.
ENDFORM.


Viewing all articles
Browse latest Browse all 9057

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>