Sales office wise Report

Hi,
I want my report according to sales office. means one sales office must not see another sales office records.
But mu code is not doing the same..
please check my code...
DATA: BEGIN OF itab OCCURS 0,
vbeln LIKE vbrk-vbeln,
matnr LIKE vbrp-matnr,
fkimg TYPE i,
netwr1 LIKE vbrp-netwr,
mwsbp1 LIKE vbrp-mwsbp,
netwr2 LIKE vbrp-netwr,
mwsbp2 LIKE vbrp-mwsbp,
diff1 LIKE vbrp-netwr,
diff2 LIKE vbrp-netwr,
total LIKE vbrp-netwr,
vkbur LIKE vbrp-vkbur,
END OF itab.
DATA: line1(116),line2(116),line3(116),line10(116), line11(116),
add1 LIKE kna1-name1,
add2 LIKE add1,
add3 LIKE add1,
add4 LIKE add1,
add5 LIKE add1,
amount LIKE bseg-wrbtr,
inwords LIKE spell-word.
DATA: total_records TYPE i,
half_total_records TYPE i,
debit_line_no TYPE i,
invdt LIKE sy-datum.
DATA: vbrptab TYPE vbrp OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: vbeln FOR vbrk-vbeln.
SELECT-OPTIONS: vkbur FOR vbrp-vkbur.
SELECTION-SCREEN END OF BLOCK b1.
SELECT * FROM vbrk WHERE vbeln IN vbeln AND ( fkart = 'ZG1' OR fkart = 'ZG2' OR fkart = 'RE' OR fkart = 'ZWCN' OR fkart = 'G2' ) AND rfbsk EQ 'C'.
IF vbrk-fkart = 'ZG1'.
line10 = 'YOUR ACCOUNT WITH US HAS BEEN CREDITED WITH THE AMOUNT AS MENTIONED BELOW FOR PRICE DIFFERENCE AGAINST,'.
ELSEIF vbrk-fkart = 'ZG2'.
line10 = 'YOUR ACCOUNT WITH US HAS BEEN CREDITED WITH THE AMOUNT AS MENTIONED BELOW FOR INCENTIVE AGAINST,'.
ENDIF.
PERFORM write_address.
PERFORM write_body.
PERFORM write_line_items.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e004.
ENDIF.
*&      Form  WRITE_ADDRESS
      text
FORM write_address.
WRITE /50 line1.
WRITE /36 line2.
WRITE /38 line3.
SKIP 5.
WRITE:/ 'CUST NO :',vbrk-kunrg.
CALL FUNCTION 'ZAK_CUSTOMER_ADDRESS'
EXPORTING
kunnr = vbrk-kunrg
IMPORTING
add1  = add1
add2  = add2
add3  = add3
add4  = add4
add5  = add5.
SELECT SINGLE * FROM bseg WHERE vbeln = vbrk-vbeln.
IF sy-subrc <> 0.
MESSAGE i021.
EXIT.
ENDIF.
ENDFORM.                    "WRITE_ADDRESS
*&      Form  WRITE_BODY
      text
FORM write_body.
SKIP 3.
SELECT SINGLE * FROM vbfa WHERE vbeln = vbrk-vbeln AND vbtyp_n IN ('P','O') AND vbtyp_v = 'M'.
IF sy-subrc = 0.
SELECT SINGLE fkdat INTO invdt FROM vbrk WHERE vbeln = vbfa-vbelv.
ENDIF.
WRITE line10.
WRITE:/'INVOICE NO :', vbfa-vbelv, 'DATED :', invdt,'.'.
ULINE /1(116).
WRITE:/ 'S.NO', 10 'CATALOG CODE',36 'QTY', 47 'VALUE', 56 'VALUE SHOULD', 81 'DIFF IN', 98 'CST', 112 'TOTAL'.
WRITE:/45 'CHARGED', 56 'HAVE CHARGED', 81 'VALUES', 108 'C/N VALUE'.
ULINE /1(116).
ENDFORM.
*&      Form  WRITE_LINE_ITEMS
      text
FORM write_line_items.
SELECT * INTO CORRESPONDING FIELDS OF TABLE vbrptab FROM vbrp WHERE vbeln = vbrk-vbeln ."and vkbur = vbrp-vkbur.
DESCRIBE TABLE vbrptab LINES total_records.
half_total_records = total_records / 2.
DO half_total_records TIMES.
READ TABLE vbrptab INDEX sy-index.
MOVE vbrptab-vbeln TO itab-vbeln.
MOVE vbrptab-matnr TO itab-matnr.
MOVE vbrptab-fkimg TO itab-fkimg.
MOVE vbrptab-netwr TO itab-netwr1.
MOVE vbrptab-mwsbp TO itab-mwsbp1.
MOVE vbrptab-vkbur TO itab-vkbur.
debit_line_no = sy-index + half_total_records.
READ TABLE vbrptab INDEX debit_line_no.
MOVE vbrptab-netwr TO itab-netwr2.
MOVE vbrptab-mwsbp TO itab-mwsbp2.
itab-netwr2 = itab-netwr2 * ( -1 ).
itab-mwsbp2 = itab-mwsbp2 * ( -1 ).
itab-diff1 = itab-netwr1 - itab-netwr2.
itab-diff2 = itab-mwsbp1 - itab-mwsbp2.
itab-total = itab-diff1 + itab-diff2.
IF itab-total NE 0.
APPEND itab.
ENDIF.
CLEAR itab.
ENDDO.
LOOP AT itab.
WRITE:/1(5) sy-tabix, 10 itab-matnr, 30(9) itab-fkimg, 40(12) itab-netwr1, 56(12) itab-netwr2, 76(12) itab-diff1, 90(12) itab-diff2, 105(12) itab-total.
AT LAST.
SUM.
ULINE /1(116).
WRITE:/10 'TOTAL VALUE',40(12) itab-netwr1, 56(12) itab-netwr2, 76(12) itab-diff1, 90(12) itab-diff2, 105(12) itab-total.
ULINE /1(116).
amount = itab-total.
CALL FUNCTION 'Z_SPELL_WORD'
EXPORTING
amount   = amount
IMPORTING
in_words = inwords.
CONCATENATE 'Amount in Words : Rupees' inwords 'Only' INTO inwords SEPARATED BY space.
WRITE:/ inwords.
SKIP 6.
WRITE:/'BCH Electric Limited'.
SKIP 4.
WRITE:/'AUTHORISED SIGNATORY'.
NEW-PAGE.
ENDAT.
ENDLOOP.
REFRESH itab.
ENDFORM.
Regards

Please check this code..
DATA: BEGIN OF itab OCCURS 0,
vbeln LIKE vbrk-vbeln,
matnr LIKE vbrp-matnr,
fkimg TYPE i,
netwr1 LIKE vbrp-netwr,
mwsbp1 LIKE vbrp-mwsbp,
netwr2 LIKE vbrp-netwr,
mwsbp2 LIKE vbrp-mwsbp,
diff1 LIKE vbrp-netwr,
diff2 LIKE vbrp-netwr,
total LIKE vbrp-netwr,
vkbur LIKE vbrp-vkbur,
END OF itab.
DATA: line1(116),line2(116),line3(116),line10(116), line11(116),
add1 LIKE kna1-name1,
add2 LIKE add1,
add3 LIKE add1,
add4 LIKE add1,
add5 LIKE add1,
amount LIKE bseg-wrbtr,
inwords LIKE spell-word.
DATA: total_records TYPE i,
half_total_records TYPE i,
debit_line_no TYPE i,
invdt LIKE sy-datum.
DATA: vbrptab TYPE vbrp OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS: vbeln FOR vbrk-vbeln.
SELECT-OPTIONS: vkbur FOR vbrp-vkbur.
SELECT * FROM vbrk WHERE vbeln IN vbeln AND ( fkart = 'ZG1' OR fkart = 'ZG2' OR fkart = 'RE' OR fkart = 'ZWCN' OR fkart = 'G2' ) AND rfbsk EQ 'C'.
IF vbrk-fkart = 'ZG1'.
line10 = 'YOUR ACCOUNT WITH US HAS BEEN CREDITED WITH THE AMOUNT AS MENTIONED BELOW FOR PRICE DIFFERENCE AGAINST,'.
ENDIF.
PERFORM write_address.
PERFORM write_body.
PERFORM write_line_items.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e004.
ENDIF.
FORM write_line_items.
SELECT * INTO CORRESPONDING FIELDS OF TABLE vbrptab FROM vbrp WHERE vbeln = vbrk-vbeln ."and vkbur = vbrp-vkbur.
DESCRIBE TABLE vbrptab LINES total_records.
half_total_records = total_records / 2.
DO half_total_records TIMES.
READ TABLE vbrptab INDEX sy-index.
MOVE vbrptab-vbeln TO itab-vbeln.
MOVE vbrptab-matnr TO itab-matnr.
MOVE vbrptab-fkimg TO itab-fkimg.
MOVE vbrptab-netwr TO itab-netwr1.
MOVE vbrptab-mwsbp TO itab-mwsbp1.
MOVE vbrptab-vkbur TO itab-vkbur.
debit_line_no = sy-index + half_total_records.
READ TABLE vbrptab INDEX debit_line_no.
MOVE vbrptab-netwr TO itab-netwr2.
MOVE vbrptab-mwsbp TO itab-mwsbp2.
itab-netwr2 = itab-netwr2 * ( -1 ).
itab-mwsbp2 = itab-mwsbp2 * ( -1 ).
itab-diff1 = itab-netwr1 - itab-netwr2.
itab-diff2 = itab-mwsbp1 - itab-mwsbp2.
itab-total = itab-diff1 + itab-diff2.
IF itab-total NE 0.
APPEND itab.
ENDIF.
CLEAR itab.
ENDDO.

Similar Messages

  • Report for monthly sales(sales office wise,sales group wise,plant wise)

    Please send the Report for monthly sales(sales office wise,sales group wise,plant wise)  with T.CODE.,

    Hi
    As per my knowledge there is no Standard Report in SAP based on sales office, sales group. and plant.
    You may create your own report using MC18,MC21 and MC24.... Otherwise ask your ABAPer's help...
    Muthu

  • Sales region wise report

    my customer is asking for a report sales region wise.
    i have taken as org units like sales office for all their sales offices and sales group for their sales persons,
    now how can i configure sales region ie., north ease west south, to take a standard report
    pl give your inputs
    thanks

    If you want to take out the report sales office wise u can u se standard SAP t code : MCTG
    In the standarad view u cannot see the sales district in the same report...so u can copy the same program and add ur logic so that u can get ur dsired output.
    To create sales region, u can use sales distict field in custmer master field. define in config and maintain it cutomer master. u can use mass or XD99  transaction to update this field in all the customer master record.
    below is the menu path to define sales distirict:
    IMG>>SD masterdata>>Business partners>>Cusotmers>>>sales>>>define sales districts.
    Thanks,
    Shaik

  • Sales Office wise grouping the Material:

    Dear Guru's,
    I have a scenario where the business wants to announce the discounts fortheir customers sales office wise and Material Group wise.
    But the the twist is they want Material Groups to be different from sales office to sales office.
    How to map this different material group in every sales office?
    REgards,
    sushil

    Have the discount condition type for the combination of sales office and material group. You should be aware, one customer can be assigned to only one sales office and similarly one material group can be assigned to a material code. 
    thanks
    G. Lakshmipathi

  • Sales office wise sales orders

    Hi,
    How to find the area or sales office wise sales orders created by users in CRM can anyone give the table name ?
    i was checked in CRMD_ORDERADM_H i am not getting...
    Regards
    MVN

    Hi,
    Use table CRMD_ORDERADM_H
    OBJECT_ID = sales doc
    CREATED_BY
    Link to get sales office, sales group..
    CRMD_ORDERADM_H->GUID to link with table CRMD_ORDER_INDEX->HEADER
    CRMD_ORDER_INDEX->OBJECT TYPE = BUS2000115
    Fields
    SALES_OFFICE
    SALES_GROUP
    Regards,
    Nilesh P.

  • Sales planning as per sales person wise/Sales group wise/Sales office wise

    we are having a querry like Sales Planning in Sales & Distribution:
    Company need's to set targets based on Sales Office wise/Sales group Wise/Sales Person wise. Later on company will check target Sales, Planned Sales, Achieved Sales. So how can we achieve in Sales and distribution module wise.
    Regards

    no my question is not related to PA
    Suppose a sales person is there in my company name as:X. His target for this financial year is Rs.10 Crores. For that he will give list of materials to achieve this target and quantities and tentative dates also for which materials he needs. So that my company will do proper planning for production also to supply these materials timely. for this Company needs to analyse what is the given target and acheved target and what are all the materials are sold with respect to quantity. what materials are not sold means dead stock. So that how can we solve this solution in SAP.
    Regards,
    Venkat

  • Alpha Numeric number Ranges for Sales order Acording to sales office wise.

    Hi Experts,
             I have a Issue for genrating sales order numbers With Alpha Numeric Number Ranges for sales office wise Internaly . How can we get this is there any Userexits or badi for this . If Any one Come across this issue plz guide me.
       The Alpha characters should not change that will be sales office region code. only the Numeric numbers should change .
    Ex;   Abc-123000  to Abc-200000
    Regards,
    Ravi.

    This alpha-numeric format is not possible directly with SNRO settings.
    You need to opt for external number range, and in the exit of your respective transaction you need to takecare of this number generation explicitly by programming.
    http://www.sap-img.com/sap-sd/number-ranges-in-sales-order.htm
    any more inputs from experts are welcome..
    Hi,
    1. goto include MV45AFZZ and to user exit Save_document This form is called before COMMITand double click on FORM USEREXIT_SAVE_DOCUMENT.
    2.it will show the program MV45AF0B_BELEG_SICHERN from were this user exit is called, selcet the program and click on Display.
    3. you can use the enhancement point enhancement-point beleg_sichern_01 spots es_sapmv45a. just below the PERFORM USEREXIT_SAVE_DOCUMENT to call the badi method on_costing_component.
    regards.
    santhosh reddy
    Message was edited by:
            Santhosh Reddy
    Message was edited by:
            Santhosh Reddy

  • Sales order wise report

    HI friends
    I am generating a report according to sales order wise stock .
    I need a help in these
    kdauf             kdpos      shkzg        menge          
    0000001663     000010     S           10
    0000001663     000010     S           20
    0000001663  000010      S           30
    0000001663  0000020    s            10
    0000001663  00000020  s            10
    0000001663 00000020    s           10
    0000001665     000010     S           10
    Now the requirement was for everysalesorder and with respect to line item  quantity should be added
    00000001663        10          60
    00000001663        20         30
    00000001665        10         10
    the ouput should be displayed like these.

    Hi
    thanks for the reply
    0000001663     000010     S 10
    0000001663     000010     S 20
    0000001663 000010 S 30
    0000001663 0000020 s 10
    0000001663 00000020 s 10
    0000001663 00000020 s 30
    0000001663 00000020 h 20
    0000001663 00000020 h 20
    0000001665     000010     S 10
    here the requirement sales order and line item debits and credits should be added and should as like thse
    00000001663  10  60qty
    00000001663  20  10                  (s = 50 h = 40 ) s-h = 10.
    00000001665 10  10
    the report should display like these
    thanks

  • Sales employee wise report

    Hi,
    I need a report to see total sales by sales employee wise. We are using HR module and I am able to select sales employee in my sales order from the HR master. However when I run the report MCTI, I am not able to select the sales employee (no drop down available). I guess the issue is with sales employee data from sales order not getting updated in LIS. Can any one tell me the settings to update sales employee data in LIS.
    Girish

    Hi Girish,
    If you run MCTI without sales employee selection (use just sales org, distr. channel or whatever), what's the result? Do you see a bunch of zeros 00000000 under the sales employee column?
    In VPE3, are you able to find the sales ppl list under Personnel no. (with restriction to the relevant sales area)?
    Thanks for your feedback
    BR,
    Zuzana

  • SD: Sales Office Data report

    Hello!
    We have about 800 sales offices (TVBUR-VKBUR).
    Each one has it address data (city, phone number etc.)
    We need do give for our users posibility to find a list of sales offices and there address data. (ready for excel)
    Is there is transaction o report ready  for use in SAP?
    Or we should develop / write quiery?
    Thank You.

    Hi janna
    This standard reports may help for your requirement
    Sales Office Analysis - MCTG
    Sales office Analysis- Invoiced Sales - MC-E
    Sales office Analysis- Returns - MC-A
    Regards
    Srinath
    Edited by: sri nath on May 18, 2008 5:09 PM

  • Sales revenue sales office wise

    Dear Experts,
    My client requirement is to see sales revenue sales office office and cost centre wise, my client is  using third party sales scenario so i have configured Order reason & cost centre and assigned to sales area.
    My client will enter order reason while creating the sales order. but while making PO the Error is coming
    " NO Direct Posting can be made to G/L a/c. 400156 in code xyz.
    Your reply is highly appreciated,
    Thanks and Regards,
    MH

    Hi
    We are doing third party sales scenario. We have this in our group for other companies as well and it is woking fine in existing company codes. Now we have a scenario for new company where third party sales with order reason to be maintained in sales order in order to book the revenues to specific cost center.
    Now the prblem is when we are creating SO with order reason system is not allowng for creating PO for this and gives this error message. When we are creating the SO without order reason sys is allowing for creating PO without any error message.
    We cannot create this GL as cost element is Contolling area as other existing processes will be effected.
    Regards,
    MH

  • Sales Office wise Billing

    Hi
    For different Sales Offices i need to create invoces with the same Billing document type ZF2,
    but the number series of invoice should be different for differnet sales office
    for Eg: For Sales Office A the invoice number should start like 82000000. and for Sales office B it should be 93000000.
    How can i do this ?

    Hi Raja,
    Ask you ABAP person to create a ZTABLE through transaction SM30.
    You can include 3 columns in the ZTABLE such as sales office,billing document type and the number range.
    Instead of picking the number range from the standard configuratin,write a code so that system should pick number range from the ZTABLE.
    We did the same in one of my project and it worked fine.
    Reward points if it helps.
    Regards
    Karan

  • Profitibility of Sales office wise

    Hi SAP Guru's,
    I am fico consultant right now i involve in an implementation project, project is now in To be phase.
    I have problem and problem is discussed below
    In my client have n no of branch we treat branch as a plantand profit center. Suppose if my client get an order from B Branch if customer is nearer to branch of C than Product delivery happen from C. In taht case order getting in Branch B but delivery And Billing happen from C, and keep in mind that our client have one centarlized bank a/c from any branch can collect the money but deposit in to same Centralized bank A/C.
    So in that case
    1. Order from Branch B
    2. Billing from Branch C
    so how can i suggest of profitibility of branch B (collect the order for collecting Order this branch put all of its effort finnacialy allso)
    can i see the the SO in Profit centetre wise and allso we can see the Billing Doc for Smae SO from Different Profit center wise or we nned the Development of a report.
    so what is the best practise for it.
    Thaks in Advance Full mark assign .
    Regards,
    suvangkar

    Hi
    We are doing third party sales scenario. We have this in our group for other companies as well and it is woking fine in existing company codes. Now we have a scenario for new company where third party sales with order reason to be maintained in sales order in order to book the revenues to specific cost center.
    Now the prblem is when we are creating SO with order reason system is not allowng for creating PO for this and gives this error message. When we are creating the SO without order reason sys is allowing for creating PO without any error message.
    We cannot create this GL as cost element is Contolling area as other existing processes will be effected.
    Regards,
    MH

  • Sale order wise Report

    Hi firends i need to develop a report according salesorder and line item stock report.
    kdauf            kdpos       shkzg
    0000001663     000010     S    10
    0000001663     000010     S    20
    0000001663 000010          S   30
    0000001663 0000020        S  10
    0000001663 00000020      S  10
    0000001663 00000020      S  30
    0000001663 00000020       S  20
    0000001663 00000020       H 2 0
    0000001665     000010     S 10
    here the requirement sales order and line item debits and credits should be added and should as like thse
    00000001663 10 60qty
    00000001663 20 10 (s = 50 h = 40 ) s-h = 10.
    00000001665 10 10
    the report should display like these
    thanks

    Hi Pramod ,
    You can use collect to add the Debit and credit and then use loop  all  the S read table H do
    s-h and append it to It_final you get  data as u want .
    Try It
    regards
    Nilesh

  • Sales office in Customer line items

    Presently using FBL5N for details of customer line items. Now the user wants the customer details Sales office wise.
    Tried to change the selection views of logical database DDF used in this program but couldn't as it doesn't include table KNVV. SPRO config also doesn't have this table.
    Is there any other standard report to achieve this except customized report development.
    Kindly resolve.
    thanks
    annie

    Hi Anya
    You can get the required data through SQVI by table joining KNVV (field VKBUR) and VBRP.
    Let me know if this is not clear and require more details on that.
    By the way dont forget to reward points if this is useful to you.
    Regards
    G. Lakshmipathi

Maybe you are looking for

  • Re Mapping your Creative Remote

    Hi everybody I recently bought a Creative X-FI surround 5.1 Pro USB soundcard, and I must say I found the remote quite amazing XD. The only bad part is the apps available.... so I googled a little : I found that VLC thread on how to remap for a speci

  • Problem with Net Service name

    while installing oracle data warehouse builder 10g i am getting prob such tat INS0009:Unable to connect to the database with user SYS java.sql.SQLException:Io exception : could not resolve the connect identifier OraHome_1\network\ADMIN\SAMPLE\TNSNAME

  • Messages strucking in Receiver ECC

    Hi,        I have a scenario i.e. non-SAP to PI to SAP ECC. In that, in PI we are getting Successful flags on every monitoring, but data is not inserting in ECC tables, due to Queues strucked in ECC (smq2) and we can see those messages with status sc

  • Media converter and stuff

    Can anybody help? I can link my 6680 no problem to my pc all ok connection is fine. But when ever i try to update too phone with pics or sound it dont work for example,every image i have tryed in every format i get the same error message. >>>nokia im

  • SONY DUAL/DOUBLE LAYER DRIVES

    Does anyone know which of Sony's new DVD burners work with the mac? I see that one model works with mac but only the dvd+r discs, ands it's an older model. I've heard some people say that even though the product information doesn't say 'Mac compatibl