How to create a BDC program for given recording.

i have to create a BDC program for uploading a file.
currently i am using call function
  CALL FUNCTION 'F4_FILENAME'

just check out the code below  it  is  for  updating two transactions
                       types Declaration                      *
types: begin of t_tab1 ,
            vendor(10),
            material(18),
            pur_org(4),
            wglif(18),
      end of t_tab1.
              Data Declaration                                 *
data : begin of it_tab5 occurs 0,
          vendor(10),
          material(18),
         end of it_tab5.
**DATA : BEGIN OF IT_TAB6 OCCURS 0,
         VENDOR(10),
         MATERIAL(18),
        END OF IT_TAB6.
data: it_tab1 type standard table of t_tab1 with header line.
data: wa_tab1 type t_tab1.
data: wa_tab2 type t_tab1.
data: it_tab3 like bdcdata occurs 0 with header line.
data: it_tab4 like bdcdata occurs 0 with header line.
data: it_tab2 type table of bdcmsgcoll with header line.
data: d_file_name like ibipparms-path,
      d_file_name1 type string.
                   Start-of-selection                        *
start-of-selection.
FM for finding the flat file
  call function 'F4_FILENAME'
EXPORTING
  PROGRAM_NAME        = SYST-CPROG
  DYNPRO_NUMBER       = SYST-DYNNR
  FIELD_NAME          = ' '
   importing
     file_name           = d_file_name.
  d_file_name1 = d_file_name.
******FM for uploading data from flat file into internal table
  call function 'GUI_UPLOAD'
    exporting
      filename                      = d_file_name1
     filetype                      = 'ASC'
  HAS_FIELD_SEPARATOR           = ' '
  HEADER_LENGTH                 = 0
  READ_BY_LINE                  = 'X'
  DAT_MODE                      = ' '
  CODEPAGE                      = ' '
  IGNORE_CERR                   = ABAP_TRUE
  REPLACEMENT                   = '#'
  CHECK_BOM                     = ' '
IMPORTING
  FILELENGTH                    =
  HEADER                        =
    tables
      data_tab                      = it_tab5
exceptions
   file_open_error               = 1
   file_read_error               = 2
   no_batch                      = 3
   gui_refuse_filetransfer       = 4
   invalid_type                  = 5
   no_authority                  = 6
   unknown_error                 = 7
   bad_data_format               = 8
   header_not_allowed            = 9
   separator_not_allowed         = 10
   header_too_long               = 11
   unknown_dp_error              = 12
   access_denied                 = 13
   dp_out_of_memory              = 14
   disk_full                     = 15
   dp_timeout                    = 16
   others                        = 17.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
                 End-of-selection                         *
end-of-selection.
  sort it_tab5 by vendor.
  loop at it_tab5.
    perform bdc_dynpro using 'SAPLBG00'  0101 .
    perform bdc_field using 'BDC_OKCODE' '/00' .
    perform bdc_dynpro using 'SAPLBG00'  1000 .
    perform bdc_field using 'BDC_OKCODE' '=BUCH' .
    perform bdc_field using 'BDC_SUBSCR'
    'SAPLBG00                                1101KOPF_1000'.
    perform bdc_field using 'GBGMK-GAART' '2' .
    perform bdc_field using 'GBGMK-GAERB' 'X' .
    perform bdc_field using 'BDC_SUBSCR'
      'SAPLBG00                          1103TAB_SUB_1000'.
    perform bdc_field using 'BDC_CURSOR' 'GBGMP-LSTNR(01)' .
    perform bdc_field using 'GBGMP-LSTNR(01)' it_tab5-material .
   call transaction 'BGM1' using it_tab3 mode 'E' messages into it_tab2
    refresh it_tab3.
    wa_tab1-pur_org = 'ABCP'.
    loop at it_tab2.
    endloop.
    perform bdc_dynpro using 'SAPMM06I'  0100 .
    perform bdc_field using 'BDC_CURSOR' 'EINE-EKORG' .
    perform bdc_field using 'BDC_OKCODE' '/00' .
    perform bdc_field using 'EINA-LIFNR' it_tab5-vendor .
    perform bdc_field using 'EINA-MATNR' it_tab5-material .
    perform bdc_field using 'EINE-EKORG' wa_tab1-pur_org .
    perform bdc_field using 'RM06I-NORMB' 'X' .
    perform bdc_dynpro using 'SAPMM06I'  0101 .
    perform bdc_field using 'BDC_CURSOR' 'EINA-WGLIF' .
    perform bdc_field using 'BDC_OKCODE' '=BU' .
    perform bdc_field using 'EINA-WGLIF' it_tab2-msgv1 .
    call transaction 'ME12' using it_tab3 mode 'E'.
    refresh it_tab3.
    refresh it_tab2.
  endloop.
*&      Form  BDC_DYNPRO
     Start new screen
     -->P_FNAM  text
     -->P_FVAL  text
form bdc_dynpro  using   program
                         dynpro.
  clear it_tab3.
  it_tab3-program  = program.
  it_tab3-dynpro   = dynpro.
  it_tab3-dynbegin = 'X'.
  append it_tab3.
endform.                    " BDC_DYNPRO
*&      Form  BDC_FIELD
   Insert field
     -->P_FNAM  text
     -->P_FVAL  text
form bdc_field  using    fnam
                         fval.
  clear it_tab3.
  it_tab3-fnam = fnam.
  it_tab3-fval = fval.
  append it_tab3.
endform.                    " BDC_FIELD
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 14, 2008 6:20 PM

Similar Messages

  • Problem in creating a BDC program for transaction cj20n(project sytem)

    Hi all,
    I am trying to create project,WBS element ,network and activity using a BDC program,
      I am able to create to a recording for the transaction cj20n using tcode shdb but when i run the recording it doesnt run properly i am not able to create any thing.
    I get error saying that a particular field doesnt exist on the screen.
    Is possible to create a BDC program for transaction CJ20N ?
    Also is there any other alternative  apart from using a BAPI or a function module.
    Thanks,
    Nishant

    Hi,
        Check below link for BAPIs of transaction cj20n.
    [BAPI for cj20n|BAPI for CJ20N transaction]
    Thanks,
    Asit Purbey.

  • How to create a customer program for "PPMOD"feature(pe03)?

    Hi,
    I want to create customer program for "PPMOD"feature(tcode:pe03),who can tell me the steps? (ECC6.0)
    thanks a lot?
    Olivia Yang

    Hi,
    /1PAPA/FEAT610PPMOD the generated program for the feature.
    You are forbidden to change this generated program. Ideally whatever logic regarding the feature needs to be put through pe03 tcode of feature and not in the program.
    Still if there are any changes that need to be done to the program you can enhance the program.
    To enhance the program you need to go to se 38 and open this program and press Shift + F4
    Then Goto->Enhancement operations->Show implicit enhancement operations
    Then go to yellow line right click on mouse and Enhancement implementation->Create
    And put your own code in the implementation.
    Regards,
    Divya

  • How to create Add-On program for SAP Business One 2007

    Hi,
    When I create my Add-On into SBO I have some issues.
    Which program do I use to create an Add-On into SBO?
    Is there a URL or Path where I find the program?
    I am using a 2003 program which is built by my colleague.
    I assume SAP provide the Add-On program for SAP Business One 2007
    Thank you,
    Rune

    Rune,
    At a high level ...
    1) VS2005
    2) Compile your program
    3) Generate and Add-on Identifier
    4) Create a registration datafile
    5) Create the setup program consisting of your .EXE and the .ARD file
    6) Add-On is created and running in SBO
    Again ... the details on deploying and packaging your add-on can be found in the SAP Business One SDK Help Center Documentation and the SDK eLearning.
    Also, you can use B1DE using the Simple Installer or Professional Installer will do most of the work for you after you have coded the add-on.
    Eddy
    Edited by: Edward Neveux on Jan 30, 2008 9:11 PM

  • How to create checkbox in WAD for every record

    Hi All,
    We have a requirement where in the user selects some of the records from the IP screen and he should be able to see only those selected records and also should be able to plan on the same. So how can i create a checkbox in WAD for each and every record. If this is not possible through check box then are there any other options to achieve this. Request your valuable inputs.

    Hi,
    Not sure if you can create a check-box in wad but for sure you can set properties of the table in which you display your data. There should be something like "Selectable rows" (don't have access to the system now). When you switch it on you will be able to select rows of your report. Then you need to set filter based on the selection you made.
    Tomasz

  • BDC program for ME29N.

    i have created a BDC program for ME29N, it is working in process level but it is not working while executing it.
    how can i solve that? pls give me a sample code.....

    Hi,
       You can use this BAPI's instead of BDC's for your ME29N Transaction.
    1) BAPI_PO_RELEASE -- This method is to release Purchase Order.
    2) BAPI_PO_GETRELINFO -- Detailed Release Information on Purchase Order
    3) BAPI_PO_GETITEMSREL -- List Purchase Orders for Release
    Regards,
    Sudhakar Reddy.A

  • Need help with an SHDB BDC program  for Change outbound delivery(VL02N).

    I have created recording to change outbound delivery(VL02N). Steps are as below-
    For VL02N recording 1st I have click on the header(F8) then dates tab.
    Then insert line (+ button) then it shows 8 transport types.
    I have chosen 7th transport type. In SHDB it shows BDC_CURSOR = '08/07'.
    Then I have created BDC program for this recording, but it's not working,
    because It is changing BDC_CURSOR value every time when we do SHDB or VL02N and in my code I have hard coded BDC_CURSOR = '08/07' . 
    Can anyone tell me how to get this BDC_CURSOR changed value. So that instead of hard coding this value I can select this value every time.
    (FYI      For this Screen name = SAPMSSY0 Screen No = 0120.)
    Thanks.

    I have created recording to change outbound delivery(VL02N). Steps are as below-
    For VL02N recording 1st I have click on the header(F8) then dates tab.
    Then insert line (+ button) then it shows 8 transport types.
    I have chosen 7th transport type. In SHDB it shows BDC_CURSOR = '08/07'.
    Then I have created BDC program for this recording, but it's not working,
    because It is changing BDC_CURSOR value every time when we do SHDB or VL02N and in my code I have hard coded BDC_CURSOR = '08/07' . 
    Can anyone tell me how to get this BDC_CURSOR changed value. So that instead of hard coding this value I can select this value every time.
    (FYI      For this Screen name = SAPMSSY0 Screen No = 0120.)
    Thanks.

  • Please  Help me How write the BDC program for the MIGO inbound Delivery

    Please help me how to write bdc program for the MIGO Inbound Delivery in 4.7EE Version. Please help me.
    Not in LSMW.  Required call transaction or Session Method. Please help me.
    Mohan

    Run transaction BAPI . Select Logistics Execution/Shipping/InboundDelivery/SaveReplica.. You can use function module BAPI_INB_DELIVERY_SAVEREPLICA in your ABAP program.

  • BDC Program for MB1B Screen..

    Hi Abapers..
    I am doing BDC Upload program using MB1B Screen. I put the receiving bin but the following error coming..
    " CALL_TRANSACTION MB1B Return code = 1,001 RECORD: 0
    S The Receiving batch will be automatically set to G02
    W Batch G02 has already been posted in stock
    S No batch input data for screen SAPLKACB 0002"
    What is the error? how to rectify that error. anybody please give the solution of this problem.
    Give me source code for this bdc program for MB1B Screen.
    This is very urgent I will give reward points..
    Thanks
    S.Muthu.

    Hi Siddu,
             Thanks Very much. My Solution solved by You. I given reward points.
    Thanks a lot.
    I created BAPI_GOODSMVT_CREATE now its working.
    Regards,
    S.Muthu.

  • How to create different log files for each of web applications deployed in OC4J

    Hi All,
    I am using OC4J(from Oracle) v1.0.2.2 and Windows2000. Now I want to know
    1. how to create different log files for each of my deployed web applications ?
    2. what are the advantages in running multiple instances of oc4j and in what case we should run
    multiple instances of OC4J ?
    3. how to run OC4J as Windows2000 Service rather than Windows2000 Application ?
    Thanks and Regards,
    Kumar.

    Hi Avi,
    First of all I have given a first reading to log4j and I think there will some more easy way of logging debugging messages than log4j (If you could provide me a detailed explanation of a servlet,jsp,java bean that uses log4j and how to use log4j then it will be very helpful for me). The other easy ways (if I am not using log4j) to my problem i.e creating different log files for each of web applications deployed in oc4j are
    I have created multiple instances of OC4J that are configured to run on different ports and so on each instance I have deployed a single web application . And I started the 2 oc4j instances by transferring thier error/log messages to a file. And the other way is ..
    I have download from jakarta site a package called servhelper . This servhelper is a thread that is started in a startup servlet and stopped in the destroy method of that startup servlet. So this thread will automatically capture all the system.out.println's and will print those to a file. I believe that this thread program is synchronized. So in this method I need not run multiple instances of OC4J instead each deployed web application on single instance of oc4j uses the same thread program (ofcourse a copy of thread program is put in each of the deployed web applications directories) to log messages on to different log files.
    Can you comment on my above 2 approached to logging debugging messages and a compartive explanation to LOG4J and how to use LOG4J using a simple servlet, simple jsp is appreciated ...
    Thanks and Regards,
    Ravi.

  • How to create a new field for Q3 - QM notification in Header and item level

    Dear All,
    l
               Sub: How to create a new field for Q3 - QM notification in Header and item level
    Ref. the link --> Quality Notification
    We want to create a new field in header level and item level.
    As per the thread the solution is given below.
    In the IMG Config: Quality Management -> Quality Notification -> Notification Types -> Define screen areas for notification types Then Choose 'Define screen areas' Then Click on 'New entries' button Now, select the relevant Notification Type and click in 'Enter'. Select the 'Iten Cases' register and remember to setup the Tabstrip Header, Icon, etc. Set the 'Tabstrip active' flag. Then Save.
    Quality Notification -> Notification Types -> Define screen areas for notification types
    WE ARE UNABLE TO FIND IN CUSTOMIZATION PATH --> DEFINE SCREEN AREAS FOR NOTIFICATION TYPES.
    Please help.
    Question No. 2 :
    THE REQUIREMENT IS GIVEN BELOW.
    We want to hide the field in Q3 - QM Notification
    In header --> Reference tab --> Item (sub heading) --> "DEFECT LOCATION" FIELD TO BE ELIMINATED (HIDE)
    Ref the link --> Quality notification
    The solutiion is given below.
    Hi Sami,
    We can hide the collumns using the Transaction OQM1 and Program Name SAPLIQS0.
    Lets say Defect location need to be hidden, the field TXTCDOT need to have the radio button HIDE.
    Hope this will suffice your requirement.
    Kindly ask me if you need any other details.
    Thanks & Regards,
    Srinivas.D
    Hi Sami,
    We can hide the collumns using the Transaction OQM1 and Program Name SAPLIQS0.
    Lets say Defect location need to be hidden, the field TXTCDOT need to have the radio button HIDE.
    Hope this will suffice your requirement.
    Kindly ask me if you need any other details.
    Thanks & Regards,
    Srinivas.D
    By double clicking the "DEFECTIVE QUANTITY (EXTERNAL), WE COULD NOT GET --> field TXTCDOT .
    Plese do the needful.
    We are using ECC6.0 Ehp3 and Ehp4.
    With Best Regards,
    Raghu Sharma

    Dear Pushpa,
    Transaction Code :SHD0 is working fine.
    Please accept my sincere thanks for your sharing your Knowledge.
    I am able to fulfill my
    Regarding the enhancement, I have not tried.
    Once I will complete, I will award the fulll marks to you.
    With Best Regards,
    Raghu Sharma

  • BDC Program for table control

    Hi Friends,
    I have an issue i am stuck here,
    i have to create BDC Program for XK01 tcode,
    and my requirement is that,
    i have three users first user want only three colum and second user want four column
    and third user want five column in table control,
    so how could i achieve it,
    please hekp me out.
    Thanks
    Vikash

    Hi Vikash,
    FORM bdc_dynpro  USING  p_program p_dynpro.
    IF user-one.
    FORM bdc_field  USING  fnam1 fval.
    FORM bdc_field  USING  fnam2 fval.
    FORM bdc_field  USING  fnam3 fval.
    ELSEIF user-two.
    FORM bdc_field  USING  fnam1 fval.
    FORM bdc_field  USING  fnam2 fval.
    FORM bdc_field  USING  fnam3 fval.
    FORM bdc_field  USING  fnam4 fval.
    ELSEIF user-three.
    FORM bdc_field  USING  fnam1 fval.
    FORM bdc_field  USING  fnam2 fval.
    FORM bdc_field  USING  fnam3 fval.
    FORM bdc_field  USING  fnam4 fval.
    FORM bdc_field  USING  fnam5 fval.
    ENDIF.
    Does this make sense?
    regards,
    Archer.

  • BDC PROGRAM FOR F-02 ERROR

    Hi ,
    i have written a bdc program for f-02 .here we have 2 posting keys 31 and 40 .when i recored in shdb i can see when i use 31 posting key then i get 302 screen and when i use 40 posting key then i get 300 screen.But the problem is in 302 screen we have new posting keys and new account numbers .how to update these . here is my code . my file is not getting updated when i get screen 302 .Any advice?
    REPORT zfip0009 NO STANDARD PAGE HEADING.
    TABLES ska1.
    DATA: BEGIN OF bdcdata OCCURS 0.
            INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdcdata.
    DATA w_date(10) TYPE c.
    DATA w_first  TYPE c.
    DATA w_second TYPE c.
    data from flat file
    DATA: BEGIN OF t_data OCCURS 0,
           bukrs LIKE bkpf-bukrs,    "company code
           newbs LIKE rf05a-newbs,   "Posting Key
           newko LIKE rf05a-newko,   "New account number(SAP)
           wrbtr(13) TYPE c,         "amount
           dmbtr(13) TYPE c,         "sterling local amount  "+MW1
           mwskz LIKE bseg-mwskz,    "Tax code
           sgtxt LIKE bseg-sgtxt,    "item description
           kostl LIKE cobl-kostl,    "Cost centre
           ps_posid LIKE cobl-ps_posid, "WBS number
           aufnr LIKE cobl-aufnr,     "Internal order
          END OF t_data.
            SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: p_file LIKE rlgrap-filename
                DEFAULT 'C:\temp\XSL.txt'.
    SELECTION-SCREEN SKIP.
    PARAMETERS: p_sess(12) DEFAULT 'GLPOSTING'.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: p_bldat LIKE bkpf-bldat,
                p_budat LIKE bkpf-budat,
                p_blart LIKE bkpf-blart,
                p_monat LIKE bkpf-monat,
               p_bukrs LIKE bkpf-bukrs,
                p_bktxt LIKE bkpf-bktxt,
                p_xblnr LIKE bkpf-xblnr,
                p_waers LIKE bkpf-waers.
    SELECTION-SCREEN END OF BLOCK b2.
    *SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    *PARAMETERS p_ktopl LIKE ska1-ktopl.
    *SELECTION-SCREEN END OF BLOCK b3.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'WS_FILENAME_GET'
          EXPORTING
               def_filename     =  p_file
              DEF_PATH         = ' '
               mask             = ',.,..'
              MODE             = ' '
              TITLE            = ' '
          IMPORTING
               filename         = p_file
              RC               =
           EXCEPTIONS
                inv_winsys       = 1
                no_batch         = 2
                selection_cancel = 3
                selection_error  = 4
                OTHERS           = 5.
          START OF SELECTION
    START-OF-SELECTION.
    Get all of the information held on the spreadsheets.
      CALL FUNCTION 'WS_UPLOAD'
        EXPORTING
          filename = p_file
          filetype = 'DAT'
        TABLES
          data_tab = t_data
        EXCEPTIONS
          OTHERS   = 1.
      IF sy-subrc <> 0.
        WRITE :/ 'Failed to Open Input file', p_file.
        EXIT.
      ENDIF.
      REFRESH bdcdata.
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          client = sy-mandt
          group  = p_sess
          user   = sy-uname
          keep   = 'X'.
      PERFORM load_bdcdata.
      CALL FUNCTION 'BDC_CLOSE_GROUP'.
      WRITE: /
    'Batch input session', p_sess, 'created: process session via SM35'.
    END-OF-SELECTION.
    *&      Form  LOAD_BDCDATA
          Load the BDCDATA fields depending
    FORM load_bdcdata.
      CLEAR: w_first, w_second.
      CLEAR bdcdata.
      LOOP AT t_data.
        IF sy-tabix = 1.
          PERFORM bdc_dynpro      USING 'SAPMF05A' '0100'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'RF05A-NEWKO'.
          PERFORM format_date USING p_bldat.
          PERFORM bdc_field       USING 'BKPF-BLDAT'
                                        w_date.
          PERFORM bdc_field       USING 'BKPF-BLART'
                                        p_blart.
          PERFORM bdc_field       USING 'BKPF-BUKRS'
                                        t_data-bukrs.
          PERFORM format_date USING p_budat.
          PERFORM bdc_field       USING 'BKPF-BUDAT'
                                        w_date.
          PERFORM bdc_field       USING 'BKPF-WAERS'
                                        p_waers.
          PERFORM bdc_field       USING 'BKPF-MONAT'
          PERFORM bdc_field       USING 'BKPF-BKTXT'
                                        p_bktxt.
          PERFORM bdc_field       USING 'BKPF-XBLNR'
                                        p_xblnr.
          PERFORM bdc_field       USING 'RF05A-NEWBS'
                                        t_data-newbs.
          PERFORM bdc_field       USING 'RF05A-NEWKO'
                                        t_data-newko.
        ELSE.
          PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'RF05A-NEWKO'.
          PERFORM bdc_field       USING 'RF05A-NEWBS'
                                        t_data-newbs.
          PERFORM bdc_field       USING 'RF05A-NEWKO'
                                        t_data-newko.
          PERFORM bdc_field       USING 'RF05A-NEWBK'
                                        t_data-bukrs.
          PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
          PERFORM bdc_field       USING 'BDC_OKCODE' 'ENTE'.
        ENDIF.
       IF t_data-newbs = '31' .
          w_second = '1'.
          PERFORM bdc_dynpro      USING 'SAPMF05A' '0302'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                              '/00'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                     'BSEG-SGTXT'.
          PERFORM bdc_field       USING 'BSEG-WRBTR'
                                      t_data-wrbtr.
          PERFORM bdc_field       USING 'BSEG-SGTXT'
                                     t_data-sgtxt.
        PERFORM bdc_field       USING 'RF05A-NEWBS'
                                       t_data-newbs.
        PERFORM bdc_field       USING 'RF05A-NEWKO'
                                       t_data-newko.
            IF NOT t_data-kostl IS INITIAL.
            PERFORM bdc_field       USING 'COBL-KOSTL'
                                          t_data-kostl.
          ELSEIF NOT t_data-ps_posid IS INITIAL.
            PERFORM bdc_field       USING 'COBL-PS_POSID'
                                          t_data-ps_posid.
          ELSEIF NOT t_data-aufnr IS INITIAL.
            PERFORM bdc_field       USING 'COBL-AUFNR'
                                          t_data-aufnr.
          ENDIF.
    *...start of Amendment MW1
          IF p_waers ne 'GBP'.
            PERFORM bdc_field       USING 'BSEG-DMBTR'
                                              t_data-dmbtr.
          ENDIF.
        ENDIF.
    *...end of Amendment MW1  ENDIF.
       IF t_data-newbs = '40'    .
          PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                     'BSEG-SGTXT'.
          PERFORM bdc_field       USING 'BSEG-WRBTR'
                                      t_data-wrbtr.
          PERFORM bdc_field       USING 'BSEG-SGTXT'
                                     t_data-sgtxt.
           PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
          PERFORM bdc_field       USING 'BDC_OKCODE' 'ENTE'.
             IF NOT t_data-kostl IS INITIAL.
            PERFORM bdc_field       USING 'COBL-KOSTL'
                                          t_data-kostl.
          ELSEIF NOT t_data-ps_posid IS INITIAL.
            PERFORM bdc_field       USING 'COBL-PS_POSID'
                                          t_data-ps_posid.
          ELSEIF NOT t_data-aufnr IS INITIAL.
            PERFORM bdc_field       USING 'COBL-AUFNR'
                                          t_data-aufnr.
          ENDIF.
          PERFORM bdc_field       USING 'BSEG-MWSKZ'
                                     t_data-mwskz.
    *...start of Amendment MW1
          IF p_waers ne 'GBP'.
            PERFORM bdc_field       USING 'BSEG-DMBTR'
                                              t_data-dmbtr.
          ENDIF.
    *...end of Amendment MW1
        ENDIF.
        AT FIRST.
    calculate the tax
          PERFORM bdc_field       USING 'BKPF-XMWST' 'X'.
        ENDAT.
      IF t_data-newbs = '40'     .
         PERFORM bdc_field       USING 'DKACB-FMORE'
                                       'X'.
         PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
         PERFORM bdc_field       USING 'BDC_OKCODE'
                                       'ENTE'.
         IF NOT t_data-kostl IS INITIAL.
           PERFORM bdc_field       USING 'COBL-KOSTL'
                                         t_data-kostl.
         ELSEIF NOT t_data-ps_posid IS INITIAL.
           PERFORM bdc_field       USING 'COBL-PS_POSID'
                                         t_data-ps_posid.
         ELSEIF NOT t_data-aufnr IS INITIAL.
           PERFORM bdc_field       USING 'COBL-AUFNR'
                                         t_data-aufnr.
         ENDIF.
       ENDIF.
      ENDLOOP.
      IF w_second = '1'.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0302'.
      ELSE.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
      ENDIF.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    'BU'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'BSEG-WRBTR'.
      PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    'ENTE'.
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          tcode     = 'F-02'
        TABLES
          dynprotab = bdcdata.
      REFRESH bdcdata.
      CLEAR bdcdata.
    ENDFORM.                    " LOAD_BDCDATA
    Start of screen
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           insert field
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.                    "BDC_FIELD
    *&      Form  format_date
          text
    FORM format_date  USING    p_date.
      CLEAR w_date.
      w_date(2) = p_date+6(2).
      w_date+2(1) = '.'.
      w_date3(2) = p_date4(2).
      w_date+5(1) = '.'.
      w_date+6(4) = p_date(4).
    ENDFORM.                    " format_date

    IF item-newbs = '09'
             OR item-newbs = '19'
             OR item-newbs = '29'
             OR item-newbs = '39'.
            IF item-newum = 'A' OR
             item-newum = 'V' OR
             item-newum = '1' OR
             item-newum = '2' OR
             item-newum = '3' OR
             item-newum = '5' OR
             item-newum = '6' OR
             item-newum = 'B' .
              PERFORM bdc_dynpro      USING 'SAPMF05A' '0304'.
              PERFORM bdc_field       USING 'BDC_CURSOR'
                                            'RF05A-NEWUM'.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                            '/00'.
              PERFORM bdc_field       USING 'BSEG-WRBTR'
                                            item-wrbtr.
              PERFORM bdc_field       USING 'BSEG-gsber'
                                            item-gsber.
              PERFORM bdc_field       USING 'BSEG-PRCTR'
                                            item-prctr.
              PERFORM bdc_field       USING 'BSEG-ZFBDT'
                                            item-zfbdt1.
              PERFORM bdc_field       USING 'BSEG-ZUONR'
                                            item-zuonr.
              PERFORM bdc_field       USING 'BSEG-SGTXT'
                                            item-sgtxt.
              IF idx1 = '002' .
                EXIT.
              ENDIF.
              idx = idx + 1.
              READ TABLE item INDEX idx .
              PERFORM bdc_field       USING 'RF05A-NEWBS'
                                            item-newbs.
              PERFORM bdc_field       USING 'RF05A-NEWKO'
                                            item-newko.
              PERFORM bdc_field       USING 'RF05A-NEWUM'
                                            item-newum.
              PERFORM bdc_field       USING 'RF05A-NEWBW'
                                            item-newbw.
              CONTINUE.
            ENDIF.
          ENDIF.
          IF item-newbs = '09'
             OR item-newbs = '19'
             OR item-newbs = '29'
             OR item-newbs = '39' .
            IF item-newum = 'H'
              OR item-newum = '4'
           OR item-newum = '6'
           OR item-newum = '7'
              OR item-newum = '8'
              OR item-newum = '9'
              OR item-newum = 'C'
              OR item-newum = 'D'
              OR item-newum = 'E'
              OR item-newum = 'I'
              OR item-newum = 'K'
              OR item-newum = 'L'
              OR item-newum = 'M'
              OR item-newum = 'O'
              OR item-newum = 'Q'
              OR item-newum = 'R'
              OR item-newum = 'T'
              OR item-newum = 'U'.
              PERFORM bdc_dynpro      USING 'SAPMF05A' '0303'.
              PERFORM bdc_field       USING 'BDC_CURSOR'
                                            'RF05A-NEWKO'.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                            '/00'.
              PERFORM bdc_field       USING 'BSEG-WRBTR'
                                            item-wrbtr.
              PERFORM bdc_field       USING 'BSEG-GSBER'
                                            item-gsber.
              PERFORM bdc_field       USING 'BSEG-ZFBDT'
                                            item-zfbdt1.
              PERFORM bdc_field       USING 'BSEG-ZUONR'
                                            item-zuonr.
              PERFORM bdc_field       USING 'BSEG-SGTXT'
                                            item-sgtxt.
              IF idx1 = '002' .
                EXIT.
              ENDIF.
              idx = idx + 1 .
              READ TABLE item INDEX idx .
              PERFORM bdc_field       USING 'RF05A-NEWBS'
                                            item-newbs.
              PERFORM bdc_field       USING 'RF05A-NEWKO'
                                            item-newko.
              PERFORM bdc_field       USING 'RF05A-NEWUM'
                                            item-newum.
              PERFORM bdc_field       USING 'RF05A-NEWBW'
                                            item-newbw.
              CONTINUE.
            ENDIF.
          ENDIF.
          IF item-newbs = '29' OR item-newbs = '39'.
            IF item-newum = '7'.
              PERFORM bdc_dynpro      USING 'SAPMF05A' '0303'.
              PERFORM bdc_field       USING 'BDC_CURSOR'
                                            'BSEG-ZFBDT'.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                            '=ZK'.
              PERFORM bdc_field       USING 'BSEG-WRBTR'
                                            item-wrbtr.
              PERFORM bdc_field       USING 'BSEG-GSBER'
                                            item-gsber.
              PERFORM bdc_field       USING 'BSEG-ZFBDT'
                                            item-zfbdt1.
              PERFORM bdc_field       USING 'BSEG-ZUONR'
                                            item-zuonr.
              PERFORM bdc_field       USING 'BSEG-SGTXT'
                                            item-sgtxt.
              PERFORM bdc_dynpro      USING 'SAPMF05A' '0332'.
              PERFORM bdc_field       USING 'BDC_CURSOR'
                                            'RF05A-NEWKO'.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                            '/00'.
              PERFORM bdc_field       USING 'BSEG-BEWAR'
                                            item-ttype.
              IF idx1 = '002' .
                EXIT.
              ENDIF.
              idx = idx + 1 .
              READ TABLE item INDEX idx .
              PERFORM bdc_field       USING 'RF05A-NEWBS'
                                            item-newbs.
              PERFORM bdc_field       USING 'RF05A-NEWKO'
                                            item-newko.
              PERFORM bdc_field       USING 'RF05A-NEWUM'
                                            item-newum.
              PERFORM bdc_field       USING 'RF05A-NEWBW'
                                            item-newbw.
              CONTINUE.
            ENDIF.
          ENDIF.
          IF item-newbs = '01' OR item-newbs = '11'
             OR item-newbs = '05' OR item-newbs = '15'.
            PERFORM bdc_dynpro      USING 'SAPMF05A' '0301'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'RF05A-NEWKO'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                           '/00'.
            PERFORM bdc_field       USING 'BSEG-WRBTR'
                                          item-wrbtr.
            PERFORM bdc_field       USING 'BSEG-GSBER'
                                           item-gsber.
            PERFORM bdc_field       USING 'BSEG-ZTERM'
                                           item-zterm.
            PERFORM bdc_field       USING 'BSEG-ZFBDT'
                                          item-zfbdt.
            PERFORM bdc_field       USING 'BSEG-ZUONR'
                                          item-zuonr.
            PERFORM bdc_field       USING 'BSEG-SGTXT'
                                          item-sgtxt.
            IF idx1 = '002' .
              EXIT.
            ENDIF.
            idx = idx + 1 .
            READ TABLE item INDEX idx .
            PERFORM bdc_field       USING 'RF05A-NEWBS'
                                          item-newbs.
            PERFORM bdc_field       USING 'RF05A-NEWKO'
                                          item-newko.
            PERFORM bdc_field       USING 'RF05A-NEWUM'
                                          item-newum.
            PERFORM bdc_field       USING 'RF05A-NEWBW'
                                          item-newbw.
            CONTINUE.
          ENDIF.
          IF item-newbs = '21' OR item-newbs = '31'
             OR item-newbs = '25' OR item-newbs = '35'.
            PERFORM bdc_dynpro      USING 'SAPMF05A' '0302'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'RF05A-NEWKO'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '/00'.
            PERFORM bdc_field       USING 'BSEG-WRBTR'
                                          item-wrbtr.
            PERFORM bdc_field       USING 'BSEG-SECCO'
                                          ''.   "'1000'.
            PERFORM bdc_field       USING 'BSEG-GSBER'
                                          item-gsber.
            PERFORM bdc_field       USING 'BSEG-ZTERM'
                                           item-zterm.
            PERFORM bdc_field       USING 'BSEG-ZFBDT'
                                          item-zfbdt.
            PERFORM bdc_field       USING 'BSEG-ZUONR'
                                          item-zuonr.
            PERFORM bdc_field       USING 'BSEG-SGTXT'
                                          item-sgtxt.
            IF idx1 = '002' .
              EXIT.
            ENDIF.
            idx = idx + 1.
            READ TABLE item INDEX idx.
            PERFORM bdc_field       USING 'RF05A-NEWBS'
                                          item-newbs.
            PERFORM bdc_field       USING 'RF05A-NEWKO'
                                          item-newko.
            PERFORM bdc_field       USING 'RF05A-NEWUM'
                                          item-newum.
            PERFORM bdc_field       USING 'RF05A-NEWBW'
                                          item-newbw.
            CONTINUE.
          ENDIF.
          IF item-newbs = '70' OR item-newbs = '75'.
            PERFORM bdc_dynpro      USING 'SAPMF05A' '0305'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'BSEG-WRBTR'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '/00'.
            PERFORM bdc_field       USING 'BSEG-WRBTR'
                                          item-wrbtr.
            PERFORM bdc_field       USING 'DKACB-FMORE'
                                                'X'.
            PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'COBL-PRCTR'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=ENTE'.
            PERFORM bdc_field       USING 'COBL-GSBER'
                                          item-gsber.
            PERFORM bdc_field       USING 'COBL-KOSTL'
                                          item-kostl.
            PERFORM bdc_field       USING 'COBL-PRCTR'
                                          item-prctr.
            PERFORM bdc_dynpro      USING 'SAPMF05A' '0305'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'RF05A-NEWBW'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '/00'.
            PERFORM bdc_field       USING 'BSEG-WRBTR'
                                          item-wrbtr.
    PERFORM bdc_field       USING 'BSEG-BZDAT'
                                   '01.04.2005'.
            IF idx1 = '002' .
              EXIT.
            ENDIF.
            idx = idx + 1 .
            READ TABLE item INDEX idx .
            PERFORM bdc_field       USING 'RF05A-NEWBS'
                                          item-newbs.
            PERFORM bdc_field       USING 'RF05A-NEWKO'
                                          item-newko.
            PERFORM bdc_field       USING 'RF05A-NEWUM'
                                           item-newum.
            PERFORM bdc_field       USING 'RF05A-NEWBW'
                                          item-newbw.
            CONTINUE.
          ENDIF.
        ENDLOOP.
        PERFORM bdc_field   USING  'BDC_OKCODE'     
                                    '=BU'.
        PERFORM bdc_transaction USING 'F-02'.
        DELETE item INDEX 1.
        DELETE item INDEX 1.
        ix = ix + 2 .
      ENDDO.
      PERFORM close_group.

  • How to create a custom measure for each level of a dimension

    Hi all!
    Can Anyone please explain me with an example, how to create a custom measure for each level for a dimension? I dont mine if you use
    one or more measures.
    thanks in advance
    hope someone helps me.

    For example:I create a dimension for product_dim witch has 4 levels:total, class, family and item:
    d_aben18
    n1_aben18
    n2_aben18
    n3_aben18
    n4_aben18
    herarchy:h_aben18
    cube:cubo_aben18
    measure:med_aben18
    I create this code to fetch the data to the dimension:
    TRAP ON CLEANUP
    SQL DECLARE c1 CURSOR FOR SELECT-
    total_product_id,1,'N1_ABEN18',total_product_dsc,-
    class_id,1,'N2_ABEN18',total_product_id,class_dsc,-
    family_id,1,'N3_ABEN18', class_id, family_dsc,-
    item_id,1,'N4_ABEN18',family_id,item_dsc-
    FROM PRODUCT_DIM
    "OPEN THE CURSOR
    SQL OPEN c1
    "FETCH THE DATA
    SQL FETCH c1 LOOP INTO-
    :APPEND D_ABEN18, :D_ABEN18_H_aben18_HIERDEF,:D_ABEN18_N1_aben18_LEVELDEF,:D_ABEN18_long_description,-
    :APPEND D_ABEN18, :D_ABEN18_H_aben18_HIERDEF,:D_ABEN18_N2_aben18_LEVELDEF,:D_ABEN18_parentrel,-
    :D_ABEN18_long_description,-
    :APPEND D_ABEN18, :D_ABEN18_H_aben18_HIERDEF,:D_ABEN18_N3_aben18_LEVELDEF,:D_ABEN18_parentrel,-
    :D_ABEN18_long_description,-
    :APPEND D_ABEN18, :D_ABEN18_H_aben18_HIERDEF,:D_ABEN18_N4_aben18_LEVELDEF,:D_ABEN18_parentrel,-
    :D_ABEN18_long_description,-
    "SAVE THE CHANGES
    UPDATE
    COMMIT
    CLEANUP:
    SQL CLOSE c1
    SHOW 'KK2'
    Then I create a cube with use compression off, and in rules sum for example.
    After, I create a measure and I select Override the aggregation specification for the cube, in rules I put nonadditive and I would like to create aprogram to assign distinct values to each level of the dimension. For example, I put 1, 2 3, and 4 values, but at the end I would like to put count(distinct(values)).
    for that I create another program:
    VRB D_RETURN DECIMAL
    if D_ABEN18_N1_ABEN18_LEVELDEF eq 'N1_ABEN18'
    then D_RETURN = 1
    if D_ABEN18_N2_ABEN18_LEVELDEF eq 'N2_ABEN18'
    then D_RETURN = 2
    if D_ABEN18_N3_ABEN18_LEVELDEF eq 'N3_ABEN18'
    then D_RETURN = 3
    if D_ABEN18_N4_ABEN18_LEVELDEF eq 'N4_ABEN18'
    then D_RETURN = 4
    else d_return=26
    return d_return
    "SHOW D_RETURN
    cubo_aben18_med_aben18_stored=d_return
    but it doesnt work.I dont know how to put to assign or to see what I want.
    I report the measure, or I report the program, but then how can I see the values of the measure?
    thanks in advance

  • How to create a profile set for a campaign.

    HI  Friends,
    I am working on CRM 7.0.
    My requirement is to create a Batch program for  campaign creation and automation.
    i have used the class 'cl_crm_mktpl_appl_base' to copy the existing campaign .
    It copied the entire target groups,campaign  elements, profile sets.
    My requirement is for the created campaign id, i need to create a profile set in that i need to create target goups.
    Fm : BAPI_PROFILESET_CREATE is not helpful for me in my case.bacause it is asking parent guid ..etc...
    I have ony one guid ,ie. campaign guid . if i give this in parent guid it is thriwing error.
    can any suggest how to create a custom profile set.
    If any one  worked on this batch program please reply to this thread.
    Edited by: jagadheeswara raju on Feb 10, 2010 7:02 PM

    Hi,
    I have replied to the below thread mentioning the FM's to create Profile sets, profiles and also target groups. This may be helpful to you.
    Re: target group creation
    Regards,
    Priyanka

Maybe you are looking for

  • Adobe 9 Pro Extended

    Hi Have a copy of the free Adobe 9 and want to upgrade it to include the above. Have attempted the upgrade to 9.4.5 but that didn't work. Any advice/tips/instructions/pointers would be most appreciated. Thx & rgds Mike

  • Page Export / Import in between two workspaces in the same instance

    Hi All, I am trying to import a page from one application to another application in a different work space in the same instance. In the export file i have changed the target application id and workspace id. I am facing below error while importing the

  • I have a new compute how do i get my music off my old one onto my new itunes ???

    i have a new compute how do i get my music off my old one onto my new itunes ???

  • Submit Z program in lsmw

    Hi all, I need to run a Z program right after a LSMW. I've tried to insert a "submit ZPROG" in the LSMW "end_of_transaction" step but it doesn't work. Does somebody has an idea if it's possible ? Or, is there any workaround ? Thanks in advance for yo

  • Help, Bootlooping, Power and Home both broken

    I have an iPhone 5 Screen cracked a few months ago, apple wanted $250 to fix it. Took it to another guy who did it for $140. Basically a terrible experience. Power button was broken at time, and part of the $140 was supposed to go towards fixing the