lundi 11 avril 2022

Field data types fingerprints for "validateUpdateListItem"

Field data types fingerprints for "validateUpdateListItem"

With "validateUpdateListItem" all major field data types update is supported, yet it can be difficult sometimes to find the correct format. So as a bonus section: 


.validateUpdateListItem([
  // Text field (single line and note)
  { FieldName: 'TextField', FieldValue: '123' },
  // Number field
  { FieldName: 'NumberField', FieldValue: '123'  },
  // Yes/No field
  { FieldName: 'YesNoField', FieldValue: '1' /* Yes, No, 1, 2 */ },
  // Person or group, single and multiple
  { FieldName: 'PersonField', FieldValue: JSON.stringify([{ Key: LoginName }]) },
  // Dates should be in in the following formats
  { FieldName: 'DateTimeField', FieldValue: '6/23/2018 10:15 PM' },
  { FieldName: 'DateField', FieldValue: '6/23/2018' },
  // Choice field (single and multi-valued)
  { FieldName: 'ChoiceField', FieldValue: 'Choice 1' },
  { FieldName: 'MultiChoiceField', FieldValue: 'Choice 1;#Choice 2' },
  // Hyperlink or picture (after URL a description can go after ', ' delimeter)
  { FieldName: 'HyperlinkField', FieldValue: 'https://arvosys.com, ARVO Systems' },
  // Lookups fields (single and multi-valued)
  { FieldName: 'LookupField', FieldValue: '2' /* Item ID as string */ },
  { FieldName: 'MutliLookupField', FieldValue: [3, 4, 5].map(id => `${id};#`).join(';#') },
  // Mamnaged metadata fields (single and multi-valued)
  { FieldName: 'SingleMMDField', FieldValue: 'Department 2|220a3627-4cd3-453d-ac54-34e71483bb8a;' },
  { FieldName: 'MultiMMDField', FieldValue: 'Department 2|220a3627-4cd3-453d-ac54-34e71483bb8a;Department 3|700a1bc3-3ef6-41ba-8a10-d3054f58db4b;' }
]);

Happy coding!

dimanche 10 avril 2022

[SAP] Génération des documents via la transaction SFP

 la génération des rapports au niveau de SAP de Fait via la transaction SFP

elle se base sur deux notions:

1- les interfaces : c'est la ou on va créer les types d'entrées , et ou on va intier le code 

2- les formulaires : c'est la ou va définir les templates , un formulaire doit faire appel à une interface , plusieurs formulaires peuvent faire appel à la même interface

Create an interface:

/wp-content/uploads/2016/01/pic_865709.jpg

Add a few import parms to the interface:

/wp-content/uploads/2016/01/pic_865709.jpg

Create a form which will use the interface and drag the interface import fields over to the Context of the form:

/wp-content/uploads/2016/01/pic_865709.jpg


Change layout Type to “ZCI Layout”


/wp-content/uploads/2016/01/pic_865709.jpg

Start Adobe LiveCycle and choose the “Layout” tab page and then “Utilities” -> “Insert Web Dynpro Script”.


Add three “ISR Text Edit” fields to the layout:


    From the Data View, drag over and bind each input field from the interface to one of the input fields on the layout of the form.


/wp-content/uploads/2016/01/pic_865709.jpg


Activate the form.


Abap Code for Report Program to call the form:

Code to call from a standard abap report:

report ytest_sfp_form.

start-of-selection.

data :fp_outputparams   type sfpoutputparams.

fp_outputparamsnodialog = ‘X’.
fp_outputparams
preview  = ‘X’.
*  fp_docparams-FILLABLE    = ‘N’.
fp_outputparams
device   = ‘PRINTER’.
fp_outputparams
connection = ‘ADS’.
fp_outputparams
bumode = ‘-‘.
fp_outputparams
dest = ‘LPDF’.
fp_outputparams
dataset = ‘PBFORM’.
fp_outputparams
pdltype= ‘pdf’.
fp_outputparams
xdcname = ‘acrobat6.xdc’.

call function ‘FP_JOB_OPEN’
changing
ie_outputparams
= fp_outputparams
exceptions
cancel         
= 1
usage_error    
= 2
system_error   
= 3
internal_error 
= 4
others          = 5.
if sysubrc <> 0.
message id symsgid type symsgty number symsgno
with symsgv1 symsgv2 symsgv3 symsgv4.
endif.

data: lv_char50_1 type char50, lv_char50_2 type char50, lv_char50_3 type char50.

lv_char50_1 = ‘Test Parm 1’.
lv_char50_2
= ‘Test Parm 2’.
lv_char50_3
= ‘Test Parm 3’.

call function ‘/1BCDWB/SM00000205’
exporting
lv_char50_1
= lv_char50_1
lv_char50_2
= lv_char50_2
lv_char50_3
= lv_char50_3.

if sysubrc <> 0.
*   Implement suitable error handling here
endif.

call function ‘FP_JOB_CLOSE’
exceptions
usage_error   
= 1
system_error  
= 2
internal_error
= 3
others         = 4.
if sysubrc <> 0.
*   Implement suitable error handling here
endif.