on 05-21-2015 11:42 AM
Hi,
I am planning to load Employee and respective sales orgs to a Z Info Object(User ID compounded on Seq No) from a flat file.
Source Data Will be like below
SEQ NO | USER_ID | SALES_ORG |
1 | 10000167 | 411 |
2 | 10000167 | 473 |
3 | 10000167 | 1068 |
4 | 10000169 | * |
5 | 10000200 | * |
6 | 10000289 | 501 |
7 | 10000289 | 513 |
8 | 10000289 | 514 |
9 | 10000289 | 513B |
10 | 10000289 | 513C |
11 | 10000289 | 513D |
My requirement is to write a routine in transformation where for Users with * (Ex:10000169),It should create multiple entries with full list of sales org from 0SALESORG master data.
In Start routine 0SALESORG master data is selected and saved in Internal Table IT_SAL_ORG
Please advise how to create multiple entries
Thanks in advance
Hi,
Try to use Rule Group functionality in transformations. Google with "Rule Groups in Transformation" you will some good documents on how to achieve this.
Also go through the below link.
Regards,
Vengal.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can refer the link that Vengal has given.It will give u a good idea to implement this using start as well as end routines.
In the start routine you can populate the internal table each time reading the internal table in which the master data has been read and append the source package.Then in the end routine u can read the source package and append the result package accordingly.
Regards,
Shalaka
Hi,
I am writing EXPERT routine to meet the above split records..but not getting the required results.
'*' are not splitting up....as my abap skills are limited and inputs are greatly helpful
TYPES: BEGIN OF TY_SALESORG,
SALESORG TYPE /BI0/OISALESORG ,
OBJVERS TYPE RSOBJVERS,
END OF TY_SALESORG.
DATA: IT_SALESORG TYPE TABLE OF TY_SALESORG.
DATA: WA_SALESORG TYPE TY_SALESORG.
DATA: t_source TYPE STANDARD TABLE OF _ty_s_SC_1.
DATA: gs_source TYPE _ty_s_SC_1,
gs_result TYPE _ty_s_TG_1.
DATA: l_index TYPE syindex,
l_index2 TYPE syindex.
CLEAR: IT_SALESORG.
SELECT SALESORG OBJVERS
FROM /BI0/PSALESORG
INTO TABLE IT_SALESORG
WHERE SALESORG <> ' ' AND
OBJVERS = 'A'.
t_source[] = SOURCE_PACKAGE[].
*Mapping all common fields.
LOOP AT SOURCE_PACKAGE INTO gs_source.
CLEAR: WA_SALESORG.
READ TABLE IT_SALESORG INTO WA_SALESORG WITH KEY OBJVERS = 'A'.
IF gs_source-SALESORG <> '*'.
gs_result-/BIC/ZSORUSER = gs_source-/BIC/ZSORUSER.
gs_result-SALESORG = gs_source-SALESORG.
gs_result-/BIC/ZCOUNTER = '1'.
APPEND GS_RESULT TO RESULT_PACKAGE.
IF gs_source-SALESORG = '*'.
gs_result-/BIC/ZSORUSER = gs_source-/BIC/ZSORUSER.
gs_result-SALESORG = WA_SALESORG-SALESORG.
gs_result-/BIC/ZCOUNTER = '1'.
APPEND GS_RESULT TO RESULT_PACKAGE.
ENDIF.
ENDIF.
ENDLOOP.
Suggestions 1: remove OBJVERS from here and every where in the code. unnecessary.
TYPES: BEGIN OF TY_SALESORG,
SALESORG TYPE /BI0/OISALESORG ,
OBJVERS TYPE RSOBJVERS,
END OF TY_SALESORG.
Suggestions 2: use refresh stmt to clear the itab. it_salesorg
CLEAR: IT_SALESORG.
Suggestions 3: Use " SELECT DISTINCT SALESORG" , dont need to select objvers
SELECT SALESORG OBJVERS
Suggestions 4: What you really need.
LOOP AT SOURCE_PACKAGE INTO gs_source.
IF gs_source-SALESORG <> '*'.
gs_result-/BIC/ZSORUSER = gs_source-/BIC/ZSORUSER.
gs_result-SALESORG = gs_source-SALESORG.
gs_result-/BIC/ZCOUNTER = '1'.
APPEND GS_RESULT TO RESULT_PACKAGE.
endif
IF gs_source-SALESORG = '*'.
LOOP AT IT_SALESORG INTO WA_SALESORG.
gs_result-/BIC/ZSORUSER = gs_source-/BIC/ZSORUSER.
gs_result-SALESORG = WA_SALESORG-SALESORG.
gs_result-/BIC/ZCOUNTER = '1'.
APPEND GS_result TO RESULT_PACKAGE.
CLEAR: WA_SALESORG.
ENDLOOP.
ENDIF.
ENDLOOP.
Hi,
Thanks for all the updates.
Both the proposed approaches are not working.....
Modified the code as below ...like mentioned
IF gs_source-SALESORG = '*'.
LOOP AT IT_SALESORG INTO WA_SALESORG.
gs_result-/BIC/ZSORUSER = gs_source-/BIC/ZSORUSER.
gs_result-SALESORG = WA_SALESORG-SALESORG.
gs_result-/BIC/ZCOUNTER = '1'.
APPEND GS_RESULT TO RESULT_PACKAGE.
CLEAR: WA_SALESORG.
ENDLOOP.
Hi SAP USER,
I am sure if I am late in answering to your query but I propose the following :
TYPES: BEGIN OF ty_salesorg,
salesorg TYPE /bi0/oisalesorg ,
objvers TYPE rsobjvers,
END OF ty_salesorg.
DATA : it_salesorg TYPE TABLE OF ty_salesorg,
wa_salesorg TYPE ty_salesorg,
t_source TYPE STANDARD TABLE OF _ty_s_sc_1,
gs_source TYPE _ty_s_sc_1,
gs_result TYPE _ty_s_tg_1,
lv_sequence TYPE i.
REFRESH : it_salesorg, result_package.
CLEAR : lv_sequence.
SELECT salesorg objvers
FROM /bi0/psalesorg
INTO TABLE it_salesorg
WHERE salesorg <> space
AND objvers = 'A'.
IF sy-subrc = 0.
SORT it_salesorg BY salesorg objvers.
DELETE ADJACENT DUPLICATES FROM it_salesorg.
ENDIF.
t_source[] = source_package[]. " Transfer Original Values
LOOP AT source_package INTO gs_source.
IF gs_source-salesorg <> '*'.
lv_sequence = lv_sequence + 1.
gs_result-/bic/zsoruser = gs_source-/bic/zsoruser. "User ID
gs_result-salesorg = gs_source-salesorg. "Sales_Org
gs_result-/bic/zcounter = lv_sequence. "SEQ No
APPEND gs_result TO result_package.
ELSEIF gs_source-salesorg = '*'.
LOOP AT it_salesorg INTO wa_salesorg. " Case for multiple entries in case of *
lv_sequence = lv_sequence + 1.
gs_result-/bic/zsoruser = gs_source-/bic/zsoruser. "User ID
gs_result-salesorg = wa_salesorg-salesorg. "Sales_Org
gs_result-/bic/zcounter = lv_sequence. "SEQ No
APPEND gs_result TO result_package.
ENDLOOP.
ENDIF.
ENDLOOP.
" result_package contains final values.
Hope you find some use for the above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi !
Try with this routine.
SELECT SALESORG
FROM /BI0/PSALESORG
INTO TABLE IT_SALESORG
WHERE SALESORG <> '' AND
OBJVERS = 'A'.
IT_SOURCE[] = SOURCE_PACKAGE[]
LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
IF <source_fields>-salesorg = '*'.
LV_SEQNO =<source_fields>-seqno.
LV_USERID =<source_fields>-userid.
LOOP AT it_salesorg INTO wa_salesorg.
wa_source-seqno = LV_SEQNO
wa_source-userid = LV_USERID
wa_source-salesorg = wa_salesorg-salesorg
APPEND IT_SOURCE.
ENDLOOP.
ENDIF.
ENDLOOP.
SOURCE_PACKAGE[] = IT_SOURCE[]
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.