Application Development 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: 

Adding mutliple condition on creating idoc segment

0 Kudos
120

Hello, my issue today is that I made a program that Add ETD date in IDOC ORDRSP.

My question is how to I add new condition base on MESTYP, MESCOD and MESFCT before addind the segment.

I put the condition in comment in my code below, I still dont know how to kae it up.

Than you for your help.

FORM f999_e1edp03_date_otm
 TABLES p_int_edidd STRUCTURE edidd
 p_dxvbpa STRUCTURE vbpa
 p_dxvbap STRUCTURE vbap
 p_dxvbep STRUCTURE vbep
 p_dxvbkd STRUCTURE vbkd
 p_dikomv STRUCTURE komv
 p_dikomvd STRUCTURE komvd
 USING p_dxvbak TYPE vbak
 p_dxhvbkd TYPE vbkd
 p_dobject TYPE nast.
 DATA : lw_E1EDP03 TYPE E1EDP03,
 lw_E1EDP01 TYPE E1EDP01,
 lw_edidd TYPE edidd,
* lw_zza68 TYPE ZZA68,
 l_zzimbd TYPE Char10,
 l_zzimbd_int TYPE VBAP-ZZIMBD,"material delivery date
 l_tabix TYPE sy-index,
 w_tabix TYPE sy-tabix.
 "get requested material delivery date zzimbd
 "filter on E1EDP01-werks
 Data : lr_werks type range of werks.
 IF p_int_edidd-segnam = 'E1EDP01'.
 MOVE p_int_edidd-sdata TO lw_e1edp01.
 " determine if new segment E1EDP03 must be added or not...
 " ...in function of plant value E1EDP01-WERKS
 " get Werks for which treatment is restricted


* Condition for adding segment:
* lw_zza68-MESTYP = 'ORDRSP'.
* lw_zza68-MESCOD = '037'.
* lw_zza68-MESFCT = 'CRE'.


 Select sign
 opti
 low
 high
 From TVARVC Into TABLE lr_werks
 Where name = 'ZZB_ZZB2I449_WERKS'
 And type = 'S'.
 If sy-subrc = 0 and lw_e1edp01-werks in lr_werks.
 " flag to inform new segment E1EDP03 with EDT need to be added.
 f_spec03 = 'X'.
 Endif.
* ENDIF.
 Endif.
 IF p_int_edidd-segnam = 'E1EDP03' AND f_spec03 = 'X'.
 " addition of new date segment
 CLEAR lw_e1edp03.
 CLEAR f_spec03.
 lw_e1edp03-iddat = 'ETD'.
 lw_e1edp03-datum = p_dxvbap-ZZIMBD.
 MOVE lw_e1edp03 TO p_int_edidd-sdata.
 APPEND p_int_edidd.
 ENDIF.
ENDFORM.
1 REPLY 1

Sandra_Rossi
Active Contributor
0 Kudos
68

Could you explain the context, what calls your custom code?