BAPI Programing- CODE

Hi All,
         I am new to ABAP and just now started to make hand on practise in BAPI,  
I need a code to try out this program
here goes the program.
Write a report to print or display the list of customers given the customer numbers and country codes (select options). Formatting and coloring should be professional.
I-B: Use the standard Bapi instead of direct table access.
I dont know how to proceed with this. please help in writing the code .
Thanks in advance
Thanks & regards.
Prasannakesavan

You could start with this....
report zrich_0002.
tables: kna1.
data: iadd type table of bapicustomer_addressdata with header line.
select-options: s_kunnr for kna1-kunnr.
start-of-selection.
  call function 'BAPI_CUSTOMER_GETLIST'
* EXPORTING
*   MAXROWS           = 0
*   CPDONLY           =
* IMPORTING
*   RETURN            =
    tables
      idrange           = s_kunnr
      addressdata       = iadd
*   SPECIALDATA       =
  check sy-subrc = 0.
Welcome to SDN.  Please remember to award points for helpful answers.  Thanks.
Regards,
Rich Heilman

Similar Messages

  • Bapi program

    hi,
    i am sending a bapi program .
    this bapi program is not executed only selection screen appears. but when i click on execute button then no data
    shows what id plz suggest.
    *& Report  ZBAPI_1                                                     *
    REPORT  ZBAPI_1  .
    *tables: ekko.
    DATA: BEGIN OF I_POITEM OCCURS 0.
          INCLUDE STRUCTURE BAPIEKPO.
    DATA: END OF I_POITEM.
    *data: begin of it_ekko occurs 0,
         ebeln like ekko-ebeln,
         end of it_ekko.
    PARAMETERS P_EBELN LIKE EKKO-EBELN default '4500012164'  ..
    CALL FUNCTION 'BAPI_PO_GETDETAIL'
      EXPORTING
        PURCHASEORDER                    = P_EBELN
      ITEMS                            = 'X'
      ACCOUNT_ASSIGNMENT               = ' '
      SCHEDULES                        = ' '
      HISTORY                          = ' '
      ITEM_TEXTS                       = ' '
      HEADER_TEXTS                     = ' '
      SERVICES                         = ' '
      CONFIRMATIONS                    = ' '
      SERVICE_TEXTS                    = ' '
      EXTENSIONS                       = ' '
    *IMPORTING
      PO_HEADER                        =
      PO_ADDRESS                       =
    TABLES
      PO_HEADER_TEXTS                  =
      PO_ITEMS                         = I_POITEM.
      PO_ITEM_ACCOUNT_ASSIGNMENT       =
      PO_ITEM_SCHEDULES                =
      PO_ITEM_CONFIRMATIONS            =
      PO_ITEM_TEXTS                    =
      PO_ITEM_HISTORY                  =
      PO_ITEM_HISTORY_TOTALS           =
      PO_ITEM_LIMITS                   =
      PO_ITEM_CONTRACT_LIMITS          =
      PO_ITEM_SERVICES                 =
      PO_ITEM_SRV_ACCASS_VALUES        =
      RETURN                           =
      PO_SERVICES_TEXTS                =
      EXTENSIONOUT                     =
    *select po_number po_item pur_mat changed_on
           short_text co_code
           plant mat_grp ner_price from bapiekpo
           into table i_poitem
           where ebeln in p_ebeln.
    *select ebeln from ekko
    into table it_ekko
      where ebeln = p_ebeln.
    LOOP AT I_POITEM.
    write: / 'ebeln    = ' , it_ekko-ebeln.
    WRITE: / 'PO NUMBER  = ' , I_POITEM-PO_NUMBER COLOR COL_HEADING,
            / 'ITEM        =' , I_POITEM-PO_ITEM,
            / 'MATERIAL = ' , I_POITEM-PUR_MAT,
            / 'CHANGED ON = ', I_POITEM-CHANGED_ON,
            / 'SHORT TEXT = ' , I_POITEM-SHORT_TEXT,
           / 'COMPANY CODE = ' , I_POITEM-CO_CODE,
           / 'PLANT = ' , I_POITEM-PLANT,
           / 'MATERIAL GROUP = ' , I_POITEM-MAT_GRP,
           / 'QUANTITY = ' , I_POITEM-QUANTITY LEFT-JUSTIFIED,
            / 'UNIT = ' , I_POITEM-UNIT,
           / 'NET PRICE = ' , I_POITEM-NET_PRICE LEFT-JUSTIFIED.
      ULINE.
      ENDLOOP.

    Hello.
    Try is like this:
    *& Report ZBAPI_1 *
    REPORT ZBAPI_1 .
    *tables: ekko.
    DATA: BEGIN OF I_POITEM OCCURS 0.
    INCLUDE STRUCTURE BAPIEKPO.
    DATA: END OF I_POITEM.
    *data: begin of it_ekko occurs 0,
    ebeln like ekko-ebeln,
    end of it_ekko.
    PARAMETERS P_EBELN LIKE EKKO-EBELN default '4500012164' ..
    start-of-selection.
    CALL FUNCTION 'BAPI_PO_GETDETAIL'
    EXPORTING
    PURCHASEORDER = P_EBELN
    ITEMS = 'X'
    ACCOUNT_ASSIGNMENT = ' '
    SCHEDULES = ' '
    HISTORY = ' '
    ITEM_TEXTS = ' '
    HEADER_TEXTS = ' '
    SERVICES = ' '
    CONFIRMATIONS = ' '
    SERVICE_TEXTS = ' '
    EXTENSIONS = ' '
    *IMPORTING
    PO_HEADER =
    PO_ADDRESS =
    TABLES
    PO_HEADER_TEXTS =
    PO_ITEMS = I_POITEM.
    PO_ITEM_ACCOUNT_ASSIGNMENT =
    PO_ITEM_SCHEDULES =
    PO_ITEM_CONFIRMATIONS =
    PO_ITEM_TEXTS =
    PO_ITEM_HISTORY =
    PO_ITEM_HISTORY_TOTALS =
    PO_ITEM_LIMITS =
    PO_ITEM_CONTRACT_LIMITS =
    PO_ITEM_SERVICES =
    PO_ITEM_SRV_ACCASS_VALUES =
    RETURN =
    PO_SERVICES_TEXTS =
    EXTENSIONOUT =
    *select po_number po_item pur_mat changed_on
    short_text co_code
    plant mat_grp ner_price from bapiekpo
    into table i_poitem
    where ebeln in p_ebeln.
    *select ebeln from ekko
    into table it_ekko
    where ebeln = p_ebeln.
    end-of-selection.
    LOOP AT I_POITEM.
    write: / 'ebeln = ' , it_ekko-ebeln.
    WRITE: / 'PO NUMBER = ' , I_POITEM-PO_NUMBER COLOR COL_HEADING,
    / 'ITEM =' , I_POITEM-PO_ITEM,
    / 'MATERIAL = ' , I_POITEM-PUR_MAT,
    / 'CHANGED ON = ', I_POITEM-CHANGED_ON,
    / 'SHORT TEXT = ' , I_POITEM-SHORT_TEXT,
    / 'COMPANY CODE = ' , I_POITEM-CO_CODE,
    / 'PLANT = ' , I_POITEM-PLANT,
    / 'MATERIAL GROUP = ' , I_POITEM-MAT_GRP,
    / 'QUANTITY = ' , I_POITEM-QUANTITY LEFT-JUSTIFIED,
    / 'UNIT = ' , I_POITEM-UNIT,
    / 'NET PRICE = ' , I_POITEM-NET_PRICE LEFT-JUSTIFIED.
    ULINE.
    ENDLOOP.
    Please reward if ot helps,
    Regards
    George

  • In VB Programming code -- How to access the formula for suppressing a field

    In VB Programming code -- How to access the formula for suppressing a field
    I am using Crystal Reports 2008 v1
    Using VB code, I am attempting to modify a Crystal Report before exporting it into a PDF format and then displaying it on the Web.
    My problem is that I am unable to access the formula used to dynamically suppress a field.
    The following code is working:
    mySections = rd.ReportDefinition.Sections
    For Each mySection As CrystalDecisions.CrystalReports.Engine.Section In mySections
       ' myFieldToChange is a String set to the text of the field I need to adjust the Suppression
       iloop = 0
       For Each RecObj As CrystalDecisions.CrystalReports.Engine.ReportObject In mySection.ReportObjects
               If mySection.ReportObjects.Item(iloop).Name.ToLower = myFieldToChange Then
                   myTextObject = CType(mySection.ReportObjects.Item(iloop), CrystalDecisions.CrystalReports.Engine.TextObject)
                   myTextObject.Text = "new field text goes here"
                   mySection.SectionFormat.EnableSuppress = True
                   '  Here is where I want to change the formula for the Suppression
                End if
                iloop = iloop + 1
        Next
    Next
    I can not find any reference to the actual suppression formula in the SDK help file.
    Note, the EnableSuppress can be set to True for False, but if there is a formula for dynamic suppression, the True or False value is overwritten.  The results of the formula determine the suppression.
    Is there a way to reference this formula.  I know that I can put on in using the Crystal Report Designer software, I need to modify this formula using VB code and the SDK.

    Hello, Mark;
    If you are using the ReportDocument object you do not have access to the Conditional Suppression formula. You can get around it by using a formula field in the report for the supression and then using the FormulaField code to change it at runtime.
    If you want to change the supression condition directly at runtime you need to use RAS and the ReportClientDocument.
    Elaine

  • Generation of program code for the ABAP Query

    Dear all,
    In the creation of the ABAP query, in the final step of SQ01, Query- more functions- generate program is made.
    Why the program code is generated for the ABAP query? please  give the logical explaination for the same.
    Thanks and Regards,
    Prash

    Prash,
    a) Do you mean Program code does not have significance in query creation?
    No it does not mean this.  All queries run based on an ABAP program.  In the standard query editing process, when you save and execute the query, you will automatically re-build the existing ABAP program as necessary.  You do not need, though, to execute the menu steps you outlined in order to build, maintain, or execute the query.  It is only there for special purposes, as outlined above by Jürgen
    b) Can we see the program code generated in any transaction?
    From any screen, System > Status.  Place your cursor on the field in "Program (screen)".  Double click.
    Rgds,
    DB49

  • Syntax highlighted program code in keynote?

    Is there any easy way insert programming code (in my case Ruby code) into a slide so it shows up with syntax highlighting and formating suitable for the code?
    I.E. so it looks like the highlighted code in Textmate or other gui editors?

    TextWrangler (and thus presumably BBEdit) do preserve their syntax colouring when PDFed, as does Taco HTML Edit. My guess is that this is capability is an app-by-app feature.
    If you were desperate for a PDF output to Keynote, you could always copy the text from Textmate and paste it into the freeware TextWrangler. You would likely have to adjust the default syntax colouring to match Textmate, but that would be relatively straightforward.

  • What to add to an program code in order to trigger an background job

    Hi there
    I wander what to add to an program code in order to trigger an event which consequently can trigger an background job
    thx in advance

    Check this code:
    DATA : v_jobhead LIKE tbtcjob.
    DATA : v_jobcount LIKE tbtcjob-jobcount.
    DATA : v_eventparm LIKE tbtcjob-eventparm.
    DATA : v_flg_released TYPE c.
    DATA: e_error.
    DATA: running LIKE tbtcv-run.
    TYPES: esp1_boolean LIKE boole-boole.
    CONSTANTS: esp1_false TYPE esp1_boolean VALUE ' ',
               esp1_true  TYPE esp1_boolean VALUE 'X'.
    CONSTANTS: true  TYPE boolean VALUE esp1_true,
                              false TYPE boolean VALUE esp1_false.
    PARAMETERS: v_jobnam LIKE tbtcjob-jobname,
                v_report LIKE sy-repid,
                v_varian LIKE  raldb-variant,
                v_uname  LIKE sy-uname.
    START-OF-SELECTION.
    * add the new job
      CALL FUNCTION 'JOB_OPEN'
           EXPORTING
    *            delanfrep        = 'X'
                jobname          = v_jobnam
           IMPORTING
                jobcount         = v_jobcount
           EXCEPTIONS
                cant_create_job  = 1
                invalid_job_data = 2
                jobname_missing  = 3
                OTHERS           = 4.
      IF sy-subrc <> 0.
        e_error = true.
      ELSE.
        CALL FUNCTION 'JOB_SUBMIT'  " or you can use SUBMIT statement as well.
             EXPORTING
                  authcknam               = v_uname
                  jobcount                = v_jobcount
                  jobname                 = v_jobnam
                  report                  = v_report
                  variant                 = v_varian
             EXCEPTIONS
                  bad_priparams           = 1
                  bad_xpgflags            = 2
                  invalid_jobdata         = 3
                  jobname_missing         = 4
                  job_notex               = 5
                  job_submit_failed       = 6
                  lock_failed             = 7
                  program_missing         = 8
                  prog_abap_and_extpg_set = 9
                  OTHERS                  = 10.
        IF sy-subrc <> 0.
          e_error = true.
        ELSE.
          CALL FUNCTION 'JOB_CLOSE'
               EXPORTING
    *               EVENT_ID                    = IC_WWI_WORKPROCESS_EVENT
    *               EVENT_PARAM                 = V_EVENTPARM
    *               EVENT_PERIODIC              = 'X'
                    jobcount                    = v_jobcount
                    jobname                     = v_jobnam
                    strtimmed                   = 'X'
               IMPORTING
                    job_was_released            = v_flg_released
               EXCEPTIONS
                    cant_start_immediate        = 1
                    invalid_startdate           = 2
                    jobname_missing             = 3
                    job_close_failed            = 4
                    job_nosteps                 = 5
                    job_notex                   = 6
                    lock_failed                 = 7
                    OTHERS                      = 8.
          IF sy-subrc <> 0.
            e_error = true.
          ELSE.
            DO.
              CALL FUNCTION 'SHOW_JOBSTATE'
                EXPORTING
                  jobcount               = v_jobcount
                  jobname                = v_jobnam
    *            IMPORTING
    *         ABORTED                =
    *         FINISHED               =
    *         PRELIMINARY            =
    *         READY                  =
    *              running                =
    *         SCHEDULED              =
               EXCEPTIONS
                 jobcount_missing       = 1
                 jobname_missing        = 2
                 job_notex              = 3
                 OTHERS                 = 4.
              IF sy-subrc <> 0.
                e_error = true.
                MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
              ENDIF.
              IF running = space.
                EXIT.
              ENDIF.
            ENDDO.
          ENDIF.
        ENDIF.
      ENDIF.

  • How to see programming Code for UCCX Script

    Hi All,
    How can I  see the programming Code for UCCX Script? I have a script and want to see its Code , something like :
    int sum = 0;
    boolean alternate = false;
    boolean isValid = false;
    try {
    int i = 0;
    for (i = ccnumber.length() - 1; i >= 0; i--) {
      int n = Integer.parseInt(ccnumber.substring(i, i + 1));
      if (alternate) {
       n = n * 2;
       if (n > 9) {
        n = (n % 10) + 1;
      sum += n;
      alternate = !alternate;
    isValid = (sum % 10 == 0);
    } catch (Exception e) {
    return -1;
    return (isValid == true ? 1 : 0);
    thanks,
    Hamed

    You're not going to find code per se, unless you have some java class you wrote and then you would only see the code if you had the source java file.  The script is the only interface you get for "code".
    david

  • What is some simple program code to set up a database

    Could someone provide some simple data base program code for the HP50G with comments on procedure by the programmer? 

    Hi there,
    Have you tried animating the Clip property in the timeline? You'd probably want each clipping rectangle in its own symbol, and then control the symbol playback from the click event on the symbol instance.
    If that won't work for your purposes, there's a slight error in your code.
    Rather than:
    sym.$("clipTangle2").css("clip:rect(0, 159px, 0, 0)");
    Try:
    sym.$("Rectangle").css("clip", "rect(0, 159px, 0, 0)");
    hth,
    Joe

  • How to use BAPI Program for change workcenter in co02?

    Hi  Abapers.
           Anybody please tell me how to change the workcenter in CO02 using BAPI Programe.
          Please give me sample of this.
           I will give urs reward of points.
    Thanks
    Regards,
    S.Muthu.

    Hi,
    Use the Function module CR_WORKCENTER_UPDATE
    for workcenter change.
    It is an update function module so you have to call it in update mode with a COMMIT statement to trigger it.
    CALL FUNCTION CR_WORKCENTER_UPDATE IN UPDATE TASK
    exporting...
    imporing..
    COMMIT WORK.
    Note: only after the commit statement the function module will be called in update mode.
    Regards,
    Raj.

  • Authorization group - to restrict other users to not see the program code

    Hi,
    I have developed report program. Is it possible to restrict the other users to don't see the program code.
    Thanks in advance.
    Regards,
    Eswar

    Eswar:
    SAP does not allow you to restrict access to your report programs. Anybody with the right autorizations can see your programs.
    There are some tricks to achieve someting like that. Tricks consists basically in write your code without enter between lines. I think there are no effective way in SAP or ABAP to protect programs source code from curious eyes.
    Ex.:
    REPORT ztest. TABLES: ztable. DATA: g_var1...
    Regards.
    Rafael Rojas.

  • Table for the program code

    Hi Freinds,
    is there any table to store the  program code , i mean whatever we write in  SE 38 will it be stores any data base tables? we have one option to get the code that is READ REPORT INTO ITAB. other than this is there any database tables for this?
    Regards,
    Tirumal.

    Hi Reddy,
      Table: REPOSRC there is only programm name but not code by using program name you can get code into your report by using Read Report syntax.
    Example,
    parameters: p_pname type reposrc-PROGNAME.
    data: Begin of table occurs 10,
             line(150),
            end of table.
    read report p_pname into table.
    loop at table.
      write / table.
    endloop.
    Plzzzzzz Reward if useful,
    Mahi.

  • Need BAPI program to upload PO creation with flatfile having HEADER N  ITEM

    Hi abap experts,
    I Need sample BAPI program to upload PO creation(ME21) with flatfile having HEADER AND   ITEM datas.
    arun

    Hi,
    Look at the below links
    Re: BAPI_PO_CREATE1 and net price
    Re: Using BAPI_PO_CREATE1 : Linking service, and account assignment
    Regards
    Sudheer

  • Need a simple example program code to use SF_EXAMPLE_01

    Hi all,
    I have just try to learn smartforms. As i have SAP NW4 for learning.
    I found SF_EXAMPLE_01 in the system.
    Can any body help me out how to use this example in abap program code?
    Thanks.
    rob

    Smart Forms, try this steps.. it will teach you how to create smart form and how to use it.
    1) Tcode --> SmartForms
    2) Form name --> Z_SF_TEST Create
    3) Under Global settings
    a) Form Interface  
        Table Tab
       ITAB LIKE EKPO
    b) GLOBAL Definitions
    WA_NETPR LIKE EKPO-NETPR
    In smart forms if we want to display quantity and currency fields. We can't directly display currency field and quantity fields
    For that we have to create an extra variable in global definitions
    Ex: netpr FIELD of EKPO
    CREATE program lines and specify WA_NETWR = itab-netpr.
    4) RT CLick on main Window
       CREATE --> TABLE
      Click Table painter
    DEFAULT %LTYPE will be Created
    a) If you want more like Header footer etc add by rt click on %LTYPE1
    Table (Tab)
    %LTYPE  Radio(SELECT) 5 CM 5 CM 6 CM
    CLICK on DATA (Tab)
    INTERNAL TABLE ITAB LIKE ITAB
    5)RT click on table control and create --> program lines
    General attribute (Tab)
    INPUT PARAMETER               OUTPUT PARAMETER
    itab                               WA_NETPR
    Code Area
    WA_NETWR = ITAB-NETPR.
    6) RT CLcick on table ctl and create 3 text to display the fields
    a) % text1 +button(insert field)
       FIELD name &itab-ebeln&
    Output options (tab)
    Check New line   LINETYPE   %Ltype1
    check new cell
    b) % text2
       & itab-ebelp&
    output options
    check new cell
    c) % text2
       & wa_netpr&
    output options
    check new cell
    Report ac
    Tables ekpo.
    Data: itab1 like ekpo occurs 0 with header line.
    select * into table itab1 from ekpo.
    Call function module   "to know function module name goto smartform and execute the smart form name it will give you the function module name.
    If your question is answered, close the thread and reward all useful answers...
    Regards,
    Sairam

  • Remote program code

    I need remote program code for HD-DVR Motorola DCX 3501/E385/012/500.When red all on button is pressed, all devices turn off, but after 2 sec. set top turns back on?

    ebroski wrote:
    I need remote program code for HD-DVR Motorola DCX 3501/E385/012/500.When red all on button is pressed, all devices turn off, but after 2 sec. set top turns back on?You should post the question in the Xfinity TV Services forum.... this is the Voice Services area..

  • I want to see the spawned program code..

    Hi,
    I wanted to see the spawned program code. Can you please give me the solution.
    Is there any software to read the code?.
    Thank you,
    jagdish.
    Message was edited by:
    Jagdish

    I haven't been able to see the code of a spawned program, but I have had some success in looking for SQL statements, etc in spawned programs, as these are typically stored in text strings in the original source code. I use the Unix strings command, as in the following example (which is not a concurrent program,but is a compiled executable):
    strings -a $FND_TOP/bin/FNDLIBR | grep -i fnd_file_private
    While I can only guess at the logic of how it does it, this shows that FNDLIBR calls several of the procedures in the FND_FILE_PRIVATE package.
    It really depends on what you are trying to find out - to get all of the database work performed by a spawned concurrent program, it is simpler to just enable tracing on the program and run a request. If you are looking for code logic (as in, in what case does FNDLIBR call fnd_file_private.outfile_get), as Shiv has said, about all you have to rely on is the documentation. Unfortunately, the documentation is not normally at that detailed a level.

Maybe you are looking for

  • 5800 Contacts problem

    Whenever i create a new msg and select one particular contact and when i search for another contact which "exists" in my list.. It doesn't appear at all !!!!.. Is this prob might be cos of sim-card? I had this prob quite recently and not on the day o

  • DB_DOMAIN NAME IN ORACLE 10G

    Hi, I need to create my service_name instance.domain name. eg: hrdw.apx (dot betweek hrdw and apx). Where hrdw is my instane name and apx is my domain name.What are the steps to follow to create like this. I tried to create with net configuration , b

  • Can I translate user defined table into mulilanguages

    Can I translate a particular field of my own data field into foreign languages in SAP B1? Actually I want to print shipping label in different langauages. And I want that address and the details of the shipping label transleted in a text file in orde

  • AwesomeWM, dual monitor, can't set wallpaper

    I can't set wallpaper on any of my monitors. The config is good, everything is in the place, but it just doesn't work. Just gray background... awesome -k Configuration file syntax OK.

  • BP Security

    Dear experts We have a simple requirement in CRM 6.0 WebUI. We use the authorisation object B_BUPA_RLT and the activity 02 to control whether the user has the authorisation to change the data depending on the roles that are assigned to an account, ro