Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

regards function module

Former Member
0 Likes
831

hi all,

please give me any body sample code for BAPI_SALES_AREAS_GET function module.

regards,

surya.

6 REPLIES 6
Read only

Former Member
0 Likes
692

Hi,

do like:


DATA: itab TYPE TABLE OF bapisdorg WITH HEADER LINE.

CALL FUNCTION 'BAPI_SALES_AREAS_GET'
  TABLES
    sales_areas = itab[].

where the itab will be containing values like:

Sales Organization

Description

Distribution Channel

Description

Division

Name

Sales Group

Description

Sales Office

Description

hope this helps. <REMOVED BY MODERATOR>

Regards,

Renjith Michael.

Edited by: Alvaro Tejada Galindo on Apr 14, 2008 6:21 PM

Read only

0 Likes
692

Hi renjith,

I'm unable to get result,if u know please provide detailed program.

regards,

surya.

Read only

Former Member
0 Likes
692

hi,

The source code for the functional module is given below,

FUNCTION BAPI_SALES_AREAS_GET.

*"----


""Lokale Schnittstelle:

*" TABLES

*" SALES_AREAS STRUCTURE BAPISDORG

*"----


DATA: LS_SALES_AREA LIKE BAPISDORG.

DATA: BEGIN OF LS_SALES_AREA_TVTA,

VKORG LIKE TVTA-VKORG,

VTWEG LIKE TVTA-VTWEG,

SPART LIKE TVTA-SPART,

END OF LS_SALES_AREA_TVTA.

DATA: BEGIN OF LS_CURRENCY_VKORG,

VKORG LIKE TVTA-VKORG,

BUKRS LIKE T001-BUKRS,

WAERS LIKE T001-WAERS,

END OF LS_CURRENCY_VKORG.

DATA: LT_WAERS_VKORG LIKE LS_CURRENCY_VKORG OCCURS 0,

LS_WAERS_VKORG LIKE LS_CURRENCY_VKORG,

LT_BUKRS_WAERS LIKE LS_CURRENCY_VKORG OCCURS 0,

LS_BUKRS_WAERS LIKE LS_CURRENCY_VKORG,

LV_INDEX LIKE SY-TABIX.

  • read table tvko

SELECT VKORG BUKRS INTO CORRESPONDING

FIELDS OF TABLE LT_WAERS_VKORG FROM TVKO.

  • read table t001

SELECT BUKRS WAERS INTO CORRESPONDING

FIELDS OF TABLE LT_BUKRS_WAERS FROM T001.

  • get relation sales org <--> currency

LOOP AT LT_WAERS_VKORG INTO LS_WAERS_VKORG.

LV_INDEX = SY-TABIX.

READ TABLE LT_BUKRS_WAERS INTO LS_BUKRS_WAERS

WITH KEY BUKRS = LS_WAERS_VKORG-BUKRS.

IF SY-SUBRC = 0.

LS_WAERS_VKORG-WAERS = LS_BUKRS_WAERS-WAERS.

MODIFY LT_WAERS_VKORG FROM LS_WAERS_VKORG INDEX LV_INDEX.

ENDIF.

ENDLOOP.

  • read sales areas and get related currency for each sales org

SELECT VKORG VTWEG SPART FROM TVTA INTO LS_SALES_AREA_TVTA.

CLEAR LS_SALES_AREA.

LS_SALES_AREA-SALESORG = LS_SALES_AREA_TVTA-VKORG.

LS_SALES_AREA-DISTR_CHAN = LS_SALES_AREA_TVTA-VTWEG.

LS_SALES_AREA-DIVISION = LS_SALES_AREA_TVTA-SPART.

READ TABLE LT_WAERS_VKORG INTO LS_WAERS_VKORG

WITH KEY VKORG = LS_SALES_AREA_TVTA-VKORG.

IF SY-SUBRC = 0.

  • use salesorg_text for waers!!

LS_SALES_AREA-SALESORG_TEXT = LS_WAERS_VKORG-WAERS.

ENDIF.

INSERT LS_SALES_AREA INTO TABLE SALES_AREAS.

ENDSELECT.

ENDFUNCTION.

Reward points if usefull,

Thanks & Regards,

Kalyan.A

Read only

0 Likes
692

Hi kalyan,

This bapi fm is predefined so this code already available,here my requirement is how to call this function module in program and what are the input parameters.If u know please provide detailed solution.

thanks and regards,

surya.

Read only

0 Likes
692

While editing the program in SE38.

In menu you will find PATTERN button.

Click on that button than in function box write this BAPI name BAPI_SALES_AREAS_GET .

now press ok than it will display function module with all input output parameters.

Read only

0 Likes
692

While editing the program in SE38.

In menu you will find PATTERN button.

Click on that button than in function box write this BAPI name BAPI_SALES_AREAS_GET .

now press ok than it will display function module with all input output parameters.