Ws_upload or upload ?

Hi all,
I see people are working on the long weekend too.. Oh.. life as an ABAPer...
What is the difference between ws_upload and upload functions? Which to use? I think the same difference would apply to ws_download and download too.. right?
Could you give examples too?
What is presentation server counterpart for ws_query (which is used for finding the file size of application server files)?
Thanks.
Charles.
++++++++++++++++++++++++++++

hi,
Both upload and ws_upload does the same functionality, that is transfere data from presentation server to application server or from PC to SAP system(to an internal table).
There are very few difference between the two.
1 Upload requires a User Interaction for uploading i.e., user has to respond to the dialog boxes that appear WS_Upload does not. You just need to specify the file location in the function input parameters itself.
2 upload - u can give the file in run time wsupload - u have to give in Function module
3 upload is meant to be used by abappers. ws_upload is meant to be called by SAP. It is not a standard ABAP command.
4 ws_upload is Obsolete : No longer supported by SAP. Use GUI_UPLOAD instead.
Regards,
Naveen

Similar Messages

  • Problem in uploading a file using Ws_upload.

    Hi Experts,
                        I am using WS_UPLOAD for uploading .xls file into SAP Standard table T558A.
    Problem is file is not uploaded to DB table.....getting error like
    ERROR DURING FILE UPLOAD/DOWNLOAD as  pop up message.....
    can any boady please help on this issue.
    Regards,
    Praveena.

    Hi,
    If you want to upload the data using EXCEL file use the function module ALSM_EXCEL_TO_INTERNAL_TABLE.
    Examples for ALSM_EXCEL_TO_INTERNAL_TABLE.
    http://wiki.sdn.sap.com/wiki/display/Snippets/Howtouse+FM'ALSM_EXCEL_TO_INTERNAL_TABLE'

  • SWUO_CREATE_TEMPLATE_API - file Upload

    Hi,
    When uploading data from an excel to the program using the FM SWUO_CREATE_TEMPLATE_API, the characters
    are all junk characters,
    Using this FM since it gives a good user interface with the container elements of the WF template and also the
    Excel view of he upload file,
    there seems to have been some change in the class that this FM uses, beforeit was using 'WS_UPLOAD' to upload the file and now it uses,  call method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD, and both are using the filetype as BIN,
    So not sure why this issue is caused, it is working fine with the old version. we are in the process of an upgrade from 4.6c to 6.0.
    Would it be due to some security settings or role.
    Appreciate any input.
    Thank you
    Lalitha

    I forgot to mention that we are using version 10.1.4 of the portal.
    Thanks,
    Roger

  • Attaching text file using SO_NEW_DOCUMENT_ATT_SEND_API1

    hello guys, i'm a newbie here.
    I'm having trouble attaching an existing text file using function 'SO_NEW_DOCUMENT_ATT_SEND_API1'. It seems i can't find the right combination of parameters that are being passed to this function.
    first, i'm using WS_UPLOAD to upload the text file to an internal table then i'm creating all the neccessary internal tables that will be use by this function..
    By the way, i'm trying to send mail w/ attachments to external mail and SAPids. Below is my code.
    REPORT ZHR_TESTEMAIL .
    TABLES: USR02, PA0105, SOSU, SOUC, RLGRAP, IBIPPARMS, DYNPREAD, RSCSEL.
    DATA: FOLD_YR(2) TYPE C,
          FOLD_TYPE(3) TYPE C,
          G_HEADER LIKE SOOD2,
          G_FOLMAM LIKE SOFM2,
          METHOD1 LIKE SY-UCOMM,
          G_DOCUMENT LIKE SOOD4,
          G_USER LIKE SOUDNAMEI1,
          FOLD_NUMBER(12) TYPE C,
          G_NEW_PARENT LIKE SOODK,
          G_OWNER LIKE SOUD-USRNAM,
          G_REF_DOCUMENT LIKE SOOD4,
          G_USER_DATA LIKE SOUDATAI1,
          G_AUTHORITY LIKE SOFA-USRACC,
          G_OBJCNT LIKE SOLI OCCURS 0 WITH HEADER LINE,
          G_OBJHEAD LIKE SOLI OCCURS 0 WITH HEADER LINE,
          G_OBJPARA LIKE SELC OCCURS 0 WITH HEADER LINE,
          G_OBJPARB LIKE SOOP1 OCCURS 0 WITH HEADER LINE,
          G_RECIPIENTS LIKE SOOS1 OCCURS 0 WITH HEADER LINE,
          G_REFERENCES LIKE SOXRL OCCURS 0 WITH HEADER LINE,
          G_ATTACHMENTS LIKE SOOD5 OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF G_FILES OCCURS 10 ,
          TEXT(4096) TYPE C,
          END OF G_FILES.
    DATA: BEGIN OF IT_WS_FILE OCCURS 0,
          WS_FILE LIKE RLGRAP-FILENAME,
          END OF IT_WS_FILE.
    DATA: BEGIN OF IT_SAPID OCCURS 0,
          SAPID LIKE USR02-BNAME,
          END OF IT_SAPID.
    DATA: BEGIN OF IT_EMAIL OCCURS 0,
          EMAILADD LIKE PA0105-USRID_LONG,
          END OF IT_EMAIL.
    DATA: BEGIN OF IT_TSP01 OCCURS 0.
            INCLUDE STRUCTURE TSP01.
    DATA: END OF IT_TSP01.
    DATA: BEGIN OF TAB2 OCCURS 50,
          TEXT(200) TYPE C,
          END OF TAB2.
    DATA: V_DOCDATA TYPE SODOCCHGI1,
          V_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
          V_OBJHEAD LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJTXT  LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJBIN  LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJHEX  LIKE SOLIX      OCCURS 0 WITH HEADER LINE,
          IT_RECVRS TYPE SOMLRECI1  OCCURS 0 WITH HEADER LINE,
          IT_CONTNT TYPE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          IT_BODY   LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
          V_TLIN    TYPE I,
          V_LINE    TYPE I.
    DATA: BEGIN OF IT_TEXTLINE OCCURS 500,
          TEXTLINE(5000),
          END OF IT_TEXTLINE.
    DATA: FYL LIKE RLGRAP-FILENAME,
          GV_SUBNO LIKE SOSU-SUBNO,
          GV_EMAIL LIKE PA0105-USRID_LONG,
          GV_NEXTDAY LIKE SY-DATUM,
          YEAR(4) TYPE C,
          RECFLAG TYPE C.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM WITH FRAME TITLE TEXT-001.
    PARAMETERS: SUBJ(254) TYPE C OBLIGATORY,            "Subject
                DESC(254) TYPE C.                       "Message
    SELECT-OPTIONS: SAPID FOR USR02-BNAME NO INTERVALS. "Recipient's SAP ID
    SELECT-OPTIONS: EMAILADD FOR PA0105-USRID_LONG NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK PARAM.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM2 WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS: WS_FILE FOR DYNPREAD-FIELDNAME NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK PARAM2.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM3 WITH FRAME TITLE TEXT-003.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT1 RADIOBUTTON GROUP A USER-COMMAND BUT. "Local PC
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT2 RADIOBUTTON GROUP A.                  "Server
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT3 RADIOBUTTON GROUP A.                  "Spool
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT3.
    PARAMETERS: SPOOLNUM LIKE RSPOTYPE-RQNUMBER.            "Spool Number
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK PARAM3.
    SELECTION-SCREEN BEGIN OF BLOCK PROC WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETER: BPROC AS CHECKBOX USER-COMMAND BCK. "Background Processing
    SELECTION-SCREEN COMMENT 5(50) FOR FIELD BPROC.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK PROC.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR WS_FILE-LOW.
      DATA: WS_FILE_TEMP TYPE IBIPPARMS-PATH.
      CLEAR: WS_FILE_TEMP.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                PROGRAM_NAME  = SY-REPID
                DYNPRO_NUMBER = SY-DYNNR
                FIELD_NAME    = 'WS_FILE'
           IMPORTING
                FILE_NAME     = WS_FILE_TEMP.
      WS_FILE-LOW = WS_FILE_TEMP.
    AT SELECTION-SCREEN.
      SELECT SAPNAM FROM SOUC
          INTO TABLE IT_SAPID
          WHERE SAPNAM IN SAPID
            AND DELETED = ''.
      GV_NEXTDAY = SY-DATUM + 1.
      LOOP AT EMAILADD.
        IT_EMAIL-EMAILADD = EMAILADD-LOW.
        APPEND IT_EMAIL.
        CLEAR: IT_EMAIL.
      ENDLOOP.
      IF NOT BPROC IS INITIAL.
        CLEAR: RBUT1, RBUT3.
        RBUT2 = 'X'.
      ELSE.
        CLEAR: RBUT2.
      ENDIF.
      IF NOT RBUT3 IS INITIAL.
        REFRESH: WS_FILE.
      ENDIF.
      IF SAPID IS INITIAL AND EMAILADD IS INITIAL.
        MESSAGE E000(ZZ) WITH TEXT-201.
      ELSEIF NOT SAPID IS INITIAL AND EMAILADD IS INITIAL.
        CLEAR IT_SAPID.
        READ TABLE IT_SAPID.
        SELECT SINGLE SUBNO FROM SOSU
          INTO GV_SUBNO
          WHERE USRNO IN ( SELECT USRNO FROM SOUC
                             WHERE SAPNAM = IT_SAPID-SAPID ).
        IF SY-SUBRC NE 0.
          MESSAGE E000(ZZ) WITH TEXT-202.
        ENDIF.
        CLEAR: IT_SAPID.
      ELSEIF NOT SAPID IS INITIAL AND NOT EMAILADD IS INITIAL.
        CLEAR: IT_SAPID, IT_EMAIL.
        READ TABLE IT_SAPID.
        READ TABLE IT_EMAIL.
        SELECT SINGLE SUBNO FROM SOSU
          INTO GV_SUBNO
          WHERE USRNO IN ( SELECT USRNO FROM SOUC
                             WHERE SAPNAM = IT_SAPID-SAPID ).
        IF SY-SUBRC NE 0.
          SUBMIT RSSOADM0 WITH USRNAM EQ IT_SAPID-SAPID
                          WITH NEW_SUBS EQ IT_EMAIL-EMAILADD
                          WITH SUB_ESC EQ 'U'
                          WITH EDAT EQ SY-DATUM
                          WITH BDAT EQ SY-DATUM
                         WITH BDAT EQ GV_NEXTDAY
                         WITH EDAT EQ '99991231'
                          WITH BTIM EQ SY-UZEIT
                          WITH ETIM EQ '240000'
                          WITH FORW_ALL EQ 'X'
                          WITH PSTHR2 EQ ''
                          AND RETURN.
        ENDIF.
        CLEAR: IT_SAPID.
      ELSEIF NOT EMAILADD IS INITIAL AND SAPID IS INITIAL.
        RECFLAG = 'X'.
      ENDIF.
    START-OF-SELECTION.
        PERFORM B_SENDMAIL.
    FORM B_SENDMAIL.
      YEAR = SY-DATUM+0(4).
      LOOP AT WS_FILE.
        CLEAR: FYL.
        FYL = WS_FILE-LOW.
        REFRESH: TAB2.
        CALL FUNCTION 'WS_UPLOAD'
             EXPORTING
                  FILENAME = FYL
                  FILETYPE = 'BIN'
             TABLES
                  DATA_TAB = TAB2.
        IT_TEXTLINE[] = TAB2[].
    DOCUMENT_DATA (SUBJECT OF MAIL)
        V_DOCDATA-OBJ_NAME   = DESC.
        V_DOCDATA-OBJ_DESCR  = SUBJ.
        V_DOCDATA-OBJ_LANGU  = SY-LANGU.
        V_DOCDATA-SENSITIVTY = 'C'.
        V_DOCDATA-OBJ_PRIO   = '1'.
    BODY OF MAIL
        IT_BODY-LINE = 'Collection Report'.
        APPEND IT_BODY.
    CONTENTS_TXT (Attachments)
        IT_CONTNT[] = IT_TEXTLINE[].
        DESCRIBE TABLE IT_CONTNT LINES V_LINE.
        READ TABLE IT_CONTNT INDEX V_LINE.
    PACKING_LIST
        V_OBJPACK-DOC_SIZE = ( V_LINE - 1 ) * 255 + STRLEN( IT_CONTNT ).
        V_OBJPACK-TRANSF_BIN = 'X'.
        V_OBJPACK-HEAD_START = 1.
        V_OBJPACK-HEAD_NUM   = 0.
        V_OBJPACK-BODY_START = 1.
        V_OBJPACK-BODY_NUM   = V_LINE.
        V_OBJPACK-DOC_TYPE   = 'TXT'.
        V_OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
        V_OBJPACK-OBJ_DESCR  = 'Attached Document'.
        APPEND V_OBJPACK.
        CLEAR  V_OBJPACK.
    RECEIVERS of mail
        IF RECFLAG IS INITIAL.
          LOOP AT IT_SAPID.
            IT_RECVRS-RECEIVER   = IT_SAPID-SAPID.
            IT_RECVRS-REC_TYPE   = 'B'.
            IT_RECVRS-COM_TYPE   = ''.
            IT_RECVRS-EXPRESS    = 'X'.
            IT_RECVRS-NO_FORWARD = ''.
            IT_RECVRS-NO_PRINT   = ''.
            APPEND IT_RECVRS.
            CLEAR IT_RECVRS.
          ENDLOOP.
        ELSE.
          LOOP AT EMAILADD.
            IT_RECVRS-RECEIVER   = EMAILADD-LOW.
            IT_RECVRS-REC_TYPE   = 'U'.
            IT_RECVRS-COM_TYPE   = 'INT'.
            IT_RECVRS-EXPRESS    = 'X'.
            APPEND IT_RECVRS.
            CLEAR IT_RECVRS.
          ENDLOOP.
        ENDIF.
    OBJECT_HEADER (Filename)
        CONCATENATE 'Collection Report' '_'
                     SY-DATUM+4(4) YEAR '.TXT'
                     INTO V_OBJHEAD-LINE.
       V_OBJHEAD-LINE = FYL+16(25).
        APPEND V_OBJHEAD.
        CLEAR V_OBJHEAD.
    Function Module For Sending Mail with Attachment
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                  DOCUMENT_DATA              = V_DOCDATA
             TABLES
                  PACKING_LIST               = V_OBJPACK
                  OBJECT_HEADER              = V_OBJHEAD
                  CONTENTS_HEX               = IT_CONTNT
                  CONTENTS_TXT               = IT_BODY
                  RECEIVERS                  = IT_RECVRS
             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 = 0.
          MESSAGE S000(ZZ) WITH TEXT-005.
        ELSE.
          MESSAGE S000(ZZ) WITH TEXT-006.
        ENDIF.
      ENDLOOP.
    end of my code *
    please help me guys... when i run this program,    DOCUMENT_NOT_SENT is what i always get.. 
    waiting for ur reply... thank you vey much and godbless.

    Hi,
    Try this sample code.
    FORM SEND_TO_EMAIL USING zFName.
      DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
      DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
      DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
      DATA: DOC_CHNG LIKE SODOCCHGI1.
      DATA: TAB_LINES LIKE SY-TABIX.
      DATA: ctmp(50) TYPE C.
    Creation of the document to be sent
      DOC_CHNG-OBJ_NAME = 'JOURNAL'.
      CONCATENATE 'SAP Payroll Journal file Period' pybegda INTO ctmp
                  SEPARATED BY SPACE.
      DOC_CHNG-OBJ_DESCR = cTmp.
      OBJTXT = 'SAP Payroll Journal'.
      APPEND OBJTXT.
      CONCATENATE 'For Period' pybegda INTO ctmp
                  SEPARATED BY SPACE.
      OBJTXT = ctmp.
      APPEND OBJTXT.
      CONCATENATE 'Attached File :' zFname INTO ctmp
                  SEPARATED BY SPACE.
      OBJTXT = ctmp.
      APPEND OBJTXT.
      OBJTXT = 'Please find the attachment.'.
      APPEND OBJTXT.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creation of the entry for the compressed document
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
    Creation of the document attachment
      <b>LOOP AT xMail.
        CONDENSE xMail-aline.
        OBJBIN = xMail-aline.
        APPEND OBJBIN.
        CLEAR OBJBIN.
      ENDLOOP.</b>
      DESCRIBE TABLE OBJBIN LINES TAB_LINES.
      OBJHEAD = zFname. APPEND OBJHEAD.
    Creation of the entry for the compressed attachment
      OBJPACK-TRANSF_BIN = 'X'.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 1.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      OBJPACK-OBJ_NAME = 'DATA'.
      OBJPACK-OBJ_DESCR = 'SAP Payroll File'.
      OBJPACK-DOC_SIZE = TAB_LINES * 255.
      APPEND OBJPACK.
    Completing the recipient list
      LOOP AT PENERIMA.
        CONDENSE PENERIMA-PNRM.
        RECLIST-RECEIVER = PENERIMA-PNRM.
        RECLIST-REC_TYPE = 'U'.
        APPEND RECLIST.
      ENDLOOP.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = DOC_CHNG
                PUT_IN_OUTBOX              = ' '
           TABLES
                PACKING_LIST               = OBJPACK
                OBJECT_HEADER              = OBJHEAD
                CONTENTS_BIN               = OBJBIN
                CONTENTS_TXT               = OBJTXT
                RECEIVERS                  = RECLIST
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                OPERATION_NO_AUTHORIZATION = 4
                OTHERS                     = 99.
      CASE SY-SUBRC.
        WHEN 0.
          WRITE: / 'Result of the send process:'.
          LOOP AT RECLIST.
            WRITE: / RECLIST-RECEIVER(48), ':'.
            IF RECLIST-RETRN_CODE = 0.
              WRITE / 'The document was sent'.
            ELSE.
              WRITE / 'The document could not be sent'.
            ENDIF.
          ENDLOOP.
        WHEN 1.
          WRITE: / 'Too many receiver'.
        WHEN 2.
          WRITE: / 'Document could not be sent to any recipient'.
        WHEN 4.
          WRITE: / 'No send authorization'.
        WHEN OTHERS.
          WRITE: / 'Error occurred while sending'.
      ENDCASE.
    ENDFORM.

  • GUI_UPLOAD and SOX

    Hi,
    I wrote a program which used GUI_UPLOAD functionality.  Now the security guy says that this is not allowed as per SOX and we need to find a alternate way for uploading data.
    Can you please suggest me what options do I have.
    Regards
    Vijay

    Hi,
    you can use ws_upload and upload functional modules.anyways ws_upload became obsolete.so you can try using upload.
    regards,
    deepthi reddy

  • How to store the flat file data into custom table?

    Hi,
    Iam working on inbound interface.Can any one tell me how to store the flat file data into custom table?what is the procedure?
    Regards,
    Sujan

    Hie
    u can use function
    F4_FILENAME
    to pick the file from front-end or location.
    then use function
    WS_UPLOAD
    to upload into
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'   "Function to pick file
        EXPORTING
          field_name = 'p_file'     "file
        IMPORTING
          file_name  = p_file.     "file
      CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
         filename                       = p_file1
        TABLES
          data_tab                      = it_line
    *then loop at it_line splitting it into the fields of your custom table.
    loop at it_line.
              split itline at ',' into
              itab-name
              itab-surname.
    endloop.
    then u can insert the values into yo table from the itab work area.
    regards
    Isaac Prince

  • BDC Step by Step Process

    Hi Experts,
    I'm new to BDC.
    If you have any material which shows step by step process of BDC
    with screen shots please forwards to the following mail id...
    [email protected]
    Kindly help me!!!!
    I would be very grateful for your help..
    thanks & regards,
    shilpa

    BDC or Batch Input Program Tips and Tricks
    Batch Data Communication or BDC is a batch interfacing technique that SAP developed. It is mainly used for uploading data into the SAP R/3 system. BDC works by simulating the user input from transactional screen via an ABAP program.
    The data input data file will come in the form of a flat file which the user save as file type txt file or prn file from the Microsoft Excel program. An Abaper will create a program to read the text file and upload into the SAP system.
    Normally, the tcode SHDB will be used to record the transaction code the user used. After, the simulation, the Abaper can generate a sample program and modify from there. It makes the programming easier and faster.
    Learning BDC Programming
    I want to learn how to upload data using BDC. If I have a excel data file how will upload it using BDC. I don't know the full process of doing it, if someone help me in this. I want it using BDC session process and processing that session. I was trying to upload material master other day. But could not follow the process of uploading using BDC though I know LSMW. Please explain me the BDC process in details with examples.
    For a BDC upload you need to write a program which created BDC sessions.
    Steps:
    1. Work out the transaction you would use to create the data manually.
    2. Use transaction SHDB to record the creation of one material master data.
    Click the New recording button or the Menu - Recording - Create
    3. Save the recording, and then go back a screen and go to the overview.
    4. Select the recording and click on Edit - Create Program. Give the program a Z name, and select transfer from recording.
    5. Edit the program. You will see that all the data you entered is hard-coded into the program. You need to make the following changes:
    5.1 After the start-of-selection, Call ws_upload to upload the file (the excel file needs to be saved as TAB separated).
    5.2 After the open-group, Loop on the uploaded data. For each line, perform validation checks on the data, then modify the perform bdc_field commands to use the file data.
    5.3. After perform bdc_transaction, add the endloop.
    Execute the program. It will have options to create a batch session or to process directly.
    These are all my finds . Might be it will be useful to you.
    Direct call of transactions, session handling:
    /nxxxx This terminates the current transaction, and starts transaction xxxx
    /n This terminates the transaction. This generally corresponds to pressing F15 to go back.
    /nend This termiantes all separate sessions and logs off (corresponds to System - Logoff).
    /nex This terminates all separate sessions and logs off immediately (without any warning!).
    /oxxxx This opens a new session and starts transaction xxxx in This session.
    /o This lists existing sessions and allows deletion or opening of a new session.
    /i This terminates the current session (corresponds to System End
    /i1, /i2,... This terminates the session with the number given.
    .xyzw Fast path: 'xyzw' refers to the underlined letters in the menus. This type of navigation is uncommon and is provided more for emergencies (such as a defective mouse).
    Batch
    The following commands can be entered in correction mode ('Process in foreground' or 'Display errors only') when processing a batch input session:
    /n This terminates the current batch input transaction and characterizes it as
    /bdel This deletes the current batch input transaction.
    /bend This terminates batch input processing and sets the session to Failed
    /bda This switches from Display errors only to Process in foreground
    /bde This switches from Process in foreground to Display errors only
    ABAP/4
    /h This switches into debugging mode.
    /hs This switches into debugging mode and activates the debugging of system functions.
    Buffer
    WARNING: Resetting buffers can significantly change the performance of the entire system for a long time.
    It should therefore only be used where there is a good reason tdso. As of release 3.0B system administator authorization is required (authorization object (S_ADMI_FCD). The action is noted in the system log.
    /$SYNC This resets all buffers of the application server
    /$CUA This resets the CUA buffer of the application server
    /$TAB This resets the TABLE buffers of the application server
    /$NAM This resets the nametab buffer of the application server
    /$DYNP This resets the screen buffer of the application server
    and also see these following links.
    For BDC:
    http://myweb.dal.ca/hchinni/sap/bdc_home.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&
    http://www.sap-img.com/abap/learning-bdc-programming.htm
    http://www.sapdevelopment.co.uk/bdc/bdchome.htm
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm
    http://www.sap-img.com/abap/learning-bdc-
    http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
    Regards.

  • Problem in background session processing

    Hi Experts,
    I am performing BDC by batch input session method.
    I acheved BDC by traditional recording method and able to create batch input session in SM35.
    Whenever I process batch input session in FOREGROUND it processes successfully.But whenever I processes it in BACKGROUND it throws an exception
    runtime error.
    This recording is for transaction CK74.this transaction screen contains some table controls.Error is "Control Framework: fatal error: GUI cannot be reached".
    Please let me know if anybody has solution for this.
    Thanks,
    Yogesh.

    Hi yogesh,
        I think u might be using the function module upload or ws_upload to upload the data to the internal table. Try to use GUI_UPLOAD, while processing the session on background.
    I think it will solve ur problem.
    Regards...
    Arun.
    Reward points if useful.

  • Steps for BDC before  program

    Can anyone just tell me the steps which one follows before going for a BDC Program. i mean right frm the starting if any Company want to implement SAP.

    HI,
    For a BDC upload you need to write a program which created BDC sessions.
    Steps:
    1. Work out the transaction you would use to create the data manually.
    2. Use transaction SHDB to record the creation of one material master data.
        Click the New recording button or the Menu - Recording - Create
    3. Save the recording, and then go back a screen and go to the overview.
    4. Select the recording and click on Edit - Create Program. Give the program a Z name, and select transfer from recording.
    5. Edit the program. You will see that all the data you entered is hard-coded into the program. You need to make the following changes:
    5.1 After the start-of-selection, Call ws_upload to upload the file (the excel file needs to be saved as TAB separated).
    5.2 After the open-group, Loop on the uploaded data. For each line, perform validation checks on the data, then modify the perform bdc_field commands to use the file data.
    5.3. After perform bdc_transaction, add the endloop.
    Execute the program. It will have options to create a batch session or to process directly.
    <b>These are all my finds . Might be it will be useful to you.</b>
    Regards
    Sudheer
    Direct call of transactions, session handling:
    /nxxxx This terminates the current transaction, and starts transaction xxxx
    /n This terminates the transaction. This generally corresponds to pressing F15 to go back.
    /nend This termiantes all separate sessions and logs off (corresponds to System - Logoff).
    /nex This terminates all separate sessions and logs off immediately (without any warning!).
    /oxxxx This opens a new session and starts transaction xxxx in This session.
    /o This lists existing sessions and allows deletion or opening of a new session.
    /i This terminates the current session (corresponds to System End
    /i1, /i2,... This terminates the session with the number given.
    .xyzw Fast path: 'xyzw' refers to the underlined letters in the menus. This type of navigation is uncommon and is provided more for emergencies (such as a defective mouse).
    Batch
    The following commands can be entered in correction mode ('Process in foreground' or 'Display errors only') when processing a batch input session:
    /n This terminates the current batch input transaction and characterizes it as
    /bdel This deletes the current batch input transaction.
    /bend This terminates batch input processing and sets the session to Failed
    /bda This switches from Display errors only to Process in foreground
    /bde This switches from Process in foreground to Display errors only
    ABAP/4
    /h This switches into debugging mode.
    /hs This switches into debugging mode and activates the debugging of system functions.
    Buffer
    WARNING: Resetting buffers can significantly change the performance of the entire system for a long time.
    It should therefore only be used where there is a good reason tdso. As of release 3.0B system administator authorization is required (authorization object (S_ADMI_FCD). The action is noted in the system log.
    /$SYNC This resets all buffers of the application server
    /$CUA This resets the CUA buffer of the application server
    /$TAB This resets the TABLE buffers of the application server
    /$NAM This resets the nametab buffer of the application server
    /$DYNP This resets the screen buffer of the application server

  • Alv's using function modules

    hi,
    in alv's using fuction modules how to add pushbuttons in application tool bar?

    Hi Ganapathi,
    Check out the list of Function Modules
    ABAP_DOCU_DOWNLOAD     Download ABAP documentation in HTML format.
    APPL_LOG_DELETE     With this function module you delete logs in the database according to specified selection conditions
    APPL_LOG_DISPLAY     With this function module you can analyze logs in the database.
    APPL_LOG_DISPLAY_INTERN     With this function module you can analyze logs in local memory, e.g. when you have only collected log records at runtime and do not want to write to the database.
    APPL_LOG_INIT     This function module checks whether the specified object or sub-object exists and deletes all existing associated data in local memory.
    APPL_LOG_READ_DB     With this function module you read the log data in the database for an object or sub-object according to specified selection conditions.
    APPL_LOG_READ_INTERN     With this function module you read all log data whose log class has at least the specified value, from local memory, for the specified object or sub-object.
    APPL_LOG_SET_OBJECT     With this function module, you create a new object or sub-object for writing in local memory. With a flag you can control whether the APPL_LOG_WRITE_... messages are written in local memory or are output on the screen.
    APPL_LOG_WRITE_DB     With this function module you write all data for the specified object or sub-object in local memory to the database. If the log for the object or sub-object in question is new, the log number is returned to the calling program.
    APPL_LOG_WRITE_HEADER     With this function module, you write the log header data in local memory.
    APPL_LOG_WRITE_LOG_PARAMETERS     With this function module, you write the name of the log parameters and the associated values for the specified object or sub-object in local memory. If this function module is called repeatedly for the same object or sub-object, the existing parameters are updated accordingly. If you do not specify an object or sub-object with the call, the most recently used is assumed.
    APPL_LOG_WRITE_MESSAGE_PARAMS     With this function module you write a single message, with parameters, in local memory. Otherwise the function module works like APPL_LOG_WRITE_SINGLE_MESSAGE.
    APPL_LOG_WRITE_MESSAGES     With this function module you write one or more messages, without parameters, in local memory.
    APPL_LOG_WRITE_SINGLE_MESSAGE     With this function module you write a single message, without parameters, in local memory. If no header entry has yet been written for the object or sub-object, it is created. If you do not specify an object or sub-object with the call, the most recently used is assumed.
    ARFC_GET_TID     will return the IP address of the terminal in hex.
    BAL_CNTL_CREATE     Create Control for log display
    BAL_CNTL_FREE     Release Control
    BAL_CNTL_REFRESH     Put new data in log display
    BAL_DB_DELETE     Delete logs from the database
    BAL_DB_DEQUEUE     Unlock log
    BAL_DB_ENQUEUE     Lock log
    BAL_DB_LOAD     Load logs from the database
    BAL_DB_LOAD     Load log(s)
    BAL_DB_SAVE     Save logs in the database
    BAL_DB_SAVE     Save log(s)
    BAL_DB_SAVE_PREPARE     Prepare save
    BAL_DB_SEARCH     Find logs in the database
    BAL_DSP_LOG_DISPLAY     Display messages in memory
    BAL_DSP_LOG_DISPLAY     Display Log
    BAL_DSP_LOG_PARAMETERS     Either output extended long text or call a callback routine (based on the data in BAL_S_LOG-PARAMS)
    BAL_DSP_LOG_TECHNICAL_DATA     Output all log header data
    BAL_DSP_MSG_LONGTEXT     Display message long text
    BAL_DSP_MSG_PARAMETERS     Either output extended long text or call a callback routine (based on the data in BAL_S_MSG-PARAMS)
    BAL_DSP_MSG_TECHNICAL_DATA     Output technical data of a message such as work area, error number, etc.
    BAL_DSP_OUTPUT_FREE     End output
    BAL_DSP_OUTPUT_INIT     Initialize output
    BAL_DSP_OUTPUT_SET_DATA     Set dataset to be displayed
    BAL_DSP_PROFILE_DETLEVEL_GET     Message hierarchy in DETLEVEL
    BAL_DSP_PROFILE_NO_TREE_GET     Display without tree (fullscreen)
    BAL_DSP_PROFILE_POPUP_GET     Display without tree (popup)
    BAL_DSP_PROFILE_SINGLE_LOG_GET     Standard profile (SLG1) for one log
    BAL_DSP_PROFILE_STANDARD_GET     Standard profile (SLG1) for a lot of logs
    BAL_GLB_AUTHORIZATION_GET     Assign authorization
    BAL_GLB_AUTHORIZATION_RESET     Reset authorization
    BAL_GLB_CONFIG_GET     Read configuration
    BAL_GLB_CONFIG_SET     Set configuration
    BAL_GLB_MEMORY_EXPORT     Put function group memory in ABAP-MEMORY
    BAL_GLB_MEMORY_IMPORT     Get function group memory from ABAP-MEMORY
    BAL_GLB_MEMORY_REFRESH     (Partially) reset global memory
    BAL_GLB_MEMORY_REFRESH     (Partially) initialize memory
    BAL_GLB_MSG_CURRENT_HANDLE_GET     Get current message handle
    BAL_GLB_MSG_DEFAULTS_GET     Get message defaults
    BAL_GLB_SEARCH_LOG     Find logs in memory
    BAL_GLB_SEARCH_MSG     Find messages in memory
    BAL_LOG_CREATE     Create log with header data
    BAL_LOG_CREATE     Create log with header data
    BAL_LOG_DELETE     Delete log (from database also at Save)
    BAL_LOG_EXIST     Check existence of a log in memory
    BAL_LOG_HDR_CHANGE     Change log header
    BAL_LOG_HDR_CHECK     Check log header data for consistency
    BAL_LOG_HDR_READ     Read log header and other data
    BAL_LOG_MSG_ADD     Put message in log
    BAL_LOG_MSG_ADD     Put message in log
    BAL_LOG_MSG_CHANGE     Change message
    BAL_LOG_MSG_CHANGE     Change message
    BAL_LOG_MSG_CHECK     Check message data for consistency
    BAL_LOG_MSG_CUMULATE     Add message cumulated
    BAL_LOG_MSG_DELETE     Delete message
    BAL_LOG_MSG_DELETE     Delete message
    BAL_LOG_MSG_EXIST     Check existence of a message in memory
    BAL_LOG_MSG_READ     Read message and other data
    BAL_LOG_MSG_REPLACE     Replace last message
    BAL_LOG_REFRESH     Delete log from memory
    BAL_LOG_REFRESH     Delete log from memory
    BAL_MSG_DISPLAY_ABAP     Output message as ABAP-MESSAGE
    BAL_OBJECT_SELECT     Read Application Log objects table record
    BAL_OBJECT_SUBOBJECT     Check whether object and subobject exist and the combination is allowed
    BAL_SUBOBJECT_SELECT     Read subobject table record
    BP_EVENT_RAISE     Trigger an event from ABAP/4 program
    BP_JOBLOG_READ     Fetch job log executions
    CHANGEDOCUMENT_READ_HEADERS     Get the change document header for a sales document, and put the results in an internal table.
    Example:
          CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
               EXPORTING
                    objectclass = 'EINKBELEG'
                    objectid    = l_objectid
                    username    = space
               TABLES
                    i_cdhdr     = lt_cdhdr.
          LOOP AT lt_cdhdr WHERE udate IN s_aedat.
            CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
                 EXPORTING
                      changenumber = lt_cdhdr-changenr
                 TABLES
                      editpos      = lt_editpos.
            LOOP AT lt_editpos WHERE fname = 'LOEKZ'
                               AND   f_new = 'L'.
              p_desc = text-r01. " Cancel Contract
            ENDLOOP.
          ENDLOOP.
    CHANGEDOCUMENT_READ_POSITIONS     Get the details of a change document, and store them in an internal table. This will tell you whether a field was changed, deleted, or updated.
    Example:
          CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
               EXPORTING
                    objectclass = 'EINKBELEG'
                    objectid    = l_objectid
                    username    = space
               TABLES
                    i_cdhdr     = lt_cdhdr.
          LOOP AT lt_cdhdr WHERE udate IN s_aedat.
            CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
                 EXPORTING
                      changenumber = lt_cdhdr-changenr
                 TABLES
                      editpos      = lt_editpos.
            LOOP AT lt_editpos WHERE fname = 'LOEKZ'
                               AND   f_new = 'L'.
              p_desc = text-r01. " Cancel Contract
            ENDLOOP.
          ENDLOOP.
    CLAF_CLASSIFICATION_OF_OBJECTS     Return all of the characteristics for a material
    CLOI_PUT_SIGN_IN_FRONT     Move the negative sign from the left hand side of a number, to the right hand side of the number. Note that The result will be left justified (like all character fields), not right justified as numbers normally are.
    CLPB_EXPORT     Export a text table to the clipboard (on presentation server)
    CLPB_IMPORT     Import a Text Table from the Clipboard (on presentation server)
    COMMIT_TEXT     To load long text into SAP
    CONVERSION_EXIT_ALPHA_INPUT     converts any number into a string fill with zeroes, with the number at the extreme right
    Example:
    input  = 123
    output = 0000000000000...000000000000123
    CONVERSION_EXIT_ALPHA_OUTPUT     converts any number with zeroes right into a simple integer
    Example:
    input   = 00000000000123
    output  = 123
    CONVERT_ABAPSPOOLJOB_2_PDF     convert abap spool output to PDF
    CONVERT_OTF     Convert SAP documents (SAPScript) to other types.
    Example:
    CALL FUNCTION "CONVERT_OTF"
           EXPORTING    FORMAT                = "PDF"
           IMPORTING    BIN_FILESIZE          = FILE_LEN
           TABLES       OTF                   = OTFDATA
                        LINES                 = PDFDATA
           EXCEPTIONS   ERR_MAX_LINEWIDTH     = 1                  
                        ERR_FORMAT            = 2
                        ERR_CONV_NOT_POSSIBLE = 3
                        OTHERS                = 4.
    CONVERT_OTFSPOOLJOB_2_PDF     converts a OTF spool to PDF (i.e. Sapscript document)
    CONVERT_TO_FOREIGN_CURRENCY     Convert local currency to foreign currency.
    CONVERT_TO_LOCAL_CURRENCY     Convert from foreign currency to local currency
    DATE_CHECK_PLAUSIBILITY     Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
    DATE_COMPUTE_DAY     Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
    DATE_GET_WEEK     will return the week that a date is in.
    DATE_IN_FUTURE     Calculate a date N days in the future.
    DAY_ATTRIBUTES_GET     Return useful information about a day. Will tell you the day of the week as a word (Tuesday), the day of the week (2 would be Tuesday), whether the day is a holiday, and more.(provided by Francois Henrotte)
    DOWNLOAD     download a file to the presentation server (PC)
    DYNP_VALUES_READ     Read the values from a dynpro. This function can be used to read the values from a report's selection screen too (Another example).
    DYNP_VALUES_UPDATE     Similar to DYNP_VALUES_READ, this function will allow the updating of fields on a dynpro. Very useful when you want to change a field based on the value entered for another field.
    ENQUE_SLEEP     Wait a specified period of time before continuing processing.
    ENQUEUE_ESFUNCTION     Lock an abap program so that it cannot be executed.
    Example:
    Set the parameters as follows:
      RELID = 'ZZ'
      SRTF2 = 0
      SRTF = (your report name)
    Please note that you should not use SY-REPID to pass your report name to the function. The value of SY-REPID will change as it is being passed to the function module, and will no longer hold the value of the calling report.
    EPS_GET_DIRECTORY_LISTING     return a list of filenames from a local or network drive
    EPS_GET_FILE_ATTRIBUTES     Pass in a filename and a path, and will return attributes for the file
    F4_DATE     displays a calendar in a popup window and allows user to choose a date, or it can be displayed read only.
    F4_IF_FIELD_VALUE_REQUEST     Use values from a DDIC table to provide a list of possible values. TABNAME and FIELDNAME are required fields, and when MULTIPLE_CHOICE is selected, more than one value can be returned.
    F4IF_INT_TABLE_VALUE_REQUEST     F4 help that returns the values selected in an internal table. Very handy when programming your very own F4 help for a field.
    Example:
    data:
        begin of t_values occurs 2,
          value like kna1-begru,
        end of t_values,
        t_return like ddshretval occurs 0 with header line.
      t_values = 'PAR*'.
      append t_values.
      t_values = 'UGG'.
      append t_values.
      call function 'F4IF_INT_TABLE_VALUE_REQUEST'
           exporting
                retfield        = 'BEGRU'
                value_org       = 'S'
           tables
                value_tab       = t_values
                return_tab      = t_return
           exceptions
                parameter_error = 1
                no_values_found = 2
                others          = 3.
      if sy-subrc = 0.
        read table t_return index 1.
        o_begru-low = t_return-fieldval.
        if o_begru-low = 'PAR*'.
          o_begru-option = 'CP'.
        else.
          o_begru-option = 'EQ'.
        endif.
        o_begru-sign = 'I'.
        append o_begru to s_begru.
      else.
        o_begru = i_begru.
      endif.
    F4IF_SHLP_EXIT_EXAMPLE     documents the different reasons to use a search help exit, and shows how it is done.
    F4IP_INT_TABLE_VALUE_REQUEST     This function does not exist in 4.6 and above. Use F4IF_INT_TABLE_VALUE_REQUEST instead.
    FILENAME_GET     popup to get a filename from a user, returns blank filename if user selects cancel
    FORMAT_MESSAGE     Takes a message id and number, and puts it into a variable. Works better than WRITE_MESSAGE, since some messages use $ as a place holder, and WRITE_MESSAGE does not accommodate that, it only replaces the ampersands (&) in the message.
    FTP_COMMAND     Execute a command on the FTP server
    FTP_CONNECT     Open a connection (and log in) to an FTP server
    FTP_DISCONNECT     Close the connection (and log off) the FTP server
    FU CSAP_MAT_BOM_READ     You can use this function module to display simple material BOMs. You cannot display BOM groups (for example, all variants of a variant BOM). as in transaction CS03. Current restrictions: You cannot display long texts. You cannot display sub-items. You cannot display classification data of BOM items for batches. You can only display one alternative or variant. You cannot enter an alternative for module CSAP_MAT_BOM_READ, so you always see alternative 01. The following example came from a posting on the SAP-R3-L mailing list.
    Example:
    data: begin of tstk2 occurs 0.
              include structure stko_api02.
    data: end of tstk2.
    data: begin of tstp2 occurs 0.
              include structure stpo_api02.
    data: end of tstp2.
    data: begin of tdep_data occurs 0.
             include structure csdep_data.
    data: end of tdep_data.
    data: begin of tdep_descr occurs 0.
             include structure csdep_descr.
    data: end of tdep_descr.
    data: begin of tdep_source occurs 0.
             include structure csdep_source.
    data: end of tdep_source.
    data: begin of tdep_order occurs 0.
             include structure csdep_order.
    data: end of tdep_order.
    data: begin of tdep_doc occurs 0.
             include structure csdep_doc.
    data: end of tdep_doc.
    data: flg_warning like capiflag-flwarning.
       call function 'CSAP_MAT_BOM_READ'
            exporting
                 material   = 'MAT100'
                 plant      = '0001'
                 bom_usage  = '1'
                 valid_from = '20.12.1996'
               valid_to
            importing
                 fl_warning = flg_warning
            tables
                 t_stko       = tstk2
                 t_stpo       = tstp2
                 t_dep_data   = tdep_data
                 t_dep_descr  = tdep_descr
                 t_dep_source = tdep_source
                 t_dep_order  = tdep_order
                 t_dep_doc    = tdep_doc
            exceptions
                 error      = 1.
    Function Group GRAP is now obsolete.     SAP recommends using functions in function group SFES instead. Below is an overview of the changes.
    G_SET_GET_ALL_VALUES     Fetch values from a set.
    GET_CURRENT_YEAR     Get the current fiscal year.
    Example:
    CALL FUNCTION 'GET_CURRENT_YEAR'
      EXPORTING
        BUKRS         = '1000'     " Company Code
        DATE          = SY-DATUM   " Date to find fiscal year for
      IMPORTING
        CURRM         = w_currm    " Current Fiscal Month
        CURRY         = w_curry    " Current Fiscal Year
        PREVM         = w_prevm    " Previous Fiscal Month
        PREVY         = w_prevy.   " Previous Fiscal Year
    GET_GLOBAL_SYMBOLS     Returns a list of all tables, select options, texts, etc for a program. Even includes the text definitions for the selection screen
    GET_INCLUDETAB     Returns a list of all INCLUDES in a program
    GET_JOB_RUNTIME_INFO     Get the current job number from a program. Also returns other useful info about the current job.
    GUI_CREATE_DIRECTORY     Create a directory on the presentation server
    GUI_DELETE_FILE     Replaces WS_FILE_DELETE. Delete a file on the presentation server
    GUI_DOWNLOAD     Replaces WS_DOWNLOAD. Download table from the app server to presentation server
    GUI_EXEC     Replaces WS_EXECUTE. Start a File or Program Asynchronously with WinExec
    GUI_GET_DESKTOP_INFO     Replaces WS_QUERY. Delivers Information About the Desktop (client)
    GUI_REMOVE_DIRECTORY     Delete a directory on the presentation server
    GUI_RUN     Start a File or Program Asynchronously with Shell Execute
    GUI_UPLOAD     Replaces WS_UPLOAD. Upload file from presentation server to the app server
    HELP_START     Display help for a field. Useful for doing AT SELECTION SCREEN ON VALUE REQUEST for those fields that do not provide F4 help at the DDIC level.
    HELP_VALUES_GET_WITH_TABLE     Show a list of possible values for F4 popup help on selection screens. This function module pops up a screen that is just like all the other F4 helps, so it looks like the rest of the SAP system. Very useful for providing dropdowns on fields that do not have them predefined.
    Example:
    tables: t001w.
    DATA: lc_werks      LIKE t001w-werks,
          ltab_fields LIKE help_value OCCURS 0 with header line,
          BEGIN OF ltab_values OCCURS 0,
            feld(40) TYPE c,
          END OF ltab_values.
    *-- Set up fields to retrieve data
      ltab_fields-tabname    = 'T001W'.
      ltab_fields-fieldname  = 'WERKS'.
      ltab_fields-selectflag = 'X'.
      APPEND ltab_fields.
      ltab_fields-tabname    = 'T001W'.
      ltab_fields-fieldname  = 'NAME1'.
      ltab_fields-selectflag = space.
      APPEND ltab_fields.
    *-- Fill values
      select * from t001w.
        ltab_values-feld = t001w-werks.
        append ltab_values.
        ltab_values-feld = t001w-name1.
        append ltab_values.
      endselect.
    CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
         EXPORTING
              fieldname                 = 'WERKS'
              tabname                   = 'T001W'
              title_in_values_list      = 'Select a value'
         IMPORTING
              select_value              = lc_werks
         TABLES
              fields                    = ltab_fields
              valuetab                  = ltab_values
         EXCEPTIONS
              field_not_in_ddic         = 01
              more_then_one_selectfield = 02
              no_selectfield            = 03.
    HOLIDAY_CHECK_AND_GET_INFO     Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the date is a holiday by checking the parameter HOLIDAY_FOUND.
    Example:
    data: ld_date                 like scal-datum  default sy-datum,
          lc_holiday_cal_id       like scal-hcalid default 'CA',
          ltab_holiday_attributes like thol occurs 0 with header line,
          lc_holiday_found        like scal-indicator.
    CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'
      EXPORTING
        date                               = ld_date
        holiday_calendar_id                = lc_holiday_cal_id
        WITH_HOLIDAY_ATTRIBUTES            = 'X'
      IMPORTING
        HOLIDAY_FOUND                      = lc_holiday_found
      tables
        holiday_attributes                 = ltab_holiday_attributes
      EXCEPTIONS
        CALENDAR_BUFFER_NOT_LOADABLE       = 1
        DATE_AFTER_RANGE                   = 2
        DATE_BEFORE_RANGE                  = 3
        DATE_INVALID                       = 4
        HOLIDAY_CALENDAR_ID_MISSING        = 5
        HOLIDAY_CALENDAR_NOT_FOUND         = 6
        OTHERS                             = 7.
    if sy-subrc = 0 and
       lc_holiday_found = 'X'.
      write: / ld_date, 'is a holiday'.
    else.
      write: / ld_date, 'is not a holiday, or there was an error calling the function'.
    endif.
    HOLIDAY_GET     Provides a table of all the holidays based upon a Factory Calendar &/ Holiday Calendar.
    HR_DISPLAY_BASIC_LIST     is an HR function, but can be used for any data. You pass it data, and column headers, and it provides a table control with the ability to manipulate the data, and send it to Word or Excel. Also see the additional documentation here.
    HR_GET_LEAVE_DATA     Get all leave information (includes leave entitlement, used holidays/paid out holidays)
    HR_IE_NUM_PRSI_WEEKS     Return the number of weeks between two dates.
    HR_PAYROLL_PERIODS_GET     Get the payroll period for a particular date. (provided by Francois Henrotte)
    Example:
      DATA: IT_T549Q TYPE T549Q OCCURS 0 WITH HEADER LINE,
            IT_ZL TYPE PC2BF OCCURS 0 WITH HEADER LINE.
      W_BEGDA = '20010101'.
      W_PERNR = '00000001'.
      CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'
           EXPORTING
                get_begda       = w_begda
           TABLES
                get_periods     = it_t549q
           EXCEPTIONS
                no_period_found = 1
                no_valid_permo  = 2.
      CHECK sy-subrc = 0.
      CALL FUNCTION 'HR_TIME_RESULTS_GET'
           EXPORTING
                get_pernr             = w_pernr
                get_pabrj             = it_t549q-pabrj
                get_pabrp             = it_t549q-pabrp
           TABLES
                get_zl                = it_zl
           EXCEPTIONS
                no_period_specified   = 1
                wrong_cluster_version = 2
                no_read_authority     = 3
                cluster_archived      = 4
                technical_error       = 5.
    NOTE: it_zl-iftyp = 'A'   absence
          it_zl-iftyp = 'S'   at work
    HR_TIME_RESULTS_GET     Get the time results for a payroll period. (provided by Francois Henrotte)
    Example:
      DATA: IT_T549Q TYPE T549Q OCCURS 0 WITH HEADER LINE,
            IT_ZL TYPE PC2BF OCCURS 0 WITH HEADER LINE.
      W_BEGDA = '20010101'.
      W_PERNR = '00000001'.
      CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'
           EXPORTING
                get_begda       = w_begda
           TABLES
                get_periods     = it_t549q
           EXCEPTIONS
                no_period_found = 1
                no_valid_permo  = 2.
      CHECK sy-subrc = 0.
      CALL FUNCTION 'HR_TIME_RESULTS_GET'
           EXPORTING
                get_pernr             = w_pernr
                get_pabrj             = it_t549q-pabrj
                get_pabrp             = it_t549q-pabrp
           TABLES
                get_zl                = it_zl
           EXCEPTIONS
                no_period_specified   = 1
                wrong_cluster_version = 2
                no_read_authority     = 3
                cluster_archived      = 4
                technical_error       = 5.
    NOTE: it_zl-iftyp = 'A'   absence
          it_zl-iftyp = 'S'   at work
    INIT_TEXT     To load long text into SAP
    K_WERKS_OF_BUKRS_FIND     Return a list of all plants for a given company code.
    LIST_FROM_MEMORY     Retrieves the output of a report from memory when the report was executed using SUBMIT... EXPORTING LIST TO MEMORY. See also WRITE_LIST.
    LIST_TO_ASCII     convert an ABAP report (displayed on screen) from OTF to ASCII format
    MBEW_EXTEND     Get the stock position for the previous month. This displays the same info that you see in MM03.
    MONTH_NAMES_GET     It returns all the month and names in respective language.
    MONTH_PLUS_DETERMINE     Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
    Example:
    data: new_date type d.
    CALL FUNCTION 'MONTH_PLUS_DETERMINE'
      EXPORTING
        months        = -5       " Negative to subtract from old date, positive to add
        olddate       = sy-datum
    IMPORTING
       NEWDATE       = new_date.
    write: / new_date.
    MS_EXCEL_OLE_STANDARD_OLE     will build a file, and automatically start Excel
    OTF_CONVERT     wraps several other function modules. Will convert OTF to ASCII or PDF
    POPUP_TO_CONFIRM_LOSS_OF_DATA     Create a dialog box in which you make a question whether the user wishes to perform a processing step with loss of data.
    POPUP_TO_CONFIRM_STEP     Create a dialog box in which you make a question whether the user wishes to perform the step.
    POPUP_TO_CONFIRM_WITH_MESSAGE     Create a dialog box in which you inform the user about a specific decision point during an action.
    POPUP_TO_CONFIRM_WITH_VALUE     Create a dialog box in which you make a question whether the user wishes to perform a processing step with a particular object.
    POPUP_TO_DECIDE     Provide user with several choices as radio buttons
    POPUP_TO_DECIDE_WITH_MESSAGE     Create a dialog box in which you inform the user about a specific decision point via a diagnosis text.
    POPUP_TO_DISPLAY_TEXT     Create a dialog box in which you display a two line message
    POPUP_TO_SELECT_MONTH     Popup to choose a month
    POPUP_WITH_TABLE_DISPLAY     Provide a display of a table for user to select one, with the value of the table line returned when selected.
    PRICING     Return pricing conditions in an internal table. Use structure TCOMK for parameter COMM_HEAD_1, and structure TCOMP for parameter COMM_ITEM_1, and set CALCULATION_TYPE to B. The pricing conditions will be returned in XOMV. You must fill TCOMP, and TCOMK with the appropriate values before callling the function in order for it to work.
    PROFILE_GET     Read an Entry in an INI File on the frontend
    PROFILE_SET     Write an Entry in an INI File on the frontend
    READ_TEXT     To load long text into SAP
    REGISTRY_GET     Read an Entry from the Registry
    REGISTRY_SET     Set an entry in the Registry
    RFC_ABAP_INSTALL_AND_RUN     Runs an ABAP program that is stored in the table PROGRAM when the MODE = 'F'. Table WRITES contains the ouput of the program. Allows you to run a program without having the source code in the target system.
    RH_GET_ACTIVE_WF_PLVAR     Return the active HR Plan
    RH_GET_DATE_DAYNAME     return the day based on the date provied
    RH_START_EXCEL_WITH_DATA     starts Excel with the contents of an internal table. This function finds Excel in the desktop registry. It also uses a local PC working directory to save the file (that's what the 'W' value for data path flag does). Very transparent to user!
    RH_STRUC_GET     Returns all related org info
    RHP0_POPUP_F4_SEARK     is a matchcode for any type of HR Planning object, including the possibility to fill the field that you want
    Example:
    Examples: search for any organizational structure
               F4 = 'X'
               PLVAR = '01'
               OTYPE = 'O '
              search for any persons
               F4 = 'X'
               PLVAR = '01'
               OTYPE = 'P '
               MULTI_SELECT = 'X' to allow multiple selection
               EASY = 'X' for user-dependent matchcode
    Unfortunately, the use of table BASE_OBJIDS is disabled, so you can't specify
    a root for the hierarchy you display
    RKD_WORD_WRAP     Convert a long string or phrase into several lines.
    RP_CALC_DATE_IN_INTERVAL     Add/subtract years/months/days from a date
    RP_LAST_DAY_OF_MONTHS     Determine last day of month
    RPY_DYNPRO_READ     Read dynpro, including screen flow
    RPY_TRANSACTION_READ     Given a transaction, return the program and screen or given a program and screen, return the transactions that use the program and screen.
    RS_COVERPAGE_SELECTIONS     Returns an internal table that contains a formatted list of all the selection parameters entered for a report. Table is ready to print out.
    RS_REFRESH_FROM_SELECTOPTIONS     Get the current contents of selection screen
    RS_SEND_MAIL_FOR_SPOOLLIST     Send message from ABAP/4 program to SAPoffice.
    RS_VARIANT_CONTENTS     Returns the contents of the specified variant in a table.
    RSPO_DOWNLOAD_SPOOLJOB     Download the spool from a program to a file. Requires spool number.
    RSPO_RETURN_ABAP_SPOOLJOB     Fetch printer spool according to the spool number informed.
    RZL_READ_DIR     If the server name is left blank, it reads a directory from local presentation server, otherwise it reads the directory of the remote server
    RZL_READ_DIR_LOCAL     Read a directory on the Application Server
    RZL_READ_FILE     Read a file from the presentation server if no server name is given, or read file from remote server. Very useful to avoid authority checks that occur doing an OPEN DATASET. This function using a SAP C program to read the data.
    RZL_SLEEP     Hang the current application from 1 to 5 seconds.
    RZL_SUBMIT     Submit a remote report.
    RZL_WRITE_FILE_LOCAL     Saves table to the presentation server (not PC). Does not use OPEN DATASET, so it does not suffer from authority checks!
    SAP_CONVERT_TO_XLS_FORMAT     Convert data to Microsoft Excel format.
    SAPGUI_PROGRESS_INDICATOR     Display a progress bar on the SAP GUI, and give the user some idea of what is happening
    SAVE_TEXT     To load long text into SAP
    SCROLLING_IN_TABLE     If you are coding a module pool and using a table control, you can use this function SCROLLING_IN_TABLE to handle any scrolling. (provided by Paul Kjaer)
    SD_DATETIME_DIFFERENCE     Give the difference in Days and Time for 2 dates
    SO_NEW_DOCUMENT_ATT_SEND_API1     Send a document as part of an email. The documentation is better than normal for this function, so please read it.
    SO_SPLIT_FILE_AND_PATH     Split a fully pathed filename into a filename and a path.
    SO_SPOOL_READ     Fetch printer spool according to the spool number informed. See also RSPO_RETURN_ABAP_SPOOLJOB
    SO_WIND_SPOOL_LIST     Browse printer spool numbers according to user informed.
    SWD_HELP_F4_ORG_OBJECTS     HR Matchcode tailored for organizational units. Includes a button so that you can browse the hierarchy too.
    SX_OBJECT_CONVERT_OTF_PDF     Conversion From OTF to PDF (SAPScript conversion)
    SX_OBJECT_CONVERT_OTF_PRT     Conversion From OTF to Printer Format (SAPScript conversion)
    SX_OBJECT_CONVERT_OTF_RAW     Conversion From OTF to ASCII (SAPScript conversion)
    SXPG_CALL_SYSTEM     you can check the user's authorization for the specified command and run the command. The command runs on the host system on which the function module is executed. The function module is RFC capable. It can therefore be run on the host system at which a user happens to be active or on another designated host system at which an R/3 server is active.
    SXPG_COMMAND_CHECK     Check whether the user is authorized to execute the specified command on the target host system with the specified arguments.
    SXPG_COMMAND_DEFINITION_GET     Read the definition of a single external OS command from the R/3 System's database.
    SXPG_COMMAND_EXECUTE     Check a user's authorization to use a command, as in SXPG_COMMAND_CHECK. If the authorization check is successful, then execute the command on the target host system.
    SXPG_COMMAND_LIST_GET     Select a list of external OS command definitions.
    TERMINAL_ID_GET     Return the terminal id
    TH_DELETE_USER     Logoff a user. Similar results to using SM04.
    TH_ENVIRONMENT     Get the UNIX environment
    TH_POPUP     Display a popup system message on a specific users screen.
    TH_REMOTE_TRANSACTION     Run a transaction on a remote server. Optionally provide BDC data to be used in the transaction
    TH_USER_INFO     Give information about the current user (sessions, workstation logged in from, etc)
    TH_USER_LIST     Show which users are logged into an app server
    TMP_GUI_DIRECTORY_LIST_FILES     Retrieve all of the files and subdirectories on the Presentation Server (PC) for a given directory.
    When a value other than * or . is used for the filter, you will not get any directories, unless they match your wildcard filter. For example, if you entered *.png, then only files and directories that end in png will be returned by the function.
    Example:
    data:  lc_directory         like bdschko16-target_dir value 'C:\TEMP\',
           lc_filter(20)        type c default '.'.
           li_file_count        type i,
           li_dir_count         type i,
           ltab_dir_table       like sdokpath occurs 0 with header line,
           ltab_file_file_table like sdokpath occurs 0 with header line.
    call function 'TMP_GUI_DIRECTORY_LIST_FILES'
      exporting
        directory        = lc_directory
        filter           = lc_filter  importing
        file_count       = li_file_count
        dir_count        = li_dir_count
      tables
        file_table       = ltab_file_table
        dir_table        = ltab_dir_table
      exceptions
        cntl_error       = 1
        others           = 2.
    UNIT_CONVERSION_SIMPLE     convert weights from one UOM to another.
    UPLOAD     upload a file to the presentation server (PC)
    UPLOAD_FILES     Will load one or more files from app or presentation server
    WEEK_GET_FIRST_DAY     For a given week (YYYYMM format), this function returns the date of the Monday of that week.
    WRITE_LIST     Useful for writing out the list contents that result from the function LIST_FROM_MEMORY.
    WS_DOWNLOAD     Save Internal Table as File on the Presentation Server
    WS_EXCEL     Start EXCEL on the PC
    WS_EXECUTE     execute a program on a windows PC
    WS_FILE_DELETE     Delete File at the Frontend
    WS_FILENAME_GET     Call File Selector
    WS_MSG     Create a dialog box in which you display an one line message
    WS_UPLOAD     Load Files from the Presentation Server to Internal ABAP Tables
    WS_VOLUME_GET     Get the label from a frontend device.
    WWW_LIST_TO_HTML     After running a report, call this function to convert the list output to HTML.
    I don't think there is any function module for ALV.
    Even for more info Checkout the links
    http://www.erpgenie.com/abap/functions.htm
    http://www.sapdevelopment.co.uk/fmodules/fmssap.htm
    http://www.erpgenie.com/abap/index.htm
    http://www.geocities.com/victorav15/sapr3/abapfun.html
    Regards,
    Chandru

  • Setting Background job for BDC

    Dear Frds,
             I created upload program(i.e through call transcation) for Material Master.I  sheduled background job through SM36/SM37 .But it is giving error as "code page error"
                if any body has idea on this topic.please send me the details.

    have you used any GUI_UPLOAD or WS_UPLOAD or UPLOAD function modules ?
    I mean how your uploading legacy data to the internal table? if you used uploading from presentation server,then you can NOT use the program to run in background. either you have to place the file on application server or use the program in foreground mode.
    Regards
    Srikanth

  • ABAP Changes for release ECC 5.0

    Hi experts,
    Can anybody please give me a list of all the changes in ABAP language, that are made from 4.6c to ECC5.0.
    Thanks in advance,
    Ravi Kanth Talagana

    Hi Ravi,
    First of all you need to check the 'UNICODE CHECKS ACTIVE' and initial steps to be taken care as follows:
    1)Replace the sy-repid with the variable v_repid by passing sy-repid to it.
    2)Replace the FM WS_UPLOAD/WS_DOWNLOAD UPLOAD/DOWNLOAD
      with the GUI_UPLOAD & GUI_DOWNLOAD.
    3)The assignment like IT_ITAB1[] = IT_ITAB2[] is not possible in the ECC 5.0 untill & unless both are of the similar structure. It gives a syntax error.
    4)Replace '09'(Hexadecimal character) by declaring a varibale and assigning the value of ABAP_CHAR_UTILITES=>HORIZONTAL_TAB which is in the class ABAP_CHAR_UTILITIES.
    Like these there are many things to be noted down.
    I can send you the detailed document on the ECC 5.0 and Unicode compliant details if you give your mail id so that I can attach the same to you.
    Reward if it helps you.
    Cheers,
    Sampath.

  • Unicode programming

    wht is unicode programming and uni code check

    Hi,
    Intial screen where you can enter your selection criteria, only field you will prob need to chnage is the max number of
    programs field so that it is high enough to return all your potential problems.
    If you have not set your max programs field high enough you will see the following screen during execution.
    Once the transaction as finished analysing your systenm it will provide you with a report detailing all your objects which do not currently have
    the unicode attribute selected. It also details what problems you will have when you check the unicode attribute and try to reactivate the object.
      Unicode attribute can be turned on without any modification to the object
      Modification(s) to the object will be required before unicode can be switched on
      Error in code which is unrelated to unicode conversion
    Error code      Solution instructions
    MESSAGEG@3      
    Replace variable declaration of type X with appropriate value from method cl_abap_char_utilities
    i.e.      CONSTANTS:      con_tab TYPE x VALUE '09',
                   con_cret TYPE x VALUE '0D'.
    would be replaced with
         CONSTANTS:      con_tab TYPE c value cl_abap_char_utilities=>HORIZONTAL_TAB,
                   con_cret TYPE c value cl_abap_char_utilities=>CR_LF.
    See here for further Hex code values
    UPLO      
    Upload/ws_upload and download/ws_download are obsolete, since they are not Unicode enabled. Replace
    with appropriate methods from cl_gui_frontend_services. Please also note that the data types of the various
    parameters will also probably also need changing for the new method calls but the code below demonstrates
    how to do this. I_TABLE is the original table and IT_UCTABLE is the converted table.
    i.e. Function module ‘WS_DOWNLOAD’
      CALL FUNCTION 'WS_DOWNLOAD'
          EXPORTING
               FILENAME                = p_file
               FILETYPE                = 'ASC'
             MODE                    = ' '
           TABLES
                DATA_TAB                = i_table
          EXCEPTIONS
    would be replaced with
    data: gd_file type string.
    types: t_uctable like line of i_table.
    data:  it_uctable type standard table of t_uctable.
      gd_file = p_file.
      it_uctable[] = i_table[].
      CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        filename = gd_file
        filetype = 'ASC' " DAT,WK1
        Append   = ' '   "if mode = A then this would be X
      CHANGING
        data_tab = it_uctable
      EXCEPTIONS
        OTHERS   = 1.
    Function module ‘DOWNLOAD’
          CALL FUNCTION 'DOWNLOAD'
            EXPORTING
              filename = p_file
              filetype = 'WK1'
            TABLES
              data_tab = i_table.
    would be replaced with
    data: gd_file type string.
    DATA: ld_filename TYPE string,
          ld_path TYPE string,
          ld_fullpath TYPE string,
          ld_result TYPE i.
    types: t_uctable like line of i_table.
    data:  it_uctable type standard table of t_uctable.
      gd_file = p_file.
      shift gd_file RIGHT DELETING TRAILING '\'.
      shift gd_file RIGHT DELETING TRAILING '/'.
      shift gd_file left DELETING LEADING space.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          DEFAULT_EXTENSION = 'WK1'
          default_file_name = gd_file
          INITIAL_DIRECTORY = gd_file
        CHANGING
          filename          = ld_filename
          path              = ld_path
          fullpath          = ld_fullpath
          user_action       = ld_result.
      check ld_result eq 0.
      gd_file = ld_fullpath.
      gd_file = p_file.
      it_uctable[] = i_table[].
      CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        filename = gd_file
        filetype = 'ASC' " DAT,WK1
        Append   = ' '   "if mode = A then this would be X
      CHANGING
        data_tab = it_uctable
      EXCEPTIONS
        OTHERS   = 1.
    Or in circumstances where you need to add field texts to the first line of the file you could use the
    GUI_DOWNLOAD function module:
    DATA: BEGIN OF fields_tab OCCURS 0,
            f1(50),
          END   OF fields_tab.
    fields_tab-f1 = 'field1 text'.
    APPEND fields_tab.
    fields_tab-f1 = 'field2 text'.
    APPEND fields_tab.
    fields_tab-f1 = 'field3 text'.
    APPEND fields_tab.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = i_filename
          filetype                = 'DAT'
        IMPORTING
          filelength              = filelen
        TABLES
          data_tab                = itab
          fieldnames              = fields_tab
        EXCEPTIONS
    Note: ‘ws_upload’ and ‘upload’ would be the same as above but would use the
    cl_gui_frontend_services=>gui_upload method call instead:
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename = gd_file
        filetype = 'ASC' " DAT,WK1
        Append   = ' '
      CHANGING
        data_tab = it_uctable
      EXCEPTIONS
        OTHERS   = 1.
    OPEN 004      
    Add ‘ENCODING’ addition to statement
    i.e.      OPEN DATASET G_DATAFILE for OUTPUT IN TEXT MODE.
    would be replaced with
         OPEN DATASET G_DATAFILE for OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
    OPEN 002      
    IN..Mode is expected within open dataset command.
    i.e.      OPEN DATASET wfilepath FOR OUTPUT.
    would be replaced with
         OPEN DATASET wfilepath FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
    Or      OPEN DATASET wfilepath FOR OUTPUT IN BINARY MODE.
    OPEN 001      
    FOR INPUT, FOR OUTPUT, FOR APPENDING or FOR UPDATE expected!
    i.e.      OPEN DATASET wfilepath FOR OUTPUT.
    would be replaced with
         OPEN FOR OUTPUT DATASET wfilepath FOR OUTPUT IN TEXT MODE.
    DESCIBE002      
    THE DESCRIBE LENGTH can only be used with the IN BYTE or IN CHARACTER MODE
    i.e.      describe field e_text length line_length.
    would be replaced with
         describe field e_text length line_length IN CHARACTER MODE.
    ASSIGN 019      
    The statement ‘ASSIGN PATH+PATHLENGTH TO
    .’ Returns the following error message:
    "You cannot use ASSIGN f+offset. Always use an explicit length (or '*')".
    i.e.      ASSIGN PATH+PATHLENGTH TO
    would be replaced with
         ASSIGN PATH+PATHLENGTH(2) TO
    . “replace 2 with the length of the field
    MESSAGEG!2      
    Itab/structure and “ “  are not mutually convertible in a Unicode program
    i.e.      G_SHOW_LIST = SPACE.
    would be replaced with
         Clear: G_SHOW_LIST.
    Or       G_SHOW_LIST-field1 = space.
         G_SHOW_LIST-field2 = space.
                             …etc
    MESSAGEG!3      
    var and var  are not comparable in a Unicode program
    Example      Data: VAR like tabix.
    was replaced with
              Data: VAR type sy-tabix.

  • Give a simple example of BDC using Recording method

    give the various steps ...

    For a BDC upload you need to write a program which created BDC sessions.
    Steps:
    1. Work out the transaction you would use to create the data manually.
    2. Use transaction SHDB to record the creation of one material master data.
    Click the New recording button or the Menu - Recording - Create
    3. Save the recording, and then go back a screen and go to the overview.
    4. Select the recording and click on Edit - Create Program. Give the program a Z name, and select transfer from recording.
    5. Edit the program. You will see that all the data you entered is hard-coded into the program. You need to make the following changes:
    5.1 After the start-of-selection, Call ws_upload to upload the file (the excel file needs to be saved as TAB separated).
    5.2 After the open-group, Loop on the uploaded data. For each line, perform validation checks on the data, then modify the perform bdc_field commands to use the file data.
    5.3. After perform bdc_transaction, add the endloop.
    Execute the program. It will have options to create a batch session or to process directly.
    These are all my finds . Might be it will be useful to you.
    Direct call of transactions, session handling:
    /nxxxx This terminates the current transaction, and starts transaction xxxx
    /n This terminates the transaction. This generally corresponds to pressing F15 to go back.
    /nend This termiantes all separate sessions and logs off (corresponds to System - Logoff).
    /nex This terminates all separate sessions and logs off immediately (without any warning!).
    /oxxxx This opens a new session and starts transaction xxxx in This session.
    /o This lists existing sessions and allows deletion or opening of a new session.
    /i This terminates the current session (corresponds to System End
    /i1, /i2,... This terminates the session with the number given.
    .xyzw Fast path: 'xyzw' refers to the underlined letters in the menus. This type of navigation is uncommon and is provided more for emergencies (such as a defective mouse).
    Batch
    The following commands can be entered in correction mode ('Process in foreground' or 'Display errors only') when processing a batch input session:
    /n This terminates the current batch input transaction and characterizes it as
    /bdel This deletes the current batch input transaction.
    /bend This terminates batch input processing and sets the session to Failed
    /bda This switches from Display errors only to Process in foreground
    /bde This switches from Process in foreground to Display errors only
    ABAP/4
    /h This switches into debugging mode.
    /hs This switches into debugging mode and activates the debugging of system functions.
    Buffer
    WARNING: Resetting buffers can significantly change the performance of the entire system for a long time.
    It should therefore only be used where there is a good reason tdso. As of release 3.0B system administator authorization is required (authorization object (S_ADMI_FCD). The action is noted in the system log.
    /$SYNC This resets all buffers of the application server
    /$CUA This resets the CUA buffer of the application server
    /$TAB This resets the TABLE buffers of the application server
    /$NAM This resets the nametab buffer of the application server
    /$DYNP This resets the screen buffer of the application server
    SHDB recording helps you to identify the desired screen flow. It shows details like screen sequence, screen nos, screen element names and required user command keys. This all helps while designing / coding a BDC flow for a transaction in the custom program. If you have any more questions or if you are not clear about SHDB, please check this links -
    http://www.planetsap.com/Tips_and_Tricks.htm
    http://www.itcserver.com/blog/2006/07/12/shdb-the-transaction-recorder/
    Direct Input.
    Without calling the screens but all the validations should be done and only for master datas upload.
    Direct Input method:
    1. Only for error free datas and also master data
    updation.
    2. It will directly updates the database table. No
    screens involved.
    3. Transaction BMVO or Program RBMVSHOW has been
    used.
    BDC(Batch Input Session):
    1. Screens will be called programmatically.
    2. First sessions will be created then we'll run the seesions in SM35 transaction.
    3.Synchronous database update. After the processing the session only database update will occur.
    For BDC:
    http://myweb.dal.ca/hchinni/sap/bdc_home.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&
    http://www.sap-img.com/abap/learning-bdc-programming.htm
    http://www.sapdevelopment.co.uk/bdc/bdchome.htm
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm
    http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
    Check these link:
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://www.sap-img.com/abap/question-about-bdc-program.htm
    http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
    http://www.planetsap.com/bdc_main_page.htm
    call Transaction or session method ?
    Check this sample one
    ******Internal Table for Header Data.
    TYPES : BEGIN OF type_header,
    kschl LIKE konv-kschl,
    vkorg LIKE vbak-vkorg,
    vtweg LIKE komg-spart,
    matnr LIKE mvke-matnr,
    kbetr(11) TYPE c,
    datab(10) TYPE c,
    datbi(10) TYPE c,
    END OF type_header.
    ****Internal Table for Item Level.
    TYPES : BEGIN OF type_item,
    kschl LIKE konv-kschl,
    vkorg LIKE vbak-vkorg,
    vtweg LIKE komg-spart,
    matnr LIKE mvke-matnr,
    kbetr(11) TYPE c,
    datab(10) TYPE c,
    datbi(10) TYPE c,
    END OF type_item.
    ******Error Table For not found in MVKE.
    TYPES : BEGIN OF type_error ,
    kschl LIKE konv-kschl,
    vkorg LIKE vbak-vkorg,
    vtweg LIKE komg-spart,
    matnr LIKE mvke-matnr,
    kbetr LIKE konp-kbetr,
    datab(10) TYPE c,
    datbi(10) TYPE c,
    text(100) TYPE c,
    END OF type_error.
    ****For error Messages
    TYPES : BEGIN OF type_mtab,
    matnr LIKE mara-matnr,
    msgtyp LIKE bdcmsgcoll-msgtyp,
    msgid LIKE bdcmsgcoll-msgid,
    msgnr LIKE bdcmsgcoll-msgnr,
    text(100) TYPE c,
    END OF type_mtab.
    ****Internal Table
    TYPES: BEGIN OF type_mvke,
    matnr LIKE mvke-matnr,
    vkorg LIKE mvke-vkorg,
    vtweg LIKE mvke-vtweg,
    END OF type_mvke.
    ****Internal Table
    TYPES : BEGIN OF type_tvkov,
    vkorg LIKE tvkov-vkorg,
    vtweg LIKE tvkov-vtweg,
    END OF type_tvkov.
    Declaring Internal Tables
    DATA : t_header TYPE STANDARD TABLE OF type_header,
    t_item TYPE STANDARD TABLE OF type_item,
    t_mvke TYPE STANDARD TABLE OF type_mvke,
    t_tvkov TYPE STANDARD TABLE OF type_tvkov,
    t_error TYPE STANDARD TABLE OF type_error,
    t_mtab TYPE STANDARD TABLE OF type_mtab.
    Work Area Declaration.
    DATA : wa_header LIKE LINE OF t_header,
    wa_item LIKE LINE OF t_item,
    wa_error LIKE LINE OF t_error,
    wa_mtab LIKE LINE OF t_mtab,
    wa_tvkov LIKE LINE OF t_tvkov,
    wa_mvke LIKE LINE OF t_mvke.
    *Rows for Table with Excel Data*******
    DATA: t_xls_file LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    ***Constant.
    DATA : c_params LIKE ctu_params.
    DATA : c_ans(1) TYPE c.
    DATA : v_count(4) TYPE c. " To show No.of records
    DATA : bdctab LIKE bdcdata OCCURS 10 WITH HEADER LINE. " BDCDATA
    DATA : tmess_mtab LIKE bdcmsgcoll OCCURS 10 WITH HEADER LINE.
    SELECTION SCREEN
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : p_fname LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN : END OF BLOCK b1.
    END OF SELECTION SCREEN.
    DATA : repid LIKE sy-repid.
    DATA : v_matnr(50) TYPE c, "used for line items
    v_kbetr(50) TYPE c, "used for line items
    v_dat1(50) TYPE c, "used for line items
    v_dat(50) TYPE c. "used for line items
    DATA : v_lindx(5) TYPE n ,"index counter for first 14 records.
    v_lindx1(5) TYPE n VALUE '01', "index counter for 13 records.
    v_item(5) TYPE c, "To increment the line index
    v_pgedwn2 TYPE i . "For Pagedown Counter
    DATA: v_currentrow TYPE i. "For Current Row
    DATA v_bdc(50) TYPE c." Text to apper in Confrim POPUP Window.
    ************AT SELECTION-SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
    PERFORM get_filename USING p_fname.
    *************START-OF-SELECTION
    START-OF-SELECTION.
    ******Values for Ctu_params to Transaction
    c_params-defsize = 'X'.
    c_params-dismode = 'N'.
    c_params-updmode = 'S'.
    ******Refresh
    PERFORM f_refresh.
    *********To upload File.
    PERFORM upload_file.
    ****User Confrimation only BDC will Process
    IF c_ans = '1'.
    *** BDC Process.
    PERFORM read_data.
    ELSE.
    FORMAT COLOR 3 INTENSIFIED .
    WRITE:/ 'Selected not to Process the Upload'.
    EXIT.
    ENDIF.
    ******On completion of Process Refresh the Internal Table
    REFRESH : t_xls_file,
    t_header,
    t_item,
    t_mvke,
    t_tvkov.
    CLEAR : t_xls_file,
    wa_header,
    wa_item,
    wa_mvke,
    wa_tvkov.
    ***********Display Messages
    WRITE : /01 'Status',19 'Status Text'.
    WRITE AT 0(150) sy-uline.
    LOOP AT t_mtab INTO wa_mtab.
    WRITE :/01 wa_mtab-msgtyp,19 wa_mtab-text.
    ENDLOOP.
    SKIP 2.
    SORT t_error BY matnr.
    WRITE AT 0(150) sy-uline.
    WRITE 'ERROR MESSAGES'.
    WRITE AT 0(150) sy-uline.
    WRITE :/01 'Material.No',20 'Status Text'.
    WRITE AT 0(150) sy-uline.
    LOOP AT t_error INTO wa_error WHERE matnr NE ' '.
    WRITE:/01 wa_error-matnr,20 wa_error-text.
    ENDLOOP.
    *& Form get_filename
    text
    -->P_FILENAME text
    FORM get_filename USING p_fname.
    *****To read the file from Presentation Server
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
    program_name = repid
    dynpro_number ! ; = syst-dynnr
    field_name = p_fname
    STATIC = ' '
    mask = '*.XLS'
    CHANGING
    file_name = p_fname
    EXCEPTIONS
    mask_too_long = 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.
    ENDFORM. " get_filename
    *& Form upload_file
    text
    --> p1 text
    <-- p2 text
    FORM upload_file.
    DATA : frow VALUE 2 TYPE i,
    fcol VALUE 1 TYPE i,
    erow VALUE 10000 TYPE i,
    ecol VALUE 7 TYPE i,
    ecol1 VALUE 1 TYPE i,
    c_col1 TYPE i VALUE '0001',
    c_col2 TYPE i VALUE '0002',
    c_col3 TYPE i VALUE '0003',
    &nb! sp; c_col4 TYPE i VALUE '0004',
    c_col5 TYPE i VALUE '0005',
    c_col6 TYPE i VALUE '0006',
    c_col7 TYPE i VALUE '0007'.
    ***FM used to UPLOAD data from Flat file
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    filename = p_fname
    i_begin_col = fcol
    i_begin_row = frow
    i_end_col = ecol
    i_end_row = erow
    TABLES
    intern = t_xls_file
    EXCEPTIONS
    inconsistent_parameters = 1
    upload_ole = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    MESSAGE e000.
    ENDIF.
    ****T_XLS_FILE is initial, stop the process & throw message
    IF t_xls_file[] IS INITIAL.
    FORMAT COLOR 6 ON INTENSIFIED ON.
    WRITE:/ 'No Data Exists '.
    FORMAT COLOR OFF INTENSIFIED OFF.
    STOP.
    ELSE.
    Sort table by rows and colums
    SORT t_xls_file BY row col.
    Get first row retrieved
    READ TABLE t_xls_file INDEX 1.
    Set first row retrieved to current row
    v_currentrow = t_xls_file-row.
    **Loop to move data in internal Table
    LOOP AT t_xls_file .
    Reset values for next row
    IF t_xls_file-row NE v_currentrow.
    APPEND wa_header TO t_header.
    CLEAR wa_header.
    v_currentrow = t_xls_file-row.
    ENDIF.
    CASE t_xls_file-col.
    WHEN c_col1. "Kschl
    wa_header-kschl = t_xls_file-value.
    WHEN c_col2. "Vkorg
    wa_header-vkorg = t_xls_file-value.
    WHEN c_col3. "vtweg
    wa_header-vtweg = t_xls_file-value.
    WHEN c_col4. "Matnr
    wa_header-matnr = t_xls_file-value.
    WHEN c_col5. "Kbetr
    wa_header-kbetr = t_xls_file-value.
    WHEN c_col6. "FROm
    wa_header-datab = t_xls_file-value.
    WHEN c_col7. "TO
    wa_header-datbi = t_xls_file-value.
    ENDCASE.
    ENDLOOP.
    APPEND wa_header TO t_header.
    CLEAR wa_header.
    ENDIF.
    ****To process the data
    PERFORM f_process.
    ENDFORM. " upload_file
    *& Form READ_DATA
    text
    --> p1 text
    <-- p2 text
    FORM read_data.
    ****To make Uniq Records in Header Level
    SORT t_header BY kschl vkorg vtweg.
    DELETE ADJACENT DUPLICATES FROM t_header COMPARING
    kschl vkorg vtweg .
    SORT t_item BY vkorg vtweg matnr.
    DATA : wa1_item TYPE type_item.
    DATA : l_cnt TYPE i.
    DATA : flag(1) TYPE c. "to process the Line item.
    ***Looping Header Table.
    LOOP AT t_header INTO wa_header.
    PERFORM bdc_dynpro US! ING 'SAPMV13A' '0100'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RV13A-KSCHL'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ANTA'.
    PERFORM bdc_field USING 'RV13A-KSCHL'
    wa_header-kschl.
    PERFORM bdc_dynpro USING 'SAPLV14A' '0100'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RV130-SELKZ(03)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=WEIT'.
    PERFORM bdc_field USING 'RV130-SELKZ(03)'
    'X'.
    PERFORM bdc_dynpro USING 'SAPMV13A' '1004'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'KOMG-VKORG'.
    PERFORM bdc_field USING 'KOMG-VKORG'
    wa_header-vkorg.
    PERFORM bdc_field USING 'KOMG-VTWEG'
    wa_header-vtweg.
    ****To handle Line Items.
    LOOP AT t_item INTO wa1_item WHERE vkorg = wa_header-vkorg AND
    vtweg = wa_header-vtweg.
    wa_item = wa1_item.
    ******Flag Set only After processing first 14 records .
    IF flag = ' '.
    v_lindx = v_lindx + 01.
    SHIFT v_lindx LEFT DELETING LEADING '0'.
    v_item = v_lindx .
    CONCATENATE 'KOMG-MATNR(' v_item ')' INTO v_matnr.
    PERFORM bdc_field USING v_matnr
    wa_item-matnr.
    CONCATENATE 'KONP-KBETR(' v_item ')' INTO v_kbetr.
    PERFORM bdc_field USING v_kbetr
    wa_item-kbetr.
    CONCATENATE 'RV13A-DATAB(' v_item ')' INTO v_dat.
    PERFORM bdc_field USING v_dat
    wa_item-datab.
    CONCATENATE 'RV13A-DATBI(' v_item ')' INTO v_dat1.
    PERFORM bdc_field USING v_dat1
    wa_item-datbi.
    IF v_item = 14.
    flag = 'X'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=P+'.
    PERFORM bdc_dynpro USING 'SAPMV13A' '1004'.
    CLEAR v_lindx.
    CLEAR v_item.
    CONTINUE.
    ENDIF.
    ENDIF.
    ***Flag is Set after Processing of 14 records.
    TO process rest of Records
    IF flag = 'X'.
    v_pgedwn2 = v_pgedwn2 + 1.
    v_lindx1 = v_lindx1 + 01.
    SHIFT v_lindx1 LEFT DE! LETING LEADING '0'.
    v_item = v_lindx1 .
    CONCATENATE 'KOMG-MATNR(' v_it! em ')' INTO v_matnr.
    PERFORM bdc_field USING v_matnr
    wa_item-matnr.
    CONCATENATE 'KONP-KBETR(' v_item ')' INTO v_kbetr.
    PERFORM bdc_field USING v_kbetr
    wa_item-kbetr.
    CONCATENATE 'RV13A-DATAB(' v_item ')' INTO v_dat.
    PERFORM bdc_field USING v_dat
    wa_item-datab.
    CONCATENATE 'RV13A-DATBI(' v_item ')' INTO v_dat1.
    PERFORM bdc_field USING v_dat1
    wa_item-datbi.
    IF v_pgedwn2 = 13.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=P+'.
    PERFORM bdc_dynpro USING 'SAPMV13A' '1004'.
    v_pgedwn2 = 0.
    v_lindx1 = 1.
    CLEAR v_item.
    CONTINUE.
    ENDIF.
    ENDIF.
    ENDLOOP.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=SICH'.
    Calling Transaction after Processing All items.
    CALL TRANSACTION 'VK11' USING bdctab
    OPTIONS FROM c_params MESSAGES INTO tmess_mtab.
    REFRESH bdctab.
    CLEAR : bdctab.
    CLEAR : wa_item.
    CLEAR : wa1_item.
    CLEAR : wa_header.
    CLEAR : l_cnt.
    CLEAR : v_lindx1.
    CLEAR: v_pgedwn2,v_lindx.
    LOOP AT tmess_mtab .
    l_cnt = l_cnt + 1.
    READ TABLE t_item INTO wa_item INDEX l_cnt .
    CALL FUNCTION 'MASS_MESSAGE_GET' "To get the Message Text
    EXPORTING
    arbgb = tmess_mtab-msgid
    msgnr = tmess_mtab-msgnr
    msgv1 = tmess_mtab-msgv1
    msgv2 = tmess_mtab-msgv2
    msgv3 = tmess_mtab-msgv3
    msgv4 ! = tmess_mtab-msgv4
    IMPORTING
    msgtext = wa_mtab-text
    EXCEPTIONS
    message_not_found = 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.
    wa_mtab-matnr = wa_item-matnr.
    wa_mtab-msgtyp = tmess_mtab-msgtyp.
    wa_mtab-msgid = tmess_mtab-msgid.
    wa_mtab-msgn! r = tmess_mtab-msgnr.
    APPEND wa_mtab TO t_mtab.
    CLEAR wa_mtab-text.
    CLEAR wa_item.
    ENDLOOP.
    ENDLOOP.
    ENDFORM. " READ_DATA
    *& Form BDC_DYNPRO
    text
    -->P_0300 text
    -->P_0301 text
    Start new screen *
    FORM bdc_dynpro USING program dynpro.
    CLEAR bdctab.
    bdctab-program = program.
    bdctab-dynpro = dynpro.
    bdctab-dynbegin = 'X'.
    APPEND bdctab.
    ENDFORM. " BDC_DYNPRO
    *& Form BDC_FIELD
    text
    -->P_0305 text
    -->P_WA_HEADER_KSCHL text
    Insert field *
    FORM bdc_field USING fnam fval.
    CLEAR bdctab.
    bdctab-fnam = fnam.
    bdctab-fval = fval.
    APPEND bdctab.
    ENDFORM. " BDC_FIELD
    *& Form bdc_trc_ansaction
    text
    -->P_0527 text
    *& Form f_Process
    text
    --> p1 text
    <-- p2 text
    FORM f_process.
    DATA : l_todate(12) TYPE c,
    l_frdate(12) TYPE c.
    ***Select for all entries of material in Header "Flat File Materials".
    IF NOT t_header[] IS INITIAL.
    SELECT matnr vkorg vtweg FROM mvke INTO TABLE t_mvke FOR ALL ENTRIES
    IN t_header WHERE matnr = t_header-matnr AND
    vkorg = t_header-vkorg AND
    vtweg = t_header-vtweg.
    ENDIF.
    *********select Sales.org & Dist.channel.
    IF NOT t_header[] IS INITIAL.
    SELECT vkorg vtweg FROM tvkov INTO TABLE t_tvkov FOR ALL ENTRIES IN
    t_header WHERE vkorg = t_header-vkorg
    AND vtweg = t_header-vtweg.
    ENDIF.
    ***Checking for material in Sales Master Table
    SORT t_mvke BY matnr vkorg vtweg.
    SORT t_tvkov BY vkorg vtweg.
    LOOP AT t_header INTO wa_header.
    READ TABLE t_mvke INTO wa_mvke WITH KEY matnr = wa_header-matnr
    vkorg = wa_header-vkorg
    ! ; vtweg = wa_header-vtweg BINARY SEARCH.
    IF sy-subrc <> 0.
    wa_error = wa_header.
    &nb! sp; MOVE text-011 TO wa_error-text.
    APPEND wa_error TO t_error.
    DELETE TABLE t_header FROM wa_header.
    ELSE.
    ********Date Validations
    IF ( wa_header-datab NE ' ! ; ' AND wa_header-datbi NE ' ' ) .
    l_todate = wa_header-datab.
    l_frdate = wa_header-datbi.
    REPLACE '.' INTO l_toda! te WITH ''.
    REPLACE '.' INTO l_todate WITH ''.
    CONDENSE l_todate NO-GAPS.
    REPLACE '.' INTO l_frdate WITH ''.
    REPLACE '.' INTO l_frdate WITH ''.
    CONDENSE l_frdate NO-GAPS.
    IF l_frdate < l_todate.
    wa_error = wa_header .
    MOVE text-012 TO wa_error-text.
    APPEND wa_error TO t_error.
    DELETE TABLE t_header FROM wa_header.
    ENDIF.
    ELSE.
    wa_error = wa_header .
    MOVE text-016 TO wa_error-text.
    APPEND wa_error TO t_error.
    DELETE TABLE t_header FROM wa_header.
    ENDIF.
    ENDIF.
    ********Rate Validation.
    IF wa_header-kbetr = ' '.
    wa_error = wa_header .
    MOVE text-017 TO wa_error-text.
    APPEND wa_error TO t_error.
    DELETE TABLE t_header FROM wa_header.
    ENDIF.
    READ TABLE t_tvkov INTO wa_tvkov WITH KEY vkorg = wa_header-vkorg
    BINARY SEARCH.
    IF sy-subrc = 0.
    READ TABLE t_tvkov INTO wa_tvkov WITH KEY vtweg = wa_header-vtweg
    BINARY SEARCH.
    IF sy-subrc <> 0.
    wa_error = wa_header.
    MOVE text-015 TO wa_error-text.
    WRITE wa_header-vtweg TO wa_error-text+13(4).
    APPEND wa_error TO t_error.
    ENDIF.
    ELSE.
    wa_error = wa_header.
    MOVE text-013 TO wa_error-text.
    WRITE wa_header-vkorg TO wa_error-text+9(4).
    APPEND wa_error TO t_error.
    ENDIF.
    CLEAR wa_header.
    ENDLOOP.
    *****Deleting Duplicate Material Form Header "Flat File Data".
    SORT t_header BY kschl vkorg vtweg matnr.
    DELETE ADJACENT DUPLICATES FROM t_header COMPARING
    kschl! vkorg vtweg matnr .
    ****Data Moving from Header to Item Level.
    t_item[] = t_header[].
    *To count No.of records in Item Table.
    DESCRIBE TABLE t_item LINES v_count.
    CONCATENATE text-014 ' ' v_count INTO v_bdc.
    ****Popup to get Confirmation from user to process BDC
    CALL FUNCTION 'POPUP_TO_CONFIRM'
    EXPORTING
    titlebar = 'Confirmation of File Data'
    text_question = v_bdc
    text_button_1 = 'Confirm'
    text_button_2 = 'Cancel Run'
    default_button = '1'
    IMPORTING
    answer = c_ans.
    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. " f_Process
    *& Form f_Refresh
    text
    --> p1 text
    <-- p2 text
    FORM f_refresh.
    REFRESH : t_xls_file,
    t_header,
    t_item,
    t_mvke,
    t_tvkov,
    t_error,
    t_mtab.
    CLEAR : t_xls_file,
    wa_header,
    wa_item,
    wa_mvke,
    wa_tvkov,
    wa_error,
    wa_mtab.
    ENDFORM. " f_Refresh
    ALSO PLEASE CHECK OUT
    sample code for call transaction method
    http://www.sapdevelopment.co.uk/bdc/bdc_ctcode.htm
    chk this for BDC recording with screen shots
    http://www.sapdevelopment.co.uk/bdc/bdc_recording.htm
    BDC
    http://www.sap-img.com/bdc.htm
    Table control in BDC
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    best typical example is BDC for MM01
    check the below links for the same
    bdc for MM01.
    mm01
    bdc mm01
    BDC
    http://www.sap-img.com/bdc.htm
    http://www.guidancetech.com/people/holland/sap/abap/zzsni001.htm
    http://www.sappoint.com/abap/bdcconcept.pdf
    Difference between Genrate session& Call transaction
    Re: Steps in BDC

  • Doubts about some popular function modules?

    Hi all,
    I have doubts about these function modules (see in parenthesis)
    ws_filename_get (to get the file name at ...?)
    ws_query (to get file size and environment variables from the presentation server to the ...?)
    upload and download (what are the new function modules used in place of these (I know they are obsolete now)
    what is the Object oriented equivalents of these functions?
    Thanks.
    Charles.
    ++++++++++++++++++++++++++++++++++++

    <i>(1)What is the use of ws_filename_get? Please be specific in your answer, about where the file resides: application server, presentation server or the ABAP program.</i>
    It is simply providing an interface for the user to choose a filename which resides on the frontend PC(presentation server). As suggested already, this has been replaced with FILE_OPEN_DIALOG method of the class CL_GUI_FRONTEND_SERVICES.
    <i>2)What is the use of ws_query? Please be specific in your answer, about where the file resides: application server, presentation server or the ABAP program.</i>
    Again, already answered,  this has been replace by multiple more specific methods of the same class mentioned above.
    <i>How can GUI_UPLOAD be a substitute of Upload? It is a substitute of WS_UPLOAD as upload is used to transfer data from presentation server to the ABAP program, whereas the other two are used to get it from presentation server to the application server.</i>
    They all transafer data from the presentation to your application.  They are all interchangable(in a sense), but you should be using the GUI_UPLOAD method of the class CL_GUI_FRONTEND_SERVICES.
    Regards
    Rich Heilman

Maybe you are looking for